Skip to content

Commit

Permalink
MEDIUM: remove support for ingress.class annotation
Browse files Browse the repository at this point in the history
In favor of .spec.ingressClassName
  • Loading branch information
hdurand0710 authored and oktalz committed Feb 7, 2025
1 parent b5c9afa commit 7695a38
Show file tree
Hide file tree
Showing 43 changed files with 159 additions and 131 deletions.
6 changes: 6 additions & 0 deletions deploy/tests/config/2.2.ingressclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: IngressClass
apiVersion: networking.k8s.io/v1
metadata:
name: haproxy
spec:
controller: haproxy.org/ingress-controller/haproxy
3 changes: 1 addition & 2 deletions deploy/tests/config/echo-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
spec:
ingressClassName: haproxy
rules:
- host: "echo.haproxy.local"
http:
Expand Down
2 changes: 2 additions & 0 deletions deploy/tests/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ if [ "$EXPERIMENTAL_GWAPI" = "1" ]; then
printf %80s |tr " " "="; echo ""
fi
kubectl apply -f $DIR/config/2.configmap.yaml
kubectl apply -f $DIR/config/2.2.ingressclass.yaml

if [ "$EXPERIMENTAL_GWAPI" = "1" ]; then
echo "Adding gateway-controller-name to IC config"
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 -
Expand Down
2 changes: 1 addition & 1 deletion deploy/tests/e2e/access-control/config/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
{{range .IngAnnotations}}
{{ .Key }}: {{ .Value }}
{{end}}
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
2 changes: 1 addition & 1 deletion deploy/tests/e2e/basic-auth/config/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ metadata:
annotations:
auth-secret: basic-auth
auth-type: basic-auth
ingress.class: haproxy
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
3 changes: 1 addition & 2 deletions deploy/tests/e2e/canary-deployment/config/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
3 changes: 1 addition & 2 deletions deploy/tests/e2e/config-snippet/config/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
3 changes: 1 addition & 2 deletions deploy/tests/e2e/cookie-persistence/config/deploy.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
{{ if .CookiePersistenceDynamic }}
cookie-persistence: "mycookie"
{{ else if .CookiePersistenceNoDynamic }}
cookie-persistence-no-dynamic: "mycookie"
{{ end }}

spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
2 changes: 1 addition & 1 deletion deploy/tests/e2e/cors/config/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
{{range .IngAnnotations}}
{{ .Key }}: {{ .Value }}
{{end}}
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
2 changes: 1 addition & 1 deletion deploy/tests/e2e/crd/config/ingress.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
{{- range .IngAnnotations}}
{{ .Key }}: "{{ .Value }}"
{{- end}}
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
2 changes: 1 addition & 1 deletion deploy/tests/e2e/endpoints/config/endpoints.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
{{- if .NotReady}}
check: "false"
backend-config-snippet: |
http-request return status 503 if !{ nbsrv() eq 2 }
{{- end}}
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
2 changes: 1 addition & 1 deletion deploy/tests/e2e/haproxy-files/config/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
backend-config-snippet: http-after-response set-header result %[var(txn.path),ltrim(/),map(patterns/mapping)]
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: http-echo-offload
annotations:
ingress.class: haproxy
spec:
ingressClassName: haproxy
tls:
- hosts:
- offload-test.haproxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: http-echo-offload
annotations:
ingress.class: haproxy
spec:
ingressClassName: haproxy
tls:
- hosts:
- default.haproxy
Expand Down
3 changes: 1 addition & 2 deletions deploy/tests/e2e/https-runtime/config/echo-app-offload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: http-echo-offload
annotations:
ingress.class: haproxy
spec:
ingressClassName: haproxy
tls:
- hosts:
- offload-test.haproxy
Expand Down
6 changes: 3 additions & 3 deletions deploy/tests/e2e/https/config/ingress.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
{{range .IngAnnotations}}
{{ .Key }}: {{ .Value}}
{{end}}
{{end}}
spec:
ingressClassName: haproxy
{{if .TLSEnabled}}
tls:
- hosts:
Expand All @@ -16,7 +16,7 @@ spec:
- hosts:
- default.haproxy
secretName: haproxy-default # Another cert to make sure HAProxy picks the right one
{{end}}
{{end}}
rules:
- host: {{ .Host }}
http:
Expand Down
3 changes: 1 addition & 2 deletions deploy/tests/e2e/ingress-match/config/ingress.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
spec:
ingressClassName: haproxy
rules:
{{- range .Rules }}
- host: "{{.Host}}"
Expand Down
3 changes: 2 additions & 1 deletion deploy/tests/e2e/ingressclass/ingressClass_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build e2e_parallel
//go:build e2e_sequential

package ingressclass

Expand Down Expand Up @@ -67,6 +67,7 @@ func (suite *IngressClassSuite) Test_IngressClassName_Resource() {

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

suite.Run("Enabled", func() {
Expand Down
6 changes: 1 addition & 5 deletions deploy/tests/e2e/ingressclass/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build e2e_parallel
//go:build e2e_sequential

package ingressclass

Expand Down Expand Up @@ -49,10 +49,6 @@ func (suite *IngressClassSuite) SetupSuite() {
suite.client, err = e2e.NewHTTPClient(suite.tmplData.Host)
suite.Require().NoError(err)
suite.Require().NoError(suite.test.Apply("config/deploy.yaml", suite.test.GetNS(), nil))
suite.Require().NoError(suite.test.Apply("config/ingressclass.yaml", "", nil))
suite.test.AddTearDown(func() error {
return suite.test.Delete("config/ingressclass.yaml")
})
}

func (suite *IngressClassSuite) TearDownSuite() {
Expand Down
3 changes: 1 addition & 2 deletions deploy/tests/e2e/map-updates/config/ingress.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
2 changes: 1 addition & 1 deletion deploy/tests/e2e/rate-limiting/config/ingress.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
{{- range .IngAnnotations}}
{{ .Key }}: "{{ .Value }}"
{{- end}}
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
5 changes: 2 additions & 3 deletions deploy/tests/e2e/send-proxy-protocol/config/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand All @@ -53,4 +52,4 @@ spec:
service:
name: http-echo
port:
name: http
name: http
3 changes: 1 addition & 2 deletions deploy/tests/e2e/service-discovery/config/ingress.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
2 changes: 1 addition & 1 deletion deploy/tests/e2e/set-header/config/ingress.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
{{- range .IngAnnotations}}
{{ .Key }}: "{{ .Value }}"
{{- end}}
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
2 changes: 1 addition & 1 deletion deploy/tests/e2e/source-ip/config/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ apiVersion: networking.k8s.io/v1
metadata:
name: http-echo
annotations:
ingress.class: haproxy
{{range .IngAnnotations}}
{{ .Key }}: {{ .Value }}
{{end}}
spec:
ingressClassName: haproxy
rules:
- host: {{ .Host }}
http:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func newAppIngress() *store.Ingress {
Name: ingressName,
Namespace: appNs,
Annotations: map[string]string{
"haproxy.org/ingress.class": "haproxy",
"backend-config-snippet": "http-send-name-header x-dst-server",
"backend-config-snippet": "http-send-name-header x-dst-server",
},
Class: "haproxy",
Rules: map[string]*store.IngressRule{
"": {
Paths: map[string]*store.IngressPath{
Expand Down
6 changes: 6 additions & 0 deletions deploy/tests/integration/config-snippet/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ func (suite *DisableConfigSnippetSuite) setupTest() {

ns := store.Namespace{Name: appNs, Status: store.ADDED}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.NAMESPACE, Namespace: ns.Name, Data: &ns}
ingressClass := &store.IngressClass{
Name: "haproxy",
Controller: "haproxy.org/ingress-controller",
Status: store.ADDED,
}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.INGRESS_CLASS, Data: ingressClass}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND}
controllerHasWorked := make(chan struct{})
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND, EventProcessed: controllerHasWorked}
Expand Down
15 changes: 11 additions & 4 deletions deploy/tests/tnr/routeacl/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,20 @@ func (suite *UseBackendSuite) UseBackendFixture() (eventChan chan k8ssync.SyncDa
}
eventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.SERVICE, Namespace: service.Namespace, Data: service}

ingressClass := &store.IngressClass{
Name: "haproxy",
Controller: "haproxy.org/ingress-controller",
Status: store.ADDED,
}
eventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.INGRESS_CLASS, Data: ingressClass}

prefixPathType := networkingv1.PathTypePrefix
ingress := &store.Ingress{
IngressCore: store.IngressCore{
APIVersion: store.NETWORKINGV1,
Name: "myapping",
Namespace: ns.Name,
Annotations: map[string]string{"haproxy.org/ingress.class": "haproxy"},
APIVersion: store.NETWORKINGV1,
Name: "myapping",
Namespace: ns.Name,
Class: "haproxy",
Rules: map[string]*store.IngressRule{
"": {
Paths: map[string]*store.IngressPath{
Expand Down
15 changes: 11 additions & 4 deletions deploy/tests/ut/acls/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,19 @@ func (suite *ACLSuite) UseACLFixture() (eventChan chan k8ssync.SyncDataEvent) {
}
eventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.SERVICE, Namespace: service.Namespace, Data: service}

ingressClass := &store.IngressClass{
Name: "haproxy",
Controller: "haproxy.org/ingress-controller",
Status: store.ADDED,
}
eventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.INGRESS_CLASS, Data: ingressClass}

ingress := &store.Ingress{
IngressCore: store.IngressCore{
APIVersion: store.NETWORKINGV1,
Name: "myapping",
Namespace: ns.Name,
Annotations: map[string]string{"haproxy.org/ingress.class": "haproxy"},
APIVersion: store.NETWORKINGV1,
Name: "myapping",
Namespace: ns.Name,
Class: "haproxy",
Rules: map[string]*store.IngressRule{
"": {
Paths: map[string]*store.IngressPath{
Expand Down
Loading

0 comments on commit 7695a38

Please sign in to comment.