File tree Expand file tree Collapse file tree
internal/operator-controller/rukpak/preflights/crdupgradesafety Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,7 +123,14 @@ func defaultConfig() *config.Config {
123123 UnhandledEnforcement : config .EnforcementPolicyError ,
124124 // Use the default validation configurations as they are
125125 // 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+ },
127134 }
128135}
129136
Original file line number Diff line number Diff line change @@ -171,6 +171,16 @@ func TestInstall(t *testing.T) {
171171 `existingFieldRemoval:` ,
172172 },
173173 },
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+ },
174184 }
175185
176186 for _ , tc := range tests {
@@ -310,6 +320,16 @@ func TestUpgrade(t *testing.T) {
310320 `validating upgrade for CRD "crontabs.stable.example.com": v1 <-> v2: ^.spec.foobarbaz: enum: allowed enum values removed` ,
311321 },
312322 },
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+ },
313333 }
314334
315335 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 1616 "type" : " object" ,
1717 "properties" : {
1818 "spec" : {
19+ "description" : " description one" ,
1920 "type" : " object" ,
2021 "properties" : {
2122 "removedField" : {
You can’t perform that action at this time.
0 commit comments