small tweaks
Signed-off-by: GautamBytes <manchandanigautam@gmail.com>
This commit is contained in:
parent
79bc354eea
commit
dd6a2f7db9
|
|
@ -22,7 +22,7 @@ limitations under the License.
|
|||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/apps/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"sigs.k8s.io/gateway-api/apis/v1beta1"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ limitations under the License.
|
|||
package v1beta1
|
||||
|
||||
import (
|
||||
"k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/apps/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
apisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
|
||||
|
|
|
|||
|
|
@ -21,14 +21,15 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
apps "k8s.io/api/apps/v1"
|
||||
|
||||
"github.com/openkruise/rollouts/api/v1alpha1"
|
||||
"github.com/openkruise/rollouts/api/v1beta1"
|
||||
"github.com/openkruise/rollouts/pkg/trafficrouting"
|
||||
"github.com/openkruise/rollouts/pkg/feature"
|
||||
utilfeature "github.com/openkruise/rollouts/pkg/util/feature"
|
||||
"github.com/openkruise/rollouts/pkg/trafficrouting"
|
||||
"github.com/openkruise/rollouts/pkg/util"
|
||||
utilfeature "github.com/openkruise/rollouts/pkg/util/feature"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
@ -314,20 +315,20 @@ func (m *blueGreenReleaseManager) doCanaryFinalising(c *RolloutContext) (bool, e
|
|||
klog.Infof("Rollout(%s/%s) is being deleted, KeepDeploymentPausedOnDeletion is enabled. Skipping resume workload step.", c.Rollout.Namespace, c.Rollout.Name)
|
||||
// Do nothing, effectively skipping this step and considering it "done".
|
||||
} else {
|
||||
// Otherwise, run the original logic to unpause the workload.
|
||||
retry, err = finalizingBatchRelease(m.Client, c)
|
||||
if err == nil && !retry {
|
||||
dep := &apps.Deployment{}
|
||||
key := client.ObjectKey{Namespace: c.Rollout.Namespace, Name: c.Rollout.Spec.WorkloadRef.Name}
|
||||
if getErr := m.Client.Get(context.TODO(), key, dep); getErr == nil {
|
||||
if dep.Spec.Paused {
|
||||
dep.Spec.Paused = false
|
||||
if updErr := m.Client.Update(context.TODO(), dep); updErr != nil {
|
||||
return false, updErr
|
||||
}
|
||||
// Otherwise, run the original logic to unpause the workload.
|
||||
retry, err = finalizingBatchRelease(m.Client, c)
|
||||
if err == nil && !retry {
|
||||
dep := &apps.Deployment{}
|
||||
key := client.ObjectKey{Namespace: c.Rollout.Namespace, Name: c.Rollout.Spec.WorkloadRef.Name}
|
||||
if getErr := m.Client.Get(context.TODO(), key, dep); getErr == nil {
|
||||
if dep.Spec.Paused {
|
||||
dep.Spec.Paused = false
|
||||
if updErr := m.Client.Update(context.TODO(), dep); updErr != nil {
|
||||
return false, updErr
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// delete batchRelease
|
||||
case v1beta1.FinalisingStepReleaseWorkloadControl:
|
||||
|
|
|
|||
|
|
@ -21,13 +21,14 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
|
||||
"github.com/openkruise/rollouts/api/v1alpha1"
|
||||
"github.com/openkruise/rollouts/api/v1beta1"
|
||||
"github.com/openkruise/rollouts/pkg/trafficrouting"
|
||||
"github.com/openkruise/rollouts/pkg/feature"
|
||||
utilfeature "github.com/openkruise/rollouts/pkg/util/feature"
|
||||
"github.com/openkruise/rollouts/pkg/trafficrouting"
|
||||
"github.com/openkruise/rollouts/pkg/util"
|
||||
utilfeature "github.com/openkruise/rollouts/pkg/util/feature"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
@ -379,20 +380,20 @@ func (m *canaryReleaseManager) doCanaryFinalising(c *RolloutContext) (bool, erro
|
|||
klog.Infof("Rollout(%s/%s) is being deleted, KeepDeploymentPausedOnDeletion is enabled. Skipping resume workload step.", c.Rollout.Namespace, c.Rollout.Name)
|
||||
// Do nothing, effectively skipping this step and considering it "done".
|
||||
} else {
|
||||
// Otherwise, run the original logic to unpause the workload.
|
||||
retry, err = finalizingBatchRelease(m.Client, c)
|
||||
if err == nil && !retry {
|
||||
dep := &apps.Deployment{}
|
||||
key := client.ObjectKey{Namespace: c.Rollout.Namespace, Name: c.Rollout.Spec.WorkloadRef.Name}
|
||||
if getErr := m.Client.Get(context.TODO(), key, dep); getErr == nil {
|
||||
if dep.Spec.Paused {
|
||||
dep.Spec.Paused = false
|
||||
if updErr := m.Client.Update(context.TODO(), dep); updErr != nil {
|
||||
return false, updErr
|
||||
}
|
||||
// Otherwise, run the original logic to unpause the workload.
|
||||
retry, err = finalizingBatchRelease(m.Client, c)
|
||||
if err == nil && !retry {
|
||||
dep := &apps.Deployment{}
|
||||
key := client.ObjectKey{Namespace: c.Rollout.Namespace, Name: c.Rollout.Spec.WorkloadRef.Name}
|
||||
if getErr := m.Client.Get(context.TODO(), key, dep); getErr == nil {
|
||||
if dep.Spec.Paused {
|
||||
dep.Spec.Paused = false
|
||||
if updErr := m.Client.Update(context.TODO(), dep); updErr != nil {
|
||||
return false, updErr
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// delete batchRelease
|
||||
case v1beta1.FinalisingStepReleaseWorkloadControl:
|
||||
|
|
|
|||
|
|
@ -19,21 +19,22 @@ package rollout
|
|||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/openkruise/rollouts/pkg/trafficrouting"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"github.com/openkruise/rollouts/pkg/trafficrouting"
|
||||
|
||||
"fmt"
|
||||
|
||||
rolloutapi "github.com/openkruise/rollouts/api"
|
||||
"github.com/openkruise/rollouts/api/v1alpha1"
|
||||
"github.com/openkruise/rollouts/pkg/feature"
|
||||
utilfeature "github.com/openkruise/rollouts/pkg/util/feature"
|
||||
"github.com/openkruise/rollouts/api/v1beta1"
|
||||
"github.com/openkruise/rollouts/pkg/feature"
|
||||
"github.com/openkruise/rollouts/pkg/util"
|
||||
"github.com/openkruise/rollouts/pkg/util/configuration"
|
||||
utilfeature "github.com/openkruise/rollouts/pkg/util/feature"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
netv1 "k8s.io/api/networking/v1"
|
||||
|
|
@ -463,11 +464,11 @@ func TestFinalizeRolloutKeepPaused(t *testing.T) {
|
|||
Scheme: scheme,
|
||||
finder: util.NewControllerFinder(fakeClient),
|
||||
canaryManager: &canaryReleaseManager{
|
||||
Client: fakeClient,
|
||||
Client: fakeClient,
|
||||
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
||||
},
|
||||
blueGreenManager: &blueGreenReleaseManager{
|
||||
Client: fakeClient,
|
||||
Client: fakeClient,
|
||||
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
||||
},
|
||||
}
|
||||
|
|
@ -496,11 +497,11 @@ func TestFinalizeRolloutKeepPaused(t *testing.T) {
|
|||
Scheme: scheme,
|
||||
finder: util.NewControllerFinder(fakeClient),
|
||||
canaryManager: &canaryReleaseManager{
|
||||
Client: fakeClient,
|
||||
Client: fakeClient,
|
||||
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
||||
},
|
||||
blueGreenManager: &blueGreenReleaseManager{
|
||||
Client: fakeClient,
|
||||
Client: fakeClient,
|
||||
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
||||
},
|
||||
}
|
||||
|
|
@ -515,4 +516,4 @@ func TestFinalizeRolloutKeepPaused(t *testing.T) {
|
|||
assert.Nil(t, err)
|
||||
assert.False(t, updatedDeployment.Spec.Paused, "Deployment should have been unpaused")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ const (
|
|||
)
|
||||
|
||||
var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
|
||||
RolloutHistoryGate: {Default: false, PreRelease: featuregate.Alpha},
|
||||
AdvancedDeploymentGate: {Default: false, PreRelease: featuregate.Alpha},
|
||||
AppendServiceSelectorGate: {Default: false, PreRelease: featuregate.Alpha},
|
||||
RolloutHistoryGate: {Default: false, PreRelease: featuregate.Alpha},
|
||||
AdvancedDeploymentGate: {Default: false, PreRelease: featuregate.Alpha},
|
||||
AppendServiceSelectorGate: {Default: false, PreRelease: featuregate.Alpha},
|
||||
KeepDeploymentPausedOnDeletionGate: {Default: false, PreRelease: featuregate.Alpha},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue