Skip to content

Commit 2a5e9b8

Browse files
authored
Consolidate configuration (#1790)
This moves all the configuration into the root config directory. The config/README.md file shows the result. Updated Makefile, goreleaser, documentation and some of the unit test code. Kept CRDs in their original locations, but made copies to the new locations to keep the verify-crd-compatibility target working properly. Once this is merged, a followup will remove the CRDs from the original locations and update the verify-crd-compatibility target. It also tries to make catalogd less of a second-class piece of code. I compared the resulting operator-controller.yaml with main, and with the exception of `image` locations, they are identical. Signed-off-by: Todd Short <[email protected]>
1 parent dd4d61f commit 2a5e9b8

File tree

81 files changed

+1196
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1196
-297
lines changed

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ release:
124124
disable: '{{ ne .Env.ENABLE_RELEASE_PIPELINE "true" }}'
125125
extra_files:
126126
- glob: 'operator-controller.yaml'
127-
- glob: './catalogd/config/base/default/clustercatalogs/default-catalogs.yaml'
127+
- glob: './config/catalogs/clustercatalogs/default-catalogs.yaml'
128128
- glob: 'install.sh'
129129
header: |
130130
## Installation

Makefile

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ $(warning Could not find docker or podman in path! This may result in targets re
6565
endif
6666

6767
KUSTOMIZE_BUILD_DIR := config/overlays/cert-manager
68-
CATALOGD_KUSTOMIZE_BUILD_DIR := catalogd/config/overlays/cert-manager
6968

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

116115
.PHONY: manifests
117-
KUSTOMIZE_CRDS_DIR := config/base/crd/bases
118-
KUSTOMIZE_RBAC_DIR := config/base/rbac
119-
KUSTOMIZE_WEBHOOKS_DIR := config/base/manager/webhook
116+
KUSTOMIZE_CATD_CRDS_DIR := config/base/catalogd/crd/bases
117+
KUSTOMIZE_CATD_RBAC_DIR := config/base/catalogd/rbac
118+
KUSTOMIZE_CATD_WEBHOOKS_DIR := config/base/catalogd/manager/webhook
119+
KUSTOMIZE_OPCON_CRDS_DIR := config/base/operator-controller/crd/bases
120+
KUSTOMIZE_OPCON_RBAC_DIR := config/base/operator-controller/rbac
120121
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
121122
# Generate the operator-controller manifests
122-
rm -rf $(KUSTOMIZE_CRDS_DIR) && $(CONTROLLER_GEN) crd paths=./api/... output:crd:artifacts:config=$(KUSTOMIZE_CRDS_DIR)
123-
rm -f $(KUSTOMIZE_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths=./internal/operator-controller/... output:rbac:artifacts:config=$(KUSTOMIZE_RBAC_DIR)
123+
rm -rf $(KUSTOMIZE_OPCON_CRDS_DIR) && $(CONTROLLER_GEN) crd paths=./api/... output:crd:artifacts:config=$(KUSTOMIZE_OPCON_CRDS_DIR)
124+
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)
124125
# Generate the catalogd manifests
125-
rm -rf catalogd/$(KUSTOMIZE_CRDS_DIR) && $(CONTROLLER_GEN) crd paths="./catalogd/api/..." output:crd:artifacts:config=catalogd/$(KUSTOMIZE_CRDS_DIR)
126-
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)
127-
rm -f catalogd/$(KUSTOMIZE_WEBHOOKS_DIR)/manifests.yaml && $(CONTROLLER_GEN) webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=catalogd/$(KUSTOMIZE_WEBHOOKS_DIR)
126+
rm -rf $(KUSTOMIZE_CATD_CRDS_DIR) && $(CONTROLLER_GEN) crd paths="./catalogd/api/..." output:crd:artifacts:config=$(KUSTOMIZE_CATD_CRDS_DIR)
127+
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)
128+
rm -f $(KUSTOMIZE_CATD_WEBHOOKS_DIR)/manifests.yaml && $(CONTROLLER_GEN) webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=$(KUSTOMIZE_CATD_WEBHOOKS_DIR)
128129

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

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

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

267267
.PHONY: kind-cluster
@@ -347,7 +347,7 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
347347
quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml
348348
quickstart: export DEFAULT_CATALOG := "https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/default-catalogs.yaml"
349349
quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the unified installation release manifests and scripts.
350-
($(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
350+
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/cert-git-version/cert-$(VERSION)/g" | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml
351351
envsubst '$$DEFAULT_CATALOG,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
352352

353353
##@ Docs
@@ -367,7 +367,7 @@ crd-ref-docs: $(CRD_REF_DOCS) #EXHELP Generate the API Reference Documents.
367367
$(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/catalogd/api \
368368
--config=$(API_REFERENCE_DIR)/crd-ref-docs-gen-config.yaml \
369369
--renderer=markdown --output-path=$(API_REFERENCE_DIR)/$(CATALOGD_API_REFERENCE_FILENAME);
370-
370+
371371
VENVDIR := $(abspath docs/.venv)
372372

373373
.PHONY: build-docs

Tiltfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load('.tilt-support', 'deploy_repo')
22

33
operator_controller = {
44
'image': 'quay.io/operator-framework/operator-controller',
5-
'yaml': 'config/overlays/tilt-local-dev',
5+
'yaml': 'config/overlays/tilt-local-dev/operator-controller',
66
'binaries': {
77
'./cmd/operator-controller': 'operator-controller-controller-manager',
88
},
@@ -13,7 +13,7 @@ deploy_repo('operator-controller', operator_controller, '-tags containers_image_
1313

1414
catalogd = {
1515
'image': 'quay.io/operator-framework/catalogd',
16-
'yaml': 'catalogd/config/overlays/cert-manager',
16+
'yaml': 'config/overlays/tilt-local-dev/catalogd',
1717
'binaries': {
1818
'./catalogd/cmd/catalogd': 'catalogd-controller-manager',
1919
},

catalogd/api/v1/clustercatalog_types_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"sigs.k8s.io/yaml"
2121
)
2222

23-
const crdFilePath = "../../config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml"
23+
const crdFilePath = "../../../config/base/catalogd/crd/bases/olm.operatorframework.io_clustercatalogs.yaml"
2424

2525
func TestImageSourceCELValidationRules(t *testing.T) {
2626
validators := fieldValidatorsFromFile(t, crdFilePath)

catalogd/config/base/default/kustomization.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

catalogd/config/components/ca/kustomization.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

catalogd/config/components/registries-conf/kustomization.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

catalogd/config/components/registries-conf/manager_e2e_registries_conf_patch.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

catalogd/config/components/registries-conf/registries_conf_configmap.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

catalogd/config/overlays/cert-manager/kustomization.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

catalogd/config/overlays/e2e/kustomization.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

catalogd/config/rbac/role.yaml

Lines changed: 0 additions & 65 deletions
This file was deleted.

catalogd/config/samples/core_v1_clustercatalog.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

config/README.md

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,77 @@
11
# OPERATOR-CONTROLLER CONFIG
22

3-
## config/base
3+
## config/overlays/basic-olm
44

5-
This provides an insecure (i.e. no TLS) basic configuration of operator-controller.
6-
7-
This configuration specifies a namespace of `olmv1-system`.
5+
This includes basic support for an insecure OLMv1 deployment. This configuration uses:
6+
* config/base/catalogd
7+
* config/base/operator-controller
8+
* config/base/common
89

910
## config/overlays/cert-manager
1011

11-
This includes support for a secure (i.e. with TLS) configuration of operator-controller. This configuration uses:
12-
* config/base
13-
* config/components/tls
14-
* config/components/ca
12+
This includes support for a secure (i.e. with TLS) configuration of OLMv1. This configuration uses:
13+
* config/base/catalogd
14+
* config/base/operator-controller
15+
* config/base/common
16+
* config/components/tls/catalogd
17+
* config/components/tls/operator-controller
18+
* config/components/tls/ca
1519

1620
This configuration requires cert-manager.
1721

1822
## config/overlays/e2e
1923

2024
This provides additional configuration support for end-to-end testing, including code coverage. This configuration uses:
21-
* config/base
22-
* config/components/tls
23-
* config/components/ca
25+
* config/base/catalogd
26+
* config/base/operator-controller
27+
* config/base/common
2428
* config/components/coverage
29+
* config/components/tls/catalogd
30+
* config/components/tls/operator-controller
31+
* config/components/tls/ca
2532

2633
This configuration requires cert-manager.
2734

28-
## Components
35+
## Base Configuration
2936

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

32-
### config/components/tls
39+
### config/base/catalogd
3340

34-
This provides a basic configuration of operator-controller with TLS support for catalogd.
41+
This provides the base configuration of catalogd.
42+
43+
### config/base/operator-controller
44+
45+
This provides the base configuration of operator-controller.
46+
47+
### config/base/common
48+
49+
This provides common components to both operator-controller and catalogd, i.e. namespace.
50+
51+
## Components
52+
53+
Each of the `kustomization.yaml` files specify a `Component`, rather than an overlay, and thus, can be used within the overlays.
3554

36-
This component specifies the `olmv1-system` namespace.
55+
### config/components/tls/catalogd
56+
57+
This provides a basic configuration of catalogd with TLS support.
3758

3859
This component requires cert-manager.
3960

40-
### config/components/coverage
61+
### config/components/tls/operator-controller
4162

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

44-
This component specifies the `olmv1-system` namespace.
65+
This component requires cert-manager.
4566

46-
### config/components/ca
67+
### config/components/tls/ca
4768

48-
Procides a CA for operator-controller operation.
69+
Provides a CA for operator-controller/catalogd operation.
4970

50-
This component _does not_ specify a namespace, and must be included last.
71+
This component _does not_ specify a namespace, and _must_ be included last.
5172

5273
This component requires cert-manager.
74+
75+
### config/components/coverage
76+
77+
Provides configuration for code coverage.

0 commit comments

Comments
 (0)