Skip to content

✨ OPRUN-3722: Consolidate configuration #1790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ release:
disable: '{{ ne .Env.ENABLE_RELEASE_PIPELINE "true" }}'
extra_files:
- glob: 'operator-controller.yaml'
- glob: './catalogd/config/base/default/clustercatalogs/default-catalogs.yaml'
- glob: './config/catalogs/clustercatalogs/default-catalogs.yaml'
- glob: 'install.sh'
header: |
## Installation
Expand Down
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ $(warning Could not find docker or podman in path! This may result in targets re
endif

KUSTOMIZE_BUILD_DIR := config/overlays/cert-manager
CATALOGD_KUSTOMIZE_BUILD_DIR := catalogd/config/overlays/cert-manager

# Disable -j flag for make
.NOTPARALLEL:
Expand Down Expand Up @@ -114,17 +113,19 @@ tidy: #HELP Update dependencies.
$(Q)go mod tidy -go=$(GOLANG_VERSION)

.PHONY: manifests
KUSTOMIZE_CRDS_DIR := config/base/crd/bases
KUSTOMIZE_RBAC_DIR := config/base/rbac
KUSTOMIZE_WEBHOOKS_DIR := config/base/manager/webhook
KUSTOMIZE_CATD_CRDS_DIR := config/base/catalogd/crd/bases
KUSTOMIZE_CATD_RBAC_DIR := config/base/catalogd/rbac
KUSTOMIZE_CATD_WEBHOOKS_DIR := config/base/catalogd/manager/webhook
KUSTOMIZE_OPCON_CRDS_DIR := config/base/operator-controller/crd/bases
KUSTOMIZE_OPCON_RBAC_DIR := config/base/operator-controller/rbac
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
# Generate the operator-controller manifests
rm -rf $(KUSTOMIZE_CRDS_DIR) && $(CONTROLLER_GEN) crd paths=./api/... output:crd:artifacts:config=$(KUSTOMIZE_CRDS_DIR)
rm -f $(KUSTOMIZE_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths=./internal/operator-controller/... output:rbac:artifacts:config=$(KUSTOMIZE_RBAC_DIR)
rm -rf $(KUSTOMIZE_OPCON_CRDS_DIR) && $(CONTROLLER_GEN) crd paths=./api/... output:crd:artifacts:config=$(KUSTOMIZE_OPCON_CRDS_DIR)
rm -f $(KUSTOMIZE_OPCON_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths=./internal/operator-controller/... output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)
# Generate the catalogd manifests
rm -rf catalogd/$(KUSTOMIZE_CRDS_DIR) && $(CONTROLLER_GEN) crd paths="./catalogd/api/..." output:crd:artifacts:config=catalogd/$(KUSTOMIZE_CRDS_DIR)
rm -f catalogd/$(KUSTOMIZE_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths="./internal/catalogd/..." output:rbac:artifacts:config=catalogd/$(KUSTOMIZE_RBAC_DIR)
rm -f catalogd/$(KUSTOMIZE_WEBHOOKS_DIR)/manifests.yaml && $(CONTROLLER_GEN) webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=catalogd/$(KUSTOMIZE_WEBHOOKS_DIR)
rm -rf $(KUSTOMIZE_CATD_CRDS_DIR) && $(CONTROLLER_GEN) crd paths="./catalogd/api/..." output:crd:artifacts:config=$(KUSTOMIZE_CATD_CRDS_DIR)
rm -f $(KUSTOMIZE_CATD_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths="./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR)
rm -f $(KUSTOMIZE_CATD_WEBHOOKS_DIR)/manifests.yaml && $(CONTROLLER_GEN) webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=$(KUSTOMIZE_CATD_WEBHOOKS_DIR)

.PHONY: generate
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down Expand Up @@ -221,7 +222,6 @@ image-registry: ## Build the testdata catalog used for e2e tests and push it to
test-e2e: KIND_CLUSTER_NAME := operator-controller-e2e
test-e2e: KUSTOMIZE_BUILD_DIR := config/overlays/e2e
test-e2e: GO_BUILD_FLAGS := -cover
test-e2e: CATALOGD_KUSTOMIZE_BUILD_DIR := catalogd/config/overlays/e2e
test-e2e: run image-registry e2e e2e-coverage kind-clean #HELP Run e2e test suite on local kind cluster

.PHONY: extension-developer-e2e
Expand Down Expand Up @@ -259,9 +259,9 @@ kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND

.PHONY: kind-deploy
kind-deploy: export MANIFEST := ./operator-controller.yaml
kind-deploy: export DEFAULT_CATALOG := ./catalogd/config/base/default/clustercatalogs/default-catalogs.yaml
kind-deploy: export DEFAULT_CATALOG := ./config/catalogs/clustercatalogs/default-catalogs.yaml
kind-deploy: manifests $(KUSTOMIZE)
($(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) && echo "---" && $(KUSTOMIZE) build $(CATALOGD_KUSTOMIZE_BUILD_DIR) | sed "s/cert-git-version/cert-$(VERSION)/g") > $(MANIFEST)
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/cert-git-version/cert-$(VERSION)/g" > $(MANIFEST)
envsubst '$$DEFAULT_CATALOG,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s

.PHONY: kind-cluster
Expand Down Expand Up @@ -347,7 +347,7 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml
quickstart: export DEFAULT_CATALOG := "https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/default-catalogs.yaml"
quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the unified installation release manifests and scripts.
($(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) && echo "---" && $(KUSTOMIZE) build catalogd/config/overlays/cert-manager) | sed "s/cert-git-version/cert-$(VERSION)/g" | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/cert-git-version/cert-$(VERSION)/g" | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml
envsubst '$$DEFAULT_CATALOG,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh

##@ Docs
Expand All @@ -367,7 +367,7 @@ crd-ref-docs: $(CRD_REF_DOCS) #EXHELP Generate the API Reference Documents.
$(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/catalogd/api \
--config=$(API_REFERENCE_DIR)/crd-ref-docs-gen-config.yaml \
--renderer=markdown --output-path=$(API_REFERENCE_DIR)/$(CATALOGD_API_REFERENCE_FILENAME);

VENVDIR := $(abspath docs/.venv)

.PHONY: build-docs
Expand Down
4 changes: 2 additions & 2 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load('.tilt-support', 'deploy_repo')

operator_controller = {
'image': 'quay.io/operator-framework/operator-controller',
'yaml': 'config/overlays/tilt-local-dev',
'yaml': 'config/overlays/tilt-local-dev/operator-controller',
'binaries': {
'./cmd/operator-controller': 'operator-controller-controller-manager',
},
Expand All @@ -13,7 +13,7 @@ deploy_repo('operator-controller', operator_controller, '-tags containers_image_

catalogd = {
'image': 'quay.io/operator-framework/catalogd',
'yaml': 'catalogd/config/overlays/cert-manager',
'yaml': 'config/overlays/tilt-local-dev/catalogd',
'binaries': {
'./catalogd/cmd/catalogd': 'catalogd-controller-manager',
},
Expand Down
2 changes: 1 addition & 1 deletion catalogd/api/v1/clustercatalog_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"sigs.k8s.io/yaml"
)

const crdFilePath = "../../config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml"
const crdFilePath = "../../../config/base/catalogd/crd/bases/olm.operatorframework.io_clustercatalogs.yaml"

func TestImageSourceCELValidationRules(t *testing.T) {
validators := fieldValidatorsFromFile(t, crdFilePath)
Expand Down
17 changes: 0 additions & 17 deletions catalogd/config/base/default/kustomization.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions catalogd/config/components/ca/kustomization.yaml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions catalogd/config/overlays/cert-manager/kustomization.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions catalogd/config/overlays/e2e/kustomization.yaml

This file was deleted.

65 changes: 0 additions & 65 deletions catalogd/config/rbac/role.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions catalogd/config/samples/core_v1_clustercatalog.yaml

This file was deleted.

69 changes: 47 additions & 22 deletions config/README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,77 @@
# OPERATOR-CONTROLLER CONFIG

## config/base
## config/overlays/basic-olm

This provides an insecure (i.e. no TLS) basic configuration of operator-controller.

This configuration specifies a namespace of `olmv1-system`.
This includes basic support for an insecure OLMv1 deployment. This configuration uses:
* config/base/catalogd
* config/base/operator-controller
* config/base/common

## config/overlays/cert-manager

This includes support for a secure (i.e. with TLS) configuration of operator-controller. This configuration uses:
* config/base
* config/components/tls
* config/components/ca
This includes support for a secure (i.e. with TLS) configuration of OLMv1. This configuration uses:
* config/base/catalogd
* config/base/operator-controller
* config/base/common
* config/components/tls/catalogd
* config/components/tls/operator-controller
* config/components/tls/ca

This configuration requires cert-manager.

## config/overlays/e2e

This provides additional configuration support for end-to-end testing, including code coverage. This configuration uses:
* config/base
* config/components/tls
* config/components/ca
* config/base/catalogd
* config/base/operator-controller
* config/base/common
* config/components/coverage
* config/components/tls/catalogd
* config/components/tls/operator-controller
* config/components/tls/ca

This configuration requires cert-manager.

## Components
## Base Configuration

Each of the `kustomization.yaml` files specify a `Component`, rather than an overlay.
The base configuration specifies a namespace of `olmv1-system`.

### config/components/tls
### config/base/catalogd

This provides a basic configuration of operator-controller with TLS support for catalogd.
This provides the base configuration of catalogd.

### config/base/operator-controller

This provides the base configuration of operator-controller.

### config/base/common

This provides common components to both operator-controller and catalogd, i.e. namespace.

## Components

Each of the `kustomization.yaml` files specify a `Component`, rather than an overlay, and thus, can be used within the overlays.

This component specifies the `olmv1-system` namespace.
### config/components/tls/catalogd

This provides a basic configuration of catalogd with TLS support.

This component requires cert-manager.

### config/components/coverage
### config/components/tls/operator-controller

Provides configuration for code coverage.
This provides a basic configuration of operator-controller with TLS support for catalogd.

This component specifies the `olmv1-system` namespace.
This component requires cert-manager.

### config/components/ca
### config/components/tls/ca

Procides a CA for operator-controller operation.
Provides a CA for operator-controller/catalogd operation.

This component _does not_ specify a namespace, and must be included last.
This component _does not_ specify a namespace, and _must_ be included last.

This component requires cert-manager.

### config/components/coverage

Provides configuration for code coverage.
Loading
Loading