@@ -18,7 +18,6 @@ package v1
1818import (
1919 "context"
2020 "fmt"
21- "slices"
2221
2322 networkingv1 "k8s.io/api/networking/v1"
2423 "k8s.io/apimachinery/pkg/runtime"
@@ -36,36 +35,6 @@ import (
3635
3736var ingresslog = logf .Log .WithName ("ingress-resource" )
3837
39- // unsupportedAnnotations contains all the APISIX Ingress annotations that are not supported in 2.0.0
40- // ref: https://apisix.apache.org/docs/ingress-controller/upgrade-guide/#limited-support-for-ingress-annotations
41- var unsupportedAnnotations = []string {
42- "k8s.apisix.apache.org/use-regex" ,
43- "k8s.apisix.apache.org/auth-type" ,
44- }
45-
46- // checkUnsupportedAnnotations checks if the Ingress contains any unsupported annotations
47- // and returns appropriate warnings
48- func checkUnsupportedAnnotations (ingress * networkingv1.Ingress ) admission.Warnings {
49- var warnings admission.Warnings
50-
51- if len (ingress .Annotations ) == 0 {
52- return warnings
53- }
54-
55- for annotation := range ingress .Annotations {
56- if slices .Contains (unsupportedAnnotations , annotation ) {
57- warningMsg := fmt .Sprintf ("Annotation '%s' is not supported in APISIX Ingress Controller 2.0.0." , annotation )
58- warnings = append (warnings , warningMsg )
59- ingresslog .Info ("Detected unsupported annotation" ,
60- "ingress" , ingress .GetName (),
61- "namespace" , ingress .GetNamespace (),
62- "annotation" , annotation )
63- }
64- }
65-
66- return warnings
67- }
68-
6938// SetupIngressWebhookWithManager registers the webhook for Ingress in the manager.
7039func SetupIngressWebhookWithManager (mgr ctrl.Manager ) error {
7140 return ctrl .NewWebhookManagedBy (mgr ).For (& networkingv1.Ingress {}).
@@ -113,10 +82,7 @@ func (v *IngressCustomValidator) ValidateCreate(ctx context.Context, obj runtime
11382 return nil , fmt .Errorf ("%s" , sslvalidator .FormatConflicts (conflicts ))
11483 }
11584
116- // Check for unsupported annotations and generate warnings
117- warnings := checkUnsupportedAnnotations (ingress )
118- warnings = append (warnings , v .collectReferenceWarnings (ctx , ingress )... )
119-
85+ warnings := v .collectReferenceWarnings (ctx , ingress )
12086 return warnings , nil
12187}
12288
@@ -137,9 +103,7 @@ func (v *IngressCustomValidator) ValidateUpdate(ctx context.Context, oldObj, new
137103 return nil , fmt .Errorf ("%s" , sslvalidator .FormatConflicts (conflicts ))
138104 }
139105
140- // Check for unsupported annotations and generate warnings
141- warnings := checkUnsupportedAnnotations (ingress )
142- warnings = append (warnings , v .collectReferenceWarnings (ctx , ingress )... )
106+ warnings := v .collectReferenceWarnings (ctx , ingress )
143107 return warnings , nil
144108}
145109
0 commit comments