Skip to content

Commit da98fd3

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

File tree

138 files changed

+6121
-2472
lines changed

Some content is hidden

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

138 files changed

+6121
-2472
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ coverage
1919
cover.out
2020

2121
# Release output
22-
dist/**
23-
operator-controller.yaml
24-
install.sh
25-
catalogd.yaml
22+
/dist/**
23+
/operator-controller.yaml
24+
/default-catalogs.yaml
25+
/install.sh
2626

2727
# vendored files
2828
vendor/

.goreleaser.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ release:
124124
disable: '{{ ne .Env.ENABLE_RELEASE_PIPELINE "true" }}'
125125
mode: replace
126126
extra_files:
127-
- glob: 'operator-controller.yaml'
128-
- glob: './config/catalogs/clustercatalogs/default-catalogs.yaml'
129-
- glob: 'install.sh'
127+
- glob: '{{ .Env.RELEASE_MANIFEST }}'
128+
- glob: '{{ .Env.RELEASE_INSTALL }}'
129+
- glob: '{{ .Env.RELEASE_CATALOGS }}'
130130
header: |
131131
## Installation
132132

.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: 49 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,20 @@ 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+
export RELEASE_MANIFEST := operator-controller.yaml
96+
export RELEASE_INSTALL := install.sh
97+
export RELEASE_CATALOGS := default-catalogs.yaml
98+
99+
DEV_MANIFESTS_DIR := dev-manifests
100+
DEV_MANIFEST := $(DEV_MANIFESTS_DIR)/operator-controller-dev.yaml
101+
E2E_MANIFEST := $(DEV_MANIFESTS_DIR)/operator-controller-e2e.yaml
102+
TILT_MANIFEST := $(DEV_MANIFESTS_DIR)/operator-controller-tilt.yaml
103+
CATALOGS_MANIFEST := $(DEV_MANIFESTS_DIR)/default-catalogs.yaml
91104

92105
# Disable -j flag for make
93106
.NOTPARALLEL:
@@ -139,15 +152,15 @@ tidy:
139152
go mod tidy
140153

141154
.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
155+
KUSTOMIZE_CATD_CRDS_DIR := config/base/catalogd/crd/bases
156+
KUSTOMIZE_CATD_RBAC_DIR := config/base/catalogd/rbac
157+
KUSTOMIZE_CATD_WEBHOOKS_DIR := config/base/catalogd/manager/webhook
158+
KUSTOMIZE_OPCON_CRDS_DIR := config/base/operator-controller/crd/bases
159+
KUSTOMIZE_OPCON_RBAC_DIR := config/base/operator-controller/rbac
147160
CRD_WORKING_DIR := crd_work_dir
148161
# Due to https://github.com/kubernetes-sigs/controller-tools/issues/837 we can't specify individual files
149162
# So we have to generate them together and then move them into place
150-
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
163+
manifests: $(CONTROLLER_GEN) $(KUSTOMIZE) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
151164
mkdir $(CRD_WORKING_DIR)
152165
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) crd paths="./api/v1/..." output:crd:artifacts:config=$(CRD_WORKING_DIR)
153166
mv $(CRD_WORKING_DIR)/olm.operatorframework.io_clusterextensions.yaml $(KUSTOMIZE_OPCON_CRDS_DIR)
@@ -157,6 +170,12 @@ manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole,
157170
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/operator-controller/..." output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)
158171
# Generate the remaining catalogd manifests
159172
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR)
173+
mkdir -p $(DEV_MANIFESTS_DIR)
174+
$(KUSTOMIZE) build $(KUSTOMIZE_RELEASE_OVERLAY) > $(DEV_MANIFEST)
175+
$(KUSTOMIZE) build $(KUSTOMIZE_E2E_OVERLAY) > $(E2E_MANIFEST)
176+
$(KUSTOMIZE) build $(KUSTOMIZE_TILT_OVERLAY) > $(TILT_MANIFEST)
177+
$(KUSTOMIZE) build $(KUSTOMIZE_CATALOGS_OVERLAY) > $(CATALOGS_MANIFEST)
178+
160179

161180
.PHONY: generate
162181
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -210,11 +229,11 @@ E2E_REGISTRY_NAME := docker-registry
210229
E2E_REGISTRY_NAMESPACE := operator-controller-e2e
211230

212231
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
232+
export INCLUSTER_REGISTRY_HOST := $(E2E_REGISTRY_NAME).$(E2E_REGISTRY_NAMESPACE).svc:5000
233+
export LOCAL_REGISTRY_HOST := localhost:30000
215234
export E2E_TEST_CATALOG_V1 := e2e/test-catalog:v1
216235
export E2E_TEST_CATALOG_V2 := e2e/test-catalog:v2
217-
export CATALOG_IMG := $(LOCAL_REGISTRY_HOST)/$(E2E_TEST_CATALOG_V1)
236+
export CATALOG_IMG := $(INCLUSTER_REGISTRY_HOST)/$(E2E_TEST_CATALOG_V1)
218237
.PHONY: test-ext-dev-e2e
219238
test-ext-dev-e2e: $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run extension create, upgrade and delete tests.
220239
test/extension-developer-e2e/setup.sh $(OPERATOR_SDK) $(CONTAINER_RUNTIME) $(KUSTOMIZE) $(KIND) $(KIND_CLUSTER_NAME) $(E2E_REGISTRY_NAMESPACE)
@@ -239,15 +258,9 @@ test-unit: $(SETUP_ENVTEST) envtest-k8s-bins #HELP Run the unit tests
239258
$(UNIT_TEST_DIRS) \
240259
-test.gocoverdir=$(COVERAGE_UNIT_DIR)
241260

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)
261+
.PHONY: push-test-images
262+
push-test-images: ## Build the testdata catalog used for e2e tests and push it to the image registry
263+
(cd ./testdata/push && go run ./ --images-path=../images --registry-address=localhost:30000)
251264

252265
# When running the e2e suite, you can set the ARTIFACT_PATH variable to the absolute path
253266
# of the directory for the operator-controller e2e tests to store the artifacts, which
@@ -256,15 +269,15 @@ image-registry: ## Build the testdata catalog used for e2e tests and push it to
256269
# for example: ARTIFACT_PATH=/tmp/artifacts make test-e2e
257270
.PHONY: test-e2e
258271
test-e2e: KIND_CLUSTER_NAME := operator-controller-e2e
259-
test-e2e: KUSTOMIZE_BUILD_DIR := config-new/overlays/community-e2e
272+
test-e2e: export MANIFEST := $(E2E_MANIFEST)
260273
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
274+
test-e2e: run-internal push-test-images e2e e2e-coverage kind-clean #HELP Run e2e test suite on local kind cluster
262275

263276
.PHONY: extension-developer-e2e
264277
extension-developer-e2e: KIND_CLUSTER_NAME := operator-controller-ext-dev-e2e
265-
extension-developer-e2e: KUSTOMIZE_BUILD_DIR := config-new/overlays/community-e2e
278+
extension-developer-e2e: export MANIFEST := $(E2E_MANIFEST)
266279
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
280+
extension-developer-e2e: run-internal push-test-images test-ext-dev-e2e kind-clean #EXHELP Run extension-developer e2e on local kind cluster
268281

269282
.PHONY: run-latest-release
270283
run-latest-release:
@@ -282,7 +295,7 @@ post-upgrade-checks:
282295
test-upgrade-e2e: KIND_CLUSTER_NAME := operator-controller-upgrade-e2e
283296
test-upgrade-e2e: export TEST_CLUSTER_CATALOG_NAME := test-catalog
284297
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
298+
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
286299

287300
.PHONY: e2e-coverage
288301
e2e-coverage:
@@ -296,11 +309,9 @@ kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND
296309
$(CONTAINER_RUNTIME) save $(CATD_IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
297310

298311
.PHONY: kind-deploy
299-
kind-deploy: export MANIFEST := ./operator-controller.yaml
300-
kind-deploy: export DEFAULT_CATALOG := ./config/catalogs/clustercatalogs/default-catalogs.yaml
301312
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
313+
envsubst '$$VERSION' < $$MANIFEST > ./tmp-manifest.yaml
314+
export MANIFEST=./tmp-manifest.yaml && envsubst '$$DEFAULT_CATALOGS,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s && rm ./tmp-manifest.yaml
304315

305316
.PHONY: kind-cluster
306317
kind-cluster: $(KIND) #EXHELP Standup a kind cluster.
@@ -351,7 +362,11 @@ go-build-linux: export GOARCH=amd64
351362
go-build-linux: $(BINARIES)
352363

353364
.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.
365+
run: export MANIFEST := $(DEV_MANIFEST)
366+
run: run-internal #HELP Build the operator-controller then deploy it into a new kind cluster.
367+
368+
.PHONY: run-internal
369+
run-internal: docker-build kind-cluster kind-load kind-deploy wait
355370

356371
CATD_NAMESPACE := olmv1-system
357372
wait:
@@ -380,10 +395,11 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
380395

381396
.PHONY: quickstart
382397
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
398+
quickstart: export DEFAULT_CATALOGS := "https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/default-catalogs.yaml"
399+
quickstart: manifests #EXHELP Generate the unified installation release manifests and scripts.
400+
envsubst '$$VERSION' < $(DEV_MANIFEST) > $(RELEASE_MANIFEST)
401+
cp $(CATALOGS_MANIFEST) > $(RELEASE_CATALOGS)
402+
envsubst '$$DEFAULT_CATALOGS,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > $(RELEASE_INSTALL)
387403

388404
##@ Docs
389405

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)