From aa47c5e83778110551d09942f909c9c9982bb465 Mon Sep 17 00:00:00 2001 From: Piyush Kumar Date: Wed, 15 Jan 2025 14:28:07 +0530 Subject: [PATCH] include init config data in kubelet-config file Signed-off-by: Piyush Kumar --- stages/init.go | 12 ++++++------ stages/join.go | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/stages/init.go b/stages/init.go index d1ad0a0..3fecfa4 100644 --- a/stages/init.go +++ b/stages/init.go @@ -47,7 +47,7 @@ func GetInitYipStagesV1Beta3(clusterCtx *domain.ClusterContext, kubeadmConfig do getKubeadmPostInitStage(clusterCtx.RootPath), getKubeadmInitUpgradeStage(clusterCtx), getKubeadmInitCreateClusterConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.InitConfiguration, clusterCtx.RootPath), - getKubeadmInitCreateKubeletConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.KubeletConfiguration, clusterCtx.RootPath), + getKubeadmInitCreateKubeletConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.InitConfiguration, &kubeadmConfig.KubeletConfiguration, clusterCtx.RootPath), getKubeadmInitReconfigureStage(clusterCtx), } } @@ -68,7 +68,7 @@ func GetInitYipStagesV1Beta4(clusterCtx *domain.ClusterContext, kubeadmConfig do getKubeadmPostInitStage(clusterCtx.RootPath), getKubeadmInitUpgradeStage(clusterCtx), getKubeadmInitCreateClusterConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.InitConfiguration, clusterCtx.RootPath), - getKubeadmInitCreateKubeletConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.KubeletConfiguration, clusterCtx.RootPath), + getKubeadmInitCreateKubeletConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.InitConfiguration, &kubeadmConfig.KubeletConfiguration, clusterCtx.RootPath), getKubeadmInitReconfigureStage(clusterCtx), } } @@ -133,8 +133,8 @@ func getKubeadmInitCreateClusterConfigStage(clusterCfgObj, initCfgObj runtime.Ob return utils.GetFileStage("Generate Cluster Config File", filepath.Join(rootPath, configurationPath, "cluster-config.yaml"), getUpdatedInitClusterConfig(clusterCfgObj, initCfgObj)) } -func getKubeadmInitCreateKubeletConfigStage(clusterCfgObj, kubeletCfg runtime.Object, rootPath string) yip.Stage { - return utils.GetFileStage("Generate Kubelet Config File", filepath.Join(rootPath, configurationPath, "kubelet-config.yaml"), getUpdatedKubeletConfig(clusterCfgObj, kubeletCfg)) +func getKubeadmInitCreateKubeletConfigStage(clusterCfgObj, initCfg, kubeletCfg runtime.Object, rootPath string) yip.Stage { + return utils.GetFileStage("Generate Kubelet Config File", filepath.Join(rootPath, configurationPath, "kubelet-config.yaml"), getUpdatedKubeletConfig(clusterCfgObj, initCfg, kubeletCfg)) } func getKubeadmInitReconfigureStage(clusterCtx *domain.ClusterContext) yip.Stage { @@ -229,8 +229,8 @@ func getUpdatedInitClusterConfig(clusterCfgObj, initCfgObj runtime.Object) strin return printObj([]runtime.Object{clusterCfgObj, initCfgObj}) } -func getUpdatedKubeletConfig(clusterCfgObj, kubeletCfg runtime.Object) string { - return printObj([]runtime.Object{clusterCfgObj, kubeletCfg}) +func getUpdatedKubeletConfig(clusterCfgObj, initCfg, kubeletCfg runtime.Object) string { + return printObj([]runtime.Object{clusterCfgObj, initCfg, kubeletCfg}) } func printObj(objects []runtime.Object) string { diff --git a/stages/join.go b/stages/join.go index 6189ed1..1a19407 100644 --- a/stages/join.go +++ b/stages/join.go @@ -34,7 +34,7 @@ func GetJoinYipStagesV1Beta3(clusterCtx *domain.ClusterContext, kubeadmConfig do if clusterCtx.NodeRole != clusterplugin.RoleWorker { joinStg = append(joinStg, getKubeadmJoinCreateClusterConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.InitConfiguration, &kubeadmConfig.JoinConfiguration, clusterCtx.RootPath), - getKubeadmJoinCreateKubeletConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.KubeletConfiguration, clusterCtx.RootPath)) + getKubeadmJoinCreateKubeletConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.InitConfiguration, &kubeadmConfig.KubeletConfiguration, clusterCtx.RootPath)) } return append(joinStg, getKubeadmJoinReconfigureStage(clusterCtx)) @@ -56,7 +56,7 @@ func GetJoinYipStagesV1Beta4(clusterCtx *domain.ClusterContext, kubeadmConfig do if clusterCtx.NodeRole != clusterplugin.RoleWorker { joinStg = append(joinStg, getKubeadmJoinCreateClusterConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.InitConfiguration, &kubeadmConfig.JoinConfiguration, clusterCtx.RootPath), - getKubeadmJoinCreateKubeletConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.KubeletConfiguration, clusterCtx.RootPath)) + getKubeadmJoinCreateKubeletConfigStage(&kubeadmConfig.ClusterConfiguration, &kubeadmConfig.InitConfiguration, &kubeadmConfig.KubeletConfiguration, clusterCtx.RootPath)) } return append(joinStg, getKubeadmJoinReconfigureStage(clusterCtx)) @@ -196,8 +196,8 @@ func getKubeadmJoinCreateClusterConfigStage(clusterCfgObj, initCfgObj, joinCfgOb return utils.GetFileStage("Generate Cluster Config File", filepath.Join(rootPath, configurationPath, "cluster-config.yaml"), getUpdatedJoinClusterConfig(clusterCfgObj, initCfgObj, joinCfgObj)) } -func getKubeadmJoinCreateKubeletConfigStage(clusterCfgObj, kubeletCfg runtime.Object, rootPath string) yip.Stage { - return utils.GetFileStage("Generate Kubelet Config File", filepath.Join(rootPath, configurationPath, "kubelet-config.yaml"), getUpdatedKubeletConfig(clusterCfgObj, kubeletCfg)) +func getKubeadmJoinCreateKubeletConfigStage(clusterCfgObj, initCfg, kubeletCfg runtime.Object, rootPath string) yip.Stage { + return utils.GetFileStage("Generate Kubelet Config File", filepath.Join(rootPath, configurationPath, "kubelet-config.yaml"), getUpdatedKubeletConfig(clusterCfgObj, initCfg, kubeletCfg)) } func getKubeadmJoinReconfigureStage(clusterCtx *domain.ClusterContext) yip.Stage {