Skip to content

Commit

Permalink
Merge pull request #7909 from johngmyers/remove-drain-feature-flag
Browse files Browse the repository at this point in the history
Remove DrainAndValidateRollingUpdate feature flag
  • Loading branch information
k8s-ci-robot authored Jan 5, 2020
2 parents 95f4f83 + 4eccd3d commit 121d9f4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 21 deletions.
19 changes: 6 additions & 13 deletions cmd/kops/rollingupdatecluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/klog"
"k8s.io/kops/cmd/kops/util"
api "k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/cloudinstances"
"k8s.io/kops/pkg/featureflag"
"k8s.io/kops/pkg/instancegroups"
"k8s.io/kops/pkg/pretty"
"k8s.io/kops/pkg/validation"
Expand Down Expand Up @@ -186,10 +184,8 @@ func NewCmdRollingUpdateCluster(f *util.Factory, out io.Writer) *cobra.Command {
cmd.Flags().StringSliceVar(&options.InstanceGroups, "instance-group", options.InstanceGroups, "List of instance groups to update (defaults to all if not specified)")
cmd.Flags().StringSliceVar(&options.InstanceGroupRoles, "instance-group-roles", options.InstanceGroupRoles, "If specified, only instance groups of the specified role will be updated (e.g. Master,Node,Bastion)")

if featureflag.DrainAndValidateRollingUpdate.Enabled() {
cmd.Flags().BoolVar(&options.FailOnDrainError, "fail-on-drain-error", true, "The rolling-update will fail if draining a node fails.")
cmd.Flags().BoolVar(&options.FailOnValidate, "fail-on-validate-error", true, "The rolling-update will fail if the cluster fails to validate.")
}
cmd.Flags().BoolVar(&options.FailOnDrainError, "fail-on-drain-error", true, "The rolling-update will fail if draining a node fails.")
cmd.Flags().BoolVar(&options.FailOnValidate, "fail-on-validate-error", true, "The rolling-update will fail if the cluster fails to validate.")

cmd.Run = func(cmd *cobra.Command, args []string) {
err := rootCommand.ProcessArgs(args)
Expand Down Expand Up @@ -389,13 +385,10 @@ func RunRollingUpdateCluster(f *util.Factory, out io.Writer, options *RollingUpd
}

var clusterValidator validation.ClusterValidator
if featureflag.DrainAndValidateRollingUpdate.Enabled() {
klog.V(2).Infof("Rolling update with drain and validate enabled.")
if !options.CloudOnly {
clusterValidator, err = validation.NewClusterValidator(cluster, cloud, list, k8sClient)
if err != nil {
return fmt.Errorf("cannot create cluster validator: %v", err)
}
if !options.CloudOnly {
clusterValidator, err = validation.NewClusterValidator(cluster, cloud, list, k8sClient)
if err != nil {
return fmt.Errorf("cannot create cluster validator: %v", err)
}
}
d := &instancegroups.RollingUpdateCluster{
Expand Down
2 changes: 0 additions & 2 deletions pkg/featureflag/featureflag.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ var (
var (
// DNSPreCreate controls whether we pre-create DNS records.
DNSPreCreate = New("DNSPreCreate", Bool(true))
// DrainAndValidateRollingUpdate if set will use new rolling update code that will drain and validate.
DrainAndValidateRollingUpdate = New("DrainAndValidateRollingUpdate", Bool(true))
// EnableLaunchTemplates indicates we wish to switch to using launch templates rather than launchconfigurations
EnableLaunchTemplates = New("EnableLaunchTemplates", Bool(false))
//EnableExternalCloudController toggles the use of cloud-controller-manager introduced in v1.7
Expand Down
1 change: 0 additions & 1 deletion pkg/instancegroups/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ go_library(
"//pkg/client/simple:go_default_library",
"//pkg/cloudinstances:go_default_library",
"//pkg/drain:go_default_library",
"//pkg/featureflag:go_default_library",
"//pkg/validation:go_default_library",
"//upup/pkg/fi:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
Expand Down
7 changes: 3 additions & 4 deletions pkg/instancegroups/instancegroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
api "k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/cloudinstances"
"k8s.io/kops/pkg/drain"
"k8s.io/kops/pkg/featureflag"
"k8s.io/kops/upup/pkg/fi"
)

Expand Down Expand Up @@ -132,7 +131,7 @@ func (r *RollingUpdateInstanceGroup) RollingUpdate(rollingUpdateData *RollingUpd
klog.V(3).Info("Not validating the cluster as instance is a bastion.")
} else if rollingUpdateData.CloudOnly {
klog.V(3).Info("Not validating cluster as validation is turned off via the cloud-only flag.")
} else if featureflag.DrainAndValidateRollingUpdate.Enabled() {
} else {
if err = r.validateCluster(rollingUpdateData, cluster); err != nil {
if rollingUpdateData.FailOnValidate {
return err
Expand Down Expand Up @@ -163,7 +162,7 @@ func (r *RollingUpdateInstanceGroup) RollingUpdate(rollingUpdateData *RollingUpd

klog.Warning("Not draining cluster nodes as 'cloudonly' flag is set.")

} else if featureflag.DrainAndValidateRollingUpdate.Enabled() {
} else {

if u.Node != nil {
klog.Infof("Draining the node: %q.", nodeName)
Expand Down Expand Up @@ -204,7 +203,7 @@ func (r *RollingUpdateInstanceGroup) RollingUpdate(rollingUpdateData *RollingUpd
if rollingUpdateData.CloudOnly {
klog.Warningf("Not validating cluster as cloudonly flag is set.")

} else if featureflag.DrainAndValidateRollingUpdate.Enabled() {
} else {
klog.Info("Validating the cluster.")

if err = r.validateClusterWithDuration(rollingUpdateData, validationTimeout); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/instancegroups/rollingupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type RollingUpdateCluster struct {
// K8sClient is the kubernetes client, used for draining etc
K8sClient kubernetes.Interface

// ClusterValidator is used for validating the cluster. Unused if DrainAndValidateRollingUpdate disabled or CloudOnly
// ClusterValidator is used for validating the cluster. Unused if CloudOnly
ClusterValidator validation.ClusterValidator

FailOnDrainError bool
Expand Down

0 comments on commit 121d9f4

Please sign in to comment.