Skip to content

Commit 9dc4404

Browse files
committed
Add IPFamily to Ingress API
Add the IPFamliy field to Ingress API's IngressSpec that enables Day 0 configuration of the default Ingress controller with DualStack configuration. This field defaults to IPv4 when not set. And when the LB Type is "Classic", IPFamily can only have the value "IPv4". Only LB Type of "NLB" is allowed for IPFamily values of "DualStackIPv4Primary" and "DualStackIPv6Primary".
1 parent 59aa3e5 commit 9dc4404

13 files changed

Lines changed: 3219 additions & 4 deletions

config/v1/tests/ingresses.config.openshift.io/AAA_ungated.yaml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,120 @@ tests:
1212
apiVersion: config.openshift.io/v1
1313
kind: Ingress
1414
spec: {}
15+
- name: Should be able to create an Ingress with Classic load balancer type and IPv4 ipFamily
16+
initial: |
17+
apiVersion: config.openshift.io/v1
18+
kind: Ingress
19+
spec:
20+
domain: apps.example.com
21+
loadBalancer:
22+
platform:
23+
type: AWS
24+
aws:
25+
type: Classic
26+
ipFamily: IPv4
27+
expected: |
28+
apiVersion: config.openshift.io/v1
29+
kind: Ingress
30+
spec:
31+
domain: apps.example.com
32+
loadBalancer:
33+
platform:
34+
type: AWS
35+
aws:
36+
type: Classic
37+
ipFamily: IPv4
38+
- name: Should be able to create an Ingress with Classic load balancer type and omitted ipFamily
39+
initial: |
40+
apiVersion: config.openshift.io/v1
41+
kind: Ingress
42+
spec:
43+
domain: apps.example.com
44+
loadBalancer:
45+
platform:
46+
type: AWS
47+
aws:
48+
type: Classic
49+
expected: |
50+
apiVersion: config.openshift.io/v1
51+
kind: Ingress
52+
spec:
53+
domain: apps.example.com
54+
loadBalancer:
55+
platform:
56+
type: AWS
57+
aws:
58+
type: Classic
59+
ipFamily: IPv4
60+
- name: Should not be able to create an Ingress with Classic load balancer type and DualStackIPv4Primary ipFamily
61+
initial: |
62+
apiVersion: config.openshift.io/v1
63+
kind: Ingress
64+
spec:
65+
domain: apps.example.com
66+
loadBalancer:
67+
platform:
68+
type: AWS
69+
aws:
70+
type: Classic
71+
ipFamily: DualStackIPv4Primary
72+
expectedError: "spec.loadBalancer.platform.aws: Invalid value: \"object\": when type is Classic, ipFamily must be IPv4 or omitted (defaults to IPv4)"
73+
- name: Should not be able to create an Ingress with Classic load balancer type and DualStackIPv6Primary ipFamily
74+
initial: |
75+
apiVersion: config.openshift.io/v1
76+
kind: Ingress
77+
spec:
78+
domain: apps.example.com
79+
loadBalancer:
80+
platform:
81+
type: AWS
82+
aws:
83+
type: Classic
84+
ipFamily: DualStackIPv6Primary
85+
expectedError: "spec.loadBalancer.platform.aws: Invalid value: \"object\": when type is Classic, ipFamily must be IPv4 or omitted (defaults to IPv4)"
86+
- name: Should be able to create an Ingress with NLB load balancer type and DualStackIPv4Primary ipFamily
87+
initial: |
88+
apiVersion: config.openshift.io/v1
89+
kind: Ingress
90+
spec:
91+
domain: apps.example.com
92+
loadBalancer:
93+
platform:
94+
type: AWS
95+
aws:
96+
type: NLB
97+
ipFamily: DualStackIPv4Primary
98+
expected: |
99+
apiVersion: config.openshift.io/v1
100+
kind: Ingress
101+
spec:
102+
domain: apps.example.com
103+
loadBalancer:
104+
platform:
105+
type: AWS
106+
aws:
107+
type: NLB
108+
ipFamily: DualStackIPv4Primary
109+
- name: Should be able to create an Ingress with NLB load balancer type and DualStackIPv6Primary ipFamily
110+
initial: |
111+
apiVersion: config.openshift.io/v1
112+
kind: Ingress
113+
spec:
114+
domain: apps.example.com
115+
loadBalancer:
116+
platform:
117+
type: AWS
118+
aws:
119+
type: NLB
120+
ipFamily: DualStackIPv6Primary
121+
expected: |
122+
apiVersion: config.openshift.io/v1
123+
kind: Ingress
124+
spec:
125+
domain: apps.example.com
126+
loadBalancer:
127+
platform:
128+
type: AWS
129+
aws:
130+
type: NLB
131+
ipFamily: DualStackIPv6Primary
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "Ingress"
3+
crdName: ingresses.config.openshift.io
4+
featureGates:
5+
- AWSDualStackInstall
6+
tests:
7+
onCreate:
8+
- name: Should be able to create an Ingress with default ipFamily
9+
initial: |
10+
apiVersion: config.openshift.io/v1
11+
kind: Ingress
12+
spec:
13+
domain: apps.example.com
14+
expected: |
15+
apiVersion: config.openshift.io/v1
16+
kind: Ingress
17+
spec:
18+
domain: apps.example.com
19+
ipFamily: IPv4
20+
- name: Should be able to create an Ingress with ipFamily set to IPv4
21+
initial: |
22+
apiVersion: config.openshift.io/v1
23+
kind: Ingress
24+
spec:
25+
domain: apps.example.com
26+
ipFamily: IPv4
27+
expected: |
28+
apiVersion: config.openshift.io/v1
29+
kind: Ingress
30+
spec:
31+
domain: apps.example.com
32+
ipFamily: IPv4
33+
- name: Should be able to create an Ingress with ipFamily set to DualStackIPv6Primary
34+
initial: |
35+
apiVersion: config.openshift.io/v1
36+
kind: Ingress
37+
spec:
38+
domain: apps.example.com
39+
ipFamily: DualStackIPv6Primary
40+
expected: |
41+
apiVersion: config.openshift.io/v1
42+
kind: Ingress
43+
spec:
44+
domain: apps.example.com
45+
ipFamily: DualStackIPv6Primary
46+
- name: Should be able to create an Ingress with ipFamily set to DualStackIPv4Primary
47+
initial: |
48+
apiVersion: config.openshift.io/v1
49+
kind: Ingress
50+
spec:
51+
domain: apps.example.com
52+
ipFamily: DualStackIPv4Primary
53+
expected: |
54+
apiVersion: config.openshift.io/v1
55+
kind: Ingress
56+
spec:
57+
domain: apps.example.com
58+
ipFamily: DualStackIPv4Primary
59+
- name: Should not be able to create an Ingress with invalid ipFamily value
60+
initial: |
61+
apiVersion: config.openshift.io/v1
62+
kind: Ingress
63+
spec:
64+
domain: apps.example.com
65+
ipFamily: InvalidValue
66+
expectedError: "spec.ipFamily: Unsupported value: \"InvalidValue\": supported values: \"IPv4\", \"DualStackIPv6Primary\", \"DualStackIPv4Primary\""
67+
onUpdate:
68+
- name: Should default ipFamily to IPv4 when not specified
69+
initial: |
70+
apiVersion: config.openshift.io/v1
71+
kind: Ingress
72+
spec:
73+
domain: apps.example.com
74+
updated: |
75+
apiVersion: config.openshift.io/v1
76+
kind: Ingress
77+
spec:
78+
domain: apps.example.com
79+
expected: |
80+
apiVersion: config.openshift.io/v1
81+
kind: Ingress
82+
spec:
83+
domain: apps.example.com
84+
ipFamily: IPv4
85+
- name: Should not allow changing ipFamily once set
86+
initial: |
87+
apiVersion: config.openshift.io/v1
88+
kind: Ingress
89+
spec:
90+
domain: apps.example.com
91+
ipFamily: IPv4
92+
updated: |
93+
apiVersion: config.openshift.io/v1
94+
kind: Ingress
95+
spec:
96+
domain: apps.example.com
97+
ipFamily: DualStackIPv6Primary
98+
expectedError: "spec.ipFamily: Invalid value: \"string\": ipFamily is immutable once set"
99+
- name: Should allow setting the same ipFamily value
100+
initial: |
101+
apiVersion: config.openshift.io/v1
102+
kind: Ingress
103+
spec:
104+
domain: apps.example.com
105+
ipFamily: DualStackIPv6Primary
106+
updated: |
107+
apiVersion: config.openshift.io/v1
108+
kind: Ingress
109+
spec:
110+
domain: apps.example.com
111+
ipFamily: DualStackIPv6Primary
112+
expected: |
113+
apiVersion: config.openshift.io/v1
114+
kind: Ingress
115+
spec:
116+
domain: apps.example.com
117+
ipFamily: DualStackIPv6Primary
118+
- name: Should not allow unsetting ipFamily once it has been set
119+
initial: |
120+
apiVersion: config.openshift.io/v1
121+
kind: Ingress
122+
spec:
123+
domain: apps.example.com
124+
ipFamily: DualStackIPv4Primary
125+
updated: |
126+
apiVersion: config.openshift.io/v1
127+
kind: Ingress
128+
spec:
129+
domain: apps.example.com
130+
expectedError: "spec.ipFamily: Invalid value: \"string\": ipFamily is immutable once set"
131+
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "Ingress"
3+
crdName: ingresses.config.openshift.io
4+
featureGates:
5+
- AzureDualStackInstall
6+
tests:
7+
onCreate:
8+
- name: Should be able to create an Ingress with default ipFamily
9+
initial: |
10+
apiVersion: config.openshift.io/v1
11+
kind: Ingress
12+
spec:
13+
domain: apps.example.com
14+
expected: |
15+
apiVersion: config.openshift.io/v1
16+
kind: Ingress
17+
spec:
18+
domain: apps.example.com
19+
ipFamily: IPv4
20+
- name: Should be able to create an Ingress with ipFamily set to IPv4
21+
initial: |
22+
apiVersion: config.openshift.io/v1
23+
kind: Ingress
24+
spec:
25+
domain: apps.example.com
26+
ipFamily: IPv4
27+
expected: |
28+
apiVersion: config.openshift.io/v1
29+
kind: Ingress
30+
spec:
31+
domain: apps.example.com
32+
ipFamily: IPv4
33+
- name: Should be able to create an Ingress with ipFamily set to DualStackIPv6Primary
34+
initial: |
35+
apiVersion: config.openshift.io/v1
36+
kind: Ingress
37+
spec:
38+
domain: apps.example.com
39+
ipFamily: DualStackIPv6Primary
40+
expected: |
41+
apiVersion: config.openshift.io/v1
42+
kind: Ingress
43+
spec:
44+
domain: apps.example.com
45+
ipFamily: DualStackIPv6Primary
46+
- name: Should be able to create an Ingress with ipFamily set to DualStackIPv4Primary
47+
initial: |
48+
apiVersion: config.openshift.io/v1
49+
kind: Ingress
50+
spec:
51+
domain: apps.example.com
52+
ipFamily: DualStackIPv4Primary
53+
expected: |
54+
apiVersion: config.openshift.io/v1
55+
kind: Ingress
56+
spec:
57+
domain: apps.example.com
58+
ipFamily: DualStackIPv4Primary
59+
- name: Should not be able to create an Ingress with invalid ipFamily value
60+
initial: |
61+
apiVersion: config.openshift.io/v1
62+
kind: Ingress
63+
spec:
64+
domain: apps.example.com
65+
ipFamily: InvalidValue
66+
expectedError: "spec.ipFamily: Unsupported value: \"InvalidValue\": supported values: \"IPv4\", \"DualStackIPv6Primary\", \"DualStackIPv4Primary\""
67+
onUpdate:
68+
- name: Should default ipFamily to IPv4 when not specified
69+
initial: |
70+
apiVersion: config.openshift.io/v1
71+
kind: Ingress
72+
spec:
73+
domain: apps.example.com
74+
updated: |
75+
apiVersion: config.openshift.io/v1
76+
kind: Ingress
77+
spec:
78+
domain: apps.example.com
79+
expected: |
80+
apiVersion: config.openshift.io/v1
81+
kind: Ingress
82+
spec:
83+
domain: apps.example.com
84+
ipFamily: IPv4
85+
- name: Should not allow changing ipFamily once set
86+
initial: |
87+
apiVersion: config.openshift.io/v1
88+
kind: Ingress
89+
spec:
90+
domain: apps.example.com
91+
ipFamily: IPv4
92+
updated: |
93+
apiVersion: config.openshift.io/v1
94+
kind: Ingress
95+
spec:
96+
domain: apps.example.com
97+
ipFamily: DualStackIPv6Primary
98+
expectedError: "spec.ipFamily: Invalid value: \"string\": ipFamily is immutable once set"
99+
- name: Should allow setting the same ipFamily value
100+
initial: |
101+
apiVersion: config.openshift.io/v1
102+
kind: Ingress
103+
spec:
104+
domain: apps.example.com
105+
ipFamily: DualStackIPv6Primary
106+
updated: |
107+
apiVersion: config.openshift.io/v1
108+
kind: Ingress
109+
spec:
110+
domain: apps.example.com
111+
ipFamily: DualStackIPv6Primary
112+
expected: |
113+
apiVersion: config.openshift.io/v1
114+
kind: Ingress
115+
spec:
116+
domain: apps.example.com
117+
ipFamily: DualStackIPv6Primary
118+
- name: Should not allow unsetting ipFamily once it has been set
119+
initial: |
120+
apiVersion: config.openshift.io/v1
121+
kind: Ingress
122+
spec:
123+
domain: apps.example.com
124+
ipFamily: DualStackIPv4Primary
125+
updated: |
126+
apiVersion: config.openshift.io/v1
127+
kind: Ingress
128+
spec:
129+
domain: apps.example.com
130+
expectedError: "spec.ipFamily: Invalid value: \"string\": ipFamily is immutable once set"
131+

0 commit comments

Comments
 (0)