From 38ea76302fa05790e231b3365528ea3a9ffa051e Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 10 Nov 2018 14:21:07 -0500 Subject: [PATCH 1/8] type: LoadBalancer for parrot svc if ingress disabled Signed-off-by: Mathieu Benoit --- parrot/charts/parrot/templates/service.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/parrot/charts/parrot/templates/service.yaml b/parrot/charts/parrot/templates/service.yaml index bce6eec..7635872 100644 --- a/parrot/charts/parrot/templates/service.yaml +++ b/parrot/charts/parrot/templates/service.yaml @@ -14,4 +14,8 @@ spec: targetPort: {{ .Values.service.internalPort }} selector: app: {{ template "fullname" . }} - type: ClusterIP \ No newline at end of file +{{ if .Values.ingress.enabled }} + type: ClusterIP +{{ else }} + type: LoadBalancer +{{ end }} \ No newline at end of file From bc74a59f526d845d460f33c3257abccab1a2fc29 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 10 Nov 2018 14:28:57 -0500 Subject: [PATCH 2/8] Trigger build per projectName path Signed-off-by: Mathieu Benoit --- azure-build-pipeline.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azure-build-pipeline.yml b/azure-build-pipeline.yml index a362219..a5b2bc1 100644 --- a/azure-build-pipeline.yml +++ b/azure-build-pipeline.yml @@ -7,6 +7,11 @@ variables: imageName: '$(projectName)' # define 4 more variables: projectName, registryName, registryLogin and registryPassword in the build pipeline in UI +trigger: + batch: true + paths: + include: + - $(projectName)/* steps: - bash: docker build -f $(system.defaultWorkingDirectory)/$(projectName)/Dockerfile -t $(registryServerName)/$(imageName):$(build.buildId) -t $(registryServerName)/$(imageName):latest $(system.defaultWorkingDirectory)/$(projectName) From 966d8bff3074e74f2d01cec036cf781ffc02e14e Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 10 Nov 2018 15:11:49 -0500 Subject: [PATCH 3/8] CI trigger by default Signed-off-by: Mathieu Benoit --- azure-build-pipeline.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/azure-build-pipeline.yml b/azure-build-pipeline.yml index a5b2bc1..a362219 100644 --- a/azure-build-pipeline.yml +++ b/azure-build-pipeline.yml @@ -7,11 +7,6 @@ variables: imageName: '$(projectName)' # define 4 more variables: projectName, registryName, registryLogin and registryPassword in the build pipeline in UI -trigger: - batch: true - paths: - include: - - $(projectName)/* steps: - bash: docker build -f $(system.defaultWorkingDirectory)/$(projectName)/Dockerfile -t $(registryServerName)/$(imageName):$(build.buildId) -t $(registryServerName)/$(imageName):latest $(system.defaultWorkingDirectory)/$(projectName) From fcc3501cfe54b972b6cf40fbf754d7b9a880d993 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 10 Nov 2018 22:49:58 -0500 Subject: [PATCH 4/8] parrot: private container repo as optional Signed-off-by: Mathieu Benoit --- parrot/charts/parrot/templates/_helpers.tpl | 7 +++++++ parrot/charts/parrot/templates/deployment.yaml | 4 ++++ parrot/charts/parrot/templates/secret.yaml | 9 +++++++++ parrot/charts/parrot/values.yaml | 1 + 4 files changed, 21 insertions(+) create mode 100644 parrot/charts/parrot/templates/secret.yaml diff --git a/parrot/charts/parrot/templates/_helpers.tpl b/parrot/charts/parrot/templates/_helpers.tpl index f0d83d2..eba3ee9 100755 --- a/parrot/charts/parrot/templates/_helpers.tpl +++ b/parrot/charts/parrot/templates/_helpers.tpl @@ -14,3 +14,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Generate the imagePullSecret for a private Container Registry. +*/}} +{{- define "imagePullSecret" }} +{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.image.repository (printf "%s:%s" .Values.image.username .Values.image.password | b64enc) | b64enc }} +{{- end }} \ No newline at end of file diff --git a/parrot/charts/parrot/templates/deployment.yaml b/parrot/charts/parrot/templates/deployment.yaml index 19b49f5..d4bf82e 100755 --- a/parrot/charts/parrot/templates/deployment.yaml +++ b/parrot/charts/parrot/templates/deployment.yaml @@ -17,6 +17,10 @@ spec: labels: app: {{ template "fullname" . }} spec: +{{ if .Values.image.private }} + imagePullSecrets: + - name: acr-secret +{{ end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" diff --git a/parrot/charts/parrot/templates/secret.yaml b/parrot/charts/parrot/templates/secret.yaml new file mode 100644 index 0000000..02c0073 --- /dev/null +++ b/parrot/charts/parrot/templates/secret.yaml @@ -0,0 +1,9 @@ +{{ if .Values.image.private }} +apiVersion: v1 +kind: Secret +metadata: + name: acr-secret +type: kubernetes.io/dockerconfigjson +data: + .dockerconfigjson: {{ template "imagePullSecret" . }} +{{ end }} \ No newline at end of file diff --git a/parrot/charts/parrot/values.yaml b/parrot/charts/parrot/values.yaml index a579cba..12a3025 100755 --- a/parrot/charts/parrot/values.yaml +++ b/parrot/charts/parrot/values.yaml @@ -1,5 +1,6 @@ replicaCount: 1 image: + private: false pullPolicy: Always service: internalPort: 80 From 37ffaffc4a9ebd7a5176593741c7672b5e654851 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 10 Nov 2018 23:00:30 -0500 Subject: [PATCH 5/8] nodebrady: private container repo as optional Signed-off-by: Mathieu Benoit --- nodebrady/charts/nodebrady/templates/_helpers.tpl | 7 +++++++ nodebrady/charts/nodebrady/templates/deployment.yaml | 4 ++++ nodebrady/charts/nodebrady/templates/secret.yaml | 9 +++++++++ nodebrady/charts/nodebrady/values.yaml | 1 + 4 files changed, 21 insertions(+) create mode 100644 nodebrady/charts/nodebrady/templates/secret.yaml diff --git a/nodebrady/charts/nodebrady/templates/_helpers.tpl b/nodebrady/charts/nodebrady/templates/_helpers.tpl index f0d83d2..eba3ee9 100755 --- a/nodebrady/charts/nodebrady/templates/_helpers.tpl +++ b/nodebrady/charts/nodebrady/templates/_helpers.tpl @@ -14,3 +14,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Generate the imagePullSecret for a private Container Registry. +*/}} +{{- define "imagePullSecret" }} +{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.image.repository (printf "%s:%s" .Values.image.username .Values.image.password | b64enc) | b64enc }} +{{- end }} \ No newline at end of file diff --git a/nodebrady/charts/nodebrady/templates/deployment.yaml b/nodebrady/charts/nodebrady/templates/deployment.yaml index 49a9b28..8bf967a 100755 --- a/nodebrady/charts/nodebrady/templates/deployment.yaml +++ b/nodebrady/charts/nodebrady/templates/deployment.yaml @@ -17,6 +17,10 @@ spec: labels: app: {{ template "fullname" . }} spec: +{{ if .Values.image.private }} + imagePullSecrets: + - name: acr-secret +{{ end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" diff --git a/nodebrady/charts/nodebrady/templates/secret.yaml b/nodebrady/charts/nodebrady/templates/secret.yaml new file mode 100644 index 0000000..02c0073 --- /dev/null +++ b/nodebrady/charts/nodebrady/templates/secret.yaml @@ -0,0 +1,9 @@ +{{ if .Values.image.private }} +apiVersion: v1 +kind: Secret +metadata: + name: acr-secret +type: kubernetes.io/dockerconfigjson +data: + .dockerconfigjson: {{ template "imagePullSecret" . }} +{{ end }} \ No newline at end of file diff --git a/nodebrady/charts/nodebrady/values.yaml b/nodebrady/charts/nodebrady/values.yaml index 162aa7b..edad168 100755 --- a/nodebrady/charts/nodebrady/values.yaml +++ b/nodebrady/charts/nodebrady/values.yaml @@ -1,5 +1,6 @@ replicaCount: 1 image: + private: false pullPolicy: Always service: internalPort: 3000 From 71b81099e3731c7b56fbd0dadb2174bba894731e Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 10 Nov 2018 23:02:51 -0500 Subject: [PATCH 6/8] captainkube: private container repo as optional Signed-off-by: Mathieu Benoit --- captainkube/charts/captainkube/templates/_helpers.tpl | 7 +++++++ captainkube/charts/captainkube/templates/deployment.yaml | 4 ++++ captainkube/charts/captainkube/templates/secret.yaml | 9 +++++++++ captainkube/charts/captainkube/values.yaml | 1 + 4 files changed, 21 insertions(+) create mode 100644 captainkube/charts/captainkube/templates/secret.yaml diff --git a/captainkube/charts/captainkube/templates/_helpers.tpl b/captainkube/charts/captainkube/templates/_helpers.tpl index f0d83d2..eba3ee9 100755 --- a/captainkube/charts/captainkube/templates/_helpers.tpl +++ b/captainkube/charts/captainkube/templates/_helpers.tpl @@ -14,3 +14,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Generate the imagePullSecret for a private Container Registry. +*/}} +{{- define "imagePullSecret" }} +{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.image.repository (printf "%s:%s" .Values.image.username .Values.image.password | b64enc) | b64enc }} +{{- end }} \ No newline at end of file diff --git a/captainkube/charts/captainkube/templates/deployment.yaml b/captainkube/charts/captainkube/templates/deployment.yaml index ba0fbdc..fc9de59 100755 --- a/captainkube/charts/captainkube/templates/deployment.yaml +++ b/captainkube/charts/captainkube/templates/deployment.yaml @@ -17,6 +17,10 @@ spec: labels: app: {{ template "fullname" . }} spec: +{{ if .Values.image.private }} + imagePullSecrets: + - name: acr-secret +{{ end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" diff --git a/captainkube/charts/captainkube/templates/secret.yaml b/captainkube/charts/captainkube/templates/secret.yaml new file mode 100644 index 0000000..02c0073 --- /dev/null +++ b/captainkube/charts/captainkube/templates/secret.yaml @@ -0,0 +1,9 @@ +{{ if .Values.image.private }} +apiVersion: v1 +kind: Secret +metadata: + name: acr-secret +type: kubernetes.io/dockerconfigjson +data: + .dockerconfigjson: {{ template "imagePullSecret" . }} +{{ end }} \ No newline at end of file diff --git a/captainkube/charts/captainkube/values.yaml b/captainkube/charts/captainkube/values.yaml index 38fcb10..14b3e58 100755 --- a/captainkube/charts/captainkube/values.yaml +++ b/captainkube/charts/captainkube/values.yaml @@ -1,3 +1,4 @@ replicaCount: 1 image: + private: false pullPolicy: Always \ No newline at end of file From 69b30acfe44a449973ce8819e6e21f57c133e6c8 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 10 Nov 2018 23:04:52 -0500 Subject: [PATCH 7/8] phippy: private container repo as optional Signed-off-by: Mathieu Benoit --- phippy/charts/phippy/templates/_helpers.tpl | 7 +++++++ phippy/charts/phippy/templates/deployment.yaml | 4 ++++ phippy/charts/phippy/templates/secret.yaml | 9 +++++++++ phippy/charts/phippy/values.yaml | 1 + 4 files changed, 21 insertions(+) create mode 100644 phippy/charts/phippy/templates/secret.yaml diff --git a/phippy/charts/phippy/templates/_helpers.tpl b/phippy/charts/phippy/templates/_helpers.tpl index f0d83d2..eba3ee9 100755 --- a/phippy/charts/phippy/templates/_helpers.tpl +++ b/phippy/charts/phippy/templates/_helpers.tpl @@ -14,3 +14,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Generate the imagePullSecret for a private Container Registry. +*/}} +{{- define "imagePullSecret" }} +{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.image.repository (printf "%s:%s" .Values.image.username .Values.image.password | b64enc) | b64enc }} +{{- end }} \ No newline at end of file diff --git a/phippy/charts/phippy/templates/deployment.yaml b/phippy/charts/phippy/templates/deployment.yaml index 9139f99..86f3ecc 100755 --- a/phippy/charts/phippy/templates/deployment.yaml +++ b/phippy/charts/phippy/templates/deployment.yaml @@ -15,6 +15,10 @@ spec: draft: {{ default "draft-app" .Values.draft }} app: {{ template "fullname" . }} spec: +{{ if .Values.image.private }} + imagePullSecrets: + - name: acr-secret +{{ end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" diff --git a/phippy/charts/phippy/templates/secret.yaml b/phippy/charts/phippy/templates/secret.yaml new file mode 100644 index 0000000..02c0073 --- /dev/null +++ b/phippy/charts/phippy/templates/secret.yaml @@ -0,0 +1,9 @@ +{{ if .Values.image.private }} +apiVersion: v1 +kind: Secret +metadata: + name: acr-secret +type: kubernetes.io/dockerconfigjson +data: + .dockerconfigjson: {{ template "imagePullSecret" . }} +{{ end }} \ No newline at end of file diff --git a/phippy/charts/phippy/values.yaml b/phippy/charts/phippy/values.yaml index ffbbf21..d22d9bc 100755 --- a/phippy/charts/phippy/values.yaml +++ b/phippy/charts/phippy/values.yaml @@ -3,6 +3,7 @@ # Declare variables to be passed into your templates. replicaCount: 1 image: + private: false pullPolicy: IfNotPresent service: externalPort: 80 From b5fa487fb5fcba7e98a1071330a23dbe6a76feb1 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 10 Nov 2018 23:23:40 -0500 Subject: [PATCH 8/8] one acr-secret per project Signed-off-by: Mathieu Benoit --- captainkube/charts/captainkube/templates/deployment.yaml | 2 +- captainkube/charts/captainkube/templates/secret.yaml | 2 +- nodebrady/charts/nodebrady/templates/deployment.yaml | 2 +- nodebrady/charts/nodebrady/templates/secret.yaml | 2 +- parrot/charts/parrot/templates/deployment.yaml | 2 +- parrot/charts/parrot/templates/secret.yaml | 2 +- phippy/charts/phippy/templates/deployment.yaml | 2 +- phippy/charts/phippy/templates/secret.yaml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/captainkube/charts/captainkube/templates/deployment.yaml b/captainkube/charts/captainkube/templates/deployment.yaml index fc9de59..1199462 100755 --- a/captainkube/charts/captainkube/templates/deployment.yaml +++ b/captainkube/charts/captainkube/templates/deployment.yaml @@ -19,7 +19,7 @@ spec: spec: {{ if .Values.image.private }} imagePullSecrets: - - name: acr-secret + - name: {{ .Chart.Name }}-acr-secret {{ end }} containers: - name: {{ .Chart.Name }} diff --git a/captainkube/charts/captainkube/templates/secret.yaml b/captainkube/charts/captainkube/templates/secret.yaml index 02c0073..3d2dd6e 100644 --- a/captainkube/charts/captainkube/templates/secret.yaml +++ b/captainkube/charts/captainkube/templates/secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: acr-secret + name: {{ .Chart.Name }}-acr-secret type: kubernetes.io/dockerconfigjson data: .dockerconfigjson: {{ template "imagePullSecret" . }} diff --git a/nodebrady/charts/nodebrady/templates/deployment.yaml b/nodebrady/charts/nodebrady/templates/deployment.yaml index 8bf967a..c820cfa 100755 --- a/nodebrady/charts/nodebrady/templates/deployment.yaml +++ b/nodebrady/charts/nodebrady/templates/deployment.yaml @@ -19,7 +19,7 @@ spec: spec: {{ if .Values.image.private }} imagePullSecrets: - - name: acr-secret + - name: {{ .Chart.Name }}-acr-secret {{ end }} containers: - name: {{ .Chart.Name }} diff --git a/nodebrady/charts/nodebrady/templates/secret.yaml b/nodebrady/charts/nodebrady/templates/secret.yaml index 02c0073..3d2dd6e 100644 --- a/nodebrady/charts/nodebrady/templates/secret.yaml +++ b/nodebrady/charts/nodebrady/templates/secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: acr-secret + name: {{ .Chart.Name }}-acr-secret type: kubernetes.io/dockerconfigjson data: .dockerconfigjson: {{ template "imagePullSecret" . }} diff --git a/parrot/charts/parrot/templates/deployment.yaml b/parrot/charts/parrot/templates/deployment.yaml index d4bf82e..0811aea 100755 --- a/parrot/charts/parrot/templates/deployment.yaml +++ b/parrot/charts/parrot/templates/deployment.yaml @@ -19,7 +19,7 @@ spec: spec: {{ if .Values.image.private }} imagePullSecrets: - - name: acr-secret + - name: {{ .Chart.Name }}-acr-secret {{ end }} containers: - name: {{ .Chart.Name }} diff --git a/parrot/charts/parrot/templates/secret.yaml b/parrot/charts/parrot/templates/secret.yaml index 02c0073..3d2dd6e 100644 --- a/parrot/charts/parrot/templates/secret.yaml +++ b/parrot/charts/parrot/templates/secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: acr-secret + name: {{ .Chart.Name }}-acr-secret type: kubernetes.io/dockerconfigjson data: .dockerconfigjson: {{ template "imagePullSecret" . }} diff --git a/phippy/charts/phippy/templates/deployment.yaml b/phippy/charts/phippy/templates/deployment.yaml index 86f3ecc..65e25a9 100755 --- a/phippy/charts/phippy/templates/deployment.yaml +++ b/phippy/charts/phippy/templates/deployment.yaml @@ -17,7 +17,7 @@ spec: spec: {{ if .Values.image.private }} imagePullSecrets: - - name: acr-secret + - name: {{ .Chart.Name }}-acr-secret {{ end }} containers: - name: {{ .Chart.Name }} diff --git a/phippy/charts/phippy/templates/secret.yaml b/phippy/charts/phippy/templates/secret.yaml index 02c0073..3d2dd6e 100644 --- a/phippy/charts/phippy/templates/secret.yaml +++ b/phippy/charts/phippy/templates/secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: acr-secret + name: {{ .Chart.Name }}-acr-secret type: kubernetes.io/dockerconfigjson data: .dockerconfigjson: {{ template "imagePullSecret" . }}