|
2 | 2 | # |
3 | 3 | # SPDX-License-Identifier: Apache-2.0 |
4 | 4 |
|
5 | | -# Image URL to use all building/pushing image targets |
6 | | -IMG ?= securecodebox/operator:latest |
| 5 | +IMG_NS ?= securecodebox |
| 6 | + |
| 7 | +# Image URL to use all building/pushing image targets for the operator |
| 8 | +OPERATOR_IMG ?= operator |
| 9 | + |
| 10 | +# Image URL to use all building/pushing image targets for the lurker |
| 11 | +LURKER_IMG ?= lurker |
| 12 | + |
| 13 | +# Tag used for the images |
| 14 | +IMG_TAG ?= sha-$$(git rev-parse --short HEAD) |
| 15 | + |
7 | 16 | # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) |
8 | 17 | CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false" |
9 | 18 |
|
@@ -67,21 +76,48 @@ run: manifests generate fmt vet ## Run a controller from your host. |
67 | 76 | go run ./main.go |
68 | 77 |
|
69 | 78 | docker-build: test ## Build docker image with the manager. |
70 | | - docker build -t ${IMG} . |
| 79 | + @echo ".: ⚙️ Build Container Images" |
| 80 | + docker build -t $(IMG_NS)/${OPERATOR_IMG}:${IMG_TAG} . |
| 81 | + cd ../lurker && docker build -t $(IMG_NS)/$(LURKER_IMG):$(IMG_TAG) . |
71 | 82 |
|
72 | 83 | docker-push: ## Push docker image with the manager. |
73 | | - docker push ${IMG} |
| 84 | + docker push $(IMG_NS)/${OPERATOR_IMG}:${IMG_TAG} |
| 85 | + docker push $(IMG_NS)/$(LURKER_IMG):$(IMG_TAG) |
| 86 | + |
| 87 | +docker-export: |
| 88 | + @echo ".: 💾 Export Container Images" |
| 89 | + docker save $(IMG_NS)/$(OPERATOR_IMG):$(IMG_TAG) > $(OPERATOR_IMG).tar |
| 90 | + docker save $(IMG_NS)/$(LURKER_IMG):$(IMG_TAG) > $(LURKER_IMG).tar |
74 | 91 |
|
75 | 92 | ##@ Deployment |
76 | 93 |
|
| 94 | +kind-import: |
| 95 | + @echo ".: 💾 Importing the image archive to local kind cluster." |
| 96 | + kind load image-archive ./$(OPERATOR_IMG).tar |
| 97 | + kind load image-archive ./$(LURKER_IMG).tar |
| 98 | + |
| 99 | +helm-deploy: |
| 100 | + @echo ".: ⚙️ Deploying Operator with the Image tag '$(IMG_TAG)' into kind." |
| 101 | + # If not exists create namespace where the tests will be executed |
| 102 | + kubectl create namespace integration-tests --dry-run=client -o yaml | kubectl apply -f - |
| 103 | + # If not exists create secureCodeBox operator namespace |
| 104 | + kubectl create namespace securecodebox-system --dry-run=client -o yaml | kubectl apply -f - |
| 105 | + helm -n securecodebox-system upgrade --install securecodebox-operator ./ --wait \ |
| 106 | + --set="image.repository=docker.io/$(IMG_NS)/$(OPERATOR_IMG)" \ |
| 107 | + --set="image.tag=$(IMG_TAG)" \ |
| 108 | + --set="image.pullPolicy=IfNotPresent" \ |
| 109 | + --set="lurker.image.repository=docker.io/$(IMG_NS)/$(LURKER_IMG)" \ |
| 110 | + --set="lurker.image.tag=$(IMG_TAG)" \ |
| 111 | + --set="lurker.pullPolicy=IfNotPresent" |
| 112 | + |
77 | 113 | install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. |
78 | 114 | $(KUSTOMIZE) build config/crd | kubectl apply -f - |
79 | 115 |
|
80 | 116 | uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. |
81 | 117 | $(KUSTOMIZE) build config/crd | kubectl delete -f - |
82 | 118 |
|
83 | 119 | deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. |
84 | | - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} |
| 120 | + cd config/manager && $(KUSTOMIZE) edit set image controller=${OPERATOR_IMG} |
85 | 121 | $(KUSTOMIZE) build config/default | kubectl apply -f - |
86 | 122 |
|
87 | 123 | undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. |
|
0 commit comments