From a6fb274dd11018fa5d016621be23f1c302833f2c Mon Sep 17 00:00:00 2001 From: irizzant Date: Fri, 24 Apr 2020 04:34:06 +0200 Subject: [PATCH] [incubator/haproxy-ingress] Labels are not compatible with Istio requirements (#22076) * Adjust app label to match Istio requirements Signed-off-by: Ivan Rizzante * Bump chart version Signed-off-by: Ivan Rizzante * Add default values Signed-off-by: Ivan Rizzante Co-authored-by: Ivan Rizzante --- incubator/haproxy-ingress/Chart.yaml | 2 +- incubator/haproxy-ingress/templates/_helpers.tpl | 14 ++++++++++++++ .../templates/controller-daemonset.yaml | 6 +++--- .../templates/controller-deployment.yaml | 6 +++--- .../templates/controller-metrics-service.yaml | 4 ++-- .../templates/controller-poddisruptionbudget.yaml | 4 ++-- .../templates/controller-service.yaml | 4 ++-- .../templates/controller-stats-service.yaml | 4 ++-- .../templates/default-backend-deployment.yaml | 6 +++--- .../default-backend-poddisruptionbudget.yaml | 4 ++-- .../templates/default-backend-service.yaml | 4 ++-- 11 files changed, 36 insertions(+), 22 deletions(-) diff --git a/incubator/haproxy-ingress/Chart.yaml b/incubator/haproxy-ingress/Chart.yaml index cb1f7a6735..b331afa74c 100644 --- a/incubator/haproxy-ingress/Chart.yaml +++ b/incubator/haproxy-ingress/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: haproxy-ingress -version: 0.0.24 +version: 0.0.25 appVersion: 0.7.2 home: https://github.com/jcmoraisjr/haproxy-ingress description: Ingress controller implementation for haproxy loadbalancer. diff --git a/incubator/haproxy-ingress/templates/_helpers.tpl b/incubator/haproxy-ingress/templates/_helpers.tpl index 07001f2721..53496577d4 100644 --- a/incubator/haproxy-ingress/templates/_helpers.tpl +++ b/incubator/haproxy-ingress/templates/_helpers.tpl @@ -6,6 +6,20 @@ Expand the name of the chart. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{/* +Create the app label for controller +*/}} +{{- define "haproxy-ingress.labels.app.controller" -}} +{{ default "haproxy-ingress.name" }}-controller +{{- end -}} + +{{/* +Create the app label for default backend +*/}} +{{- define "haproxy-ingress.labels.app.default-backend" -}} +{{ default "haproxy-ingress.name" }}-default-backend +{{- 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/incubator/haproxy-ingress/templates/controller-daemonset.yaml b/incubator/haproxy-ingress/templates/controller-daemonset.yaml index a5be71028a..6af7066086 100644 --- a/incubator/haproxy-ingress/templates/controller-daemonset.yaml +++ b/incubator/haproxy-ingress/templates/controller-daemonset.yaml @@ -3,7 +3,7 @@ apiVersion: apps/v1 kind: DaemonSet metadata: labels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} chart: {{ template "haproxy-ingress.chart" . }} component: "{{ .Values.controller.name }}" release: {{ .Release.Name }} @@ -16,7 +16,7 @@ spec: minReadySeconds: {{ .Values.controller.minReadySeconds }} selector: matchLabels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} release: {{ .Release.Name }} template: metadata: @@ -28,7 +28,7 @@ spec: {{ toYaml .Values.controller.podAnnotations | indent 8}} {{- end }} labels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} component: "{{ .Values.controller.name }}" release: {{ .Release.Name }} {{- if .Values.controller.podLabels }} diff --git a/incubator/haproxy-ingress/templates/controller-deployment.yaml b/incubator/haproxy-ingress/templates/controller-deployment.yaml index 96316e5bbf..36dbd3a1c4 100644 --- a/incubator/haproxy-ingress/templates/controller-deployment.yaml +++ b/incubator/haproxy-ingress/templates/controller-deployment.yaml @@ -3,7 +3,7 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} chart: {{ template "haproxy-ingress.chart" . }} component: "{{ .Values.controller.name }}" release: {{ .Release.Name }} @@ -20,7 +20,7 @@ spec: minReadySeconds: {{ .Values.controller.minReadySeconds }} selector: matchLabels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} component: "{{ .Values.controller.name }}" release: {{ .Release.Name }} template: @@ -33,7 +33,7 @@ spec: {{ toYaml .Values.controller.podAnnotations | indent 8}} {{- end }} labels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} component: "{{ .Values.controller.name }}" release: {{ .Release.Name }} {{- if .Values.controller.podLabels }} diff --git a/incubator/haproxy-ingress/templates/controller-metrics-service.yaml b/incubator/haproxy-ingress/templates/controller-metrics-service.yaml index 15861733c5..2da9cd6017 100644 --- a/incubator/haproxy-ingress/templates/controller-metrics-service.yaml +++ b/incubator/haproxy-ingress/templates/controller-metrics-service.yaml @@ -7,7 +7,7 @@ metadata: {{ toYaml .Values.controller.metrics.service.annotations | indent 4 }} {{- end }} labels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} component: "{{ .Values.controller.name }}" heritage: {{ .Release.Service }} @@ -32,7 +32,7 @@ spec: port: {{ .Values.controller.metrics.service.servicePort }} targetPort: metrics selector: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} component: "{{ .Values.controller.name }}" release: {{ .Release.Name }} type: "{{ .Values.controller.metrics.service.type }}" diff --git a/incubator/haproxy-ingress/templates/controller-poddisruptionbudget.yaml b/incubator/haproxy-ingress/templates/controller-poddisruptionbudget.yaml index da60a181e7..fdca412471 100644 --- a/incubator/haproxy-ingress/templates/controller-poddisruptionbudget.yaml +++ b/incubator/haproxy-ingress/templates/controller-poddisruptionbudget.yaml @@ -2,7 +2,7 @@ apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: labels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} chart: {{ template "haproxy-ingress.chart" . }} component: "{{ .Values.controller.name }}" release: {{ .Release.Name }} @@ -11,7 +11,7 @@ metadata: spec: selector: matchLabels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} release: {{ .Release.Name }} component: "{{ .Values.controller.name }}" minAvailable: {{ .Values.controller.minAvailable }} diff --git a/incubator/haproxy-ingress/templates/controller-service.yaml b/incubator/haproxy-ingress/templates/controller-service.yaml index 5c2f472842..974e41717c 100644 --- a/incubator/haproxy-ingress/templates/controller-service.yaml +++ b/incubator/haproxy-ingress/templates/controller-service.yaml @@ -9,7 +9,7 @@ metadata: {{- if .Values.controller.service.labels }} {{ toYaml .Values.controller.service.labels | indent 4 }} {{- end }} - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} chart: {{ template "haproxy-ingress.chart" . }} component: "{{ .Values.controller.name }}" release: {{ .Release.Name }} @@ -65,7 +65,7 @@ spec: targetPort: "{{ tpl $key $ }}-tcp" {{- end }} selector: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} component: "{{ .Values.controller.name }}" release: {{ .Release.Name }} type: "{{ .Values.controller.service.type }}" diff --git a/incubator/haproxy-ingress/templates/controller-stats-service.yaml b/incubator/haproxy-ingress/templates/controller-stats-service.yaml index 50104b7d68..6b5bb8ee3d 100644 --- a/incubator/haproxy-ingress/templates/controller-stats-service.yaml +++ b/incubator/haproxy-ingress/templates/controller-stats-service.yaml @@ -7,7 +7,7 @@ metadata: {{ toYaml .Values.controller.stats.service.annotations | indent 4 }} {{- end }} labels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} component: "{{ .Values.controller.name }}" heritage: {{ .Release.Service }} @@ -32,7 +32,7 @@ spec: port: {{ .Values.controller.stats.service.servicePort }} targetPort: stats selector: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.controller" . }} component: "{{ .Values.controller.name }}" release: {{ .Release.Name }} type: "{{ .Values.controller.stats.service.type }}" diff --git a/incubator/haproxy-ingress/templates/default-backend-deployment.yaml b/incubator/haproxy-ingress/templates/default-backend-deployment.yaml index d83cc29733..5655c718a7 100644 --- a/incubator/haproxy-ingress/templates/default-backend-deployment.yaml +++ b/incubator/haproxy-ingress/templates/default-backend-deployment.yaml @@ -3,7 +3,7 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.default-backend" . }} chart: {{ template "haproxy-ingress.chart" . }} component: "{{ .Values.defaultBackend.name }}" heritage: {{ .Release.Service }} @@ -14,7 +14,7 @@ spec: replicas: {{ .Values.defaultBackend.replicaCount }} selector: matchLabels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.default-backend" . }} component: "{{ .Values.defaultBackend.name }}" release: {{ .Release.Name }} template: @@ -24,7 +24,7 @@ spec: {{ toYaml .Values.defaultBackend.podAnnotations | indent 8 }} {{- end }} labels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.default-backend" . }} component: "{{ .Values.defaultBackend.name }}" release: {{ .Release.Name }} {{- if .Values.defaultBackend.podLabels }} diff --git a/incubator/haproxy-ingress/templates/default-backend-poddisruptionbudget.yaml b/incubator/haproxy-ingress/templates/default-backend-poddisruptionbudget.yaml index dc3aaffa68..883773e7dd 100644 --- a/incubator/haproxy-ingress/templates/default-backend-poddisruptionbudget.yaml +++ b/incubator/haproxy-ingress/templates/default-backend-poddisruptionbudget.yaml @@ -2,7 +2,7 @@ apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: labels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.default-backend" . }} chart: {{ template "haproxy-ingress.chart" . }} component: "{{ .Values.defaultBackend.name }}" release: {{ .Release.Name }} @@ -11,7 +11,7 @@ metadata: spec: selector: matchLabels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.default-backend" . }} release: {{ .Release.Name }} component: "{{ .Values.defaultBackend.name }}" minAvailable: {{ .Values.defaultBackend.minAvailable }} diff --git a/incubator/haproxy-ingress/templates/default-backend-service.yaml b/incubator/haproxy-ingress/templates/default-backend-service.yaml index 883dca8a41..29dd065e0b 100644 --- a/incubator/haproxy-ingress/templates/default-backend-service.yaml +++ b/incubator/haproxy-ingress/templates/default-backend-service.yaml @@ -7,7 +7,7 @@ metadata: {{ toYaml .Values.defaultBackend.service.annotations | indent 4 }} {{- end }} labels: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.default-backend" . }} chart: {{ template "haproxy-ingress.chart" . }} component: "{{ .Values.defaultBackend.name }}" release: {{ .Release.Name }} @@ -35,7 +35,7 @@ spec: protocol: TCP targetPort: http selector: - app: {{ template "haproxy-ingress.name" . }} + app: {{ template "haproxy-ingress.labels.app.default-backend" . }} component: "{{ .Values.defaultBackend.name }}" release: {{ .Release.Name }} type: "{{ .Values.defaultBackend.service.type }}"