From 997da5057d2d612f3b6b599870edf27d2625742e Mon Sep 17 00:00:00 2001 From: Vladyslav Riabyk Date: Mon, 4 Aug 2025 11:47:52 +0300 Subject: [PATCH 1/4] Add disable-ingress-status-update configuration option --- pkg/controller/builder.go | 2 +- pkg/ingress/status.go | 7 ++++++- pkg/status/updatestatus.go | 20 +++++++++++--------- pkg/utils/flags.go | 1 + 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/pkg/controller/builder.go b/pkg/controller/builder.go index 47812225..4c382de1 100644 --- a/pkg/controller/builder.go +++ b/pkg/controller/builder.go @@ -176,7 +176,7 @@ func (builder *Builder) Build() *HAProxyController { } updateStatusManager := builder.updateStatusManager if updateStatusManager == nil { - updateStatusManager = status.New(builder.clientSet, builder.osArgs.IngressClass, builder.osArgs.EmptyIngressClass) + updateStatusManager = status.New(builder.clientSet, builder.osArgs.IngressClass, builder.osArgs.EmptyIngressClass, builder.osArgs.DisableIngressStatusUpdate) } hostname, _ := os.Hostname() podIP := utils.GetIP() diff --git a/pkg/ingress/status.go b/pkg/ingress/status.go index f219ff14..d3f23383 100644 --- a/pkg/ingress/status.go +++ b/pkg/ingress/status.go @@ -11,7 +11,12 @@ import ( "k8s.io/client-go/kubernetes" ) -func (i *Ingress) UpdateStatus(client *kubernetes.Clientset) (err error) { +func (i *Ingress) UpdateStatus(client *kubernetes.Clientset, disableStatusUpdate bool) (err error) { + if disableStatusUpdate { + logger.Tracef("Skipping update of LoadBalancer status in ingress %s/%s due to configuration", i.resource.Namespace, i.resource.Name) + return nil + } + var lbi []networkingv1.IngressLoadBalancerIngress for _, addr := range i.resource.Addresses { diff --git a/pkg/status/updatestatus.go b/pkg/status/updatestatus.go index 8b724032..4103d284 100644 --- a/pkg/status/updatestatus.go +++ b/pkg/status/updatestatus.go @@ -17,17 +17,19 @@ type UpdateStatusManager interface { } type UpdateStatusManagerImpl struct { - client *kubernetes.Clientset - ingressClass string - updateIngresses []*ingress.Ingress - emptyIngressClass bool + client *kubernetes.Clientset + ingressClass string + updateIngresses []*ingress.Ingress + emptyIngressClass bool + disableIngressStatusUpdate bool } -func New(client *kubernetes.Clientset, ingressClass string, emptyIngressClass bool) UpdateStatusManager { +func New(client *kubernetes.Clientset, ingressClass string, emptyIngressClass bool, disableIngressStatusUpdate bool) UpdateStatusManager { return &UpdateStatusManagerImpl{ - client: client, - ingressClass: ingressClass, - emptyIngressClass: emptyIngressClass, + client: client, + ingressClass: ingressClass, + emptyIngressClass: emptyIngressClass, + disableIngressStatusUpdate: disableIngressStatusUpdate, } } @@ -75,7 +77,7 @@ func (m *UpdateStatusManagerImpl) Update(k store.K8s, h haproxy.HAProxy, a annot go func() { for _, ing := range ingresses { if ing != nil { - errs.Add(ing.UpdateStatus(m.client)) + errs.Add(ing.UpdateStatus(m.client, m.disableIngressStatusUpdate)) } } }() diff --git a/pkg/utils/flags.go b/pkg/utils/flags.go index c92271e5..322a31da 100644 --- a/pkg/utils/flags.go +++ b/pkg/utils/flags.go @@ -122,4 +122,5 @@ type OSArgs struct { DisableDelayedWritingOnlyIfReload bool `long:"disable-writing-only-if-reload" description:"disable the delayed writing of files to disk only in case of haproxy reload (=write files to disk even if no reload)"` CRDInputFile string `long:"input-file" description:"The file path of a CRD manifest to convert"` CRDOutputFile string `long:"output-file" description:"The file path of the converted (to the most recent version) CRD manifest"` + DisableIngressStatusUpdate bool `long:"disable-ingress-status-update" description:"If true, disables updating the status field of Ingress resources"` } From 8311aade1ebe3b430ac3eb14cae53f2342ad24f9 Mon Sep 17 00:00:00 2001 From: Vladyslav Riabyk Date: Fri, 8 Aug 2025 12:09:12 +0300 Subject: [PATCH 2/4] update documentation --- documentation/controller.md | 18 +++++++++++++++++- documentation/doc.yaml | 10 ++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/documentation/controller.md b/documentation/controller.md index 3bf1075c..ffbdda57 100644 --- a/documentation/controller.md +++ b/documentation/controller.md @@ -1,4 +1,3 @@ - # ![HAProxy](../assets/images/haproxy-weblogo-210x49.png "HAProxy") ## HAProxy kubernetes ingress controller @@ -49,6 +48,7 @@ Image can be run with arguments: | [`--disable-writing-only-if-reload`](#--disable-writing-only-if-reload) :construction:(dev) | `false` | | [`--input-file`](#--input-file) :construction:(dev) | | | [`--output-file`](#--output-file) :construction:(dev) | | +| [`--disable-ingress-status-update`](#--disable-ingress-status-update) | `false` | ### `--configmap` @@ -883,5 +883,21 @@ Example:

:arrow_up_small: back to top

+### `--disable-ingress-status-update` + + If set, disables updating the status field of Ingress resources by the controller. By default, the controller will update the status field with the LoadBalancer address. This flag is useful if you want to prevent the controller from modifying Ingress status, for example when using another controller or external process to manage status updates. + +Possible values: + +- Boolean value, just need to declare the flag to disable status updates. + +Example: + +```yaml +--disable-ingress-status-update +``` + +

:arrow_up_small: back to top

+ *** diff --git a/documentation/doc.yaml b/documentation/doc.yaml index 1f401147..d50d8cea 100644 --- a/documentation/doc.yaml +++ b/documentation/doc.yaml @@ -420,6 +420,16 @@ image_arguments: - Path a to a CRD manifest where the converted v3 CRDs will be written example: --output-file=/home/xxx/convert/v3/global-full.yaml version_min: "3.2" + - argument: --disable-ingress-status-update + description: |- + If set, disables updating the status field of Ingress resources by the controller. + By default, the controller will update the status field with the LoadBalancer address. + This flag is useful if you want to prevent the controller from modifying Ingress status, for example when using another controller or external process to manage status updates. + values: + - Boolean flag; just declare the flag to disable status updates. + default: false + version_min: "3.0" + example: --disable-ingress-status-update groups: config-snippet: header: |- From 2f2e481551c6bb3a1869c2eb335aa8d91157d9ef Mon Sep 17 00:00:00 2001 From: Vladyslav Riabyk Date: Fri, 8 Aug 2025 12:10:15 +0300 Subject: [PATCH 3/4] update documentation --- documentation/controller.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/controller.md b/documentation/controller.md index ffbdda57..8a3efe88 100644 --- a/documentation/controller.md +++ b/documentation/controller.md @@ -1,3 +1,4 @@ + # ![HAProxy](../assets/images/haproxy-weblogo-210x49.png "HAProxy") ## HAProxy kubernetes ingress controller From bcd32d48b2d6a28c5c79f764d8e97726cc507000 Mon Sep 17 00:00:00 2001 From: Vladyslav Riabyk Date: Mon, 18 Aug 2025 11:16:56 +0300 Subject: [PATCH 4/4] update documentation --- documentation/controller.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/documentation/controller.md b/documentation/controller.md index 8a3efe88..1d745b59 100644 --- a/documentation/controller.md +++ b/documentation/controller.md @@ -884,13 +884,17 @@ Example:

:arrow_up_small: back to top

+*** + ### `--disable-ingress-status-update` - If set, disables updating the status field of Ingress resources by the controller. By default, the controller will update the status field with the LoadBalancer address. This flag is useful if you want to prevent the controller from modifying Ingress status, for example when using another controller or external process to manage status updates. + If set, disables updating the status field of Ingress resources by the controller. +By default, the controller will update the status field with the LoadBalancer address. +This flag is useful if you want to prevent the controller from modifying Ingress status, for example when using another controller or external process to manage status updates. Possible values: -- Boolean value, just need to declare the flag to disable status updates. +- Boolean flag; just declare the flag to disable status updates. Example: