File tree Expand file tree Collapse file tree 4 files changed +151
-1
lines changed
internal/operator-controller/rukpak/preflights/crdupgradesafety Expand file tree Collapse file tree 4 files changed +151
-1
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,14 @@ func defaultConfig() *config.Config {
123
123
UnhandledEnforcement : config .EnforcementPolicyError ,
124
124
// Use the default validation configurations as they are
125
125
// the strictest possible.
126
- Validations : []config.ValidationConfig {},
126
+ Validations : []config.ValidationConfig {
127
+ // Do not enforce the description validation
128
+ // because OLM should not block on field description changes.
129
+ {
130
+ Name : "description" ,
131
+ Enforcement : config .EnforcementPolicyNone ,
132
+ },
133
+ },
127
134
}
128
135
}
129
136
Original file line number Diff line number Diff line change @@ -171,6 +171,16 @@ func TestInstall(t *testing.T) {
171
171
`existingFieldRemoval:` ,
172
172
},
173
173
},
174
+ {
175
+ name : "new crd validation should not fail on description changes" ,
176
+ // Separate test from above as this error will cause the validator to
177
+ // return early and skip some of the above validations.
178
+ oldCrdPath : "old-crd.json" ,
179
+ release : & release.Release {
180
+ Name : "test-release" ,
181
+ Manifest : getManifestString (t , "crd-description-changed.json" ),
182
+ },
183
+ },
174
184
}
175
185
176
186
for _ , tc := range tests {
@@ -310,6 +320,16 @@ func TestUpgrade(t *testing.T) {
310
320
`validating upgrade for CRD "crontabs.stable.example.com": v1 <-> v2: ^.spec.foobarbaz: enum: allowed enum values removed` ,
311
321
},
312
322
},
323
+ {
324
+ name : "new crd validation should not fail on description changes" ,
325
+ // Separate test from above as this error will cause the validator to
326
+ // return early and skip some of the above validations.
327
+ oldCrdPath : "old-crd.json" ,
328
+ release : & release.Release {
329
+ Name : "test-release" ,
330
+ Manifest : getManifestString (t , "crd-description-changed.json" ),
331
+ },
332
+ },
313
333
}
314
334
315
335
for _ , tc := range tests {
Original file line number Diff line number Diff line change
1
+ {
2
+ "apiVersion" : " apiextensions.k8s.io/v1" ,
3
+ "kind" : " CustomResourceDefinition" ,
4
+ "metadata" : {
5
+ "name" : " crontabs.stable.example.com"
6
+ },
7
+ "spec" : {
8
+ "group" : " stable.example.com" ,
9
+ "versions" : [
10
+ {
11
+ "name" : " v1" ,
12
+ "served" : true ,
13
+ "storage" : false ,
14
+ "schema" : {
15
+ "openAPIV3Schema" : {
16
+ "type" : " object" ,
17
+ "properties" : {
18
+ "spec" : {
19
+ "description" : " description two" ,
20
+ "type" : " object" ,
21
+ "properties" : {
22
+ "removedField" : {
23
+ "type" :" integer"
24
+ },
25
+ "enum" : {
26
+ "type" :" integer"
27
+ },
28
+ "minMaxValue" : {
29
+ "type" :" integer"
30
+ },
31
+ "required" : {
32
+ "type" :" integer"
33
+ },
34
+ "minMaxItems" : {
35
+ "type" :" array" ,
36
+ "items" : {
37
+ "type" :" string"
38
+ }
39
+ },
40
+ "minMaxLength" : {
41
+ "type" :" string"
42
+ },
43
+ "defaultVal" : {
44
+ "type" : " string"
45
+ },
46
+ "requiredVal" : {
47
+ "type" : " string"
48
+ }
49
+ }
50
+ }
51
+ },
52
+ "required" : [
53
+ " requiredVal"
54
+ ]
55
+ }
56
+ }
57
+ },
58
+ {
59
+ "name" : " v2" ,
60
+ "served" : true ,
61
+ "storage" : true ,
62
+ "schema" : {
63
+ "openAPIV3Schema" : {
64
+ "type" : " object" ,
65
+ "properties" : {
66
+ "spec" : {
67
+ "type" : " object" ,
68
+ "properties" : {
69
+ "removedField" : {
70
+ "type" :" integer"
71
+ },
72
+ "enum" : {
73
+ "type" :" integer"
74
+ },
75
+ "minMaxValue" : {
76
+ "type" :" integer"
77
+ },
78
+ "required" : {
79
+ "type" :" integer"
80
+ },
81
+ "minMaxItems" : {
82
+ "type" :" array" ,
83
+ "items" : {
84
+ "type" :" string"
85
+ }
86
+ },
87
+ "minMaxLength" : {
88
+ "type" :" string"
89
+ },
90
+ "defaultVal" : {
91
+ "type" : " string"
92
+ },
93
+ "requiredVal" : {
94
+ "type" : " string"
95
+ }
96
+ }
97
+ }
98
+ },
99
+ "required" : [
100
+ " requiredVal"
101
+ ]
102
+ }
103
+ }
104
+ }
105
+ ],
106
+ "scope" : " Cluster" ,
107
+ "names" : {
108
+ "plural" : " crontabs" ,
109
+ "singular" : " crontab" ,
110
+ "kind" : " CronTab" ,
111
+ "shortNames" : [
112
+ " ct"
113
+ ]
114
+ }
115
+ },
116
+ "status" : {
117
+ "storedVersions" : [
118
+ " v1" ,
119
+ " v2"
120
+ ]
121
+ }
122
+ }
Original file line number Diff line number Diff line change 16
16
"type" : " object" ,
17
17
"properties" : {
18
18
"spec" : {
19
+ "description" : " description one" ,
19
20
"type" : " object" ,
20
21
"properties" : {
21
22
"removedField" : {
You can’t perform that action at this time.
0 commit comments