This commit is contained in:
Vladimir Videlov
2025-07-02 12:20:42 +02:00
parent 8b0311f799
commit f896e1462d
2 changed files with 12 additions and 25 deletions
-1
View File
@@ -205,7 +205,6 @@ func doRollingUpgrade(config util.Config, collectors metrics.Collectors, recorde
}
func rollingUpgrade(clients kube.Clients, config util.Config, upgradeFuncs callbacks.RollingUpgradeFuncs, collectors metrics.Collectors, recorder record.EventRecorder, strategy invokeStrategy) error {
err := PerformAction(clients, config, upgradeFuncs, collectors, recorder, strategy)
if err != nil {
logrus.Errorf("Rolling upgrade for '%s' failed with error = %v", config.ResourceName, err)
+12 -24
View File
@@ -1441,18 +1441,16 @@ func TestRollingUpgradeForDeploymentWithConfigmapUsingArs(t *testing.T) {
deploymentFuncs := GetDeploymentRollingUpgradeFuncs()
collectors := getCollectors()
orgItemFunc := deploymentFuncs.ItemFunc
orgItemsFunc := deploymentFuncs.ItemsFunc
itemCalled := 0
itemsCalled := 0
deploymentFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
itemCalled++
return orgItemFunc(client, namespace, name)
return callbacks.GetDeploymentItem(client, namespace, name)
}
deploymentFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
itemsCalled++
return orgItemsFunc(client, namespace)
return callbacks.GetDeploymentItems(client, namespace)
}
err := PerformAction(clients, config, deploymentFuncs, collectors, nil, invokeReloadStrategy)
@@ -1492,18 +1490,16 @@ func TestRollingUpgradeForDeploymentWithPatchAndRetryUsingArs(t *testing.T) {
assert.True(t, deploymentFuncs.SupportsPatch)
assert.NotEmpty(t, deploymentFuncs.PatchTemplatesFunc().AnnotationTemplate)
orgItemFunc := deploymentFuncs.ItemFunc
orgItemsFunc := deploymentFuncs.ItemsFunc
itemCalled := 0
itemsCalled := 0
deploymentFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
itemCalled++
return orgItemFunc(client, namespace, name)
return callbacks.GetDeploymentItem(client, namespace, name)
}
deploymentFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
itemsCalled++
return orgItemsFunc(client, namespace)
return callbacks.GetDeploymentItems(client, namespace)
}
patchCalled := 0
@@ -2238,18 +2234,16 @@ func TestRollingUpgradeForDaemonSetWithConfigmapUsingArs(t *testing.T) {
daemonSetFuncs := GetDaemonSetRollingUpgradeFuncs()
collectors := getCollectors()
orgItemFunc := daemonSetFuncs.ItemFunc
orgItemsFunc := daemonSetFuncs.ItemsFunc
itemCalled := 0
itemsCalled := 0
daemonSetFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
itemCalled++
return orgItemFunc(client, namespace, name)
return callbacks.GetDaemonSetItem(client, namespace, name)
}
daemonSetFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
itemsCalled++
return orgItemsFunc(client, namespace)
return callbacks.GetDaemonSetItems(client, namespace)
}
err := PerformAction(clients, config, daemonSetFuncs, collectors, nil, invokeReloadStrategy)
@@ -2286,18 +2280,16 @@ func TestRollingUpgradeForDaemonSetWithPatchAndRetryUsingArs(t *testing.T) {
config := getConfigWithAnnotations(envVarPostfix, arsConfigmapName, shaData, options.ConfigmapUpdateOnChangeAnnotation, options.ConfigmapReloaderAutoAnnotation)
daemonSetFuncs := GetDaemonSetRollingUpgradeFuncs()
orgItemFunc := daemonSetFuncs.ItemFunc
orgItemsFunc := daemonSetFuncs.ItemsFunc
itemCalled := 0
itemsCalled := 0
daemonSetFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
itemCalled++
return orgItemFunc(client, namespace, name)
return callbacks.GetDaemonSetItem(client, namespace, name)
}
daemonSetFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
itemsCalled++
return orgItemsFunc(client, namespace)
return callbacks.GetDaemonSetItems(client, namespace)
}
assert.True(t, daemonSetFuncs.SupportsPatch)
@@ -2473,18 +2465,16 @@ func TestRollingUpgradeForStatefulSetWithConfigmapUsingArs(t *testing.T) {
statefulSetFuncs := GetStatefulSetRollingUpgradeFuncs()
collectors := getCollectors()
orgItemFunc := statefulSetFuncs.ItemFunc
orgItemsFunc := statefulSetFuncs.ItemsFunc
itemCalled := 0
itemsCalled := 0
statefulSetFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
itemCalled++
return orgItemFunc(client, namespace, name)
return callbacks.GetStatefulSetItem(client, namespace, name)
}
statefulSetFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
itemsCalled++
return orgItemsFunc(client, namespace)
return callbacks.GetStatefulSetItems(client, namespace)
}
err := PerformAction(clients, config, statefulSetFuncs, collectors, nil, invokeReloadStrategy)
@@ -2521,18 +2511,16 @@ func TestRollingUpgradeForStatefulSetWithPatchAndRetryUsingArs(t *testing.T) {
config := getConfigWithAnnotations(envVarPostfix, arsConfigmapName, shaData, options.ConfigmapUpdateOnChangeAnnotation, options.ConfigmapReloaderAutoAnnotation)
statefulSetFuncs := GetStatefulSetRollingUpgradeFuncs()
orgItemFunc := statefulSetFuncs.ItemFunc
orgItemsFunc := statefulSetFuncs.ItemsFunc
itemCalled := 0
itemsCalled := 0
statefulSetFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
itemCalled++
return orgItemFunc(client, namespace, name)
return callbacks.GetStatefulSetItem(client, namespace, name)
}
statefulSetFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
itemsCalled++
return orgItemsFunc(client, namespace)
return callbacks.GetStatefulSetItems(client, namespace)
}
assert.True(t, statefulSetFuncs.SupportsPatch)