Merge pull request #7909 from johngmyers/remove-drain-feature-flag

Remove DrainAndValidateRollingUpdate feature flag
This commit is contained in:
Kubernetes Prow Robot 2020-01-05 11:15:40 -08:00 committed by GitHub
commit 121d9f461f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 21 deletions

View File

@ -30,11 +30,9 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth" _ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/klog"
"k8s.io/kops/cmd/kops/util" "k8s.io/kops/cmd/kops/util"
api "k8s.io/kops/pkg/apis/kops" api "k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/cloudinstances" "k8s.io/kops/pkg/cloudinstances"
"k8s.io/kops/pkg/featureflag"
"k8s.io/kops/pkg/instancegroups" "k8s.io/kops/pkg/instancegroups"
"k8s.io/kops/pkg/pretty" "k8s.io/kops/pkg/pretty"
"k8s.io/kops/pkg/validation" "k8s.io/kops/pkg/validation"
@ -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.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)") 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.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.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) { cmd.Run = func(cmd *cobra.Command, args []string) {
err := rootCommand.ProcessArgs(args) err := rootCommand.ProcessArgs(args)
@ -389,13 +385,10 @@ func RunRollingUpdateCluster(f *util.Factory, out io.Writer, options *RollingUpd
} }
var clusterValidator validation.ClusterValidator var clusterValidator validation.ClusterValidator
if featureflag.DrainAndValidateRollingUpdate.Enabled() { if !options.CloudOnly {
klog.V(2).Infof("Rolling update with drain and validate enabled.") clusterValidator, err = validation.NewClusterValidator(cluster, cloud, list, k8sClient)
if !options.CloudOnly { if err != nil {
clusterValidator, err = validation.NewClusterValidator(cluster, cloud, list, k8sClient) return fmt.Errorf("cannot create cluster validator: %v", err)
if err != nil {
return fmt.Errorf("cannot create cluster validator: %v", err)
}
} }
} }
d := &instancegroups.RollingUpdateCluster{ d := &instancegroups.RollingUpdateCluster{

View File

@ -49,8 +49,6 @@ var (
var ( var (
// DNSPreCreate controls whether we pre-create DNS records. // DNSPreCreate controls whether we pre-create DNS records.
DNSPreCreate = New("DNSPreCreate", Bool(true)) 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 indicates we wish to switch to using launch templates rather than launchconfigurations
EnableLaunchTemplates = New("EnableLaunchTemplates", Bool(false)) EnableLaunchTemplates = New("EnableLaunchTemplates", Bool(false))
//EnableExternalCloudController toggles the use of cloud-controller-manager introduced in v1.7 //EnableExternalCloudController toggles the use of cloud-controller-manager introduced in v1.7

View File

@ -14,7 +14,6 @@ go_library(
"//pkg/client/simple:go_default_library", "//pkg/client/simple:go_default_library",
"//pkg/cloudinstances:go_default_library", "//pkg/cloudinstances:go_default_library",
"//pkg/drain:go_default_library", "//pkg/drain:go_default_library",
"//pkg/featureflag:go_default_library",
"//pkg/validation:go_default_library", "//pkg/validation:go_default_library",
"//upup/pkg/fi:go_default_library", "//upup/pkg/fi:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library",

View File

@ -33,7 +33,6 @@ import (
api "k8s.io/kops/pkg/apis/kops" api "k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/cloudinstances" "k8s.io/kops/pkg/cloudinstances"
"k8s.io/kops/pkg/drain" "k8s.io/kops/pkg/drain"
"k8s.io/kops/pkg/featureflag"
"k8s.io/kops/upup/pkg/fi" "k8s.io/kops/upup/pkg/fi"
) )
@ -132,7 +131,7 @@ func (r *RollingUpdateInstanceGroup) RollingUpdate(rollingUpdateData *RollingUpd
klog.V(3).Info("Not validating the cluster as instance is a bastion.") klog.V(3).Info("Not validating the cluster as instance is a bastion.")
} else if rollingUpdateData.CloudOnly { } else if rollingUpdateData.CloudOnly {
klog.V(3).Info("Not validating cluster as validation is turned off via the cloud-only flag.") 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 err = r.validateCluster(rollingUpdateData, cluster); err != nil {
if rollingUpdateData.FailOnValidate { if rollingUpdateData.FailOnValidate {
return err return err
@ -163,7 +162,7 @@ func (r *RollingUpdateInstanceGroup) RollingUpdate(rollingUpdateData *RollingUpd
klog.Warning("Not draining cluster nodes as 'cloudonly' flag is set.") klog.Warning("Not draining cluster nodes as 'cloudonly' flag is set.")
} else if featureflag.DrainAndValidateRollingUpdate.Enabled() { } else {
if u.Node != nil { if u.Node != nil {
klog.Infof("Draining the node: %q.", nodeName) klog.Infof("Draining the node: %q.", nodeName)
@ -204,7 +203,7 @@ func (r *RollingUpdateInstanceGroup) RollingUpdate(rollingUpdateData *RollingUpd
if rollingUpdateData.CloudOnly { if rollingUpdateData.CloudOnly {
klog.Warningf("Not validating cluster as cloudonly flag is set.") klog.Warningf("Not validating cluster as cloudonly flag is set.")
} else if featureflag.DrainAndValidateRollingUpdate.Enabled() { } else {
klog.Info("Validating the cluster.") klog.Info("Validating the cluster.")
if err = r.validateClusterWithDuration(rollingUpdateData, validationTimeout); err != nil { if err = r.validateClusterWithDuration(rollingUpdateData, validationTimeout); err != nil {

View File

@ -47,7 +47,7 @@ type RollingUpdateCluster struct {
// K8sClient is the kubernetes client, used for draining etc // K8sClient is the kubernetes client, used for draining etc
K8sClient kubernetes.Interface 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 ClusterValidator validation.ClusterValidator
FailOnDrainError bool FailOnDrainError bool