mirror of https://github.com/kubernetes/kops.git
Warn/prevent if the version of etcd is unsupported with etcd-manager
Should prevent the scenario where etcd-manager can't come up because of a different version. Can be bypassed with the SkipEtcdVersionCheck feature flag.
This commit is contained in:
parent
748c8c0ae6
commit
72b4563729
|
|
@ -82,6 +82,8 @@ var (
|
|||
VPCSkipEnableDNSSupport = New("VPCSkipEnableDNSSupport", Bool(false))
|
||||
// VSphereCloudProvider enables the vsphere cloud provider
|
||||
VSphereCloudProvider = New("VSphereCloudProvider", Bool(false))
|
||||
// SkipEtcdVersionCheck will bypass the check that etcd-manager is using a supported etcd version
|
||||
SkipEtcdVersionCheck = New("SkipEtcdVersionCheck", Bool(false))
|
||||
)
|
||||
|
||||
// FeatureFlag defines a feature flag
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ go_library(
|
|||
"//pkg/apis/kops:go_default_library",
|
||||
"//pkg/assets:go_default_library",
|
||||
"//pkg/dns:go_default_library",
|
||||
"//pkg/featureflag:go_default_library",
|
||||
"//pkg/flagbuilder:go_default_library",
|
||||
"//pkg/k8scodecs:go_default_library",
|
||||
"//pkg/kubemanifest:go_default_library",
|
||||
|
|
|
|||
|
|
@ -17,7 +17,12 @@ limitations under the License.
|
|||
package etcdmanager
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"k8s.io/klog"
|
||||
"k8s.io/kops/pkg/apis/kops"
|
||||
"k8s.io/kops/pkg/featureflag"
|
||||
"k8s.io/kops/pkg/model/components"
|
||||
"k8s.io/kops/pkg/urls"
|
||||
"k8s.io/kops/upup/pkg/fi/loader"
|
||||
|
|
@ -59,7 +64,29 @@ func (b *EtcdManagerOptionsBuilder) BuildOptions(o interface{}) error {
|
|||
etcdCluster.Version = "2.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
if !etcdVersionIsSupported(etcdCluster.Version) {
|
||||
if featureflag.SkipEtcdVersionCheck.Enabled() {
|
||||
klog.Warningf("etcd version %q is not known to be supported, but ignoring because of SkipEtcdVersionCheck feature flag", etcdCluster.Version)
|
||||
} else {
|
||||
klog.Warningf("unsupported etcd version %q detected; please update etcd version. Use export KOPS_FEATURE_FLAGS=SkipEtcdVersionCheck to override this check", etcdCluster.Version)
|
||||
return fmt.Errorf("etcd version %q is not supported with etcd-manager, please specify a supported version or remove the value to use the default version. Supported versions: %s", etcdCluster.Version, strings.Join(supportedEtcdVersions, ", "))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var supportedEtcdVersions = []string{"2.2.1", "3.1.12", "3.2.18", "3.2.24", "3.3.10", "3.3.13"}
|
||||
|
||||
func etcdVersionIsSupported(version string) bool {
|
||||
version = strings.TrimPrefix(version, "v")
|
||||
for _, v := range supportedEtcdVersions {
|
||||
if v == version {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue