Skip to content

Commit 7695a38

Browse files
hdurand0710oktalz
authored andcommitted
MEDIUM: remove support for ingress.class annotation
In favor of .spec.ingressClassName
1 parent b5c9afa commit 7695a38

File tree

43 files changed

+159
-131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+159
-131
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: IngressClass
2+
apiVersion: networking.k8s.io/v1
3+
metadata:
4+
name: haproxy
5+
spec:
6+
controller: haproxy.org/ingress-controller/haproxy

deploy/tests/config/echo-app.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ kind: Ingress
4545
apiVersion: networking.k8s.io/v1
4646
metadata:
4747
name: http-echo
48-
annotations:
49-
ingress.class: haproxy
5048
spec:
49+
ingressClassName: haproxy
5150
rules:
5251
- host: "echo.haproxy.local"
5352
http:

deploy/tests/create.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ if [ "$EXPERIMENTAL_GWAPI" = "1" ]; then
9191
printf %80s |tr " " "="; echo ""
9292
fi
9393
kubectl apply -f $DIR/config/2.configmap.yaml
94+
kubectl apply -f $DIR/config/2.2.ingressclass.yaml
95+
9496
if [ "$EXPERIMENTAL_GWAPI" = "1" ]; then
9597
echo "Adding gateway-controller-name to IC config"
9698
cat deploy/tests/config/3.ingress-controller.yaml | sed 's#ingress.class=haproxy#&\n - --gateway-controller-name=haproxy.org/gateway-controller#g' | kubectl apply -f -

deploy/tests/e2e/access-control/config/deploy.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ apiVersion: networking.k8s.io/v1
5050
metadata:
5151
name: http-echo
5252
annotations:
53-
ingress.class: haproxy
5453
{{range .IngAnnotations}}
5554
{{ .Key }}: {{ .Value }}
5655
{{end}}
5756
spec:
57+
ingressClassName: haproxy
5858
rules:
5959
- host: {{ .Host }}
6060
http:

deploy/tests/e2e/basic-auth/config/deploy.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ metadata:
6464
annotations:
6565
auth-secret: basic-auth
6666
auth-type: basic-auth
67-
ingress.class: haproxy
6867
spec:
68+
ingressClassName: haproxy
6969
rules:
7070
- host: {{ .Host }}
7171
http:

deploy/tests/e2e/canary-deployment/config/deploy.yaml.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,8 @@ kind: Ingress
8787
apiVersion: networking.k8s.io/v1
8888
metadata:
8989
name: http-echo
90-
annotations:
91-
ingress.class: haproxy
9290
spec:
91+
ingressClassName: haproxy
9392
rules:
9493
- host: {{ .Host }}
9594
http:

deploy/tests/e2e/config-snippet/config/deploy.yaml.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ kind: Ingress
4848
apiVersion: networking.k8s.io/v1
4949
metadata:
5050
name: http-echo
51-
annotations:
52-
ingress.class: haproxy
5351
spec:
52+
ingressClassName: haproxy
5453
rules:
5554
- host: {{ .Host }}
5655
http:

deploy/tests/e2e/cookie-persistence/config/deploy.yml.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,13 @@ apiVersion: networking.k8s.io/v1
4646
metadata:
4747
name: http-echo
4848
annotations:
49-
ingress.class: haproxy
5049
{{ if .CookiePersistenceDynamic }}
5150
cookie-persistence: "mycookie"
5251
{{ else if .CookiePersistenceNoDynamic }}
5352
cookie-persistence-no-dynamic: "mycookie"
5453
{{ end }}
55-
5654
spec:
55+
ingressClassName: haproxy
5756
rules:
5857
- host: {{ .Host }}
5958
http:

deploy/tests/e2e/cors/config/deploy.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ apiVersion: networking.k8s.io/v1
5050
metadata:
5151
name: http-echo
5252
annotations:
53-
ingress.class: haproxy
5453
{{range .IngAnnotations}}
5554
{{ .Key }}: {{ .Value }}
5655
{{end}}
5756
spec:
57+
ingressClassName: haproxy
5858
rules:
5959
- host: {{ .Host }}
6060
http:

deploy/tests/e2e/crd/config/ingress.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ apiVersion: networking.k8s.io/v1
44
metadata:
55
name: http-echo
66
annotations:
7-
ingress.class: haproxy
87
{{- range .IngAnnotations}}
98
{{ .Key }}: "{{ .Value }}"
109
{{- end}}
1110
spec:
11+
ingressClassName: haproxy
1212
rules:
1313
- host: {{ .Host }}
1414
http:

deploy/tests/e2e/endpoints/config/endpoints.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ apiVersion: networking.k8s.io/v1
5353
metadata:
5454
name: http-echo
5555
annotations:
56-
ingress.class: haproxy
5756
{{- if .NotReady}}
5857
check: "false"
5958
backend-config-snippet: |
6059
http-request return status 503 if !{ nbsrv() eq 2 }
6160
{{- end}}
6261
spec:
62+
ingressClassName: haproxy
6363
rules:
6464
- host: {{ .Host }}
6565
http:

deploy/tests/e2e/haproxy-files/config/deploy.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ apiVersion: networking.k8s.io/v1
2222
metadata:
2323
name: http-echo
2424
annotations:
25-
ingress.class: haproxy
2625
backend-config-snippet: http-after-response set-header result %[var(txn.path),ltrim(/),map(patterns/mapping)]
2726
spec:
27+
ingressClassName: haproxy
2828
rules:
2929
- host: {{ .Host }}
3030
http:

deploy/tests/e2e/https-runtime/config/echo-app-offload-backend-crd.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ kind: Ingress
4747
apiVersion: networking.k8s.io/v1
4848
metadata:
4949
name: http-echo-offload
50-
annotations:
51-
ingress.class: haproxy
5250
spec:
51+
ingressClassName: haproxy
5352
tls:
5453
- hosts:
5554
- offload-test.haproxy

deploy/tests/e2e/https-runtime/config/echo-app-offload-default.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ kind: Ingress
4646
apiVersion: networking.k8s.io/v1
4747
metadata:
4848
name: http-echo-offload
49-
annotations:
50-
ingress.class: haproxy
5149
spec:
50+
ingressClassName: haproxy
5251
tls:
5352
- hosts:
5453
- default.haproxy

deploy/tests/e2e/https-runtime/config/echo-app-offload.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ kind: Ingress
4646
apiVersion: networking.k8s.io/v1
4747
metadata:
4848
name: http-echo-offload
49-
annotations:
50-
ingress.class: haproxy
5149
spec:
50+
ingressClassName: haproxy
5251
tls:
5352
- hosts:
5453
- offload-test.haproxy

deploy/tests/e2e/https/config/ingress.yaml.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ apiVersion: networking.k8s.io/v1
33
metadata:
44
name: http-echo
55
annotations:
6-
ingress.class: haproxy
76
{{range .IngAnnotations}}
87
{{ .Key }}: {{ .Value}}
9-
{{end}}
8+
{{end}}
109
spec:
10+
ingressClassName: haproxy
1111
{{if .TLSEnabled}}
1212
tls:
1313
- hosts:
@@ -16,7 +16,7 @@ spec:
1616
- hosts:
1717
- default.haproxy
1818
secretName: haproxy-default # Another cert to make sure HAProxy picks the right one
19-
{{end}}
19+
{{end}}
2020
rules:
2121
- host: {{ .Host }}
2222
http:

deploy/tests/e2e/ingress-match/config/ingress.yaml.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ kind: Ingress
44
apiVersion: networking.k8s.io/v1
55
metadata:
66
name: http-echo
7-
annotations:
8-
ingress.class: haproxy
97
spec:
8+
ingressClassName: haproxy
109
rules:
1110
{{- range .Rules }}
1211
- host: "{{.Host}}"

deploy/tests/e2e/ingressclass/ingressClass_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//go:build e2e_parallel
15+
//go:build e2e_sequential
1616

1717
package ingressclass
1818

@@ -67,6 +67,7 @@ func (suite *IngressClassSuite) Test_IngressClassName_Resource() {
6767

6868
return res.StatusCode == http.StatusServiceUnavailable || res.StatusCode == http.StatusNotFound
6969
}, e2e.WaitDuration, e2e.TickDuration)
70+
suite.Require().NoError(suite.test.Apply("config/ingressclass.yaml", "", nil))
7071
})
7172

7273
suite.Run("Enabled", func() {

deploy/tests/e2e/ingressclass/suite_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//go:build e2e_parallel
15+
//go:build e2e_sequential
1616

1717
package ingressclass
1818

@@ -49,10 +49,6 @@ func (suite *IngressClassSuite) SetupSuite() {
4949
suite.client, err = e2e.NewHTTPClient(suite.tmplData.Host)
5050
suite.Require().NoError(err)
5151
suite.Require().NoError(suite.test.Apply("config/deploy.yaml", suite.test.GetNS(), nil))
52-
suite.Require().NoError(suite.test.Apply("config/ingressclass.yaml", "", nil))
53-
suite.test.AddTearDown(func() error {
54-
return suite.test.Delete("config/ingressclass.yaml")
55-
})
5652
}
5753

5854
func (suite *IngressClassSuite) TearDownSuite() {

deploy/tests/e2e/map-updates/config/ingress.yaml.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ kind: Ingress
33
apiVersion: networking.k8s.io/v1
44
metadata:
55
name: http-echo
6-
annotations:
7-
ingress.class: haproxy
86
spec:
7+
ingressClassName: haproxy
98
rules:
109
- host: {{ .Host }}
1110
http:

deploy/tests/e2e/rate-limiting/config/ingress.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ apiVersion: networking.k8s.io/v1
44
metadata:
55
name: http-echo
66
annotations:
7-
ingress.class: haproxy
87
{{- range .IngAnnotations}}
98
{{ .Key }}: "{{ .Value }}"
109
{{- end}}
1110
spec:
11+
ingressClassName: haproxy
1212
rules:
1313
- host: {{ .Host }}
1414
http:

deploy/tests/e2e/send-proxy-protocol/config/deploy.yaml.tmpl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ kind: Ingress
4040
apiVersion: networking.k8s.io/v1
4141
metadata:
4242
name: http-echo
43-
annotations:
44-
ingress.class: haproxy
4543
spec:
44+
ingressClassName: haproxy
4645
rules:
4746
- host: {{ .Host }}
4847
http:
@@ -53,4 +52,4 @@ spec:
5352
service:
5453
name: http-echo
5554
port:
56-
name: http
55+
name: http

deploy/tests/e2e/service-discovery/config/ingress.yaml.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ kind: Ingress
33
apiVersion: networking.k8s.io/v1
44
metadata:
55
name: http-echo
6-
annotations:
7-
ingress.class: haproxy
86
spec:
7+
ingressClassName: haproxy
98
rules:
109
- host: {{ .Host }}
1110
http:

deploy/tests/e2e/set-header/config/ingress.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ apiVersion: networking.k8s.io/v1
44
metadata:
55
name: http-echo
66
annotations:
7-
ingress.class: haproxy
87
{{- range .IngAnnotations}}
98
{{ .Key }}: "{{ .Value }}"
109
{{- end}}
1110
spec:
11+
ingressClassName: haproxy
1212
rules:
1313
- host: {{ .Host }}
1414
http:

deploy/tests/e2e/source-ip/config/deploy.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ apiVersion: networking.k8s.io/v1
5050
metadata:
5151
name: http-echo
5252
annotations:
53-
ingress.class: haproxy
5453
{{range .IngAnnotations}}
5554
{{ .Key }}: {{ .Value }}
5655
{{end}}
5756
spec:
57+
ingressClassName: haproxy
5858
rules:
5959
- host: {{ .Host }}
6060
http:

deploy/tests/integration/config-snippet/disable_configsnippet_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ func newAppIngress() *store.Ingress {
5656
Name: ingressName,
5757
Namespace: appNs,
5858
Annotations: map[string]string{
59-
"haproxy.org/ingress.class": "haproxy",
60-
"backend-config-snippet": "http-send-name-header x-dst-server",
59+
"backend-config-snippet": "http-send-name-header x-dst-server",
6160
},
61+
Class: "haproxy",
6262
Rules: map[string]*store.IngressRule{
6363
"": {
6464
Paths: map[string]*store.IngressPath{

deploy/tests/integration/config-snippet/suite_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ func (suite *DisableConfigSnippetSuite) setupTest() {
5757

5858
ns := store.Namespace{Name: appNs, Status: store.ADDED}
5959
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.NAMESPACE, Namespace: ns.Name, Data: &ns}
60+
ingressClass := &store.IngressClass{
61+
Name: "haproxy",
62+
Controller: "haproxy.org/ingress-controller",
63+
Status: store.ADDED,
64+
}
65+
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.INGRESS_CLASS, Data: ingressClass}
6066
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND}
6167
controllerHasWorked := make(chan struct{})
6268
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND, EventProcessed: controllerHasWorked}

deploy/tests/tnr/routeacl/suite_test.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,20 @@ func (suite *UseBackendSuite) UseBackendFixture() (eventChan chan k8ssync.SyncDa
163163
}
164164
eventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.SERVICE, Namespace: service.Namespace, Data: service}
165165

166+
ingressClass := &store.IngressClass{
167+
Name: "haproxy",
168+
Controller: "haproxy.org/ingress-controller",
169+
Status: store.ADDED,
170+
}
171+
eventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.INGRESS_CLASS, Data: ingressClass}
172+
166173
prefixPathType := networkingv1.PathTypePrefix
167174
ingress := &store.Ingress{
168175
IngressCore: store.IngressCore{
169-
APIVersion: store.NETWORKINGV1,
170-
Name: "myapping",
171-
Namespace: ns.Name,
172-
Annotations: map[string]string{"haproxy.org/ingress.class": "haproxy"},
176+
APIVersion: store.NETWORKINGV1,
177+
Name: "myapping",
178+
Namespace: ns.Name,
179+
Class: "haproxy",
173180
Rules: map[string]*store.IngressRule{
174181
"": {
175182
Paths: map[string]*store.IngressPath{

deploy/tests/ut/acls/suite_test.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,19 @@ func (suite *ACLSuite) UseACLFixture() (eventChan chan k8ssync.SyncDataEvent) {
172172
}
173173
eventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.SERVICE, Namespace: service.Namespace, Data: service}
174174

175+
ingressClass := &store.IngressClass{
176+
Name: "haproxy",
177+
Controller: "haproxy.org/ingress-controller",
178+
Status: store.ADDED,
179+
}
180+
eventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.INGRESS_CLASS, Data: ingressClass}
181+
175182
ingress := &store.Ingress{
176183
IngressCore: store.IngressCore{
177-
APIVersion: store.NETWORKINGV1,
178-
Name: "myapping",
179-
Namespace: ns.Name,
180-
Annotations: map[string]string{"haproxy.org/ingress.class": "haproxy"},
184+
APIVersion: store.NETWORKINGV1,
185+
Name: "myapping",
186+
Namespace: ns.Name,
187+
Class: "haproxy",
181188
Rules: map[string]*store.IngressRule{
182189
"": {
183190
Paths: map[string]*store.IngressPath{

0 commit comments

Comments
 (0)