From 21f39e966dedb0765a9848302f8cb713aa461cfe Mon Sep 17 00:00:00 2001 From: Jintao Zhang Date: Thu, 27 Oct 2022 17:34:13 +0800 Subject: [PATCH] fix: handle v2 ApisixPluginConfig status (#1409) Signed-off-by: Jintao Zhang --- pkg/ingress/status.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/ingress/status.go b/pkg/ingress/status.go index a897b1f72c..82a16ef5ec 100644 --- a/pkg/ingress/status.go +++ b/pkg/ingress/status.go @@ -241,6 +241,23 @@ func (c *Controller) recordStatus(at interface{}, reason string, err error, stat ) } } + case *configv2.ApisixPluginConfig: + // set to status + if v.Status.Conditions == nil { + conditions := make([]metav1.Condition, 0) + v.Status.Conditions = conditions + } + if c.verifyGeneration(&v.Status.Conditions, condition) { + meta.SetStatusCondition(&v.Status.Conditions, condition) + if _, errRecord := client.ApisixV2().ApisixPluginConfigs(v.Namespace). + UpdateStatus(context.TODO(), v, metav1.UpdateOptions{}); errRecord != nil { + log.Errorw("failed to record status change for ApisixPluginConfig", + zap.Error(errRecord), + zap.String("name", v.Name), + zap.String("namespace", v.Namespace), + ) + } + } case *configv2beta3.ApisixClusterConfig: // set to status if v.Status.Conditions == nil {