@@ -84,6 +84,7 @@ var _ = Describe("MigrationConfig", func() {
8484 completionTimeoutPerGiBAnnotation : "1200" ,
8585 parallelOutboundMigrationsPerNodeAnnotation : "5" ,
8686 progressTimeoutAnnotation : "300" ,
87+ disableTLSAnnotation : "true" ,
8788 }))
8889
8990 values .GetMock .Set (func (path string ) gjson.Result {
@@ -96,6 +97,8 @@ var _ = Describe("MigrationConfig", func() {
9697 return gjson.Result {Type : gjson .Number , Num : defaultParallelOutboundMigrationsPerNode }
9798 case progressTimeoutValuesPath :
9899 return gjson.Result {Type : gjson .Number , Num : defaultProgressTimeout }
100+ case disableTLSValuesPath :
101+ return gjson.Result {Type : gjson .False }
99102 }
100103 return gjson.Result {}
101104 })
@@ -111,6 +114,7 @@ var _ = Describe("MigrationConfig", func() {
111114 Expect (setValues ).To (HaveKeyWithValue (completionTimeoutPerGiBValuesPath , 1200 ))
112115 Expect (setValues ).To (HaveKeyWithValue (parallelOutboundMigrationsPerNodeValuesPath , 5 ))
113116 Expect (setValues ).To (HaveKeyWithValue (progressTimeoutValuesPath , 300 ))
117+ Expect (setValues ).To (HaveKeyWithValue (disableTLSValuesPath , true ))
114118 })
115119
116120 It ("Should set defaults when no annotations present" , func () {
@@ -126,6 +130,8 @@ var _ = Describe("MigrationConfig", func() {
126130 return gjson.Result {Type : gjson .Number , Num : 9999 }
127131 case progressTimeoutValuesPath :
128132 return gjson.Result {Type : gjson .Number , Num : 9999 }
133+ case disableTLSValuesPath :
134+ return gjson.Result {Type : gjson .True }
129135 }
130136 return gjson.Result {}
131137 })
@@ -141,6 +147,7 @@ var _ = Describe("MigrationConfig", func() {
141147 Expect (setValues ).To (HaveKeyWithValue (completionTimeoutPerGiBValuesPath , defaultCompletionTimeoutPerGiB ))
142148 Expect (setValues ).To (HaveKeyWithValue (parallelOutboundMigrationsPerNodeValuesPath , defaultParallelOutboundMigrationsPerNode ))
143149 Expect (setValues ).To (HaveKeyWithValue (progressTimeoutValuesPath , defaultProgressTimeout ))
150+ Expect (setValues ).To (HaveKeyWithValue (disableTLSValuesPath , defaultDisableTLS ))
144151 })
145152
146153 It ("Should not set values when current matches target" , func () {
@@ -149,6 +156,7 @@ var _ = Describe("MigrationConfig", func() {
149156 completionTimeoutPerGiBAnnotation : "800" ,
150157 parallelOutboundMigrationsPerNodeAnnotation : "1" ,
151158 progressTimeoutAnnotation : "150" ,
159+ disableTLSAnnotation : "false" ,
152160 }))
153161
154162 values .GetMock .Set (func (path string ) gjson.Result {
@@ -161,6 +169,8 @@ var _ = Describe("MigrationConfig", func() {
161169 return gjson.Result {Type : gjson .Number , Num : defaultParallelOutboundMigrationsPerNode }
162170 case progressTimeoutValuesPath :
163171 return gjson.Result {Type : gjson .Number , Num : defaultProgressTimeout }
172+ case disableTLSValuesPath :
173+ return gjson.Result {Type : gjson .False }
164174 }
165175 return gjson.Result {}
166176 })
@@ -175,6 +185,8 @@ var _ = Describe("MigrationConfig", func() {
175185
176186 values .GetMock .Set (func (path string ) gjson.Result {
177187 switch path {
188+ case disableTLSValuesPath :
189+ return gjson.Result {Type : gjson .False }
178190 case bandwidthPerMigrationValuesPath :
179191 return gjson.Result {Type : gjson .String , Str : defaultBandwidthPerMigration }
180192 default :
@@ -189,6 +201,35 @@ var _ = Describe("MigrationConfig", func() {
189201 ))))
190202 })
191203
204+ It ("Should fail on invalid boolean annotation" , func () {
205+ setSnapshots (newSnapshot (map [string ]string {
206+ disableTLSAnnotation : "not-a-bool" ,
207+ }))
208+
209+ values .GetMock .Set (func (path string ) gjson.Result {
210+ switch path {
211+ case bandwidthPerMigrationValuesPath :
212+ return gjson.Result {Type : gjson .String , Str : defaultBandwidthPerMigration }
213+ case completionTimeoutPerGiBValuesPath :
214+ return gjson.Result {Type : gjson .Number , Num : defaultCompletionTimeoutPerGiB }
215+ case parallelOutboundMigrationsPerNodeValuesPath :
216+ return gjson.Result {Type : gjson .Number , Num : defaultParallelOutboundMigrationsPerNode }
217+ case progressTimeoutValuesPath :
218+ return gjson.Result {Type : gjson .Number , Num : defaultProgressTimeout }
219+ case disableTLSValuesPath :
220+ return gjson.Result {Type : gjson .False }
221+ default :
222+ return gjson.Result {}
223+ }
224+ })
225+
226+ err := reconcile (context .Background (), newInput ())
227+ Expect (err ).To (MatchError (ContainSubstring (fmt .Sprintf (
228+ "failed to parse %q annotation:" ,
229+ disableTLSAnnotation ,
230+ ))))
231+ })
232+
192233 It ("Should set only one param from annotation and defaults for the rest" , func () {
193234 setSnapshots (newSnapshot (map [string ]string {
194235 parallelOutboundMigrationsPerNodeAnnotation : "5" ,
@@ -204,6 +245,8 @@ var _ = Describe("MigrationConfig", func() {
204245 return gjson.Result {Type : gjson .Number , Num : defaultParallelOutboundMigrationsPerNode }
205246 case progressTimeoutValuesPath :
206247 return gjson.Result {Type : gjson .Number , Num : defaultProgressTimeout }
248+ case disableTLSValuesPath :
249+ return gjson.Result {Type : gjson .False }
207250 }
208251 return gjson.Result {}
209252 })
0 commit comments