Skip to content

Commit 2b76a84

Browse files
committed
replace old config, simply testdata image build, add tilt component
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
1 parent c9be3f7 commit 2b76a84

File tree

137 files changed

+5955
-2466
lines changed

Some content is hidden

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

137 files changed

+5955
-2466
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ cover.out
2020

2121
# Release output
2222
dist/**
23-
operator-controller.yaml
2423
install.sh
25-
catalogd.yaml
2624

2725
# vendored files
2826
vendor/

.tilt-support

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ load('ext://cert_manager', 'deploy_cert_manager')
55
def deploy_cert_manager_if_needed():
66
cert_manager_var = '__CERT_MANAGER__'
77
if os.getenv(cert_manager_var) != '1':
8-
deploy_cert_manager(version="v1.15.3")
8+
deploy_cert_manager(version="v1.17.1")
99
os.putenv(cert_manager_var, '1')
1010

1111

@@ -130,7 +130,6 @@ def process_yaml(yaml):
130130
# data format:
131131
# {
132132
# 'image': 'quay.io/operator-framework/rukpak',
133-
# 'yaml': 'manifests/overlays/cert-manager',
134133
# 'binaries': {
135134
# 'core': 'core',
136135
# 'crdvalidator': 'crd-validation-webhook',
@@ -148,4 +147,3 @@ def deploy_repo(repo, data, tags="", debug=True):
148147
build_binary(repo, binary, data['deps'], data['image'], tags, debug)
149148
k8s_resource(deployment, port_forwards=['{}:30000'.format(local_port)])
150149
local_port += 1
151-
process_yaml(kustomize(data['yaml']))

Makefile

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ else
8787
$(warning Could not find docker or podman in path! This may result in targets requiring a container runtime failing!)
8888
endif
8989

90-
KUSTOMIZE_BUILD_DIR := config-new/overlays/community
90+
KUSTOMIZE_RELEASE_OVERLAY := config/overlays/community
91+
KUSTOMIZE_E2E_OVERLAY := config/overlays/community-e2e
92+
KUSTOMIZE_TILT_OVERLAY := config/overlays/community-tilt
93+
KUSTOMIZE_CATALOGS_OVERLAY := config/overlays/default-catalogs
94+
95+
RELEASE_MANIFEST := ./release-manifests/operator-controller.yaml
96+
E2E_MANIFEST := ./release-manifests/operator-controller-e2e.yaml
97+
TILT_MANIFEST := ./release-manifests/operator-controller-tilt.yaml
98+
CATALOGS_MANIFEST := ./release-manifests/default-catalogs.yaml
9199

92100
# Disable -j flag for make
93101
.NOTPARALLEL:
@@ -139,15 +147,15 @@ tidy:
139147
go mod tidy
140148

141149
.PHONY: manifests
142-
KUSTOMIZE_CATD_CRDS_DIR := config-new/base/catalogd/crd/bases
143-
KUSTOMIZE_CATD_RBAC_DIR := config-new/base/catalogd/rbac
144-
KUSTOMIZE_CATD_WEBHOOKS_DIR := config-new/base/catalogd/manager/webhook
145-
KUSTOMIZE_OPCON_CRDS_DIR := config-new/base/operator-controller/crd/bases
146-
KUSTOMIZE_OPCON_RBAC_DIR := config-new/base/operator-controller/rbac
150+
KUSTOMIZE_CATD_CRDS_DIR := config/base/catalogd/crd/bases
151+
KUSTOMIZE_CATD_RBAC_DIR := config/base/catalogd/rbac
152+
KUSTOMIZE_CATD_WEBHOOKS_DIR := config/base/catalogd/manager/webhook
153+
KUSTOMIZE_OPCON_CRDS_DIR := config/base/operator-controller/crd/bases
154+
KUSTOMIZE_OPCON_RBAC_DIR := config/base/operator-controller/rbac
147155
CRD_WORKING_DIR := crd_work_dir
148156
# Due to https://github.com/kubernetes-sigs/controller-tools/issues/837 we can't specify individual files
149157
# So we have to generate them together and then move them into place
150-
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
158+
manifests: $(CONTROLLER_GEN) $(KUSTOMIZE) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
151159
mkdir $(CRD_WORKING_DIR)
152160
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) crd paths="./api/v1/..." output:crd:artifacts:config=$(CRD_WORKING_DIR)
153161
mv $(CRD_WORKING_DIR)/olm.operatorframework.io_clusterextensions.yaml $(KUSTOMIZE_OPCON_CRDS_DIR)
@@ -157,6 +165,11 @@ manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole,
157165
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/operator-controller/..." output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)
158166
# Generate the remaining catalogd manifests
159167
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR)
168+
$(KUSTOMIZE) build $(KUSTOMIZE_RELEASE_OVERLAY) | envsubst '$$VERSION' > $(RELEASE_MANIFEST)
169+
$(KUSTOMIZE) build $(KUSTOMIZE_E2E_OVERLAY) | envsubst '$$VERSION' > $(E2E_MANIFEST)
170+
$(KUSTOMIZE) build $(KUSTOMIZE_TILT_OVERLAY) | envsubst '$$VERSION' > $(TILT_MANIFEST)
171+
$(KUSTOMIZE) build $(KUSTOMIZE_CATALOGS_OVERLAY) > $(CATALOGS_MANIFEST)
172+
160173

161174
.PHONY: generate
162175
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -210,11 +223,11 @@ E2E_REGISTRY_NAME := docker-registry
210223
E2E_REGISTRY_NAMESPACE := operator-controller-e2e
211224

212225
export REG_PKG_NAME := registry-operator
213-
export LOCAL_REGISTRY_HOST := $(E2E_REGISTRY_NAME).$(E2E_REGISTRY_NAMESPACE).svc:5000
214-
export CLUSTER_REGISTRY_HOST := localhost:30000
226+
export INCLUSTER_REGISTRY_HOST := $(E2E_REGISTRY_NAME).$(E2E_REGISTRY_NAMESPACE).svc:5000
227+
export LOCAL_REGISTRY_HOST := localhost:30000
215228
export E2E_TEST_CATALOG_V1 := e2e/test-catalog:v1
216229
export E2E_TEST_CATALOG_V2 := e2e/test-catalog:v2
217-
export CATALOG_IMG := $(LOCAL_REGISTRY_HOST)/$(E2E_TEST_CATALOG_V1)
230+
export CATALOG_IMG := $(INCLUSTER_REGISTRY_HOST)/$(E2E_TEST_CATALOG_V1)
218231
.PHONY: test-ext-dev-e2e
219232
test-ext-dev-e2e: $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run extension create, upgrade and delete tests.
220233
test/extension-developer-e2e/setup.sh $(OPERATOR_SDK) $(CONTAINER_RUNTIME) $(KUSTOMIZE) $(KIND) $(KIND_CLUSTER_NAME) $(E2E_REGISTRY_NAMESPACE)
@@ -239,15 +252,9 @@ test-unit: $(SETUP_ENVTEST) envtest-k8s-bins #HELP Run the unit tests
239252
$(UNIT_TEST_DIRS) \
240253
-test.gocoverdir=$(COVERAGE_UNIT_DIR)
241254

242-
.PHONY: image-registry
243-
E2E_REGISTRY_IMAGE=localhost/e2e-test-registry:devel
244-
image-registry: export GOOS=linux
245-
image-registry: export GOARCH=amd64
246-
image-registry: ## Build the testdata catalog used for e2e tests and push it to the image registry
247-
go build $(GO_BUILD_FLAGS) $(GO_BUILD_EXTRA_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o ./testdata/push/bin/push ./testdata/push/push.go
248-
$(CONTAINER_RUNTIME) build -f ./testdata/Dockerfile -t $(E2E_REGISTRY_IMAGE) ./testdata
249-
$(CONTAINER_RUNTIME) save $(E2E_REGISTRY_IMAGE) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
250-
./testdata/build-test-registry.sh $(E2E_REGISTRY_NAMESPACE) $(E2E_REGISTRY_NAME) $(E2E_REGISTRY_IMAGE)
255+
.PHONY: push-test-images
256+
push-test-images: ## Build the testdata catalog used for e2e tests and push it to the image registry
257+
(cd ./testdata/push && go run ./ --images-path=../images --registry-address=localhost:30000)
251258

252259
# When running the e2e suite, you can set the ARTIFACT_PATH variable to the absolute path
253260
# of the directory for the operator-controller e2e tests to store the artifacts, which
@@ -256,15 +263,15 @@ image-registry: ## Build the testdata catalog used for e2e tests and push it to
256263
# for example: ARTIFACT_PATH=/tmp/artifacts make test-e2e
257264
.PHONY: test-e2e
258265
test-e2e: KIND_CLUSTER_NAME := operator-controller-e2e
259-
test-e2e: KUSTOMIZE_BUILD_DIR := config-new/overlays/community-e2e
266+
test-e2e: export MANIFEST := $(E2E_MANIFEST)
260267
test-e2e: GO_BUILD_EXTRA_FLAGS := -cover
261-
test-e2e: run image-registry e2e e2e-coverage kind-clean #HELP Run e2e test suite on local kind cluster
268+
test-e2e: run-internal push-test-images e2e e2e-coverage kind-clean #HELP Run e2e test suite on local kind cluster
262269

263270
.PHONY: extension-developer-e2e
264271
extension-developer-e2e: KIND_CLUSTER_NAME := operator-controller-ext-dev-e2e
265-
extension-developer-e2e: KUSTOMIZE_BUILD_DIR := config-new/overlays/community-e2e
272+
extension-developer-e2e: export MANIFEST := $(E2E_MANIFEST)
266273
extension-developer-e2e: export INSTALL_DEFAULT_CATALOGS := false
267-
extension-developer-e2e: run image-registry test-ext-dev-e2e kind-clean #EXHELP Run extension-developer e2e on local kind cluster
274+
extension-developer-e2e: run-internal push-test-images test-ext-dev-e2e kind-clean #EXHELP Run extension-developer e2e on local kind cluster
268275

269276
.PHONY: run-latest-release
270277
run-latest-release:
@@ -282,7 +289,7 @@ post-upgrade-checks:
282289
test-upgrade-e2e: KIND_CLUSTER_NAME := operator-controller-upgrade-e2e
283290
test-upgrade-e2e: export TEST_CLUSTER_CATALOG_NAME := test-catalog
284291
test-upgrade-e2e: export TEST_CLUSTER_EXTENSION_NAME := test-package
285-
test-upgrade-e2e: kind-cluster run-latest-release image-registry pre-upgrade-setup docker-build kind-load kind-deploy post-upgrade-checks kind-clean #HELP Run upgrade e2e tests on a local kind cluster
292+
test-upgrade-e2e: kind-cluster run-latest-release push-test-images pre-upgrade-setup docker-build kind-load kind-deploy post-upgrade-checks kind-clean #HELP Run upgrade e2e tests on a local kind cluster
286293

287294
.PHONY: e2e-coverage
288295
e2e-coverage:
@@ -296,11 +303,9 @@ kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND
296303
$(CONTAINER_RUNTIME) save $(CATD_IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
297304

298305
.PHONY: kind-deploy
299-
kind-deploy: export MANIFEST := ./operator-controller.yaml
300-
kind-deploy: export DEFAULT_CATALOG := ./config/catalogs/clustercatalogs/default-catalogs.yaml
306+
kind-deploy: export DEFAULT_CATALOGS := $(CATALOGS_MANIFEST)
301307
kind-deploy: manifests $(KUSTOMIZE)
302-
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | envsubst '$$VERSION' > operator-controller.yaml
303-
envsubst '$$DEFAULT_CATALOG,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s
308+
envsubst '$$DEFAULT_CATALOGS,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s
304309

305310
.PHONY: kind-cluster
306311
kind-cluster: $(KIND) #EXHELP Standup a kind cluster.
@@ -351,7 +356,11 @@ go-build-linux: export GOARCH=amd64
351356
go-build-linux: $(BINARIES)
352357

353358
.PHONY: run
354-
run: docker-build kind-cluster kind-load kind-deploy wait #HELP Build the operator-controller then deploy it into a new kind cluster.
359+
run: export MANIFEST := $(RELEASE_MANIFEST)
360+
run: run-internal #HELP Build the operator-controller then deploy it into a new kind cluster.
361+
362+
.PHONY: run-internal
363+
run-internal: docker-build kind-cluster kind-load kind-deploy wait
355364

356365
CATD_NAMESPACE := olmv1-system
357366
wait:
@@ -380,10 +389,9 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
380389

381390
.PHONY: quickstart
382391
quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml
383-
quickstart: export DEFAULT_CATALOG := "https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/default-catalogs.yaml"
384-
quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the unified installation release manifests and scripts.
385-
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | envsubst '$$VERSION' > operator-controller.yaml
386-
envsubst '$$DEFAULT_CATALOG,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
392+
quickstart: export DEFAULT_CATALOGS := "https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/default-catalogs.yaml"
393+
quickstart: manifests #EXHELP Generate the unified installation release manifests and scripts.
394+
envsubst '$$DEFAULT_CATALOGS,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
387395

388396
##@ Docs
389397

Tiltfile

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

33
operator_controller = {
44
'image': 'quay.io/operator-framework/operator-controller',
5-
'yaml': 'config/overlays/tilt-local-dev/operator-controller',
65
'binaries': {
76
'./cmd/operator-controller': 'operator-controller-controller-manager',
87
},
@@ -13,7 +12,6 @@ deploy_repo('operator-controller', operator_controller, '-tags containers_image_
1312

1413
catalogd = {
1514
'image': 'quay.io/operator-framework/catalogd',
16-
'yaml': 'config/overlays/tilt-local-dev/catalogd',
1715
'binaries': {
1816
'./cmd/catalogd': 'catalogd-controller-manager',
1917
},
@@ -22,3 +20,4 @@ catalogd = {
2220
}
2321

2422
deploy_repo('catalogd', catalogd, '-tags containers_image_openpgp')
23+
process_yaml(read_file('release-manifests/operator-controller-tilt.yaml'))

0 commit comments

Comments
 (0)