From 86ee925cfa3fa975aee86b5189737293c86f2c77 Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Fri, 14 Feb 2020 17:32:53 +0100 Subject: [PATCH] fix(k8s): fix build-sync Pod crash loop issue --- .../src/plugins/kubernetes/hot-reload.ts | 2 +- .../build-sync/templates/deployment.yaml | 2 +- .../unit/src/plugins/kubernetes/hot-reload.ts | 2 +- rsync-server/Dockerfile | 7 ++++++ rsync-server/entrypoint.sh | 22 +++++++++++++++++++ rsync-server/garden.yml | 6 +++++ 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 rsync-server/Dockerfile create mode 100755 rsync-server/entrypoint.sh create mode 100644 rsync-server/garden.yml diff --git a/garden-service/src/plugins/kubernetes/hot-reload.ts b/garden-service/src/plugins/kubernetes/hot-reload.ts index c97469a477..ff2a414f8a 100644 --- a/garden-service/src/plugins/kubernetes/hot-reload.ts +++ b/garden-service/src/plugins/kubernetes/hot-reload.ts @@ -120,7 +120,7 @@ export function configureHotReload({ const rsyncContainer = { name: "garden-rsync", - image: "gardendev/rsync:0.1", + image: "gardendev/rsync:0.2.0", imagePullPolicy: "IfNotPresent", env: [ // This makes sure the server is accessible on any IP address, because CIDRs can be different across clusters. diff --git a/garden-service/static/kubernetes/system/build-sync/templates/deployment.yaml b/garden-service/static/kubernetes/system/build-sync/templates/deployment.yaml index 805e23be16..e2196a364b 100644 --- a/garden-service/static/kubernetes/system/build-sync/templates/deployment.yaml +++ b/garden-service/static/kubernetes/system/build-sync/templates/deployment.yaml @@ -36,7 +36,7 @@ spec: name: garden-build-sync containers: - name: sync - image: "gardendev/rsync:0.1" + image: "gardendev/rsync:0.2.0" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: rsync diff --git a/garden-service/test/unit/src/plugins/kubernetes/hot-reload.ts b/garden-service/test/unit/src/plugins/kubernetes/hot-reload.ts index 6c4c7159db..4f7ea0310a 100644 --- a/garden-service/test/unit/src/plugins/kubernetes/hot-reload.ts +++ b/garden-service/test/unit/src/plugins/kubernetes/hot-reload.ts @@ -81,7 +81,7 @@ describe("configureHotReload", () => { }, { name: "garden-rsync", - image: "gardendev/rsync:0.1", + image: "gardendev/rsync:0.2.0", imagePullPolicy: "IfNotPresent", env: [ { diff --git a/rsync-server/Dockerfile b/rsync-server/Dockerfile new file mode 100644 index 0000000000..9bc21cb2d9 --- /dev/null +++ b/rsync-server/Dockerfile @@ -0,0 +1,7 @@ +FROM alpine:3.11.3 + +RUN apk add --no-cache rsync + +ADD entrypoint.sh / + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/rsync-server/entrypoint.sh b/rsync-server/entrypoint.sh new file mode 100755 index 0000000000..9c0ab2ad9c --- /dev/null +++ b/rsync-server/entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/sh +VOLUME=${VOLUME:-/data} +ALLOW=${ALLOW:-192.168.0.0/16 172.16.0.0/12} + +mkdir -p ${VOLUME} + +cat < /etc/rsyncd.conf +uid = 0 +#gid = +use chroot = no +log file = /dev/stdout +reverse lookup = no +munge symlinks = yes +[volume] + hosts deny = * + hosts allow = ${ALLOW} + read only = false + path = ${VOLUME} + comment = docker volume +EOF + +exec /usr/bin/rsync --no-detach --daemon --config /etc/rsyncd.conf diff --git a/rsync-server/garden.yml b/rsync-server/garden.yml new file mode 100644 index 0000000000..117a223698 --- /dev/null +++ b/rsync-server/garden.yml @@ -0,0 +1,6 @@ +kind: Module +type: container +name: rsync-server +description: The rsync server image, used for hot reloading and in-cluster build syncs +image: gardendev/rsync:0.2.0 +dockerfile: Dockerfile