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
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/api/apps/v1"
|
v1 "k8s.io/api/apps/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
"sigs.k8s.io/gateway-api/apis/v1beta1"
|
"sigs.k8s.io/gateway-api/apis/v1beta1"
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ limitations under the License.
|
||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/api/apps/v1"
|
v1 "k8s.io/api/apps/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
apisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
|
apisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,15 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
apps "k8s.io/api/apps/v1"
|
apps "k8s.io/api/apps/v1"
|
||||||
|
|
||||||
"github.com/openkruise/rollouts/api/v1alpha1"
|
"github.com/openkruise/rollouts/api/v1alpha1"
|
||||||
"github.com/openkruise/rollouts/api/v1beta1"
|
"github.com/openkruise/rollouts/api/v1beta1"
|
||||||
"github.com/openkruise/rollouts/pkg/trafficrouting"
|
|
||||||
"github.com/openkruise/rollouts/pkg/feature"
|
"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"
|
"github.com/openkruise/rollouts/pkg/util"
|
||||||
|
utilfeature "github.com/openkruise/rollouts/pkg/util/feature"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
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)
|
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".
|
// Do nothing, effectively skipping this step and considering it "done".
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, run the original logic to unpause the workload.
|
// Otherwise, run the original logic to unpause the workload.
|
||||||
retry, err = finalizingBatchRelease(m.Client, c)
|
retry, err = finalizingBatchRelease(m.Client, c)
|
||||||
if err == nil && !retry {
|
if err == nil && !retry {
|
||||||
dep := &apps.Deployment{}
|
dep := &apps.Deployment{}
|
||||||
key := client.ObjectKey{Namespace: c.Rollout.Namespace, Name: c.Rollout.Spec.WorkloadRef.Name}
|
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 getErr := m.Client.Get(context.TODO(), key, dep); getErr == nil {
|
||||||
if dep.Spec.Paused {
|
if dep.Spec.Paused {
|
||||||
dep.Spec.Paused = false
|
dep.Spec.Paused = false
|
||||||
if updErr := m.Client.Update(context.TODO(), dep); updErr != nil {
|
if updErr := m.Client.Update(context.TODO(), dep); updErr != nil {
|
||||||
return false, updErr
|
return false, updErr
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// delete batchRelease
|
// delete batchRelease
|
||||||
case v1beta1.FinalisingStepReleaseWorkloadControl:
|
case v1beta1.FinalisingStepReleaseWorkloadControl:
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,14 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
apps "k8s.io/api/apps/v1"
|
|
||||||
"github.com/openkruise/rollouts/api/v1alpha1"
|
"github.com/openkruise/rollouts/api/v1alpha1"
|
||||||
"github.com/openkruise/rollouts/api/v1beta1"
|
"github.com/openkruise/rollouts/api/v1beta1"
|
||||||
"github.com/openkruise/rollouts/pkg/trafficrouting"
|
|
||||||
"github.com/openkruise/rollouts/pkg/feature"
|
"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"
|
"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"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
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)
|
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".
|
// Do nothing, effectively skipping this step and considering it "done".
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, run the original logic to unpause the workload.
|
// Otherwise, run the original logic to unpause the workload.
|
||||||
retry, err = finalizingBatchRelease(m.Client, c)
|
retry, err = finalizingBatchRelease(m.Client, c)
|
||||||
if err == nil && !retry {
|
if err == nil && !retry {
|
||||||
dep := &apps.Deployment{}
|
dep := &apps.Deployment{}
|
||||||
key := client.ObjectKey{Namespace: c.Rollout.Namespace, Name: c.Rollout.Spec.WorkloadRef.Name}
|
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 getErr := m.Client.Get(context.TODO(), key, dep); getErr == nil {
|
||||||
if dep.Spec.Paused {
|
if dep.Spec.Paused {
|
||||||
dep.Spec.Paused = false
|
dep.Spec.Paused = false
|
||||||
if updErr := m.Client.Update(context.TODO(), dep); updErr != nil {
|
if updErr := m.Client.Update(context.TODO(), dep); updErr != nil {
|
||||||
return false, updErr
|
return false, updErr
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// delete batchRelease
|
// delete batchRelease
|
||||||
case v1beta1.FinalisingStepReleaseWorkloadControl:
|
case v1beta1.FinalisingStepReleaseWorkloadControl:
|
||||||
|
|
|
||||||
|
|
@ -19,21 +19,22 @@ package rollout
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/openkruise/rollouts/pkg/trafficrouting"
|
||||||
"github.com/stretchr/testify/assert"
|
"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/client/fake"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
|
||||||
"github.com/openkruise/rollouts/pkg/trafficrouting"
|
|
||||||
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rolloutapi "github.com/openkruise/rollouts/api"
|
rolloutapi "github.com/openkruise/rollouts/api"
|
||||||
"github.com/openkruise/rollouts/api/v1alpha1"
|
"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/api/v1beta1"
|
||||||
|
"github.com/openkruise/rollouts/pkg/feature"
|
||||||
"github.com/openkruise/rollouts/pkg/util"
|
"github.com/openkruise/rollouts/pkg/util"
|
||||||
"github.com/openkruise/rollouts/pkg/util/configuration"
|
"github.com/openkruise/rollouts/pkg/util/configuration"
|
||||||
|
utilfeature "github.com/openkruise/rollouts/pkg/util/feature"
|
||||||
apps "k8s.io/api/apps/v1"
|
apps "k8s.io/api/apps/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
netv1 "k8s.io/api/networking/v1"
|
netv1 "k8s.io/api/networking/v1"
|
||||||
|
|
@ -463,11 +464,11 @@ func TestFinalizeRolloutKeepPaused(t *testing.T) {
|
||||||
Scheme: scheme,
|
Scheme: scheme,
|
||||||
finder: util.NewControllerFinder(fakeClient),
|
finder: util.NewControllerFinder(fakeClient),
|
||||||
canaryManager: &canaryReleaseManager{
|
canaryManager: &canaryReleaseManager{
|
||||||
Client: fakeClient,
|
Client: fakeClient,
|
||||||
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
||||||
},
|
},
|
||||||
blueGreenManager: &blueGreenReleaseManager{
|
blueGreenManager: &blueGreenReleaseManager{
|
||||||
Client: fakeClient,
|
Client: fakeClient,
|
||||||
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -496,11 +497,11 @@ func TestFinalizeRolloutKeepPaused(t *testing.T) {
|
||||||
Scheme: scheme,
|
Scheme: scheme,
|
||||||
finder: util.NewControllerFinder(fakeClient),
|
finder: util.NewControllerFinder(fakeClient),
|
||||||
canaryManager: &canaryReleaseManager{
|
canaryManager: &canaryReleaseManager{
|
||||||
Client: fakeClient,
|
Client: fakeClient,
|
||||||
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
||||||
},
|
},
|
||||||
blueGreenManager: &blueGreenReleaseManager{
|
blueGreenManager: &blueGreenReleaseManager{
|
||||||
Client: fakeClient,
|
Client: fakeClient,
|
||||||
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
trafficRoutingManager: trafficrouting.NewTrafficRoutingManager(fakeClient),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
|
var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
|
||||||
RolloutHistoryGate: {Default: false, PreRelease: featuregate.Alpha},
|
RolloutHistoryGate: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
AdvancedDeploymentGate: {Default: false, PreRelease: featuregate.Alpha},
|
AdvancedDeploymentGate: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
AppendServiceSelectorGate: {Default: false, PreRelease: featuregate.Alpha},
|
AppendServiceSelectorGate: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
KeepDeploymentPausedOnDeletionGate: {Default: false, PreRelease: featuregate.Alpha},
|
KeepDeploymentPausedOnDeletionGate: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue