@@ -138,7 +138,7 @@ func GetArgoRolloutRollingUpgradeFuncs() callbacks.RollingUpgradeFuncs {
138
138
}
139
139
}
140
140
141
- func sendUpgradeWebhook (config util .Config , webhookUrl string ) error {
141
+ func sendUpgradeWebhook (config common .Config , webhookUrl string ) error {
142
142
logrus .Infof ("Changes detected in '%s' of type '%s' in namespace '%s', Sending webhook to '%s'" ,
143
143
config .ResourceName , config .Type , config .Namespace , webhookUrl )
144
144
@@ -169,7 +169,7 @@ func sendWebhook(url string) (string, []error) {
169
169
return buffer .String (), nil
170
170
}
171
171
172
- func doRollingUpgrade (config util .Config , collectors metrics.Collectors , recorder record.EventRecorder , invoke invokeStrategy ) error {
172
+ func doRollingUpgrade (config common .Config , collectors metrics.Collectors , recorder record.EventRecorder , invoke invokeStrategy ) error {
173
173
clients := kube .GetClients ()
174
174
175
175
err := rollingUpgrade (clients , config , GetDeploymentRollingUpgradeFuncs (), collectors , recorder , invoke )
@@ -203,7 +203,7 @@ func doRollingUpgrade(config util.Config, collectors metrics.Collectors, recorde
203
203
return nil
204
204
}
205
205
206
- func rollingUpgrade (clients kube.Clients , config util .Config , upgradeFuncs callbacks.RollingUpgradeFuncs , collectors metrics.Collectors , recorder record.EventRecorder , strategy invokeStrategy ) error {
206
+ func rollingUpgrade (clients kube.Clients , config common .Config , upgradeFuncs callbacks.RollingUpgradeFuncs , collectors metrics.Collectors , recorder record.EventRecorder , strategy invokeStrategy ) error {
207
207
err := PerformAction (clients , config , upgradeFuncs , collectors , recorder , strategy )
208
208
if err != nil {
209
209
logrus .Errorf ("Rolling upgrade for '%s' failed with error = %v" , config .ResourceName , err )
@@ -212,7 +212,7 @@ func rollingUpgrade(clients kube.Clients, config util.Config, upgradeFuncs callb
212
212
}
213
213
214
214
// PerformAction invokes the deployment if there is any change in configmap or secret data
215
- func PerformAction (clients kube.Clients , config util .Config , upgradeFuncs callbacks.RollingUpgradeFuncs , collectors metrics.Collectors , recorder record.EventRecorder , strategy invokeStrategy ) error {
215
+ func PerformAction (clients kube.Clients , config common .Config , upgradeFuncs callbacks.RollingUpgradeFuncs , collectors metrics.Collectors , recorder record.EventRecorder , strategy invokeStrategy ) error {
216
216
items := upgradeFuncs .ItemsFunc (clients , config .Namespace )
217
217
218
218
for _ , item := range items {
@@ -249,7 +249,7 @@ func retryOnConflict(backoff wait.Backoff, fn func(_ bool) error) error {
249
249
return err
250
250
}
251
251
252
- func upgradeResource (clients kube.Clients , config util .Config , upgradeFuncs callbacks.RollingUpgradeFuncs , collectors metrics.Collectors , recorder record.EventRecorder , strategy invokeStrategy , resource runtime.Object , fetchResource bool ) error {
252
+ func upgradeResource (clients kube.Clients , config common .Config , upgradeFuncs callbacks.RollingUpgradeFuncs , collectors metrics.Collectors , recorder record.EventRecorder , strategy invokeStrategy , resource runtime.Object , fetchResource bool ) error {
253
253
accessor , err := meta .Accessor (resource )
254
254
if err != nil {
255
255
return err
@@ -264,7 +264,7 @@ func upgradeResource(clients kube.Clients, config util.Config, upgradeFuncs call
264
264
}
265
265
annotations := upgradeFuncs .AnnotationsFunc (resource )
266
266
podAnnotations := upgradeFuncs .PodAnnotationsFunc (resource )
267
- result := common .ShouldReloadInternal (config , upgradeFuncs .ResourceType , annotations , podAnnotations , common .GetCommandLineOptions ())
267
+ result := common .ShouldReload (config , upgradeFuncs .ResourceType , annotations , podAnnotations , common .GetCommandLineOptions ())
268
268
269
269
if ! result .ShouldReload {
270
270
logrus .Debugf ("No changes detected in '%s' of type '%s' in namespace '%s'" , config .ResourceName , config .Type , config .Namespace )
@@ -403,7 +403,7 @@ func getContainerWithEnvReference(containers []v1.Container, resourceName string
403
403
return nil
404
404
}
405
405
406
- func getContainerUsingResource (upgradeFuncs callbacks.RollingUpgradeFuncs , item runtime.Object , config util .Config , autoReload bool ) * v1.Container {
406
+ func getContainerUsingResource (upgradeFuncs callbacks.RollingUpgradeFuncs , item runtime.Object , config common .Config , autoReload bool ) * v1.Container {
407
407
volumes := upgradeFuncs .VolumesFunc (item )
408
408
containers := upgradeFuncs .ContainersFunc (item )
409
409
initContainers := upgradeFuncs .InitContainersFunc (item )
@@ -452,24 +452,24 @@ type InvokeStrategyResult struct {
452
452
Patch * Patch
453
453
}
454
454
455
- type invokeStrategy func (upgradeFuncs callbacks.RollingUpgradeFuncs , item runtime.Object , config util .Config , autoReload bool ) InvokeStrategyResult
455
+ type invokeStrategy func (upgradeFuncs callbacks.RollingUpgradeFuncs , item runtime.Object , config common .Config , autoReload bool ) InvokeStrategyResult
456
456
457
- func invokeReloadStrategy (upgradeFuncs callbacks.RollingUpgradeFuncs , item runtime.Object , config util .Config , autoReload bool ) InvokeStrategyResult {
457
+ func invokeReloadStrategy (upgradeFuncs callbacks.RollingUpgradeFuncs , item runtime.Object , config common .Config , autoReload bool ) InvokeStrategyResult {
458
458
if options .ReloadStrategy == constants .AnnotationsReloadStrategy {
459
459
return updatePodAnnotations (upgradeFuncs , item , config , autoReload )
460
460
}
461
461
return updateContainerEnvVars (upgradeFuncs , item , config , autoReload )
462
462
}
463
463
464
- func updatePodAnnotations (upgradeFuncs callbacks.RollingUpgradeFuncs , item runtime.Object , config util .Config , autoReload bool ) InvokeStrategyResult {
464
+ func updatePodAnnotations (upgradeFuncs callbacks.RollingUpgradeFuncs , item runtime.Object , config common .Config , autoReload bool ) InvokeStrategyResult {
465
465
container := getContainerUsingResource (upgradeFuncs , item , config , autoReload )
466
466
if container == nil {
467
467
return InvokeStrategyResult {constants .NoContainerFound , nil }
468
468
}
469
469
470
470
// Generate reloaded annotations. Attaching this to the item's annotation will trigger a rollout
471
471
// Note: the data on this struct is purely informational and is not used for future updates
472
- reloadSource := util .NewReloadSourceFromConfig (config , []string {container .Name })
472
+ reloadSource := common .NewReloadSourceFromConfig (config , []string {container .Name })
473
473
annotations , patch , err := createReloadedAnnotations (& reloadSource , upgradeFuncs )
474
474
if err != nil {
475
475
logrus .Errorf ("Failed to create reloaded annotations for %s! error = %v" , config .ResourceName , err )
@@ -496,7 +496,7 @@ func getReloaderAnnotationKey() string {
496
496
)
497
497
}
498
498
499
- func createReloadedAnnotations (target * util .ReloadSource , upgradeFuncs callbacks.RollingUpgradeFuncs ) (map [string ]string , []byte , error ) {
499
+ func createReloadedAnnotations (target * common .ReloadSource , upgradeFuncs callbacks.RollingUpgradeFuncs ) (map [string ]string , []byte , error ) {
500
500
if target == nil {
501
501
return nil , nil , errors .New ("target is required" )
502
502
}
@@ -531,7 +531,7 @@ func getEnvVarName(resourceName string, typeName string) string {
531
531
return constants .EnvVarPrefix + util .ConvertToEnvVarName (resourceName ) + "_" + typeName
532
532
}
533
533
534
- func updateContainerEnvVars (upgradeFuncs callbacks.RollingUpgradeFuncs , item runtime.Object , config util .Config , autoReload bool ) InvokeStrategyResult {
534
+ func updateContainerEnvVars (upgradeFuncs callbacks.RollingUpgradeFuncs , item runtime.Object , config common .Config , autoReload bool ) InvokeStrategyResult {
535
535
envVar := getEnvVarName (config .ResourceName , config .Type )
536
536
container := getContainerUsingResource (upgradeFuncs , item , config , autoReload )
537
537
0 commit comments