@@ -27,6 +27,11 @@ TARGETALLOCATOR_IMG ?= ${IMG_PREFIX}/${TARGETALLOCATOR_IMG_REPO}:$(addprefix v,$
27
27
OPERATOROPAMPBRIDGE_IMG_REPO ?= operator-opamp-bridge
28
28
OPERATOROPAMPBRIDGE_IMG ?= ${IMG_PREFIX}/${OPERATOROPAMPBRIDGE_IMG_REPO}:$(addprefix v,${VERSION})
29
29
30
+ # Kustomization directory for local manifests
31
+ # Whenever we need to make any changes over the default manifests, we put them here
32
+ KUSTOMIZATION_DIR = ./dist
33
+ KUSTOMIZATION_BASE = config/default
34
+
30
35
# Options for 'bundle-build'
31
36
ifneq ($(origin CHANNELS ) , undefined)
32
37
BUNDLE_CHANNELS := --channels=$(CHANNELS )
@@ -81,7 +86,7 @@ SED ?= $(shell which gsed 2>/dev/null || which sed)
81
86
.PHONY : ensure-generate-is-noop
82
87
ensure-generate-is-noop : VERSION=$(OPERATOR_VERSION )
83
88
ensure-generate-is-noop : USER=open-telemetry
84
- ensure-generate-is-noop : set-image-controller generate bundle
89
+ ensure-generate-is-noop : bundle
85
90
@# on make bundle config/manager/kustomization.yaml includes changes, which should be ignored for the below check
86
91
@git restore config/manager/kustomization.yaml
87
92
@git diff -s --exit-code apis/v1alpha1/zz_generated.* .go || (echo " Build failed: a model has been changed but the generated resources aren't up to date. Run 'make generate' and update your PR." && exit 1)
@@ -124,25 +129,30 @@ uninstall: manifests kustomize
124
129
125
130
# Set the controller image parameters
126
131
.PHONY : set-image-controller
127
- set-image-controller : manifests kustomize
128
- cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
132
+ set-image-controller : manifests kustomize create-kustomization
133
+ cd $( KUSTOMIZATION_DIR ) && $(KUSTOMIZE ) edit set image controller=${IMG}
129
134
130
135
# Deploy controller in the current Kubernetes context, configured in ~/.kube/config
131
136
.PHONY : deploy
132
137
deploy : set-image-controller
133
- $(KUSTOMIZE ) build config/default | kubectl apply -f -
138
+ $(KUSTOMIZE ) build $( KUSTOMIZATION_DIR ) | kubectl apply -f -
134
139
go run hack/check-operator-ready.go 300
135
140
136
141
# Undeploy controller in the current Kubernetes context, configured in ~/.kube/config
137
142
.PHONY : undeploy
138
143
undeploy : set-image-controller
139
- $(KUSTOMIZE ) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found ) -f -
144
+ $(KUSTOMIZE ) build $( KUSTOMIZATION_DIR ) | kubectl delete --ignore-not-found=$(ignore-not-found ) -f -
140
145
141
146
# Generates the released manifests
142
147
.PHONY : release-artifacts
143
148
release-artifacts : set-image-controller
144
- mkdir -p dist
145
- $(KUSTOMIZE ) build config/default -o dist/opentelemetry-operator.yaml
149
+ $(KUSTOMIZE ) build $(KUSTOMIZATION_DIR ) -o dist/opentelemetry-operator.yaml
150
+
151
+ .PHONY : create-kustomization
152
+ create-kustomization :
153
+ mkdir -p $(KUSTOMIZATION_DIR )
154
+ rm -f $(KUSTOMIZATION_DIR ) /kustomization.yaml
155
+ cd $(KUSTOMIZATION_DIR ) && $(KUSTOMIZE ) create --resources ../$(KUSTOMIZATION_BASE )
146
156
147
157
# Generate manifests e.g. CRD, RBAC etc.
148
158
.PHONY : manifests
@@ -377,9 +387,10 @@ operator-sdk:
377
387
378
388
# Generate bundle manifests and metadata, then validate generated files.
379
389
.PHONY : bundle
390
+ bundle : KUSTOMIZATION_BASE = config/manifests
380
391
bundle : kustomize operator-sdk manifests set-image-controller
381
392
$(OPERATOR_SDK ) generate kustomize manifests -q
382
- $(KUSTOMIZE ) build config/manifests | $(OPERATOR_SDK ) generate bundle -q --overwrite --version $(VERSION ) $(BUNDLE_METADATA_OPTS )
393
+ $(KUSTOMIZE ) build $( KUSTOMIZATION_DIR ) | $(OPERATOR_SDK ) generate bundle -q --overwrite --version $(VERSION ) $(BUNDLE_METADATA_OPTS )
383
394
$(OPERATOR_SDK ) bundle validate ./bundle
384
395
./hack/ignore-createdAt-bundle.sh
385
396
0 commit comments