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

fix: return converted component configs #4121

Merged
merged 1 commit into from
Oct 20, 2023
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
16 changes: 12 additions & 4 deletions pkg/runtime/kubernetes/types/kubeadm_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,17 @@ func NewKubeadmConfig() *KubeadmConfig {
}

func (k *KubeadmConfig) GetComponents() []any {
converted, err := k.ToConvertedKubeadmConfig()
if err != nil {
logger.Error("failed to convert kubeadmConfig: %v", err)
return nil
}
return []any{
k.InitConfiguration, k.ClusterConfiguration, k.JoinConfiguration, k.KubeProxyConfiguration, k.KubeletConfiguration,
converted.InitConfiguration,
converted.ClusterConfiguration,
converted.JoinConfiguration,
converted.KubeProxyConfiguration,
converted.KubeletConfiguration,
}
}

Expand Down Expand Up @@ -146,8 +155,7 @@ func (k *KubeadmConfig) ToConvertedKubeadmConfig() (*ConvertedKubeadmConfig, err
conversion.InitConfiguration = v1beta2InitConfiguration
conversion.ClusterConfiguration = v1beta2ClusterConfiguration
conversion.JoinConfiguration = v1beta2JoinConfiguration

case KubeadmV1beta3:
case KubeadmV1beta3, "": // defaults to v1beta3
var v1beta3InitConfiguration v1beta3.InitConfiguration
var v1beta3ClusterConfiguration v1beta3.ClusterConfiguration
var v1beta3JoinConfiguration v1beta3.JoinConfiguration
Expand All @@ -169,7 +177,7 @@ func (k *KubeadmConfig) ToConvertedKubeadmConfig() (*ConvertedKubeadmConfig, err
conversion.InitConfiguration = v1beta3InitConfiguration
conversion.ClusterConfiguration = v1beta3ClusterConfiguration
conversion.JoinConfiguration = v1beta3JoinConfiguration
default:
default: // unknown version
conversion.JoinConfiguration = k.JoinConfiguration
conversion.InitConfiguration = k.InitConfiguration
conversion.ClusterConfiguration = k.ClusterConfiguration
Expand Down
Loading