Skip to content

Commit 023f662

Browse files
committed
Consolidate configuration
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 e7dabc2 commit 023f662

File tree

76 files changed

+1161
-284
lines changed

Some content is hidden

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

76 files changed

+1161
-284
lines changed

Diff for: .goreleaser.yml

+1-1
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

Diff for: Makefile

+14-14
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

Diff for: catalogd/api/v1/clustercatalog_types_test.go

+1-1
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)

Diff for: catalogd/config/base/default/kustomization.yaml

-17
This file was deleted.

Diff for: catalogd/config/components/ca/kustomization.yaml

-10
This file was deleted.

Diff for: catalogd/config/components/registries-conf/kustomization.yaml

-7
This file was deleted.

Diff for: catalogd/config/components/registries-conf/manager_e2e_registries_conf_patch.yaml

-17
This file was deleted.

Diff for: catalogd/config/components/registries-conf/registries_conf_configmap.yaml

-10
This file was deleted.

Diff for: catalogd/config/overlays/cert-manager/kustomization.yaml

-9
This file was deleted.

Diff for: catalogd/config/overlays/e2e/kustomization.yaml

-12
This file was deleted.

Diff for: catalogd/config/rbac/role.yaml

-65
This file was deleted.

Diff for: catalogd/config/samples/core_v1_clustercatalog.yaml

-11
This file was deleted.

Diff for: config/README.md

+48-15
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,70 @@
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/operator-controller
7+
* config/base/catalogd
8+
* config/base/common
89

910
## config/overlays/cert-manager
1011

1112
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
13+
* config/base/operator-controller
14+
* config/base/catalogd
15+
* config/base/common
16+
* config/components/tls/operator-controller
17+
* config/components/tls/catalogd
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/operator-controller
26+
* config/base/catalogd
27+
* config/base/common
28+
* config/components/tls/operator-controller
29+
* config/components/tls/catalogd
2430
* config/components/coverage
31+
* config/components/tls/ca
2532

2633
This configuration requires cert-manager.
2734

35+
## Base Configuration
36+
37+
### config/base/catalogd
38+
39+
This provides the basic configuration of catalogd.
40+
41+
This configuration specifies a namespace of `olmv1-system`.
42+
43+
### config/base/operator-controller
44+
45+
This provides the basic configuration of operator-controller.
46+
47+
This configuration specifies a namespace of `olmv1-system`.
48+
49+
### config/base/common
50+
51+
This provides common components to both operator-controller and catalogd, i.e. namespace.
52+
2853
## Components
2954

3055
Each of the `kustomization.yaml` files specify a `Component`, rather than an overlay.
3156

32-
### config/components/tls
57+
### config/components/tls/catalogd
58+
59+
This provides a basic configuration of operator-controller with TLS support.
60+
61+
This component specifies the `olmv1-system` namespace.
62+
63+
This component requires cert-manager.
64+
65+
### config/components/tls/operator-controller
3366

34-
This provides a basic configuration of operator-controller with TLS support for catalogd.
67+
This provides a basic configuration of catalogdoperator-controller with TLS support for catalogd.
3568

3669
This component specifies the `olmv1-system` namespace.
3770

@@ -43,10 +76,10 @@ Provides configuration for code coverage.
4376

4477
This component specifies the `olmv1-system` namespace.
4578

46-
### config/components/ca
79+
### config/components/tls/ca
4780

48-
Procides a CA for operator-controller operation.
81+
Provides a CA for operator-controller/catalogd operation.
4982

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

5285
This component requires cert-manager.

0 commit comments

Comments
 (0)