@@ -119,6 +119,38 @@ var _ = Describe("kubebuilder", func() {
119
119
})
120
120
121
121
It ("should generate a runnable project go/v3 with v1 CRDs and Webhooks" , func () {
122
+ // Skip if cluster version < 1.16, when v1 CRDs and webhooks did not exist.
123
+ if srvVer := kbc .K8sVersion .ServerVersion ; srvVer .GetMajorInt () <= 1 && srvVer .GetMinorInt () < 16 {
124
+ Skip (fmt .Sprintf ("cluster version %s does not support v1 CRDs or webhooks" ,
125
+ srvVer .GitVersion ))
126
+ }
127
+
128
+ GenerateV3 (kbc , "v1" , false )
129
+ Run (kbc )
130
+ })
131
+ It ("should generate a runnable project with the golang base plugin v3 and kustomize v4-alpha" , func () {
132
+ // Skip if cluster version < 1.16, when v1 CRDs and webhooks did not exist.
133
+ if srvVer := kbc .K8sVersion .ServerVersion ; srvVer .GetMajorInt () <= 1 && srvVer .GetMinorInt () < 16 {
134
+ Skip (fmt .Sprintf ("cluster version %s does not support v1 CRDs or webhooks" ,
135
+ srvVer .GitVersion ))
136
+ }
137
+ GenerateV3WithKustomizeV2 (kbc , "v1" , false )
138
+ Run (kbc )
139
+ })
140
+ It ("should generate a runnable project with v1beta1 CRDs and Webhooks" , func () {
141
+ // Skip if cluster version < 1.15, when `.spec.preserveUnknownFields` was not a v1beta1 CRD field.
142
+ // Skip if cluster version >= 1.22 because pre v1 CRDs and webhooks no longer exist.
143
+ if srvVer := kbc .K8sVersion .ServerVersion ; srvVer .GetMajorInt () <= 1 && srvVer .GetMinorInt () < 15 ||
144
+ srvVer .GetMajorInt () <= 1 && srvVer .GetMinorInt () >= 22 {
145
+ Skip (fmt .Sprintf ("cluster version %s does not support project defaults " ,
146
+ srvVer .GitVersion ))
147
+ }
148
+
149
+ GenerateV3 (kbc , "v1beta1" , false )
150
+ Run (kbc )
151
+ })
152
+
153
+ It ("should generate a runnable project go/v3 with v1 CRDs and Webhooks with restricted pods" , func () {
122
154
// Skip if cluster version < 1.16, when v1 CRDs and webhooks did not exist.
123
155
// Skip if cluster version < 1.19, because securityContext.seccompProfile only works from 1.19
124
156
// Otherwise, unknown field "seccompProfile" in io.k8s.api.core.v1.PodSecurityContext will be faced
@@ -127,10 +159,11 @@ var _ = Describe("kubebuilder", func() {
127
159
"and securityContext.seccompProfile" , srvVer .GitVersion ))
128
160
}
129
161
130
- GenerateV3 (kbc , "v1" )
162
+ GenerateV3 (kbc , "v1" , true )
131
163
Run (kbc )
132
164
})
133
- It ("should generate a runnable project with the golang base plugin v3 and kustomize v4-alpha" , func () {
165
+ It ("should generate a runnable project with the golang base plugin v3 and kustomize v4-alpha" +
166
+ " with restricted pods" , func () {
134
167
// Skip if cluster version < 1.16, when v1 CRDs and webhooks did not exist.
135
168
// Skip if cluster version < 1.19, because securityContext.seccompProfile only works from 1.19
136
169
// Otherwise, unknown field "seccompProfile" in io.k8s.api.core.v1.PodSecurityContext will be faced
@@ -139,10 +172,10 @@ var _ = Describe("kubebuilder", func() {
139
172
"and securityContext.seccompProfile" , srvVer .GitVersion ))
140
173
}
141
174
142
- GenerateV3WithKustomizeV2 (kbc , "v1" )
175
+ GenerateV3WithKustomizeV2 (kbc , "v1" , true )
143
176
Run (kbc )
144
177
})
145
- It ("should generate a runnable project with v1beta1 CRDs and Webhooks" , func () {
178
+ It ("should generate a runnable project with v1beta1 CRDs and Webhooks with restricted pods " , func () {
146
179
// Skip if cluster version < 1.15, when `.spec.preserveUnknownFields` was not a v1beta1 CRD field.
147
180
// Skip if cluster version < 1.19, because securityContext.seccompProfile only works from 1.19
148
181
// Otherwise, unknown field "seccompProfile" in io.k8s.api.core.v1.PodSecurityContext will be faced
@@ -153,7 +186,7 @@ var _ = Describe("kubebuilder", func() {
153
186
"and securityContext.seccompProfile" , srvVer .GitVersion ))
154
187
}
155
188
156
- GenerateV3 (kbc , "v1beta1" )
189
+ GenerateV3 (kbc , "v1beta1" , true )
157
190
Run (kbc )
158
191
})
159
192
})
0 commit comments