You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by my...@apache.org on 2020/11/12 08:00:23 UTC
[incubator-datalab] branch DATALAB-2102 updated: [DLAB-2102]:
step-ca chart changes
This is an automated email from the ASF dual-hosted git repository.
mykolabodnar pushed a commit to branch DATALAB-2102
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
The following commit(s) were added to refs/heads/DATALAB-2102 by this push:
new 90f1a0b [DLAB-2102]: step-ca chart changes
90f1a0b is described below
commit 90f1a0bb00217a38b21174b0bfeb2865afa38b37
Author: bodnarmykola <bo...@gmail.com>
AuthorDate: Thu Nov 12 09:58:22 2020 +0200
[DLAB-2102]: step-ca chart changes
---
.../modules/helm_charts/step-ca-chart/Chart.yaml | 53 +++---
.../step-ca-chart/templates/bootstrap.yaml | 36 ++--
.../helm_charts/step-ca-chart/templates/ca.yaml | 212 ++++++++++-----------
.../step-ca-chart/templates/configmaps.yaml | 165 ++++++++--------
.../step-ca-chart/templates/ingress.yaml | 52 ++---
.../helm_charts/step-ca-chart/templates/rbac.yaml | 16 +-
.../step-ca-chart/templates/secrets.yaml | 8 +-
.../step-ca-chart/templates/service.yaml | 15 +-
8 files changed, 281 insertions(+), 276 deletions(-)
diff --git a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/Chart.yaml b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/Chart.yaml
index d7e6eab..d133831 100644
--- a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/Chart.yaml
+++ b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/Chart.yaml
@@ -20,32 +20,33 @@
# ******************************************************************************
apiVersion: v1
-name: step-certificates
-version: 1.15.5
-appVersion: 0.15.5
-description: An online certificate authority and related tools for secure automated certificate management, so you can use TLS everywhere.
-keywords:
- - acme
- - authority
- - ca
- - certificate
- - certificates
- - certificate-authority
- - kubernetes
- - pki
- - security
- - security-tools
- - smallstep
- - ssh
- - step
- - step-ca
- - tls
- - x509
+appVersion: 0.13.2
+description: An online certificate authority and related tools for secure automated
+ certificate management, so you can use TLS everywhere.
+engine: gotpl
home: https://smallstep.com
icon: https://raw.githubusercontent.com/smallstep/certificates/master/icon.png
-sources:
- - https://github.com/smallstep/certificates
+keywords:
+ - acme
+- authority
+- ca
+- certificate
+- certificates
+- certificate-authority
+- kubernetes
+- pki
+- security
+- security-tools
+- smallstep
+- ssh
+- step
+- step-ca
+- tls
+- x509
maintainers:
- - name: Mariano Cano
- email: mariano@smallstep.com
-engine: gotpl
\ No newline at end of file
+- email: mariano@smallstep.com
+ name: Mariano Cano
+name: step-certificates
+sources:
+- https://github.com/smallstep/certificates
+version: 1.13.2
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/bootstrap.yaml b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/bootstrap.yaml
index 0bd25fd..2c562fe 100644
--- a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/bootstrap.yaml
+++ b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/bootstrap.yaml
@@ -1,22 +1,22 @@
-{{- if .Release.IsInstall -}}
+ {{- if .Release.IsInstall -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "step-certificates.fullname" . }}-config
- namespace: {{ .Release.Namespace }}
+ namespace: {{.Release.Namespace}}
labels:
- {{- include "step-certificates.labels" . | nindent 4 }}
+ {{ include "step-certificates.labels" . | indent 4 }}
---
apiVersion: batch/v1
kind: Job
metadata:
- name: "{{ .Release.Name }}"
+ name: "{{.Release.Name}}"
labels:
- {{- include "step-certificates.labels" . | nindent 4 }}
+{{ include "step-certificates.labels" . | indent 4 }}
spec:
template:
metadata:
- name: "{{ .Release.Name }}"
+ name: "{{.Release.Name}}"
labels:
app.kubernetes.io/name: {{ include "step-certificates.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
@@ -24,16 +24,16 @@ spec:
serviceAccountName: {{ include "step-certificates.fullname" . }}-config
restartPolicy: Never
volumes:
- - name: bootstrap
- configMap:
- name: {{ include "step-certificates.fullname" . }}-bootstrap
+ - name: bootstrap
+ configMap:
+ name: {{ include "step-certificates.fullname" . }}-bootstrap
containers:
- - name: config
- image: "{{ .Values.bootstrapImage.repository }}:{{ .Values.bootstrapImage.tag }}"
- imagePullPolicy: {{ .Values.bootstrapImage.pullPolicy }}
- command: ["/bin/sh", "/home/step/bootstrap/bootstrap.sh"]
- volumeMounts:
- - name: bootstrap
- mountPath: /home/step/bootstrap
- readOnly: true
-{{- end }}
\ No newline at end of file
+ - name: config
+ image: "{{ .Values.bootstrapImage.repository }}:{{ .Values.bootstrapImage.tag }}"
+ imagePullPolicy: {{ .Values.bootstrapImage.pullPolicy }}
+ command: ["/bin/sh", "/home/step/bootstrap/bootstrap.sh"]
+ volumeMounts:
+ - name: bootstrap
+ mountPath: /home/step/bootstrap
+ readOnly: true
+{{- end -}}
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/ca.yaml b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/ca.yaml
index da3af64..8107263 100644
--- a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/ca.yaml
+++ b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/ca.yaml
@@ -3,7 +3,7 @@ kind: StatefulSet
metadata:
name: {{ include "step-certificates.fullname" . }}
labels:
- {{- include "step-certificates.labels" . | nindent 4 }}
+ {{ include "step-certificates.labels" . | indent 4 }}
spec:
# Only one replica is supported at this moment
# Requested {{ .Values.replicaCount }}
@@ -18,106 +18,102 @@ spec:
labels:
app.kubernetes.io/name: {{ include "step-certificates.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
+ app: {{ include "step-certificates.fullname" . }}
spec:
- {{- if .Release.IsInstall }}
- initContainers:
- - name: {{ .Chart.Name }}-init
- image: busybox:latest
- imagePullPolicy: {{ .Values.image.pullPolicy }}
- command: ["sleep", "20"]
- {{- end }}
- securityContext:
- {{- if .Values.ca.runAsRoot }}
- runAsUser: 0
- {{- else }}
- runAsUser: 1000
- runAsNonRoot: true
- runAsGroup: 1000
- fsGroup: 1000
- {{- end }}
- containers:
- - name: {{ .Chart.Name }}
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
- imagePullPolicy: {{ .Values.image.pullPolicy }}
- command: [
- "/usr/local/bin/step-ca",
- "--password-file", "/home/step/secrets/passwords/password",
- "/home/step/config/ca.json"
- ]
- env:
- - name: NAMESPACE
- value: "{{ .Release.Namespace }}"
- ports:
- - name: https
- containerPort: {{ .Values.service.targetPort }}
- protocol: TCP
- livenessProbe:
- initialDelaySeconds: 5
- httpGet:
- path: /health
- port: {{ .Values.service.targetPort }}
- scheme: HTTPS
- readinessProbe:
- initialDelaySeconds: 5
- httpGet:
- path: /health
- port: {{ .Values.service.targetPort }}
- scheme: HTTPS
- resources:
- {{- toYaml .Values.resources | nindent 12 }}
- {{- if not .Values.ca.runAsRoot }}
- securityContext:
- allowPrivilegeEscalation: false
- {{- end }}
- volumeMounts:
- - name: certs
- mountPath: /home/step/certs
- readOnly: true
- - name: config
- mountPath: /home/step/config
- readOnly: true
- - name: secrets
- mountPath: /home/step/secrets
- readOnly: true
- - name: ca-password
- mountPath: /home/step/secrets/passwords
- readOnly: true
- {{- if .Values.ca.db.enabled }}
- - name: database
- mountPath: /home/step/db
- readOnly: false
- {{- end }}
- volumes:
+{{- if .Release.IsInstall }}
+initContainers:
+ - name: {{ .Chart.Name }}-init
+ image: busybox:latest
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ command: ["sleep", "20"]
+{{- end }}
+securityContext:
+ {{- if .Values.ca.runAsRoot }}
+ runAsUser: 0
+ {{- else }}
+ runAsUser: 1000
+ runAsNonRoot: true
+ runAsGroup: 1000
+ fsGroup: 1000
+ allowPrivilegeEscalation: false
+ {{- end }}
+containers:
+ - name: {{ .Chart.Name }}
+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ command: ["/usr/local/bin/step-ca",
+ "--password-file", "/home/step/secrets/passwords/password",
+ "/home/step/config/ca.json"]
+ env:
+ - name: NAMESPACE
+ value: "{{ .Release.Namespace }}"
+ ports:
+ - name: https
+ containerPort: {{ .Values.service.targetPort }}
+ protocol: TCP
+ livenessProbe:
+ initialDelaySeconds: 5
+ httpGet:
+ path: /health
+ port: {{ .Values.service.targetPort }}
+ scheme: HTTPS
+ readinessProbe:
+ initialDelaySeconds: 5
+ httpGet:
+ path: /health
+ port: {{ .Values.service.targetPort }}
+ scheme: HTTPS
+ resources:
+ {{- toYaml .Values.resources | nindent 12 }}
+ volumeMounts:
- name: certs
- configMap:
- name: {{ include "step-certificates.fullname" . }}-certs
+ mountPath: /home/step/certs
+ readOnly: true
- name: config
- configMap:
- name: {{ include "step-certificates.fullname" . }}-config
+ mountPath: /home/step/config
+ readOnly: true
- name: secrets
- configMap:
- name: {{ include "step-certificates.fullname" . }}-secrets
+ mountPath: /home/step/secrets
+ readOnly: true
- name: ca-password
- secret:
- secretName: {{ include "step-certificates.fullname" . }}-ca-password
- {{- if and .Values.ca.db.enabled (not .Values.ca.db.persistent) }}
- - name: database
- emptyDir: {}
- {{- end }}
- {{- with .Values.nodeSelector }}
- nodeSelector:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- with .Values.affinity }}
- affinity:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- with .Values.tolerations }}
- tolerations:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- if and .Values.ca.db.enabled .Values.ca.db.persistent }}
- volumeClaimTemplates:
+ mountPath: /home/step/secrets/passwords
+ readOnly: true
+ {{- if .Values.ca.db.enabled }}
+ - name: database
+ mountPath: /home/step/db
+ readOnly: false
+ {{- end }}
+volumes:
+ - name: certs
+ configMap:
+ name: {{ include "step-certificates.fullname" . }}-certs
+ - name: config
+configMap:
+ name: {{ include "step-certificates.fullname" . }}-config
+ - name: secrets
+configMap:
+ name: {{ include "step-certificates.fullname" . }}-secrets
+ - name: ca-password
+secret:
+ secretName: {{ include "step-certificates.fullname" . }}-ca-password
+ {{- if and .Values.ca.db.enabled (not .Values.ca.db.persistent) }}
+ - name: database
+emptyDir: {}
+ {{- end }}
+ {{- with .Values.nodeSelector }}
+nodeSelector:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.affinity }}
+affinity:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.tolerations }}
+tolerations:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+{{- if and .Values.ca.db.enabled .Values.ca.db.persistent }}
+volumeClaimTemplates:
- metadata:
name: database
labels:
@@ -127,22 +123,16 @@ spec:
spec:
accessModes:
{{- range .Values.ca.db.accessModes }}
- - {{ . | quote }}
+ - {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.ca.db.size | quote }}
- {{ if .Values.ca.db.existingClaim }}
- selector:
- matchLabels:
- name: {{ .Values.ca.db.existingClaim | quote }}
- {{- else }}
- {{- if .Values.ca.db.storageClass }}
- {{- if (eq "-" .Values.ca.db.storageClass) }}
- storageClassName: ""
- {{- else }}
- storageClassName: {{ .Values.ca.db.storageClass | quote }}
- {{- end }}
- {{- end }}
- {{- end }}
- {{- end }}
\ No newline at end of file
+ {{- if .Values.ca.db.storageClass }}
+ {{- if (eq "-" .Values.ca.db.storageClass) }}
+ storageClassName: ""
+ {{- else }}
+ storageClassName: {{ .Values.ca.db.storageClass | quote }}
+ {{- end }}
+ {{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/configmaps.yaml b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/configmaps.yaml
index 5bf6300..d56a0fe 100644
--- a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/configmaps.yaml
+++ b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/configmaps.yaml
@@ -1,38 +1,37 @@
-# ConfigMaps that will be updated by the configuration job:
-# 1. Step CA config directory.
-# 2. Step CA certs direcotry.
-# 3. Step CA secrets directory.
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "step-certificates.fullname" . }}-config
- namespace: {{ .Release.Namespace }}
+ namespace: {{.Release.Namespace}}
labels:
- {{- include "step-certificates.labels" . | nindent 4 }}
+{{ include "step-certificates.labels" . | indent 4 }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "step-certificates.fullname" . }}-certs
- namespace: {{ .Release.Namespace }}
+ namespace: {{.Release.Namespace}}
labels:
- {{- include "step-certificates.labels" . | nindent 4 }}
+{{ include "step-certificates.labels" . | indent 4 }}
---
apiVersion: v1
+data:
+ intermediate_ca_key: ""
+ root_ca_key: ""
kind: ConfigMap
metadata:
name: {{ include "step-certificates.fullname" . }}-secrets
- namespace: {{ .Release.Namespace }}
+ namespace: {{.Release.Namespace}}
labels:
- {{- include "step-certificates.labels" . | nindent 4 }}
+{{ include "step-certificates.labels" . | indent 4 }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "step-certificates.fullname" . }}-bootstrap
- namespace: {{ .Release.Namespace }}
+ namespace: {{.Release.Namespace}}
labels:
- {{- include "step-certificates.labels" . | nindent 4 }}
+{{ include "step-certificates.labels" . | indent 4 }}
data:
bootstrap.sh: |-
#!/bin/sh
@@ -52,77 +51,87 @@ data:
kubectl config set-context cfc --cluster=cfc --user=bootstrap
kubectl config use-context cfc
echo -e "\n\e[1mChecking cluster permissions...\e[0m"
- echo -n "Checking for permission to create configmaps in {{ .Release.Namespace }} namespace: "
- kubectl auth can-i create configmaps --namespace {{ .Release.Namespace }}
+ echo -n "Checking for permission to create configmaps in {{.Release.Namespace}} namespace: "
+ kubectl auth can-i create configmaps --namespace {{.Release.Namespace}}
if [ $? -ne 0 ]; then
permission_error "create configmaps"
fi
- echo -n "Checking for permission to create secrets in {{ .Release.Namespace }} namespace: "
- kubectl auth can-i create secrets --namespace {{ .Release.Namespace }}
+ echo -n "Checking for permission to create secrets in {{.Release.Namespace}} namespace: "
+ kubectl auth can-i create secrets --namespace {{.Release.Namespace}}
if [ $? -ne 0 ]; then
permission_error "create secrets"
fi
- {{- if .Values.autocert.enabled }}
- echo -n "Checking for permission to create mutatingwebhookconfiguration in {{ .Release.Namespace }} namespace: "
- kubectl auth can-i create mutatingwebhookconfiguration --namespace {{ .Release.Namespace }}
+{{ if .Values.autocert.enabled }}
+echo -n "Checking for permission to create mutatingwebhookconfiguration in {{.Release.Namespace}} namespace: "
+ kubectl auth can-i create mutatingwebhookconfiguration --namespace {{.Release.Namespace}}
if [ $? -ne 0 ]; then
permission_error "create mutatingwebhookconfiguration"
- fi
- {{- end }}
- # Setting this here on purpose, after the above section which explicitly checks
- # for and handles exit errors.
- set -e
- echo -e "\n\e[1mInitializating the CA...\e[0m"
- # CA password
- {{- if .Values.ca.password }}
- CA_PASSWORD={{ quote .Values.ca.password }}
- {{- else }}
- CA_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32 ; echo '')
- {{- end }}
- # Provisioner password
- {{- if .Values.ca.provisioner.password }}
- CA_PROVISIONER_PASSWORD={{ quote .Values.ca.provisioner.password }}
- {{- else }}
- CA_PROVISIONER_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32 ; echo '')
- {{- end }}
- TMP_CA_PASSWORD=$(mktemp /tmp/autocert.XXXXXX)
- TMP_CA_PROVISIONER_PASSWORD=$(mktemp /tmp/autocert.XXXXXX)
- echo $CA_PASSWORD > $TMP_CA_PASSWORD
- echo $CA_PROVISIONER_PASSWORD > $TMP_CA_PROVISIONER_PASSWORD
- step ca init \
- --name "{{.Values.ca.name}}" \
- --dns "{{include "step-certificates.dns" .}}" \
- --address "{{.Values.ca.address}}" \
- --provisioner "{{.Values.ca.provisioner.name}}" \
- --with-ca-url "{{include "step-certificates.url" .}}" \
- --password-file "$TMP_CA_PASSWORD" \
- --provisioner-password-file "$TMP_CA_PROVISIONER_PASSWORD" {{ if not .Values.ca.db.enabled }}--no-db{{ end }}
- rm -f $TMP_CA_PASSWORD $TMP_CA_PROVISIONER_PASSWORD
- {{- if .Values.ca.bootstrap.postInitHook }}
- {{ .Values.ca.bootstrap.postInitHook | nindent 4 }}
- {{- end }}
- echo -e "\n\e[1mCreating configmaps and secrets in {{ .Release.Namespace }} namespace ...\e[0m"
- # Replace secrets created on helm install
- # It allows to properly remove them on helm delete
- kbreplace -n {{ .Release.Namespace }} create configmap {{ include "step-certificates.fullname" . }}-config --from-file $(step path)/config
- kbreplace -n {{ .Release.Namespace }} create configmap {{ include "step-certificates.fullname" . }}-certs --from-file $(step path)/certs
- kbreplace -n {{ .Release.Namespace }} create configmap {{ include "step-certificates.fullname" . }}-secrets --from-file $(step path)/secrets
- kbreplace -n {{ .Release.Namespace }} create secret generic {{ include "step-certificates.fullname" . }}-ca-password --from-literal "password=${CA_PASSWORD}"
- kbreplace -n {{ .Release.Namespace }} create secret generic {{ include "step-certificates.fullname" . }}-provisioner-password --from-literal "password=${CA_PROVISIONER_PASSWORD}"
- # Label all configmaps and secrets
- kubectl -n {{ .Release.Namespace }} label configmap {{ include "step-certificates.fullname" . }}-config {{ include "step-certificates.labels" . | replace ": " "=" | replace "\n" " " }}
- kubectl -n {{ .Release.Namespace }} label configmap {{ include "step-certificates.fullname" . }}-certs {{ include "step-certificates.labels" . | replace ": " "=" | replace "\n" " " }}
- kubectl -n {{ .Release.Namespace }} label configmap {{ include "step-certificates.fullname" . }}-secrets {{ include "step-certificates.labels" . | replace ": " "=" | replace "\n" " " }}
- kubectl -n {{ .Release.Namespace }} label secret {{ include "step-certificates.fullname" . }}-ca-password {{ include "step-certificates.labels" . | replace ": " "=" | replace "\n" " " }}
- kubectl -n {{ .Release.Namespace }} label secret {{ include "step-certificates.fullname" . }}-provisioner-password {{ include "step-certificates.labels" . | replace ": " "=" | replace "\n" " " }}
- # Patch webhook if autocert is enabled
- {{- if .Values.autocert.enabled }}
- CA_BUNDLE=$(cat $(step path)/certs/root_ca.crt | base64 | tr -d '\n')
- kubectl patch mutatingwebhookconfigurations {{ .Release.Name }}-autocert-webhook-config \
- --type json -p="[{\"op\":\"replace\",\"path\":\"/webhooks/0/clientConfig/caBundle\",\"value\":\"$CA_BUNDLE\"}]"
- {{- end }}
- echo -e "\n\e[1mStep Certificates installed!\e[0m"
- echo
- echo "CA URL: {{include "step-certificates.url" .}}"
- echo "CA Fingerprint: $(step certificate fingerprint $(step path)/certs/root_ca.crt)"
- echo
\ No newline at end of file
+ fi
+{{- end }}
+
+# Setting this here on purpose, after the above section which explicitly checks
+# for and handles exit errors.
+ set -e
+
+ echo -e "\n\e[1mInitializating the CA...\e[0m"
+
+# CA password
+{{- if .Values.ca.password }}
+ CA_PASSWORD={{ quote .Values.ca.password }}
+{{- else }}
+ CA_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32 ; echo '')
+{{- end }}
+# Provisioner password
+{{- if .Values.ca.provisioner.password }}
+ CA_PROVISIONER_PASSWORD={{ quote .Values.ca.provisioner.password }}
+{{- else }}
+ CA_PROVISIONER_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32 ; echo '')
+{{- end }}
+
+ TMP_CA_PASSWORD=$(mktemp /tmp/autocert.XXXXXX)
+ TMP_CA_PROVISIONER_PASSWORD=$(mktemp /tmp/autocert.XXXXXX)
+
+ echo $CA_PASSWORD > $TMP_CA_PASSWORD
+ echo $CA_PROVISIONER_PASSWORD > $TMP_CA_PROVISIONER_PASSWORD
+
+ step ca init \
+ --name "{{.Values.ca.name}}" \
+ --dns "{{include "step-certificates.dns" .}}" \
+ --address "{{.Values.ca.address}}" \
+ --provisioner "{{.Values.ca.provisioner.name}}" \
+ --with-ca-url "{{include "step-certificates.url" .}}" \
+ --password-file "$TMP_CA_PASSWORD" \
+ --provisioner-password-file "$TMP_CA_PROVISIONER_PASSWORD" {{ if not .Values.ca.db.enabled }}--no-db{{ end }}
+
+ rm -f $TMP_CA_PASSWORD $TMP_CA_PROVISIONER_PASSWORD
+
+ echo -e "\n\e[1mCreating configmaps and secrets in {{.Release.Namespace}} namespace ...\e[0m"
+
+ # Replace secrets created on helm install
+ # It allows to properly remove them on helm delete
+ kbreplace -n {{.Release.Namespace}} create configmap {{ include "step-certificates.fullname" . }}-config --from-file $(step path)/config
+ kbreplace -n {{.Release.Namespace}} create configmap {{ include "step-certificates.fullname" . }}-certs --from-file $(step path)/certs
+ kbreplace -n {{.Release.Namespace}} create configmap {{ include "step-certificates.fullname" . }}-secrets --from-file $(step path)/secrets
+
+ kbreplace -n {{.Release.Namespace}} create secret generic {{ include "step-certificates.fullname" . }}-ca-password --from-literal "password=${CA_PASSWORD}"
+ kbreplace -n {{.Release.Namespace}} create secret generic {{ include "step-certificates.fullname" . }}-provisioner-password --from-literal "password=${CA_PROVISIONER_PASSWORD}"
+
+# Label all configmaps and secrets
+kubectl -n {{.Release.Namespace}} label configmap {{ include "step-certificates.fullname" . }}-config {{ include "step-certificates.labels" . | replace ": " "=" | replace "\n" " " }}
+kubectl -n {{.Release.Namespace}} label configmap {{ include "step-certificates.fullname" . }}-certs {{ include "step-certificates.labels" . | replace ": " "=" | replace "\n" " " }}
+kubectl -n {{.Release.Namespace}} label configmap {{ include "step-certificates.fullname" . }}-secrets {{ include "step-certificates.labels" . | replace ": " "=" | replace "\n" " " }}
+kubectl -n {{.Release.Namespace}} label secret {{ include "step-certificates.fullname" . }}-ca-password {{ include "step-certificates.labels" . | replace ": " "=" | replace "\n" " " }}
+kubectl -n {{.Release.Namespace}} label secret {{ include "step-certificates.fullname" . }}-provisioner-password {{ include "step-certificates.labels" . | replace ": " "=" | replace "\n" " " }}
+
+# Patch webhook if autocert is enabled
+{{ if .Values.autocert.enabled }}
+ CA_BUNDLE=$(cat $(step path)/certs/root_ca.crt | base64 | tr -d '\n')
+ kubectl patch mutatingwebhookconfigurations {{ .Release.Name }}-autocert-webhook-config \
+ --type json -p="[{\"op\":\"replace\",\"path\":\"/webhooks/0/clientConfig/caBundle\",\"value\":\"$CA_BUNDLE\"}]"
+{{- end }}
+
+ echo -e "\n\e[1mStep Certificates installed!\e[0m"
+ echo
+echo "CA URL: {{include "step-certificates.url" .}}"
+echo "CA Fingerprint: $(step certificate fingerprint $(step path)/certs/root_ca.crt)"
+ echo
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/ingress.yaml b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/ingress.yaml
index 7e44e9e..1a35a72 100644
--- a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/ingress.yaml
+++ b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/ingress.yaml
@@ -1,36 +1,36 @@
-{{- if .Values.ingress.enabled -}}
-{{- $fullName := include "step-certificates.fullname" . -}}
+ {{- if .Values.ingress.enabled -}}
+ {{- $fullName := include "step-certificates.fullname" . -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
- {{- include "step-certificates.labels" . | nindent 4 }}
+ {{ include "step-certificates.labels" . | indent 4 }}
{{- with .Values.ingress.annotations }}
- annotations:
- {{- toYaml . | nindent 4 }}
+annotations:
+ {{- toYaml . | nindent 4 }}
{{- end }}
spec:
- {{- if .Values.ingress.tls }}
- tls:
- {{- range .Values.ingress.tls }}
- - hosts:
- {{- range .hosts }}
- - {{ . | quote }}
- {{- end }}
- secretName: {{ .secretName }}
- {{- end }}
+{{- if .Values.ingress.tls }}
+tls:
+ {{- range .Values.ingress.tls }}
+- hosts:
+ {{- range .hosts }}
+ - {{ . | quote }}
+ {{- end }}
+ secretName: {{ .secretName }}
{{- end }}
- rules:
- {{- range .Values.ingress.hosts }}
- - host: {{ .host | quote }}
- http:
- paths:
- {{- range .paths }}
- - path: {{ . }}
- backend:
- serviceName: {{ $fullName }}
- servicePort: https
- {{- end }}
- {{- end }}
{{- end }}
+rules:
+ {{- range .Values.ingress.hosts }}
+- host: {{ .host | quote }}
+ http:
+ paths:
+ {{- range .paths }}
+ - path: {{ . }}
+ backend:
+ serviceName: {{ $fullName }}
+ servicePort: http
+ {{- end }}
+ {{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/rbac.yaml b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/rbac.yaml
index 3bee0e2..32266a2 100644
--- a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/rbac.yaml
+++ b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/rbac.yaml
@@ -1,9 +1,9 @@
-{{- if .Release.IsInstall -}}
+ {{- if .Release.IsInstall -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "step-certificates.fullname" . }}-config
- namespace: {{ .Release.Namespace }}
+ namespace: {{.Release.Namespace}}
labels:
helm.sh/chart: {{ include "step-certificates.chart" . }}
app.kubernetes.io/name: {{ include "step-certificates.name" . }}
@@ -19,7 +19,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "step-certificates.fullname" . }}-config
- namespace: {{ .Release.Namespace }}
+ namespace: {{.Release.Namespace}}
labels:
helm.sh/chart: {{ include "step-certificates.chart" . }}
app.kubernetes.io/name: {{ include "step-certificates.name" . }}
@@ -29,13 +29,12 @@ metadata:
subjects:
- kind: ServiceAccount
name: {{ include "step-certificates.fullname" . }}-config
- namespace: {{ .Release.Namespace }}
+ namespace: {{.Release.Namespace}}
roleRef:
kind: Role
name: {{ include "step-certificates.fullname" . }}-config
apiGroup: rbac.authorization.k8s.io
---
-{{ if .Values.autocert.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
@@ -55,7 +54,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "step-certificates.fullname" . }}-config
- namespace: {{ .Release.Namespace }}
+ namespace: {{.Release.Namespace}}
labels:
helm.sh/chart: {{ include "step-certificates.chart" . }}
app.kubernetes.io/name: {{ include "step-certificates.name" . }}
@@ -65,10 +64,9 @@ metadata:
subjects:
- kind: ServiceAccount
name: {{ include "step-certificates.fullname" . }}-config
- namespace: {{ .Release.Namespace }}
+ namespace: {{.Release.Namespace}}
roleRef:
kind: ClusterRole
name: {{ include "step-certificates.fullname" . }}-config
apiGroup: rbac.authorization.k8s.io
-{{- end }} # if .Values.autocert.enabled
-{{- end }}
\ No newline at end of file
+{{- end -}}
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/secrets.yaml b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/secrets.yaml
index 4c4290e..567a989 100644
--- a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/secrets.yaml
+++ b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/secrets.yaml
@@ -2,13 +2,17 @@
# 1. CA keys password.
# 2. Provisioner password.
apiVersion: v1
+data:
+ password: ""
kind: Secret
metadata:
name: {{ include "step-certificates.fullname" . }}-ca-password
- namespace: {{ .Release.Namespace }}
+ namespace: {{.Release.Namespace}}
---
apiVersion: v1
+data:
+ password: ""
kind: Secret
metadata:
name: {{ include "step-certificates.fullname" . }}-provisioner-password
- namespace: {{ .Release.Namespace }}
\ No newline at end of file
+ namespace: {{.Release.Namespace}}
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/service.yaml b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/service.yaml
index e234fdf..91778c7 100644
--- a/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/service.yaml
+++ b/infrastructure-provisioning/terraform/gcp/ssn-gke/main/modules/helm_charts/step-ca-chart/templates/service.yaml
@@ -3,14 +3,17 @@ kind: Service
metadata:
name: {{ include "step-certificates.fullname" . }}
labels:
- {{- include "step-certificates.labels" . | nindent 4 }}
+ {{ include "step-certificates.labels" . | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
- protocol: TCP
- name: https
- selector:
- app.kubernetes.io/name: {{ include "step-certificates.name" . }}
- app.kubernetes.io/instance: {{ .Release.Name }}
\ No newline at end of file
+{{- if .Values.service.nodePort }}
+nodePort: {{ .Values.service.nodePort }}
+{{- end }}
+protocol: TCP
+name: https
+selector:
+ app.kubernetes.io/name: {{ include "step-certificates.name" . }}
+ app.kubernetes.io/instance: {{ .Release.Name }}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org