Skip to content

Commit

Permalink
Merge pull request zalando-incubator#515 from zalando-incubator/ingre…
Browse files Browse the repository at this point in the history
…ss-upgrade-v1

Limit ingress support to only networking.k8s.io/v1
  • Loading branch information
katyanna authored Jan 31, 2024
2 parents 2275800 + d9390b6 commit c530fcd
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 43 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ This information is used to manage AWS resources for each ingress objects of the

## Upgrade

### <v0.15.0 to >=v0.15.0

Version `v0.15.0` removes support for deprecated Ingress versions
`extensions/v1beta1` and `networking.k8s.io/v1beta1`.

### <v0.14.0 to >=v0.14.0

Version `v0.14.0` makes `target-access-mode` flag required to make upgrading users aware of the [issue](https://github.com/zalando-incubator/kube-ingress-aws-controller/issues/507).
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.14
v0.15
2 changes: 0 additions & 2 deletions controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ func loadSettings() error {
Default("false").BoolVar(&nlbCrossZone)
kingpin.Flag("nlb-http-enabled", "Enable HTTP (port 80) for Network Load Balancers. By default this is disabled as NLB can't provide HTTP -> HTTPS redirect.").
Default("false").BoolVar(&nlbHTTPEnabled)
kingpin.Flag("ingress-api-version", "APIversion used for listing/updating ingresses.").
Default(kubernetes.IngressAPIVersionNetworkingV1).EnumVar(&ingressAPIVersion, kubernetes.IngressAPIVersionNetworking, kubernetes.IngressAPIVersionExtensions, kubernetes.IngressAPIVersionNetworkingV1)
kingpin.Flag("deny-internal-domains", "Sets a rule on ALB's Listeners that denies requests with the Host header as a internal domain. Domains can be set with the -internal-domains flag.").
Default("false").BoolVar(&denyInternalDomains)
kingpin.Flag("internal-domains", "Define the internal domains to be blocked when -deny-internal-domains is set to true. Set it multiple times for multiple domains. The maximum size of each name is 128 characters. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).").
Expand Down
3 changes: 1 addition & 2 deletions kubernetes/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ const (
// ingressALBIPAddressType is used in external-dns, https://github.com/kubernetes-incubator/external-dns/pull/1079
ingressALBIPAddressType = "alb.ingress.kubernetes.io/ip-address-type"
IngressAPIVersionExtensions = "extensions/v1beta1"
IngressAPIVersionNetworking = "networking.k8s.io/v1beta1"
IngressAPIVersionNetworkingV1 = "networking.k8s.io/v1"
IngressAPIVersionNetworking = "networking.k8s.io/v1"
ingressListResource = "/apis/%s/ingresses"
ingressPatchStatusResource = "/apis/%s/namespaces/%s/ingresses/%s/status"
ingressCertificateARNAnnotation = "zalando.org/aws-load-balancer-ssl-cert"
Expand Down
31 changes: 1 addition & 30 deletions kubernetes/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

func TestListIngresses(t *testing.T) {
testServer := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
f, _ := os.Open("testdata/fixture01.json")
f, _ := os.Open("testdata/fixture03.json")
defer f.Close()
rw.WriteHeader(http.StatusOK)
_, err := io.Copy(rw, f)
Expand All @@ -30,35 +30,6 @@ func TestListIngresses(t *testing.T) {
newIngress("fixture02", map[string]string{ingressClassAnnotation: "skipper"}, "", "skipper.example.org", "fixture02", IngressAPIVersionNetworking),
newIngress("fixture03", map[string]string{ingressClassAnnotation: "other"}, "", "other.example.org", "fixture03", IngressAPIVersionNetworking),
newIngress("fixture04", nil, "another", "another.example.org", "fixture04", IngressAPIVersionNetworking),
newIngress("fixture05", map[string]string{ingressClassAnnotation: "yet-another-ignored"}, "yet-another", "yet-another.example.org", "fixture05", IngressAPIVersionNetworking),
)
got, err := ingressClient.listIngress(kubeClient)
if err != nil {
t.Errorf("unexpected error from listIngresses: %v", err)
} else {
if !reflect.DeepEqual(got, want) {
t.Errorf("unexpected result from listIngresses. wanted %v, got %v", want, got)
t.Errorf("%v", cmp.Diff(want, got))
}
}
}

func TestListIngressesV1(t *testing.T) {
testServer := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
f, _ := os.Open("testdata/fixture03.json")
defer f.Close()
rw.WriteHeader(http.StatusOK)
_, err := io.Copy(rw, f)
require.NoError(t, err)
}))
defer testServer.Close()
kubeClient, _ := newSimpleClient(&Config{BaseURL: testServer.URL}, false)
ingressClient := &ingressClient{apiVersion: IngressAPIVersionNetworkingV1}
want := newList(IngressAPIVersionNetworkingV1,
newIngress("fixture01", nil, "", "example.org", "fixture01", IngressAPIVersionNetworkingV1),
newIngress("fixture02", map[string]string{ingressClassAnnotation: "skipper"}, "", "skipper.example.org", "fixture02", IngressAPIVersionNetworkingV1),
newIngress("fixture03", map[string]string{ingressClassAnnotation: "other"}, "", "other.example.org", "fixture03", IngressAPIVersionNetworkingV1),
newIngress("fixture04", nil, "another", "another.example.org", "fixture04", IngressAPIVersionNetworkingV1),
)
got, err := ingressClient.listIngress(kubeClient)
if err != nil {
Expand Down
14 changes: 7 additions & 7 deletions kubernetes/testdata/fixture01.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"kind": "IngressList",
"apiVersion": "networking.k8s.io/v1beta1",
"apiVersion": "networking.k8s.io/v1",
"metadata": {
"selfLink": "/apis/networking.k8s.io/v1beta1/ingresses",
"selfLink": "/apis/networking.k8s.io/v1/ingresses",
"resourceVersion": "42"
},
"items": [
{
"metadata": {
"name": "fixture01",
"namespace": "default",
"selfLink": "/apis/networking.k8s.io/v1beta1/namespaces/default/ingresses/fixture01",
"selfLink": "/apis/networking.k8s.io/v1/namespaces/default/ingresses/fixture01",
"uid": "fixture01",
"resourceVersion": "42",
"generation": 1,
Expand All @@ -31,7 +31,7 @@
"metadata": {
"name": "fixture02",
"namespace": "default",
"selfLink": "/apis/networking.k8s.io/v1beta1/namespaces/default/ingresses/fixture02",
"selfLink": "/apis/networking.k8s.io/v1/namespaces/default/ingresses/fixture02",
"uid": "fixture02",
"resourceVersion": "42",
"generation": 1,
Expand All @@ -53,7 +53,7 @@
"metadata": {
"name": "fixture03",
"namespace": "default",
"selfLink": "/apis/networking.k8s.io/v1beta1/namespaces/default/ingresses/fixture03",
"selfLink": "/apis/networking.k8s.io/v1/namespaces/default/ingresses/fixture03",
"uid": "fixture03",
"resourceVersion": "42",
"generation": 1,
Expand All @@ -75,7 +75,7 @@
"metadata": {
"name": "fixture04",
"namespace": "default",
"selfLink": "/apis/networking.k8s.io/v1beta1/namespaces/default/ingresses/fixture04",
"selfLink": "/apis/networking.k8s.io/v1/namespaces/default/ingresses/fixture04",
"uid": "fixture04",
"resourceVersion": "42",
"generation": 1,
Expand All @@ -99,7 +99,7 @@
"metadata": {
"name": "fixture05",
"namespace": "default",
"selfLink": "/apis/networking.k8s.io/v1beta1/namespaces/default/ingresses/fixture05",
"selfLink": "/apis/networking.k8s.io/v1/namespaces/default/ingresses/fixture05",
"uid": "fixture05",
"resourceVersion": "42",
"generation": 1,
Expand Down
2 changes: 1 addition & 1 deletion worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ func TestResourceConversionOneToOne(tt *testing.T) {

sslPolicy := "ELBSecurityPolicy-2016-08"
clusterLocalDomain := ""
ingressAPIVersion := kubernetes.IngressAPIVersionNetworkingV1
ingressAPIVersion := kubernetes.IngressAPIVersionNetworking

k, err := kubernetes.NewAdapter(
kubeConfig,
Expand Down

0 comments on commit c530fcd

Please sign in to comment.