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

Cherry pick of #6410 onto release-1.11 #6543

Merged
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
18 changes: 17 additions & 1 deletion pkg/commands/set_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ func SetClusterFields(fields []string, cluster *api.Cluster, instanceGroups []*a
c.Version = kv[1]
}
case "cluster.spec.etcdClusters[*].provider":
p, err := toEtcdProviderType(kv[1])
if err != nil {
return err
}
for _, etcd := range cluster.Spec.EtcdClusters {
etcd.Provider = api.EtcdProviderType(kv[1])
etcd.Provider = p
}
case "cluster.spec.etcdClusters[*].manager.image":
for _, etcd := range cluster.Spec.EtcdClusters {
Expand All @@ -125,3 +129,15 @@ func SetClusterFields(fields []string, cluster *api.Cluster, instanceGroups []*a
}
return nil
}

func toEtcdProviderType(in string) (api.EtcdProviderType, error) {
s := strings.ToLower(in)
switch s {
case "legacy":
return api.EtcdProviderTypeLegacy, nil
case "manager":
return api.EtcdProviderTypeManager, nil
default:
return api.EtcdProviderTypeManager, fmt.Errorf("unknown etcd provider type %q", in)
}
}