Skip to content

Commit 4d043a4

Browse files
committed
crd: add label with CRD version on CRDs
Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
1 parent 5b84620 commit 4d043a4

5 files changed

+25
-0
lines changed

config/crd-base/multicluster.x-k8s.io_serviceexports.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ apiVersion: apiextensions.k8s.io/v1
1515
kind: CustomResourceDefinition
1616
metadata:
1717
name: serviceexports.multicluster.x-k8s.io
18+
labels:
19+
# This MUST BE updated on each CRD changed and be the same as the version
20+
# in config/crd/embed.go
21+
io.x-k8s.multicluster.crd.schema.version: 0.1.0
1822
spec:
1923
group: multicluster.x-k8s.io
2024
scope: Namespaced

config/crd-base/multicluster.x-k8s.io_serviceimports.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ apiVersion: apiextensions.k8s.io/v1
1515
kind: CustomResourceDefinition
1616
metadata:
1717
name: serviceimports.multicluster.x-k8s.io
18+
labels:
19+
# This MUST BE updated on each CRD changed and be the same as the version
20+
# in config/crd/embed.go
21+
io.x-k8s.multicluster.crd.schema.version: 0.1.0
1822
spec:
1923
group: multicluster.x-k8s.io
2024
scope: Namespaced

config/crd/embed.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,12 @@ var (
2626
//go:embed multicluster.x-k8s.io_serviceimports.yaml
2727
ServiceImportCRD []byte
2828
)
29+
30+
const (
31+
// CustomResourceDefinitionSchemaVersionKey is key to label which holds the CRD schema version
32+
CustomResourceDefinitionSchemaVersionKey = "io.x-k8s.multicluster.crd.schema.version"
33+
// CustomResourceDefinitionSchemaVersion is semver-conformant version of CRD schema
34+
// Used to determine if CRD needs to be updated in cluster. This MUST BE
35+
// updated on each CRD change and be the same as the version in config/crd-base.
36+
CustomResourceDefinitionSchemaVersion = "0.1.0"
37+
)

config/crd/multicluster.x-k8s.io_serviceexports.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ apiVersion: apiextensions.k8s.io/v1
1515
kind: CustomResourceDefinition
1616
metadata:
1717
name: serviceexports.multicluster.x-k8s.io
18+
labels:
19+
# This MUST BE updated on each CRD changed and be the same as the version
20+
# in config/crd/embed.go
21+
io.x-k8s.multicluster.crd.schema.version: 0.1.0
1822
spec:
1923
group: multicluster.x-k8s.io
2024
scope: Namespaced

config/crd/multicluster.x-k8s.io_serviceimports.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ apiVersion: apiextensions.k8s.io/v1
1515
kind: CustomResourceDefinition
1616
metadata:
1717
name: serviceimports.multicluster.x-k8s.io
18+
labels:
19+
# This MUST BE updated on each CRD changed and be the same as the version
20+
# in config/crd/embed.go
21+
io.x-k8s.multicluster.crd.schema.version: 0.1.0
1822
spec:
1923
group: multicluster.x-k8s.io
2024
scope: Namespaced

0 commit comments

Comments
 (0)