Skip to content

Commit 4ddd133

Browse files
committed
Add configuration items to support targeting the development environment at an remote Kubernetes cluster.
1 parent afcdff7 commit 4ddd133

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ foundationdb-kubernetes-sidecar/website
3535

3636
config/default/manager_image_patch.yaml
3737
config/default/manager_image_patch.yaml-e
38+
config/development/kustomization.yaml
3839

3940
# General temp directory
4041
tmp/

Makefile

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Image URL to use all building/pushing image targets
44
IMG ?= fdb-kubernetes-operator:latest
5+
REMOTE_BUILD ?= 0
56
CRD_OPTIONS ?= "crd:maxDescLen=0,crdVersions=v1,generateEmbeddedObjectMeta=true"
67

78
ifneq "$(FDB_WEBSITE)" ""
@@ -67,7 +68,7 @@ endif
6768

6869
all: deps generate fmt vet manager snapshot manifests samples documentation test_if_changed
6970

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
7172

7273
deps: $(BUILD_DEPS)
7374

@@ -78,6 +79,7 @@ clean:
7879
rm -r bin
7980
rm -f $(SAMPLES)
8081
rm -f config/rbac/role.yaml
82+
rm -f config/development/kustomization.yaml
8183
rm -rf ./dist/*
8284
find . -name "cover.out" -delete
8385

@@ -120,9 +122,20 @@ install: manifests
120122
uninstall: manifests
121123
kustomize build config/crd | kubectl $(KUBECTL_ARGS) delete -f -
122124

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
125129
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
126139
kustomize build config/development | kubectl $(KUBECTL_ARGS) apply -f -
127140

128141
# Generate manifests e.g. CRD, RBAC etc.
@@ -164,8 +177,14 @@ container-build: test_if_changed
164177
container-push:
165178
$(BUILDER) push ${IMG}
166179

180+
# Push the container image
181+
container-push-if-remote:
182+
ifeq "$(REMOTE_BUILD)" "1"
183+
$(BUILDER) push ${IMG}
184+
endif
185+
167186
# Rebuilds, deploys, and bounces the operator
168-
rebuild-operator: container-build deploy bounce
187+
rebuild-operator: container-build container-push-if-remote deploy bounce
169188

170189
bounce:
171190
kubectl $(KUBECTL_ARGS) delete pod -l app=fdb-kubernetes-operator-controller-manager
File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: controller-manager
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: manager
10+
imagePullPolicy: Always

config/tests/dns/client.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
automountServiceAccountToken: false
1818
initContainers:
1919
- name: foundationdb-kubernetes-init-7-1
20-
image: foundationdb/foundationdb-kubernetes-sidecar:7.1.0-rc2-1
20+
image: foundationdb/foundationdb-kubernetes-sidecar:7.1.5-1
2121
imagePullPolicy: IfNotPresent
2222
args:
2323
- "--copy-file"

config/tests/dns/dns.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- op: add
22
path: "/spec/version"
3-
value: 7.1.0-rc2
3+
value: 7.1.5
44
- op: add
55
path: "/spec/routing/useDNSInClusterFile"
66
value: true

0 commit comments

Comments
 (0)