|
2 | 2 |
|
3 | 3 | # Image URL to use all building/pushing image targets |
4 | 4 | IMG ?= fdb-kubernetes-operator:latest |
| 5 | +REMOTE_BUILD ?= 0 |
5 | 6 | CRD_OPTIONS ?= "crd:maxDescLen=0,crdVersions=v1,generateEmbeddedObjectMeta=true" |
6 | 7 |
|
7 | 8 | ifneq "$(FDB_WEBSITE)" "" |
|
67 | 68 |
|
68 | 69 | all: deps generate fmt vet manager snapshot manifests samples documentation test_if_changed |
69 | 70 |
|
70 | | -.PHONY: clean all manager samples documentation run install uninstall deploy manifests fmt vet generate container-build container-push rebuild-operator bounce lint |
| 71 | +.PHONY: clean all manager samples documentation run install uninstall deploy manifests fmt vet generate container-build container-push container-push-if-remote rebuild-operator bounce lint |
71 | 72 |
|
72 | 73 | deps: $(BUILD_DEPS) |
73 | 74 |
|
|
78 | 79 | rm -r bin |
79 | 80 | rm -f $(SAMPLES) |
80 | 81 | rm -f config/rbac/role.yaml |
| 82 | + rm -f config/development/kustomization.yaml |
81 | 83 | rm -rf ./dist/* |
82 | 84 | find . -name "cover.out" -delete |
83 | 85 |
|
@@ -120,9 +122,20 @@ install: manifests |
120 | 122 | uninstall: manifests |
121 | 123 | kustomize build config/crd | kubectl $(KUBECTL_ARGS) delete -f - |
122 | 124 |
|
123 | | -# Deploy controller in the configured Kubernetes cluster in ~/.kube/config |
124 | | -deploy: install manifests |
| 125 | +# Apply config to the local development environment based on environment |
| 126 | +# variables. |
| 127 | +config/development/kustomization.yaml: config/development/kustomization.yaml.sample |
| 128 | + cp config/development/kustomization.yaml.sample config/development/kustomization.yaml |
125 | 129 | cd config/development && kustomize edit set image foundationdb/fdb-kubernetes-operator=${IMG} |
| 130 | +ifneq "$(IMG_PREFIX)" "" |
| 131 | + cd config/development && kustomize edit set image foundationdb/foundationdb-kubernetes-sidecar=${IMG_PREFIX}/foundationdb/foundationdb-kubernetes-sidecar |
| 132 | +endif |
| 133 | +ifeq "$(REMOTE_BUILD)" "1" |
| 134 | + cd config/development && kustomize edit add patch --path=remote_build.yaml |
| 135 | +endif |
| 136 | + |
| 137 | +# Deploy controller in the configured Kubernetes cluster in ~/.kube/config |
| 138 | +deploy: install manifests config/development/kustomization.yaml |
126 | 139 | kustomize build config/development | kubectl $(KUBECTL_ARGS) apply -f - |
127 | 140 |
|
128 | 141 | # Generate manifests e.g. CRD, RBAC etc. |
@@ -164,8 +177,14 @@ container-build: test_if_changed |
164 | 177 | container-push: |
165 | 178 | $(BUILDER) push ${IMG} |
166 | 179 |
|
| 180 | +# Push the container image |
| 181 | +container-push-if-remote: |
| 182 | +ifeq "$(REMOTE_BUILD)" "1" |
| 183 | + $(BUILDER) push ${IMG} |
| 184 | +endif |
| 185 | + |
167 | 186 | # Rebuilds, deploys, and bounces the operator |
168 | | -rebuild-operator: container-build deploy bounce |
| 187 | +rebuild-operator: container-build container-push-if-remote deploy bounce |
169 | 188 |
|
170 | 189 | bounce: |
171 | 190 | kubectl $(KUBECTL_ARGS) delete pod -l app=fdb-kubernetes-operator-controller-manager |
|
0 commit comments