Skip to content

Commit b0222ed

Browse files
authored
Merge pull request #1193 from grzpiotrowski/NE-1952-gwapi-upgrade-check
NE-1952: Pre-upgrade check for Gateway API CRD Management Succession
2 parents a730e8a + e05ad9a commit b0222ed

21 files changed

+19681
-17
lines changed

pkg/manifests/assets/gateway-api/v1_2_1/gateway.networking.k8s.io_gatewayclasses.yaml

Lines changed: 478 additions & 0 deletions
Large diffs are not rendered by default.

pkg/manifests/assets/gateway-api/v1_2_1/gateway.networking.k8s.io_gateways.yaml

Lines changed: 2104 additions & 0 deletions
Large diffs are not rendered by default.

pkg/manifests/assets/gateway-api/v1_2_1/gateway.networking.k8s.io_grpcroutes.yaml

Lines changed: 2009 additions & 0 deletions
Large diffs are not rendered by default.

pkg/manifests/assets/gateway-api/v1_2_1/gateway.networking.k8s.io_httproutes.yaml

Lines changed: 5528 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/3328
6+
gateway.networking.k8s.io/bundle-version: v1.2.1
7+
gateway.networking.k8s.io/channel: standard
8+
creationTimestamp: null
9+
name: referencegrants.gateway.networking.k8s.io
10+
spec:
11+
group: gateway.networking.k8s.io
12+
names:
13+
categories:
14+
- gateway-api
15+
kind: ReferenceGrant
16+
listKind: ReferenceGrantList
17+
plural: referencegrants
18+
shortNames:
19+
- refgrant
20+
singular: referencegrant
21+
scope: Namespaced
22+
versions:
23+
- additionalPrinterColumns:
24+
- jsonPath: .metadata.creationTimestamp
25+
name: Age
26+
type: date
27+
name: v1beta1
28+
schema:
29+
openAPIV3Schema:
30+
description: |-
31+
ReferenceGrant identifies kinds of resources in other namespaces that are
32+
trusted to reference the specified kinds of resources in the same namespace
33+
as the policy.
34+
35+
Each ReferenceGrant can be used to represent a unique trust relationship.
36+
Additional Reference Grants can be used to add to the set of trusted
37+
sources of inbound references for the namespace they are defined within.
38+
39+
All cross-namespace references in Gateway API (with the exception of cross-namespace
40+
Gateway-route attachment) require a ReferenceGrant.
41+
42+
ReferenceGrant is a form of runtime verification allowing users to assert
43+
which cross-namespace object references are permitted. Implementations that
44+
support ReferenceGrant MUST NOT permit cross-namespace references which have
45+
no grant, and MUST respond to the removal of a grant by revoking the access
46+
that the grant allowed.
47+
properties:
48+
apiVersion:
49+
description: |-
50+
APIVersion defines the versioned schema of this representation of an object.
51+
Servers should convert recognized schemas to the latest internal value, and
52+
may reject unrecognized values.
53+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
54+
type: string
55+
kind:
56+
description: |-
57+
Kind is a string value representing the REST resource this object represents.
58+
Servers may infer this from the endpoint the client submits requests to.
59+
Cannot be updated.
60+
In CamelCase.
61+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
62+
type: string
63+
metadata:
64+
type: object
65+
spec:
66+
description: Spec defines the desired state of ReferenceGrant.
67+
properties:
68+
from:
69+
description: |-
70+
From describes the trusted namespaces and kinds that can reference the
71+
resources described in "To". Each entry in this list MUST be considered
72+
to be an additional place that references can be valid from, or to put
73+
this another way, entries MUST be combined using OR.
74+
75+
Support: Core
76+
items:
77+
description: ReferenceGrantFrom describes trusted namespaces and
78+
kinds.
79+
properties:
80+
group:
81+
description: |-
82+
Group is the group of the referent.
83+
When empty, the Kubernetes core API group is inferred.
84+
85+
Support: Core
86+
maxLength: 253
87+
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
88+
type: string
89+
kind:
90+
description: |-
91+
Kind is the kind of the referent. Although implementations may support
92+
additional resources, the following types are part of the "Core"
93+
support level for this field.
94+
95+
When used to permit a SecretObjectReference:
96+
97+
* Gateway
98+
99+
When used to permit a BackendObjectReference:
100+
101+
* GRPCRoute
102+
* HTTPRoute
103+
* TCPRoute
104+
* TLSRoute
105+
* UDPRoute
106+
maxLength: 63
107+
minLength: 1
108+
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
109+
type: string
110+
namespace:
111+
description: |-
112+
Namespace is the namespace of the referent.
113+
114+
Support: Core
115+
maxLength: 63
116+
minLength: 1
117+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
118+
type: string
119+
required:
120+
- group
121+
- kind
122+
- namespace
123+
type: object
124+
maxItems: 16
125+
minItems: 1
126+
type: array
127+
to:
128+
description: |-
129+
To describes the resources that may be referenced by the resources
130+
described in "From". Each entry in this list MUST be considered to be an
131+
additional place that references can be valid to, or to put this another
132+
way, entries MUST be combined using OR.
133+
134+
Support: Core
135+
items:
136+
description: |-
137+
ReferenceGrantTo describes what Kinds are allowed as targets of the
138+
references.
139+
properties:
140+
group:
141+
description: |-
142+
Group is the group of the referent.
143+
When empty, the Kubernetes core API group is inferred.
144+
145+
Support: Core
146+
maxLength: 253
147+
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
148+
type: string
149+
kind:
150+
description: |-
151+
Kind is the kind of the referent. Although implementations may support
152+
additional resources, the following types are part of the "Core"
153+
support level for this field:
154+
155+
* Secret when used to permit a SecretObjectReference
156+
* Service when used to permit a BackendObjectReference
157+
maxLength: 63
158+
minLength: 1
159+
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
160+
type: string
161+
name:
162+
description: |-
163+
Name is the name of the referent. When unspecified, this policy
164+
refers to all resources of the specified Group and Kind in the local
165+
namespace.
166+
maxLength: 253
167+
minLength: 1
168+
type: string
169+
required:
170+
- group
171+
- kind
172+
type: object
173+
maxItems: 16
174+
minItems: 1
175+
type: array
176+
required:
177+
- from
178+
- to
179+
type: object
180+
type: object
181+
served: true
182+
storage: true
183+
subresources: {}
184+
status:
185+
acceptedNames:
186+
kind: ""
187+
plural: ""
188+
conditions: null
189+
storedVersions: null

pkg/manifests/manifests.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ const (
4747
HTTPRouteCRDAsset = "assets/gateway-api/gateway.networking.k8s.io_httproutes.yaml"
4848
ReferenceGrantCRDAsset = "assets/gateway-api/gateway.networking.k8s.io_referencegrants.yaml"
4949

50+
GatewayClassCRDAsset_v1_2_1 = "assets/gateway-api/v1_2_1/gateway.networking.k8s.io_gatewayclasses.yaml"
51+
GatewayCRDAsset_v1_2_1 = "assets/gateway-api/v1_2_1/gateway.networking.k8s.io_gateways.yaml"
52+
GRPCRouteCRDAsset_v1_2_1 = "assets/gateway-api/v1_2_1/gateway.networking.k8s.io_grpcroutes.yaml"
53+
HTTPRouteCRDAsset_v1_2_1 = "assets/gateway-api/v1_2_1/gateway.networking.k8s.io_httproutes.yaml"
54+
ReferenceGrantCRDAsset_v1_2_1 = "assets/gateway-api/v1_2_1/gateway.networking.k8s.io_referencegrants.yaml"
55+
5056
// Annotation used to inform the certificate generation service to
5157
// generate a cluster-signed certificate and populate the secret.
5258
ServingCertSecretAnnotation = "service.alpha.openshift.io/serving-cert-secret-name"
@@ -287,6 +293,46 @@ func ReferenceGrantCRD() *apiextensionsv1.CustomResourceDefinition {
287293
return crd
288294
}
289295

296+
func GatewayClassCRD_v1_2_1() *apiextensionsv1.CustomResourceDefinition {
297+
crd, err := NewCustomResourceDefinition(MustAssetReader(GatewayClassCRDAsset_v1_2_1))
298+
if err != nil {
299+
panic(err)
300+
}
301+
return crd
302+
}
303+
304+
func GatewayCRD_v1_2_1() *apiextensionsv1.CustomResourceDefinition {
305+
crd, err := NewCustomResourceDefinition(MustAssetReader(GatewayCRDAsset_v1_2_1))
306+
if err != nil {
307+
panic(err)
308+
}
309+
return crd
310+
}
311+
312+
func GRPCRouteCRD_v1_2_1() *apiextensionsv1.CustomResourceDefinition {
313+
crd, err := NewCustomResourceDefinition(MustAssetReader(GRPCRouteCRDAsset_v1_2_1))
314+
if err != nil {
315+
panic(err)
316+
}
317+
return crd
318+
}
319+
320+
func HTTPRouteCRD_v1_2_1() *apiextensionsv1.CustomResourceDefinition {
321+
crd, err := NewCustomResourceDefinition(MustAssetReader(HTTPRouteCRDAsset_v1_2_1))
322+
if err != nil {
323+
panic(err)
324+
}
325+
return crd
326+
}
327+
328+
func ReferenceGrantCRD_v1_2_1() *apiextensionsv1.CustomResourceDefinition {
329+
crd, err := NewCustomResourceDefinition(MustAssetReader(ReferenceGrantCRDAsset_v1_2_1))
330+
if err != nil {
331+
panic(err)
332+
}
333+
return crd
334+
}
335+
290336
func NewServiceAccount(manifest io.Reader) (*corev1.ServiceAccount, error) {
291337
sa := corev1.ServiceAccount{}
292338
if err := yaml.NewYAMLOrJSONDecoder(manifest, 100).Decode(&sa); err != nil {

pkg/manifests/manifests_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ func TestManifests(t *testing.T) {
4949
HTTPRouteCRD()
5050
ReferenceGrantCRD()
5151

52+
GatewayClassCRD_v1_2_1()
53+
GatewayCRD_v1_2_1()
54+
GRPCRouteCRD_v1_2_1()
55+
HTTPRouteCRD_v1_2_1()
56+
ReferenceGrantCRD_v1_2_1()
57+
5258
MustAsset(CustomResourceDefinitionManifest)
5359
MustAsset(NamespaceManifest)
5460
}

0 commit comments

Comments
 (0)