Skip to content

Commit 43b4e5d

Browse files
committed
Adds an option to use a local build of the website to supply binaries for the main operator image.
Use a deep copy when filling in pod spec information from the cluster spec to make the pod specs more stable.
1 parent d9d3348 commit 43b4e5d

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

.dockerignore

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
foundationdb-kubernetes-sidecar

Dockerfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ FROM golang:1.12.5 as builder
44
# Install FDB
55
ARG FDB_VERSION=6.1.8
66
ARG FDB_ADDITIONAL_VERSIONS="6.0.18"
7+
ARG FDB_WEBSITE=https://www.foundationdb.org
8+
9+
COPY foundationdb-kubernetes-sidecar/website/ /mnt/website/
10+
711
RUN \
8-
wget https://www.foundationdb.org/downloads/$FDB_VERSION/ubuntu/installers/foundationdb-clients_$FDB_VERSION-1_amd64.deb -O fdb.deb && \
12+
curl $FDB_WEBSITE/downloads/$FDB_VERSION/ubuntu/installers/foundationdb-clients_$FDB_VERSION-1_amd64.deb -o fdb.deb && \
913
dpkg -i fdb.deb && rm fdb.deb && \
1014
for version in ${FDB_VERSION} ${FDB_ADDITIONAL_VERSIONS}; do \
1115
minor=${version%.*} && \
1216
mkdir -p /usr/bin/fdb/$minor && \
13-
wget https://www.foundationdb.org/downloads/$version/linux/fdb_$version.tar.gz -O /usr/bin/fdb/$minor/binaries.tar.gz && \
17+
curl $FDB_WEBSITE/downloads/$version/linux/fdb_$version.tar.gz -o /usr/bin/fdb/$minor/binaries.tar.gz && \
1418
tar --strip-components=1 -C /usr/bin/fdb/$minor -xzf /usr/bin/fdb/$minor/binaries.tar.gz && \
1519
rm /usr/bin/fdb/$minor/binaries.tar.gz && \
1620
for binary in fdbserver fdbmonitor backup_agent dr_agent; do \

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ ifneq "$(go_subs)" ""
1414
go_ld_flags := -ldflags "$(go_subs)"
1515
endif
1616

17+
ifneq "$(FDB_WEBSITE)" ""
18+
docker_build_args := $(docker_build_args) --build-arg FDB_WEBSITE=$(FDB_WEBSITE)
19+
endif
1720

1821
# Run tests
1922
test: generate fmt vet manifests
@@ -63,7 +66,7 @@ endif
6366

6467
# Build the docker image
6568
docker-build: test templates
66-
docker build --build-arg "GO_BUILD_SUBS=${go_subs}" . -t ${IMG}
69+
docker build ${docker_build_args} --build-arg "GO_BUILD_SUBS=${go_subs}" . -t ${IMG}
6770
@echo "updating kustomize image patch file for manager resource"
6871
sed -i'' -e 's@image: .*@image: '"${IMG}"'@' ./config/default/manager_image_patch.yaml
6972

pkg/controller/foundationdbcluster/foundationdbcluster_controller.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ func customizeContainer(container *corev1.Container, overrides fdbtypes.Containe
15031503
fullEnv := []corev1.EnvVar{}
15041504

15051505
for _, envVar := range overrides.Env {
1506-
fullEnv = append(fullEnv, envVar)
1506+
fullEnv = append(fullEnv, *envVar.DeepCopy())
15071507
envOverrides[envVar.Name] = true
15081508
}
15091509

@@ -1514,7 +1514,10 @@ func customizeContainer(container *corev1.Container, overrides fdbtypes.Containe
15141514
}
15151515

15161516
container.Env = fullEnv
1517-
container.VolumeMounts = append(container.VolumeMounts, overrides.VolumeMounts...)
1517+
1518+
for _, volume := range overrides.VolumeMounts {
1519+
container.VolumeMounts = append(container.VolumeMounts, *volume.DeepCopy())
1520+
}
15181521
}
15191522

15201523
// GetPodSpec builds a pod spec for a FoundationDB pod
@@ -1644,7 +1647,10 @@ func GetPodSpec(cluster *fdbtypes.FoundationDBCluster, processClass string, podI
16441647
}}},
16451648
corev1.Volume{Name: "fdb-trace-logs", VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}},
16461649
}
1647-
volumes = append(volumes, cluster.Spec.Volumes...)
1650+
1651+
for _, volume := range cluster.Spec.Volumes {
1652+
volumes = append(volumes, *volume.DeepCopy())
1653+
}
16481654

16491655
var affinity *corev1.Affinity
16501656

0 commit comments

Comments
 (0)