This is an automated email from the ASF dual-hosted git repository.
AlinsRan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git
The following commit(s) were added to refs/heads/master by this push:
new ff8cd429 fix: exclude status-only API v2 resources from readiness
gating (#2745)
ff8cd429 is described below
commit ff8cd42953b6e3af2b05fd2241c58a09740970b3
Author: yangkaa <[email protected]>
AuthorDate: Fri May 8 09:40:45 2026 +0800
fix: exclude status-only API v2 resources from readiness gating (#2745)
---
internal/manager/controllers.go | 20 +++++++------
internal/manager/controllers_test.go | 56 ++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 9 deletions(-)
diff --git a/internal/manager/controllers.go b/internal/manager/controllers.go
index a3970566..fd6e5782 100644
--- a/internal/manager/controllers.go
+++ b/internal/manager/controllers.go
@@ -337,15 +337,7 @@ func registerAPIv2ForReadiness(
readier readiness.ReadinessManager,
) {
var installed []schema.GroupVersionKind
- for _, resource := range []client.Object{
- &netv1.Ingress{},
- &apiv2.ApisixRoute{},
- &apiv2.ApisixGlobalRule{},
- &apiv2.ApisixPluginConfig{},
- &apiv2.ApisixTls{},
- &apiv2.ApisixConsumer{},
- &apiv2.ApisixUpstream{},
- } {
+ for _, resource := range apiV2ReadinessResources() {
gvk := types.GvkOf(resource)
if utils.HasAPIResource(mgr, resource) {
installed = append(installed, gvk)
@@ -368,6 +360,16 @@ func registerAPIv2ForReadiness(
})
}
+func apiV2ReadinessResources() []client.Object {
+ return []client.Object{
+ &netv1.Ingress{},
+ &apiv2.ApisixRoute{},
+ &apiv2.ApisixGlobalRule{},
+ &apiv2.ApisixTls{},
+ &apiv2.ApisixConsumer{},
+ }
+}
+
func registerAPIv1alpha1ForReadiness(
mgr manager.Manager,
log logr.Logger,
diff --git a/internal/manager/controllers_test.go
b/internal/manager/controllers_test.go
new file mode 100644
index 00000000..8158daf5
--- /dev/null
+++ b/internal/manager/controllers_test.go
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package manager
+
+import (
+ "testing"
+
+ netv1 "k8s.io/api/networking/v1"
+
+ apiv2 "github.com/apache/apisix-ingress-controller/api/v2"
+ types "github.com/apache/apisix-ingress-controller/internal/types"
+)
+
+func TestAPIv2ReadinessResources(t *testing.T) {
+ resources := apiV2ReadinessResources()
+ seen := map[string]bool{}
+ for _, resource := range resources {
+ seen[types.GvkOf(resource).String()] = true
+ }
+
+ want := []string{
+ types.GvkOf(&netv1.Ingress{}).String(),
+ types.GvkOf(&apiv2.ApisixRoute{}).String(),
+ types.GvkOf(&apiv2.ApisixGlobalRule{}).String(),
+ types.GvkOf(&apiv2.ApisixTls{}).String(),
+ types.GvkOf(&apiv2.ApisixConsumer{}).String(),
+ }
+ for _, gvk := range want {
+ if !seen[gvk] {
+ t.Fatalf("expected readiness resources to include %s",
gvk)
+ }
+ }
+
+ notExpected := []string{
+ types.GvkOf(&apiv2.ApisixPluginConfig{}).String(),
+ types.GvkOf(&apiv2.ApisixUpstream{}).String(),
+ }
+ for _, gvk := range notExpected {
+ if seen[gvk] {
+ t.Fatalf("expected readiness resources to exclude %s",
gvk)
+ }
+ }
+}