From f83b44b513af85481a6a5f94cb6be1631b5a55db Mon Sep 17 00:00:00 2001 From: kakascx <395752434@qq.com> Date: Wed, 15 Mar 2023 17:55:11 +0800 Subject: [PATCH] fix: add annotation for UI ingress add the https annotation for UI ingress when using secure mode --- pkg/resource/ui_ingress.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/resource/ui_ingress.go b/pkg/resource/ui_ingress.go index c73aacdd6..09dfb33f9 100644 --- a/pkg/resource/ui_ingress.go +++ b/pkg/resource/ui_ingress.go @@ -69,6 +69,9 @@ func (b *UIIngressBuilder) BuildV1Ingress(obj client.Object) error { } kube.MergeAnnotations(ingress.ObjectMeta.Annotations, b.SSLPassThroughAnnotations()) + if b.Spec().Ingress.UI.TLS != nil { + kube.MergeAnnotations(ingress.ObjectMeta.Annotations, b.BackendProtocolAnnotations()) + } ingressConfig := b.Spec().Ingress if ingressConfig == nil { @@ -113,6 +116,9 @@ func (b *UIIngressBuilder) BuildV1beta1Ingress(obj client.Object) error { } kube.MergeAnnotations(ingress.ObjectMeta.Annotations, b.SSLPassThroughAnnotations()) + if b.Spec().Ingress.UI.TLS != nil { + kube.MergeAnnotations(ingress.ObjectMeta.Annotations, b.BackendProtocolAnnotations()) + } ingressConfig := b.Spec().Ingress if ingressConfig == nil { @@ -204,3 +210,9 @@ func (b *UIIngressBuilder) SSLPassThroughAnnotations() map[string]string { "nginx.ingress.kubernetes.io/ssl-passthrough": "true", } } + +func (b *UIIngressBuilder) BackendProtocolAnnotations() map[string]string { + return map[string]string{ + "nginx.ingress.kubernetes.io/backend-protocol": "HTTPS", + } +}