Skip to content

✨ Merge operator-controller and catalogd kustomize config directories #1701

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

Closed
wants to merge 7 commits into from
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/crd-diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ jobs:
run: |
make verify-crd-compatibility \
CRD_DIFF_ORIGINAL_REF=${{ github.event.pull_request.base.sha }} \
CRD_DIFF_UPDATED_SOURCE="git://${{ github.event.pull_request.head.sha }}?path=config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml" \
CATALOGD_CRD_DIFF_UPDATED_SOURCE="git://${{ github.event.pull_request.head.sha }}?path=catalogd/config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml"
CRD_DIFF_UPDATED_SOURCE="git://${{ github.event.pull_request.head.sha }}?path=config/operator-controller/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml" \
CATALOGD_CRD_DIFF_UPDATED_SOURCE="git://${{ github.event.pull_request.head.sha }}?path=config/catalogd/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml"
31 changes: 15 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ else
$(warning Could not find docker or podman in path! This may result in targets requiring a container runtime failing!)
endif

KUSTOMIZE_BUILD_DIR := config/overlays/cert-manager
KUSTOMIZE_BUILD_DIR := config/operator-controller/overlays/cert-manager

# Disable -j flag for make
.NOTPARALLEL:
Expand Down Expand Up @@ -107,10 +107,10 @@ tidy: #HELP Update dependencies.
.PHONY: manifests
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
# To generate the manifests used and do not use catalogd directory
$(CONTROLLER_GEN) rbac:roleName=manager-role paths=./internal/... output:rbac:artifacts:config=config/base/rbac
$(CONTROLLER_GEN) crd paths=./api/... output:crd:artifacts:config=config/base/crd/bases
$(CONTROLLER_GEN) rbac:roleName=manager-role paths=./internal/... output:rbac:artifacts:config=config/operator-controller/base/rbac
$(CONTROLLER_GEN) crd paths=./api/... output:crd:artifacts:config=config/operator-controller/base/crd/bases
# To generate the manifests for catalogd
$(MAKE) -C catalogd generate
$(MAKE) -f Makefile.catalogd generate

.PHONY: generate
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down Expand Up @@ -141,14 +141,13 @@ bingo-upgrade: $(BINGO) #EXHELP Upgrade tools

.PHONY: verify-crd-compatibility
CRD_DIFF_ORIGINAL_REF := main
CRD_DIFF_UPDATED_SOURCE := file://config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml
CATALOGD_CRD_DIFF_UPDATED_SOURCE := file://catalogd/config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml
CRD_DIFF_UPDATED_SOURCE := file://config/operator-controller/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml
CATALOGD_CRD_DIFF_UPDATED_SOURCE := file://config/catalogd/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml
CRD_DIFF_CONFIG := crd-diff-config.yaml

verify-crd-compatibility: $(CRD_DIFF) manifests
$(CRD_DIFF) --config="${CRD_DIFF_CONFIG}" "git://${CRD_DIFF_ORIGINAL_REF}?path=config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml" ${CRD_DIFF_UPDATED_SOURCE}
$(CRD_DIFF) --config="${CRD_DIFF_CONFIG}" "git://${CRD_DIFF_ORIGINAL_REF}?path=catalogd/config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml" ${CATALOGD_CRD_DIFF_UPDATED_SOURCE}

$(CRD_DIFF) --config="${CRD_DIFF_CONFIG}" "git://${CRD_DIFF_ORIGINAL_REF}?path=config/operator-controller/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml" ${CRD_DIFF_UPDATED_SOURCE}
$(CRD_DIFF) --config="${CRD_DIFF_CONFIG}" "git://${CRD_DIFF_ORIGINAL_REF}?path=config/catalogd/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml" ${CATALOGD_CRD_DIFF_UPDATED_SOURCE}

.PHONY: test
test: manifests generate fmt vet test-unit test-e2e #HELP Run all tests.
Expand Down Expand Up @@ -209,12 +208,12 @@ image-registry: ## Build the testdata catalog used for e2e tests and push it to
# for example: ARTIFACT_PATH=/tmp/artifacts make test-e2e
.PHONY: test-e2e
test-e2e: KIND_CLUSTER_NAME := operator-controller-e2e
test-e2e: KUSTOMIZE_BUILD_DIR := config/overlays/e2e
test-e2e: KUSTOMIZE_BUILD_DIR := config/operator-controller/overlays/e2e
test-e2e: GO_BUILD_FLAGS := -cover
test-e2e: run image-registry e2e e2e-coverage kind-clean #HELP Run e2e test suite on local kind cluster

.PHONY: extension-developer-e2e
extension-developer-e2e: KUSTOMIZE_BUILD_DIR := config/overlays/cert-manager
extension-developer-e2e: KUSTOMIZE_BUILD_DIR := config/operator-controller/overlays/cert-manager
extension-developer-e2e: KIND_CLUSTER_NAME := operator-controller-ext-dev-e2e #EXHELP Run extension-developer e2e on local kind cluster
extension-developer-e2e: export INSTALL_DEFAULT_CATALOGS := false #EXHELP Run extension-developer e2e on local kind cluster
extension-developer-e2e: run image-registry test-ext-dev-e2e kind-clean
Expand Down Expand Up @@ -244,13 +243,13 @@ e2e-coverage:
.PHONY: kind-load
kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND cluster.
$(CONTAINER_RUNTIME) save $(IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
IMAGE_REPO=$(CATALOG_IMAGE_REPO) KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) $(MAKE) -C catalogd kind-load
IMAGE_REPO=$(CATALOG_IMAGE_REPO) KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) $(MAKE) -f Makefile.catalogd kind-load

.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/catalogd/base/default/clustercatalogs/default-catalogs.yaml
kind-deploy: manifests $(KUSTOMIZE)
($(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) && echo "---" && $(KUSTOMIZE) build catalogd/config/overlays/cert-manager | sed "s/cert-git-version/cert-$(VERSION)/g") > $(MANIFEST)
($(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) && echo "---" && $(KUSTOMIZE) build config/catalogd/overlays/cert-manager | 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


Expand Down Expand Up @@ -311,7 +310,7 @@ run: docker-build kind-cluster kind-load kind-deploy #HELP Build the operator-co
.PHONY: docker-build
docker-build: build-linux #EXHELP Build docker image for operator-controller and catalog with GOOS=linux and local GOARCH.
$(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/linux
IMAGE_REPO=$(CATALOG_IMAGE_REPO) $(MAKE) -C catalogd build-container
IMAGE_REPO=$(CATALOG_IMAGE_REPO) $(MAKE) -f Makefile.catalogd build-container

#SECTION Release
ifeq ($(origin ENABLE_RELEASE_PIPELINE), undefined)
Expand All @@ -332,7 +331,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) && echo "---" && $(KUSTOMIZE) build config/catalogd/overlays/cert-manager) | 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 Down
34 changes: 17 additions & 17 deletions catalogd/Makefile → Makefile.catalogd
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ $(warning Could not find docker or podman in path! This may result in targets re
endif

# For standard development and release flows, we use the config/overlays/cert-manager overlay.
KUSTOMIZE_OVERLAY := config/overlays/cert-manager
KUSTOMIZE_OVERLAY := config/catalogd/overlays/cert-manager

# bingo manages consistent tooling versions for things like kind, kustomize, etc.
include ./../.bingo/Variables.mk
include ./.bingo/Variables.mk

# Dependencies
export CERT_MGR_VERSION := v1.15.3
Expand Down Expand Up @@ -67,24 +67,24 @@ help: ## Display this help.
##@ Development

clean: ## Remove binaries and test artifacts
rm -rf bin
rm -rf catalogd/bin

.PHONY: generate
generate: $(CONTROLLER_GEN) ## Generate code and manifests.
$(CONTROLLER_GEN) object:headerFile="../hack/boilerplate.go.txt" paths="./..."
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/base/crd/bases output:rbac:artifacts:config=config/base/rbac output:webhook:artifacts:config=config/base/manager/webhook/
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./catalogd/..."
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./catalogd/..." output:crd:artifacts:config=config/catalogd/base/crd/bases output:rbac:artifacts:config=config/catalogd/base/rbac output:webhook:artifacts:config=config/catalogd/base/manager/webhook/

FOCUS := $(if $(TEST),-v -focus "$(TEST)")
ifeq ($(origin E2E_FLAGS), undefined)
E2E_FLAGS :=
endif
test-e2e: ## Run the e2e tests on existing cluster
$(GINKGO) $(E2E_FLAGS) -trace -vv $(FOCUS) test/e2e
test-e2e: $(GINKGO) ## Run the e2e tests on existing cluster
$(GINKGO) $(E2E_FLAGS) -trace -vv $(FOCUS) catalogd/test/e2e

e2e: KIND_CLUSTER_NAME := catalogd-e2e
e2e: ISSUER_KIND := Issuer
e2e: ISSUER_NAME := selfsigned-issuer
e2e: KUSTOMIZE_OVERLAY := config/overlays/e2e
e2e: KUSTOMIZE_OVERLAY := config/catalogd/overlays/e2e
e2e: run image-registry test-e2e kind-cluster-cleanup ## Run e2e test suite on local kind cluster

image-registry: ## Setup in-cluster image registry
Expand Down Expand Up @@ -138,22 +138,22 @@ export GO_BUILD_LDFLAGS := -s -w \
export GO_BUILD_GCFLAGS := all=-trimpath=${PWD}
export GO_BUILD_TAGS := containers_image_openpgp

BUILDCMD = go build -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$(notdir $@) ./cmd/$(notdir $@)
BUILDCMD = go build -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$(notdir $@) ./catalogd/cmd/$(notdir $@)

.PHONY: build-deps
build-deps: generate

.PHONY: build go-build-local $(BINARIES)
build: build-deps go-build-local ## Build binaries for current GOOS and GOARCH.
go-build-local: $(BINARIES)
$(BINARIES): BUILDBIN = bin
$(BINARIES): BUILDBIN = catalogd/bin
$(BINARIES):
$(BUILDCMD)

.PHONY: build-linux go-build-linux $(LINUX_BINARIES)
build-linux: build-deps go-build-linux ## Build binaries for GOOS=linux and local GOARCH.
go-build-linux: $(LINUX_BINARIES)
$(LINUX_BINARIES): BUILDBIN = bin/linux
$(LINUX_BINARIES): BUILDBIN = catalogd/bin/linux
$(LINUX_BINARIES):
GOOS=linux $(BUILDCMD)

Expand All @@ -163,7 +163,7 @@ run: generate kind-cluster install ## Create a kind cluster and install a local

.PHONY: build-container
build-container: build-linux ## Build docker image for catalogd.
$(CONTAINER_RUNTIME) build -f Dockerfile -t $(IMAGE) ./bin/linux
$(CONTAINER_RUNTIME) build -f catalogd/Dockerfile -t $(IMAGE) ./catalogd/bin/linux

##@ Deploy

Expand All @@ -185,15 +185,15 @@ install: check-cluster build-container kind-load deploy wait ## Install local ca

.PHONY: deploy
deploy: export MANIFEST="./catalogd.yaml"
deploy: export DEFAULT_CATALOGS="./config/base/default/clustercatalogs/default-catalogs.yaml"
deploy: export DEFAULT_CATALOGS="./config/catalogd/base/default/clustercatalogs/default-catalogs.yaml"
deploy: $(KUSTOMIZE) ## Deploy Catalogd to the K8s cluster specified in ~/.kube/config with cert-manager and default clustercatalogs
cd config/base/manager && $(KUSTOMIZE) edit set image controller=$(IMAGE) && cd ../../..
cd config/catalogd/base/manager && $(KUSTOMIZE) edit set image controller=$(IMAGE) && cd ../../../../
$(KUSTOMIZE) build $(KUSTOMIZE_OVERLAY) | sed "s/cert-git-version/cert-$(GIT_VERSION)/g" > catalogd.yaml
envsubst '$$CERT_MGR_VERSION,$$MANIFEST,$$DEFAULT_CATALOGS' < scripts/install.tpl.sh | bash -s
envsubst '$$CERT_MGR_VERSION,$$MANIFEST,$$DEFAULT_CATALOGS' < catalogd/scripts/install.tpl.sh | bash -s

.PHONY: only-deploy-manifest
only-deploy-manifest: $(KUSTOMIZE) ## Deploy just the Catalogd manifest--used in e2e testing where cert-manager is installed in a separate step
cd config/base/manager && $(KUSTOMIZE) edit set image controller=$(IMAGE)
cd config/catalogd/base/manager && $(KUSTOMIZE) edit set image controller=$(IMAGE)
$(KUSTOMIZE) build $(KUSTOMIZE_OVERLAY) | kubectl apply -f -

wait:
Expand All @@ -208,7 +208,7 @@ cert-manager:

.PHONY: demo-update
demo-update:
hack/scripts/generate-asciidemo.sh
catalogd/hack/scripts/generate-asciidemo.sh

.PHONY: check-cluster
check-cluster:
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/cert-manager',
'yaml': 'config/operator-controller/overlays/cert-manager',
'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/catalogd/overlays/cert-manager',
'binaries': {
'./catalogd/cmd/catalogd': 'catalogd-controller-manager',
},
Expand Down
File renamed without changes.
File renamed without changes.
Loading