Skip to content

Commit 1d9f9be

Browse files
committed
schemapatcher testdata for multi-CRD-version
This updates the schemapatcher testdata to work with the previous commit, which introduced multi-CRD-version support.
1 parent 95ba66e commit 1d9f9be

10 files changed

+254
-160
lines changed

pkg/schemapatcher/testdata/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
all:
2-
go run -v sigs.k8s.io/controller-tools/cmd/controller-gen schemapatch:manifests=./manifests output:dir=./expected paths=./apis/...
2+
../../../.run-controller-gen.sh schemapatch:manifests=./manifests output:dir=./expected paths=./apis/...
33
egrep -v -- "- foo" < expected/kubebuilder-example-crd.yaml > manifests/kubebuilder-example-crd.yaml
4+
egrep -v -- "- foo" < expected/kubebuilder-example-crd.v1.yaml > manifests/kubebuilder-example-crd.v1.yaml
45
egrep -v -- "- foo" < expected/legacy-example-crd.yaml > manifests/legacy-example-crd.yaml
56

67
.PHONY: all
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: example.kubebuilder.schemapatcher.controller-tools.sigs.k8s.io
5+
spec:
6+
group: kubebuilder.schemapatcher.controller-tools.sigs.k8s.io
7+
scope: Cluster
8+
names:
9+
kind: Example
10+
singular: example
11+
plural: examples
12+
listKind: ExampleList
13+
versions:
14+
- name: v1
15+
schema:
16+
openAPIV3Schema:
17+
description: Example is a kind with schema changes.
18+
type: object
19+
required:
20+
- spec
21+
properties:
22+
apiVersion:
23+
description: 'APIVersion defines the versioned schema of this representation
24+
of an object. Servers should convert recognized schemas to the latest
25+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
26+
type: string
27+
kind:
28+
description: 'Kind is a string value representing the REST resource this
29+
object represents. Servers may infer this from the endpoint the client
30+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
31+
type: string
32+
metadata:
33+
type: object
34+
spec:
35+
type: object
36+
required:
37+
- bar
38+
- foo
39+
properties:
40+
bar:
41+
description: foo contains foo.
42+
type: string
43+
foo:
44+
description: foo contains foo.
45+
type: string
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
apiVersion: apiextensions.k8s.io/v1beta1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: unchanged.kubebuilder.schemapatcher.controller-tools.sigs.k8s.io
5+
spec:
6+
group: kubebuilder.schemapatcher.controller-tools.sigs.k8s.io
7+
scope: Cluster
8+
names:
9+
kind: Unchanged
10+
singular: unchanged
11+
plural: unchangeds
12+
listKind: UnchangedList
13+
version: v1
14+
validation:
15+
openAPIV3Schema:
16+
description: Unchanged is a kind without schema changes.
17+
type: object
18+
required:
19+
- spec
20+
properties:
21+
apiVersion:
22+
description: 'APIVersion defines the versioned schema of this representation
23+
of an object. Servers should convert recognized schemas to the latest
24+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25+
type: string
26+
kind:
27+
description: 'Kind is a string value representing the REST resource this
28+
object represents. Servers may infer this from the endpoint the client
29+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
30+
type: string
31+
metadata:
32+
type: object
33+
spec:
34+
type: object
35+
required:
36+
- bar
37+
- foo
38+
properties:
39+
bar:
40+
description: foo contains foo.
41+
type: string
42+
foo:
43+
description: foo contains foo.
44+
type: string
Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: apiextensions.k8s.io/v1beta1
1+
apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
name: unchanged.kubebuilder.schemapatcher.controller-tools.sigs.k8s.io
@@ -10,35 +10,36 @@ spec:
1010
singular: unchanged
1111
plural: unchangeds
1212
listKind: UnchangedList
13-
version: v1
14-
validation:
15-
openAPIV3Schema:
16-
description: Unchanged is a kind without schema changes.
17-
type: object
18-
required:
19-
- spec
20-
properties:
21-
apiVersion:
22-
description: 'APIVersion defines the versioned schema of this representation
23-
of an object. Servers should convert recognized schemas to the latest
24-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25-
type: string
26-
kind:
27-
description: 'Kind is a string value representing the REST resource this
28-
object represents. Servers may infer this from the endpoint the client
29-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
30-
type: string
31-
metadata:
32-
type: object
33-
spec:
34-
type: object
35-
required:
36-
- bar
37-
- foo
38-
properties:
39-
bar:
40-
description: foo contains foo.
41-
type: string
42-
foo:
43-
description: foo contains foo.
44-
type: string
13+
versions:
14+
- name: v1
15+
schema:
16+
openAPIV3Schema:
17+
description: Unchanged is a kind without schema changes.
18+
type: object
19+
required:
20+
- spec
21+
properties:
22+
apiVersion:
23+
description: 'APIVersion defines the versioned schema of this representation
24+
of an object. Servers should convert recognized schemas to the latest
25+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
26+
type: string
27+
kind:
28+
description: 'Kind is a string value representing the REST resource this
29+
object represents. Servers may infer this from the endpoint the client
30+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
31+
type: string
32+
metadata:
33+
type: object
34+
spec:
35+
type: object
36+
required:
37+
- bar
38+
- foo
39+
properties:
40+
bar:
41+
description: foo contains foo.
42+
type: string
43+
foo:
44+
description: foo contains foo.
45+
type: string

pkg/schemapatcher/testdata/go.mod

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,4 @@ module testdata.kubebuilder.io/inplaceschema
22

33
go 1.12
44

5-
require (
6-
k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655
7-
sigs.k8s.io/controller-tools v0.0.0-00010101000000-000000000000 // indirect
8-
)
9-
10-
// use the current copy of controller-tools
11-
replace sigs.k8s.io/controller-tools => ../../..
5+
require k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655

0 commit comments

Comments
 (0)