From d13179311fc30b66abbe63d6af712749378b83e4 Mon Sep 17 00:00:00 2001 From: Naseem Date: Wed, 25 Dec 2019 10:31:31 -0500 Subject: [PATCH 1/4] Add yours truly as a reviewer --- stable/gcloud-sqlproxy/OWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/stable/gcloud-sqlproxy/OWNERS b/stable/gcloud-sqlproxy/OWNERS index 2daa738..031bc1e 100755 --- a/stable/gcloud-sqlproxy/OWNERS +++ b/stable/gcloud-sqlproxy/OWNERS @@ -2,3 +2,4 @@ approvers: - rimusz reviewers: - rimusz +- naseemkullah From f1728db05de5f4ab93a15de9fd62323ac0192dc8 Mon Sep 17 00:00:00 2001 From: Naseem Date: Wed, 25 Dec 2019 10:32:05 -0500 Subject: [PATCH 2/4] Use label helpers --- stable/gcloud-sqlproxy/templates/_helpers.tpl | 22 ++++++++++++++++++- .../gcloud-sqlproxy/templates/deployment.yaml | 11 +++++----- .../templates/gcpserviceaccount.yaml | 7 ++---- .../templates/horizontalpodautoscaler.yaml | 5 +---- .../templates/networkpolicy.yaml | 5 +---- stable/gcloud-sqlproxy/templates/pdb.yaml | 5 +---- stable/gcloud-sqlproxy/templates/role.yaml | 5 +---- .../templates/rolebinding.yaml | 5 +---- stable/gcloud-sqlproxy/templates/secrets.yaml | 7 ++---- .../templates/serviceaccount.yaml | 5 +---- stable/gcloud-sqlproxy/templates/svc.yaml | 8 ++----- 11 files changed, 38 insertions(+), 47 deletions(-) diff --git a/stable/gcloud-sqlproxy/templates/_helpers.tpl b/stable/gcloud-sqlproxy/templates/_helpers.tpl index 2890b9a..b94108e 100755 --- a/stable/gcloud-sqlproxy/templates/_helpers.tpl +++ b/stable/gcloud-sqlproxy/templates/_helpers.tpl @@ -31,6 +31,26 @@ Create chart name and version as used by the chart label. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{/* +Common labels +*/}} +{{- define "gcloud-sqlproxy.labels" -}} +helm.sh/chart: {{ include "gcloud-sqlproxy.chart" . }} +{{ include "gcloud-sqlproxy.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "gcloud-sqlproxy.selectorLabels" -}} +app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + {{/* Generate gcp service account name */}} @@ -57,4 +77,4 @@ Check if any type of credentials are defined */}} {{- define "gcloud-sqlproxy.hasCredentials" -}} {{ or .Values.serviceAccountKey ( or .Values.existingSecret .Values.usingGCPController ) -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/stable/gcloud-sqlproxy/templates/deployment.yaml b/stable/gcloud-sqlproxy/templates/deployment.yaml index b62ae69..47f7001 100755 --- a/stable/gcloud-sqlproxy/templates/deployment.yaml +++ b/stable/gcloud-sqlproxy/templates/deployment.yaml @@ -5,17 +5,16 @@ kind: Deployment metadata: name: {{ include "gcloud-sqlproxy.fullname" . }} labels: - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} - helm.sh/chart: {{ include "gcloud-sqlproxy.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "gcloud-sqlproxy.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicasCount }} + selector: + matchLabels: + {{- include "gcloud-sqlproxy.selectorLabels" . | nindent 6 }} template: metadata: labels: - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + {{- include "gcloud-sqlproxy.selectorLabels" . | nindent 8 }} annotations: {{ toYaml .Values.podAnnotations | indent 8 }} spec: diff --git a/stable/gcloud-sqlproxy/templates/gcpserviceaccount.yaml b/stable/gcloud-sqlproxy/templates/gcpserviceaccount.yaml index aac422d..07d4017 100644 --- a/stable/gcloud-sqlproxy/templates/gcpserviceaccount.yaml +++ b/stable/gcloud-sqlproxy/templates/gcpserviceaccount.yaml @@ -4,10 +4,7 @@ kind: GcpServiceAccount metadata: labels: controller-tools.k8s.io: "1.0" - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.fullname" . }} - helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "gcloud-sqlproxy.labels" . | nindent 4 }} name: {{ include "gcloud-sqlproxy.fullname" . }} spec: serviceAccountIdentifier: {{ include "gcloud-sqlproxy.serviceAccountName" . }} @@ -19,4 +16,4 @@ spec: roles: - roles/cloudsql.client {{ end }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/stable/gcloud-sqlproxy/templates/horizontalpodautoscaler.yaml b/stable/gcloud-sqlproxy/templates/horizontalpodautoscaler.yaml index 9df4446..71b8938 100644 --- a/stable/gcloud-sqlproxy/templates/horizontalpodautoscaler.yaml +++ b/stable/gcloud-sqlproxy/templates/horizontalpodautoscaler.yaml @@ -3,10 +3,7 @@ apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: labels: - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} - helm.sh/chart: {{ include "gcloud-sqlproxy.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "gcloud-sqlproxy.labels" . | nindent 4 }} name: {{ include "gcloud-sqlproxy.fullname" . }} spec: scaleTargetRef: diff --git a/stable/gcloud-sqlproxy/templates/networkpolicy.yaml b/stable/gcloud-sqlproxy/templates/networkpolicy.yaml index 870468f..d734a77 100644 --- a/stable/gcloud-sqlproxy/templates/networkpolicy.yaml +++ b/stable/gcloud-sqlproxy/templates/networkpolicy.yaml @@ -4,10 +4,7 @@ apiVersion: networking.k8s.io/v1 metadata: name: "{{ include "gcloud-sqlproxy.fullname" . }}" labels: - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} - helm.sh/chart: {{ include "gcloud-sqlproxy.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "gcloud-sqlproxy.labels" . | nindent 4 }} spec: podSelector: matchLabels: diff --git a/stable/gcloud-sqlproxy/templates/pdb.yaml b/stable/gcloud-sqlproxy/templates/pdb.yaml index 0881b09..edf8952 100755 --- a/stable/gcloud-sqlproxy/templates/pdb.yaml +++ b/stable/gcloud-sqlproxy/templates/pdb.yaml @@ -3,10 +3,7 @@ apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: labels: - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} - helm.sh/chart: {{ include "gcloud-sqlproxy.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "gcloud-sqlproxy.labels" . | nindent 4 }} name: {{ include "gcloud-sqlproxy.fullname" . }} spec: selector: diff --git a/stable/gcloud-sqlproxy/templates/role.yaml b/stable/gcloud-sqlproxy/templates/role.yaml index 873bd34..969dc78 100755 --- a/stable/gcloud-sqlproxy/templates/role.yaml +++ b/stable/gcloud-sqlproxy/templates/role.yaml @@ -4,10 +4,7 @@ kind: Role metadata: namespace: {{ .Values.namespace }} labels: - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} - helm.sh/chart: {{ include "gcloud-sqlproxy.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "gcloud-sqlproxy.labels" . | nindent 4 }} name: {{ include "gcloud-sqlproxy.fullname" . }} rules: - apiGroups: [""] diff --git a/stable/gcloud-sqlproxy/templates/rolebinding.yaml b/stable/gcloud-sqlproxy/templates/rolebinding.yaml index cfdd840..28c9464 100755 --- a/stable/gcloud-sqlproxy/templates/rolebinding.yaml +++ b/stable/gcloud-sqlproxy/templates/rolebinding.yaml @@ -4,10 +4,7 @@ kind: RoleBinding metadata: namespace: {{ .Values.namespace }} labels: - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} - helm.sh/chart: {{ include "gcloud-sqlproxy.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "gcloud-sqlproxy.labels" . | nindent 4 }} name: {{ .Release.Name }} roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/stable/gcloud-sqlproxy/templates/secrets.yaml b/stable/gcloud-sqlproxy/templates/secrets.yaml index 8691c81..b219b1f 100755 --- a/stable/gcloud-sqlproxy/templates/secrets.yaml +++ b/stable/gcloud-sqlproxy/templates/secrets.yaml @@ -5,13 +5,10 @@ kind: Secret metadata: name: {{ include "gcloud-sqlproxy.fullname" . }} labels: - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} - helm.sh/chart: {{ include "gcloud-sqlproxy.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "gcloud-sqlproxy.labels" . | nindent 4 }} type: Opaque data: credentials.json: |- {{ .Values.serviceAccountKey }} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/stable/gcloud-sqlproxy/templates/serviceaccount.yaml b/stable/gcloud-sqlproxy/templates/serviceaccount.yaml index a8a5a55..37adb90 100755 --- a/stable/gcloud-sqlproxy/templates/serviceaccount.yaml +++ b/stable/gcloud-sqlproxy/templates/serviceaccount.yaml @@ -4,9 +4,6 @@ kind: ServiceAccount metadata: namespace: {{ .Values.namespace }} labels: - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} - helm.sh/chart: {{ include "gcloud-sqlproxy.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "gcloud-sqlproxy.labels" . | nindent 4 }} name: {{ include "gcloud-sqlproxy.fullname" . }} {{- end }} diff --git a/stable/gcloud-sqlproxy/templates/svc.yaml b/stable/gcloud-sqlproxy/templates/svc.yaml index 76c5024..0bba814 100755 --- a/stable/gcloud-sqlproxy/templates/svc.yaml +++ b/stable/gcloud-sqlproxy/templates/svc.yaml @@ -7,10 +7,7 @@ metadata: cloud.google.com/load-balancer-type: "Internal" {{- end }} labels: - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} - helm.sh/chart: {{ include "gcloud-sqlproxy.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "gcloud-sqlproxy.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -21,5 +18,4 @@ spec: targetPort: {{ .instanceShortName | default (.instance | trunc 15) }} {{- end }} selector: - app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} \ No newline at end of file + {{- include "gcloud-sqlproxy.selectorLabels" . | nindent 4 }} From d281f5059507d678075685be67468544b56b6063 Mon Sep 17 00:00:00 2001 From: Naseem Date: Wed, 25 Dec 2019 10:41:28 -0500 Subject: [PATCH 3/4] bump version --- stable/gcloud-sqlproxy/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stable/gcloud-sqlproxy/Chart.yaml b/stable/gcloud-sqlproxy/Chart.yaml index 2801da8..94ea896 100755 --- a/stable/gcloud-sqlproxy/Chart.yaml +++ b/stable/gcloud-sqlproxy/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: gcloud-sqlproxy sources: - https://github.com/rimusz/charts -version: 0.19.2 +version: 0.19.3 From 577a9e1900c5bc43b340e2db90782a137b13a38b Mon Sep 17 00:00:00 2001 From: Naseem Date: Wed, 25 Dec 2019 10:42:22 -0500 Subject: [PATCH 4/4] Add yours truly as a maintainer --- stable/gcloud-sqlproxy/Chart.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stable/gcloud-sqlproxy/Chart.yaml b/stable/gcloud-sqlproxy/Chart.yaml index 94ea896..0754cc9 100755 --- a/stable/gcloud-sqlproxy/Chart.yaml +++ b/stable/gcloud-sqlproxy/Chart.yaml @@ -12,6 +12,8 @@ keywords: maintainers: - email: rmocius@gmail.com name: rimusz +- email: naseemkullah@gmail.com + name: naseemkullah name: gcloud-sqlproxy sources: - https://github.com/rimusz/charts