@@ -32,6 +32,11 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
32
32
endif
33
33
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS ) $(BUNDLE_DEFAULT_CHANNEL )
34
34
35
+ # Set the Operator SDK version to use.
36
+ # This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
37
+ OPERATOR_SDK_VERSION ?= v1.11.0
38
+
39
+
35
40
# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.
36
41
# This variable is used to construct full image tags for bundle and catalog images.
37
42
#
@@ -112,6 +117,28 @@ docker-build: test ## Build docker image with the manager.
112
117
docker-push : # # Push docker image with the manager.
113
118
$(CONTAINER_RUNTIME ) push ${IMG}
114
119
120
+ # #@ Build Dependencies
121
+
122
+ # # Location to install dependencies to
123
+ LOCALBIN ?= $(shell pwd) /bin
124
+ $(LOCALBIN ) :
125
+ mkdir -p $(LOCALBIN )
126
+
127
+
128
+ .PHONY : operator-sdk
129
+ OPERATOR_SDK ?= $(LOCALBIN ) /operator-sdk
130
+ operator-sdk : # # Download operator-sdk locally if necessary.
131
+ ifeq (,$(wildcard $(OPERATOR_SDK ) ) )
132
+ @{ \
133
+ set -e ;\
134
+ mkdir -p $(dir $(OPERATOR_SDK)) ;\
135
+ OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
136
+ curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\
137
+ chmod +x $(OPERATOR_SDK) ;\
138
+ }
139
+ endif
140
+
141
+
115
142
# #@ Deployment
116
143
117
144
install : manifests kustomize # # Install CRDs into the K8s cluster specified in ~/.kube/config.
@@ -165,11 +192,11 @@ rm -rf $$TMP_DIR ;\
165
192
endef
166
193
167
194
.PHONY : bundle
168
- bundle : manifests kustomize # # Generate bundle manifests and metadata, then validate generated files.
169
- operator-sdk generate kustomize manifests -q
195
+ bundle : operator-sdk manifests kustomize # # Generate bundle manifests and metadata, then validate generated files.
196
+ $( OPERATOR_SDK ) generate kustomize manifests -q
170
197
cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
171
- $(KUSTOMIZE ) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION ) $(BUNDLE_METADATA_OPTS )
172
- operator-sdk bundle validate ./bundle
198
+ $(KUSTOMIZE ) build config/manifests | $( OPERATOR_SDK ) generate bundle -q --overwrite --version $(VERSION ) $(BUNDLE_METADATA_OPTS )
199
+ $( OPERATOR_SDK ) bundle validate ./bundle
173
200
rm -fr deploy/olm-catalog/argocd-operator/$(VERSION )
174
201
mkdir -p deploy/olm-catalog/argocd-operator/$(VERSION )
175
202
cp -r bundle/manifests/* deploy/olm-catalog/argocd-operator/$(VERSION ) /
0 commit comments