From 20a02bff421224380b9c4656e60bc7e547c63fcc Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Mon, 13 Jul 2020 18:14:26 +0200 Subject: [PATCH] Port name + helm revision based podAntiAffinity to redirect and docker-hub-exporter ALso sneaked in a new logo for Redirect --- charts/docker-hub-exporter/Chart.yaml | 4 ++-- .../templates/_helpers.tpl | 4 ++++ .../templates/deployment.yaml | 4 +++- charts/redirect/Chart.yaml | 22 +++---------------- charts/redirect/templates/_helpers.tpl | 4 ++++ charts/redirect/templates/deployment.yaml | 4 +++- 6 files changed, 19 insertions(+), 23 deletions(-) diff --git a/charts/docker-hub-exporter/Chart.yaml b/charts/docker-hub-exporter/Chart.yaml index ed6acc4..07afe9d 100644 --- a/charts/docker-hub-exporter/Chart.yaml +++ b/charts/docker-hub-exporter/Chart.yaml @@ -1,10 +1,10 @@ apiVersion: v2 name: docker-hub-exporter -description: Docker Hub exporter +description: Docker Hub Exporter home: https://github.com/jessestuart/docker-hub-exporter icon: https://helm.wyrihaximus.net/images/charts/docker-hub-exporter.png type: application -version: 0.4.0 +version: 0.5.0 appVersion: d05df48 maintainers: - name: WyriHaximus diff --git a/charts/docker-hub-exporter/templates/_helpers.tpl b/charts/docker-hub-exporter/templates/_helpers.tpl index 884fed3..cf725e2 100644 --- a/charts/docker-hub-exporter/templates/_helpers.tpl +++ b/charts/docker-hub-exporter/templates/_helpers.tpl @@ -6,6 +6,10 @@ Expand the name of the chart. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define ".helm.nameRevision" -}} +{{ template ".helm.name" . }}___{{ .Release.Revision }} +{{- end -}} + {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). diff --git a/charts/docker-hub-exporter/templates/deployment.yaml b/charts/docker-hub-exporter/templates/deployment.yaml index 6bdebc8..d3ae9e8 100644 --- a/charts/docker-hub-exporter/templates/deployment.yaml +++ b/charts/docker-hub-exporter/templates/deployment.yaml @@ -4,7 +4,9 @@ metadata: name: {{ include ".helm.fullname" . }} labels: app: {{ include ".helm.fullname" . }} + appRevision: {{ template ".helm.nameRevision" . }} release: {{ include ".helm.fullname" . }} + releaseRevision: {{ .Release.Revision | quote }} {{- include ".helm.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicas }} @@ -62,5 +64,5 @@ spec: - key: app operator: In values: - - {{ include ".helm.fullname" . }} + - {{ template ".helm.nameRevision" . }} topologyKey: "kubernetes.io/hostname" diff --git a/charts/redirect/Chart.yaml b/charts/redirect/Chart.yaml index 86c1b02..30a51ea 100644 --- a/charts/redirect/Chart.yaml +++ b/charts/redirect/Chart.yaml @@ -1,27 +1,11 @@ apiVersion: v2 name: redirect -description: Redirect Delpoyment +description: Redirect home: https://github.com/wyrihaximusnet/docker-redirect -icon: https://avatars0.githubusercontent.com/u/19738034?s=200&v=4 - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. +icon: https://helm.wyrihaximus.net/images/charts/redirect.png type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -version: 0.4.1 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. +version: 0.5.0 appVersion: random - maintainers: - name: WyriHaximus email: helm@wyrihaximus.net diff --git a/charts/redirect/templates/_helpers.tpl b/charts/redirect/templates/_helpers.tpl index 79035a7..54e7d71 100644 --- a/charts/redirect/templates/_helpers.tpl +++ b/charts/redirect/templates/_helpers.tpl @@ -51,6 +51,10 @@ app.kubernetes.io/name: {{ include ".helm.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} +{{- define ".helm.nameRevision" -}} +{{ template ".helm.name" . }}___{{ .Release.Revision }} +{{- end -}} + {{/* Create the name of the service account to use */}} diff --git a/charts/redirect/templates/deployment.yaml b/charts/redirect/templates/deployment.yaml index b002660..38481b9 100644 --- a/charts/redirect/templates/deployment.yaml +++ b/charts/redirect/templates/deployment.yaml @@ -4,7 +4,9 @@ metadata: name: {{ include ".helm.fullname" . }} labels: app: {{ include ".helm.fullname" . }} + appRevision: {{ template ".helm.nameRevision" . }} release: {{ include ".helm.fullname" . }} + releaseRevision: {{ .Release.Revision | quote }} {{- include ".helm.labels" . | nindent 4 }} {{- toYaml .Values.labels | nindent 4 }} spec: @@ -74,5 +76,5 @@ spec: - key: app operator: In values: - - {{ include ".helm.fullname" . }} + - {{ template ".helm.nameRevision" . }} topologyKey: "kubernetes.io/hostname"