@@ -199,13 +199,34 @@ func PerformAction(clients kube.Clients, config util.Config, upgradeFuncs callba
199
199
searchAnnotationValue , foundSearchAnn := annotations [options .AutoSearchAnnotation ]
200
200
reloaderEnabledValue , foundAuto := annotations [options .ReloaderAutoAnnotation ]
201
201
typedAutoAnnotationEnabledValue , foundTypedAuto := annotations [config .TypedAutoAnnotation ]
202
+ excludeConfigmapAnnotationValue , foundExcludeConfigmap := annotations [options .ConfigmapExcludeReloaderAnnotation ]
203
+ excludeSecretAnnotationValue , foundExcludeSecret := annotations [options .SecretExcludeReloaderAnnotation ]
204
+
202
205
if ! found && ! foundAuto && ! foundTypedAuto && ! foundSearchAnn {
203
206
annotations = upgradeFuncs .PodAnnotationsFunc (i )
204
207
annotationValue = annotations [config .Annotation ]
205
208
searchAnnotationValue = annotations [options .AutoSearchAnnotation ]
206
209
reloaderEnabledValue = annotations [options .ReloaderAutoAnnotation ]
207
210
typedAutoAnnotationEnabledValue = annotations [config .TypedAutoAnnotation ]
208
211
}
212
+
213
+ isResourceExcluded := false
214
+
215
+ switch config .Type {
216
+ case constants .ConfigmapEnvVarPostfix :
217
+ if foundExcludeConfigmap {
218
+ isResourceExcluded = checkIfResourceIsExcluded (config .ResourceName , excludeConfigmapAnnotationValue )
219
+ }
220
+ case constants .SecretEnvVarPostfix :
221
+ if foundExcludeSecret {
222
+ isResourceExcluded = checkIfResourceIsExcluded (config .ResourceName , excludeSecretAnnotationValue )
223
+ }
224
+ }
225
+
226
+ if isResourceExcluded {
227
+ continue
228
+ }
229
+
209
230
result := constants .NotUpdated
210
231
reloaderEnabled , _ := strconv .ParseBool (reloaderEnabledValue )
211
232
typedAutoAnnotationEnabled , _ := strconv .ParseBool (typedAutoAnnotationEnabledValue )
@@ -275,6 +296,21 @@ func PerformAction(clients kube.Clients, config util.Config, upgradeFuncs callba
275
296
return nil
276
297
}
277
298
299
+ func checkIfResourceIsExcluded (resourceName , excludedResources string ) bool {
300
+ if excludedResources == "" {
301
+ return false
302
+ }
303
+
304
+ excludedResourcesList := strings .Split (excludedResources , "," )
305
+ for _ , excludedResource := range excludedResourcesList {
306
+ if strings .TrimSpace (excludedResource ) == resourceName {
307
+ return true
308
+ }
309
+ }
310
+
311
+ return false
312
+ }
313
+
278
314
func getVolumeMountName (volumes []v1.Volume , mountType string , volumeName string ) string {
279
315
for i := range volumes {
280
316
if mountType == constants .ConfigmapEnvVarPostfix {
0 commit comments