Skip to content

Commit

Permalink
Merge pull request #43 from naseemkullah/recommended-labels
Browse files Browse the repository at this point in the history
[gcloud-sqlproxy] Using recommended labels
  • Loading branch information
rimusz authored Jan 30, 2019
2 parents a6b4325 + ef6d247 commit 66c33fb
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 40 deletions.
2 changes: 1 addition & 1 deletion stable/gcloud-sqlproxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ maintainers:
name: gcloud-sqlproxy
sources:
- https://github.com/rimusz/charts
version: 0.10.1
version: 0.11.0
6 changes: 5 additions & 1 deletion stable/gcloud-sqlproxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,8 @@ By enabling the flag `usingGCPController` and having a GCP Service Account Contr
**From < 0.10.0 to >= 0.10.0**

Please note, if chart name is included in release name, it will now be used as full name.
E.g. service `gcloud-sqlproxy-gcloud-sqlproxy` will now show up as `gcloud-sqlproxy`.
E.g. service `gcloud-sqlproxy-gcloud-sqlproxy` will now show up as `gcloud-sqlproxy`.

**From < 0.11.0 to >= 0.11.0**

Please note, as of `0.11.0` recommended labels are used. Please take into anything that may target your release's objects via labels.
7 changes: 7 additions & 0 deletions stable/gcloud-sqlproxy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ If release name contains chart name it will be used as a full name.
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "gcloud-sqlproxy.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Generate gcp service account name
*/}}
Expand Down
12 changes: 6 additions & 6 deletions stable/gcloud-sqlproxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ kind: Deployment
metadata:
name: {{ include "gcloud-sqlproxy.fullname" . }}
labels:
app: {{ include "gcloud-sqlproxy.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
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 }}
spec:
replicas: {{ .Values.replicasCount }}
template:
metadata:
labels:
app: {{ include "gcloud-sqlproxy.fullname" . }}
release: "{{ .Release.Name }}"
app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- if .Values.rbac.create }}
serviceAccountName: {{ include "gcloud-sqlproxy.fullname" . }}
Expand Down
12 changes: 6 additions & 6 deletions stable/gcloud-sqlproxy/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ apiVersion: networking.k8s.io/v1
metadata:
name: "{{ include "gcloud-sqlproxy.fullname" . }}"
labels:
app: {{ include "gcloud-sqlproxy.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
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 }}
spec:
podSelector:
matchLabels:
app: {{ include "gcloud-sqlproxy.name" . }}
release: "{{ .Release.Name }}"
app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
ingress:
# Allow inbound connections
- ports:
Expand Down
11 changes: 6 additions & 5 deletions stable/gcloud-sqlproxy/templates/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
app: {{ include "gcloud-sqlproxy.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
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 }}
name: {{ include "gcloud-sqlproxy.fullname" . }}
spec:
selector:
matchLabels:
app: {{ include "gcloud-sqlproxy.fullname" . }}
app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ .Values.podDisruptionBudget | indent 2 }}
{{- end -}}
8 changes: 4 additions & 4 deletions stable/gcloud-sqlproxy/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ kind: Role
metadata:
namespace: {{ .Values.namespace }}
labels:
app: {{ include "gcloud-sqlproxy.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
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 }}
name: {{ include "gcloud-sqlproxy.fullname" . }}
rules:
- apiGroups: [""]
Expand Down
8 changes: 4 additions & 4 deletions stable/gcloud-sqlproxy/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ kind: RoleBinding
metadata:
namespace: {{ .Values.namespace }}
labels:
app: {{ include "gcloud-sqlproxy.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
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 }}
name: {{ .Release.Name }}
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
8 changes: 4 additions & 4 deletions stable/gcloud-sqlproxy/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ kind: Secret
metadata:
name: {{ include "gcloud-sqlproxy.fullname" . }}
labels:
app: {{ include "gcloud-sqlproxy.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
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 }}
type: Opaque
data:
credentials.json: |-
Expand Down
8 changes: 4 additions & 4 deletions stable/gcloud-sqlproxy/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ kind: ServiceAccount
metadata:
namespace: {{ .Values.namespace }}
labels:
app: {{ include "gcloud-sqlproxy.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
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 }}
name: {{ include "gcloud-sqlproxy.fullname" . }}
{{- end }}
11 changes: 6 additions & 5 deletions stable/gcloud-sqlproxy/templates/svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ kind: Service
metadata:
name: {{ include "gcloud-sqlproxy.fullname" . }}
labels:
app: {{ include "gcloud-sqlproxy.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
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 }}
spec:
ports:
{{- range .Values.cloudsql.instances }}
Expand All @@ -16,4 +16,5 @@ spec:
targetPort: {{ .instanceShortName | default (.instance | trunc 15) }}
{{- end }}
selector:
app: {{ include "gcloud-sqlproxy.fullname" . }}
app.kubernetes.io/name: {{ include "gcloud-sqlproxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}

0 comments on commit 66c33fb

Please sign in to comment.