From d4481773870ea19a5ba1f068e4840d6e4d44fcde Mon Sep 17 00:00:00 2001
From: Dean Coakley <dean.s.coakley@gmail.com>
Date: Wed, 26 Aug 2020 18:55:55 +0100
Subject: [PATCH] Fix GlobalConfiguration support in helm chart

Bug introduced in: https://github.com/nginxinc/kubernetes-ingress/commit/058d596271cb24671e4bddb1722f0cd5cfde29aa

Generated GlobalConfiguration resourceName did not match the generated reference in the deployment/daemonset manifest.
---
 deployments/helm-chart/templates/controller-daemonset.yaml  | 2 +-
 deployments/helm-chart/templates/controller-deployment.yaml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/deployments/helm-chart/templates/controller-daemonset.yaml b/deployments/helm-chart/templates/controller-daemonset.yaml
index 0ea4a78845..1f58b6a9bf 100644
--- a/deployments/helm-chart/templates/controller-daemonset.yaml
+++ b/deployments/helm-chart/templates/controller-daemonset.yaml
@@ -143,7 +143,7 @@ spec:
           - -enable-tls-passthrough={{ .Values.controller.enableTLSPassthrough }}
           - -enable-snippets={{ .Values.controller.enableSnippets }}
 {{- if .Values.controller.globalConfiguration.create }}
-          - -global-configuration=$(POD_NAMESPACE)/{{ .Release.Name }}
+          - -global-configuration=$(POD_NAMESPACE)/{{ include "nginx-ingress.name" . }}
 {{- end }}
 {{- end }}
           - -ready-status={{ .Values.controller.readyStatus.enable }}
diff --git a/deployments/helm-chart/templates/controller-deployment.yaml b/deployments/helm-chart/templates/controller-deployment.yaml
index 4349141f9f..6b952d25f9 100644
--- a/deployments/helm-chart/templates/controller-deployment.yaml
+++ b/deployments/helm-chart/templates/controller-deployment.yaml
@@ -141,7 +141,7 @@ spec:
           - -enable-tls-passthrough={{ .Values.controller.enableTLSPassthrough }}
           - -enable-snippets={{ .Values.controller.enableSnippets }}
 {{- if .Values.controller.globalConfiguration.create }}
-          - -global-configuration=$(POD_NAMESPACE)/{{ .Release.Name }}
+          - -global-configuration=$(POD_NAMESPACE)/{{ include "nginx-ingress.name" . }}
 {{- end }}
 {{- end }}
           - -ready-status={{ .Values.controller.readyStatus.enable }}