@@ -33,7 +33,7 @@ IMAGE_TAG_BASE ?= gitlab-registry.cern.ch/aliceo2group/dockerfiles/aliecs
3333
3434# BUNDLE_IMG defines the image:tag used for the bundle.
3535# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
36- BUNDLE_IMG ?= $(IMAGE_TAG_BASE ) - bundle:v$(VERSION )
36+ BUNDLE_IMG ?= $(IMAGE_TAG_BASE ) / bundle:v$(VERSION )
3737
3838# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
3939BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION ) $(BUNDLE_METADATA_OPTS )
5151OPERATOR_SDK_VERSION ?= unknown
5252
5353# Image URL to use all building/pushing image targets
54- IMG ?= gitlab-registry.cern.ch/aliceo2group/dockerfiles/aliecs/task-manager:latest
54+ TASK_IMG ?= gitlab-registry.cern.ch/aliceo2group/dockerfiles/aliecs/task-manager:latest
55+ ENVIRONMENT_IMG ?= gitlab-registry.cern.ch/aliceo2group/dockerfiles/aliecs/environment-manager:latest
5556# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5657ENVTEST_K8S_VERSION = 1.27.1
5758
@@ -97,11 +98,11 @@ help: ## Display this help.
9798
9899.PHONY : manifests
99100manifests : controller-gen # # Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
100- # Note that the option maxDescLen=0 was added in the default scaffold in order to sort out the issue
101- # Too long: must have at most 262144 bytes. By using kubectl apply to create / update resources an annotation
102- # is created by K8s API to store the latest version of the resource ( kubectl.kubernetes.io/last-applied-configuration).
103- # However, it has a size limit and if the CRD is too big with so many long descriptions as this one it will cause the failure.
104- $(CONTROLLER_GEN ) rbac :roleName=manager-role crd:maxDescLen=0 webhook paths="./..." output:crd:artifacts:config=config/crd/bases
101+ # Note that the option maxDescLen=0 was added in the default scaffold in order to sort out the issue
102+ # Too long: must have at most 262144 bytes. By using kubectl apply to create / update resources an annotation
103+ # is created by K8s API to store the latest version of the resource ( kubectl.kubernetes.io/last-applied-configuration).
104+ # However, it has a size limit and if the CRD is too big with so many long descriptions as this one it will cause the failure.
105+ $(CONTROLLER_GEN ) rbac:roleName=manager-role crd:maxDescLen=0 webhook paths=" ./..." output:crd:artifacts:config=config/crd/bases
105106
106107# .PHONY: manifests
107108# manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
@@ -137,23 +138,42 @@ clean-proto: ## Remove generated protobuf and gRPC Go files.
137138# #@ Build
138139
139140.PHONY : build
140- build : manifests generate fmt vet # # Build manager binary.
141- go build -o bin/manager cmd/main.go
141+ build : manifests generate fmt vet # # Build manager binaries.
142+ go build -o bin/task-manager ./cmd/task-manager/
143+ go build -o bin/environment-manager ./cmd/environment-manager/
142144
143- .PHONY : run
144- run : manifests generate fmt vet # # Run a controller from your host.
145- go run ./cmd/main.go
145+ .PHONY : run-task
146+ run-task : manifests generate fmt vet # # Run the task controller from your host.
147+ go run ./cmd/task-manager/
148+
149+ .PHONY : run-environment
150+ run-environment : manifests generate fmt vet # # Run the environment controller from your host.
151+ go run ./cmd/environment-manager/
146152
147153# If you wish built the manager image targeting other platforms you can use the --platform flag.
148154# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
149155# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
150156.PHONY : docker-build
151- docker-build : test # # Build docker image with the manager.
152- $(CONTAINER_TOOL ) build -t ${IMG} .
157+ docker-build : docker-build-task docker-build-environment # # Build all docker images.
158+
159+ .PHONY : docker-build-task
160+ docker-build-task : test # # Build docker image for the task manager.
161+ $(CONTAINER_TOOL ) build --build-arg MANAGER=task-manager -t ${TASK_IMG} .
162+
163+ .PHONY : docker-build-environment
164+ docker-build-environment : test # # Build docker image for the environment manager.
165+ $(CONTAINER_TOOL ) build --build-arg MANAGER=environment-manager -t ${ENVIRONMENT_IMG} .
153166
154167.PHONY : docker-push
155- docker-push : # # Push docker image with the manager.
156- $(CONTAINER_TOOL ) push ${IMG}
168+ docker-push : docker-push-task docker-push-environment # # Push all docker images.
169+
170+ .PHONY : docker-push-task
171+ docker-push-task : # # Push docker image for the task manager.
172+ $(CONTAINER_TOOL ) push ${TASK_IMG}
173+
174+ .PHONY : docker-push-environment
175+ docker-push-environment : # # Push docker image for the environment manager.
176+ $(CONTAINER_TOOL ) push ${ENVIRONMENT_IMG}
157177
158178# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
159179# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
@@ -187,12 +207,20 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
187207 $(KUSTOMIZE ) build config/crd | $(KUBECTL ) delete --ignore-not-found=$(ignore-not-found ) -f -
188208
189209.PHONY : deploy
190- deploy : manifests kustomize # # Deploy controller to the K8s cluster specified in ~/.kube/config.
191- cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
192- $(KUSTOMIZE ) build config/default | $(KUBECTL ) apply -f - --server-side
210+ deploy : deploy-task deploy-environment # # Deploy both controllers to the K8s cluster specified in ~/.kube/config.
211+
212+ .PHONY : deploy-task
213+ deploy-task : manifests kustomize # # Deploy task controller to the K8s cluster specified in ~/.kube/config.
214+ cd config/task && $(KUSTOMIZE ) edit set image task-manager=${TASK_IMG}
215+ $(KUSTOMIZE ) build config/task | $(KUBECTL ) apply -f - --server-side
216+
217+ .PHONY : deploy-environment
218+ deploy-environment : manifests kustomize # # Deploy environment controller to the K8s cluster specified in ~/.kube/config.
219+ cd config/environment && $(KUSTOMIZE ) edit set image environment-manager=${ENVIRONMENT_IMG}
220+ $(KUSTOMIZE ) build config/environment | $(KUBECTL ) apply -f - --server-side
193221
194222.PHONY : undeploy
195- undeploy : # # Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
223+ undeploy : # # Undeploy both controllers from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
196224 $(KUSTOMIZE ) build config/default | $(KUBECTL ) delete --ignore-not-found=$(ignore-not-found ) -f -
197225
198226# #@ Build Dependencies
@@ -252,7 +280,8 @@ endif
252280.PHONY : bundle
253281bundle : manifests kustomize operator-sdk # # Generate bundle manifests and metadata, then validate generated files.
254282 $(OPERATOR_SDK ) generate kustomize manifests -q
255- cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
283+ cd config/manager && $(KUSTOMIZE ) edit set image task-manager=$(TASK_IMG )
284+ cd config/manager && $(KUSTOMIZE ) edit set image environment-manager=$(ENVIRONMENT_IMG )
256285 $(KUSTOMIZE ) build config/manifests | $(OPERATOR_SDK ) generate bundle $(BUNDLE_GEN_FLAGS )
257286 $(OPERATOR_SDK ) bundle validate ./bundle
258287
@@ -286,7 +315,7 @@ endif
286315BUNDLE_IMGS ?= $(BUNDLE_IMG )
287316
288317# The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0).
289- CATALOG_IMG ?= $(IMAGE_TAG_BASE ) - catalog:v$(VERSION )
318+ CATALOG_IMG ?= $(IMAGE_TAG_BASE ) / catalog:v$(VERSION )
290319
291320# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image.
292321ifneq ($(origin CATALOG_BASE_IMG ) , undefined)
0 commit comments