Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/v1.3] Enable the etcd corruption checks for etcd v3.5 #1928

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions pkg/templates/kubeadm/v1beta3/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,34 @@ const (
bootstrapTokenTTL = 60 * time.Minute
)

const (
// greaterOrEqualThan122 defines a version constraint for the Kubernetes 1.22+ clusters
greaterOrEqualThan122 = ">= 1.22.0"
)

// NewConfig returns all required configs to init a cluster via a set of v1beta3 configs
func NewConfig(s *state.State, host kubeoneapi.HostConfig) ([]runtime.Object, error) {
etcdIntegrityCheckConstraint, err := semver.NewConstraint(greaterOrEqualThan122)
if err != nil {
return nil, err
}

cluster := s.Cluster
kubeSemVer, err := semver.NewVersion(cluster.Versions.Kubernetes)
if err != nil {
return nil, errors.Wrapf(err, "failed to parse generate config, wrong kubernetes version %s", cluster.Versions.Kubernetes)
}

etcdExtraArgs := map[string]string{}
if etcdIntegrityCheckConstraint.Check(kubeSemVer) {
// This is required because etcd v3.5 (used for Kubernetes 1.22+)
// has an issue with the data integrity.
// See https://groups.google.com/a/kubernetes.io/g/dev/c/B7gJs88XtQc/m/rSgNOzV2BwAJ
// for more details.
etcdExtraArgs["experimental-initial-corrupt-check"] = "true"
etcdExtraArgs["experimental-corrupt-check-time"] = "240m"
}

nodeRegistration := newNodeRegistration(s, host)
nodeRegistration.IgnorePreflightErrors = []string{
"DirAvailable--var-lib-etcd",
Expand Down Expand Up @@ -149,6 +169,7 @@ func NewConfig(s *state.State, host kubeoneapi.HostConfig) ([]runtime.Object, er
ImageRepository: cluster.AssetConfiguration.Etcd.ImageRepository,
ImageTag: cluster.AssetConfiguration.Etcd.ImageTag,
},
ExtraArgs: etcdExtraArgs,
},
},
DNS: kubeadmv1beta3.DNS{
Expand Down