From 23586feea80c73db058c82949cbf2a10414bf3a5 Mon Sep 17 00:00:00 2001 From: Nitish Malhotra Date: Tue, 9 Feb 2021 00:33:42 -0800 Subject: [PATCH] Configmap for config.yaml (#57) config.yaml parsed from mounted configmap volume Co-authored-by: Nitish Malhotra --- Dockerfile | 6 ++-- chart/orkestra/templates/configmap.yaml | 35 ++++++++++++++++++++++++ chart/orkestra/templates/deployment.yaml | 19 +++++-------- chart/orkestra/values.yaml | 13 +++++++++ config.yaml | 7 ----- 5 files changed, 58 insertions(+), 22 deletions(-) create mode 100644 chart/orkestra/templates/configmap.yaml delete mode 100644 config.yaml diff --git a/Dockerfile b/Dockerfile index acf4d22..b578a4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,10 +14,10 @@ COPY main.go main.go COPY api/ api/ COPY pkg/ pkg/ COPY controllers/ controllers/ -COPY config.yaml config.yaml +# COPY config.yaml config.yaml # Build -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -o manager main.go FROM alpine:3.7 RUN apk add --no-cache bash @@ -25,6 +25,6 @@ RUN mkdir -p /etc/orkestra/charts/pull/ WORKDIR / COPY --from=builder /workspace/manager . -COPY --from=builder /workspace/config.yaml /etc/controller/config.yaml +# COPY --from=builder /workspace/config.yaml /etc/controller/config.yaml ENTRYPOINT ["/manager"] diff --git a/chart/orkestra/templates/configmap.yaml b/chart/orkestra/templates/configmap.yaml new file mode 100644 index 0000000..cc69fe5 --- /dev/null +++ b/chart/orkestra/templates/configmap.yaml @@ -0,0 +1,35 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: registry-config + labels: + {{- include "orkestra.labels" . | nindent 4 }} +data: + config.yaml: | + registries: + {{- range $repo := $.Values.repositories }} + {{ $repo.name }}: + url: {{ $repo.url }} + {{ if $repo.username }} + username: { {$repo.username }} + {{ end }} + {{ if $repo.password }} + password: {{ $repo.password }} + {{ end }} + {{ if $repo.authHeader }} + authHeader: {{ $repo.authHeader }} + {{ end }} + {{ if $repo.caFile }} + caFile: {{ $repo.caFile }} + {{ end }} + {{ if $repo.certFile }} + certFile: {{ $repo.certFile }} + {{ end }} + {{ if $repo.keyFile }} + keyFile: {{ $repo.keyFile }} + {{ end }} + {{ if $repo.insecureSkipVerify }} + insecureSkipVerify: {{ $repo.insecureSkipVerify }} + {{ end }} + {{ end -}} + \ No newline at end of file diff --git a/chart/orkestra/templates/deployment.yaml b/chart/orkestra/templates/deployment.yaml index 3a14adb..f3d8c02 100644 --- a/chart/orkestra/templates/deployment.yaml +++ b/chart/orkestra/templates/deployment.yaml @@ -43,20 +43,15 @@ spec: value: orkestra - name: SERVICE_ACCOUNT_NAME value: {{ include "orkestra.serviceAccountName" . }} - # ports: - # - name: http - # containerPort: 80 - # protocol: TCP - # livenessProbe: - # httpGet: - # path: / - # port: http - # readinessProbe: - # httpGet: - # path: / - # port: http + volumeMounts: + - name: registry-config + mountPath: /etc/controller/ resources: {{- toYaml .Values.resources | nindent 12 }} + volumes: + - name: registry-config + configMap: + name: registry-config {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/chart/orkestra/values.yaml b/chart/orkestra/values.yaml index 6a59244..146dce0 100644 --- a/chart/orkestra/values.yaml +++ b/chart/orkestra/values.yaml @@ -17,6 +17,19 @@ serviceAccount: annotations: {} name: *serviceAccount +repositories: + - name: staging + url: "http://orkestra-chartmuseum.orkestra:8080" + - name: bitnami + url: "https://charts.bitnami.com/bitnami" + # username: admin + # password: password + # authHeader: 'Authorization: Basic HTTPBASICAUTHCREDS' + # caFile: /path/to/ca/file + # certFile: /path/to/cert/file + # keyFile: /path/to/key/file + # insecureSkipVerify: false + podAnnotations: {} podSecurityContext: {} diff --git a/config.yaml b/config.yaml deleted file mode 100644 index 13ffe0b..0000000 --- a/config.yaml +++ /dev/null @@ -1,7 +0,0 @@ -registries: - bitnami: - url: "https://charts.bitnami.com/bitnami" - insecureSkipVerify: true - - staging: - url: "http://orkestra-chartmuseum.orkestra:8080" \ No newline at end of file