1
0
mirror of https://github.com/rancher/rke.git synced 2025-04-27 19:25:44 +00:00

Get checksum of the cloud file content

This commit is contained in:
galal-hussein 2018-12-07 01:35:11 +02:00 committed by Alena Prokharchyk
parent afaad6c824
commit 66fb2c4ac0

View File

@ -154,7 +154,7 @@ func (c *Cluster) BuildKubeAPIProcess(prefixPath string) v3.Process {
if len(c.CloudProvider.Name) > 0 {
c.Services.KubeAPI.ExtraEnv = append(
c.Services.KubeAPI.ExtraEnv,
fmt.Sprintf("%s=%s", CloudConfigSumEnv, getCloudConfigChecksum(c.CloudProvider)))
fmt.Sprintf("%s=%s", CloudConfigSumEnv, getCloudConfigChecksum(c.CloudConfigFile)))
}
// check if our version has specific options for this component
serviceOptions := c.GetKubernetesServicesOptions()
@ -258,7 +258,7 @@ func (c *Cluster) BuildKubeControllerProcess(prefixPath string) v3.Process {
if len(c.CloudProvider.Name) > 0 {
c.Services.KubeController.ExtraEnv = append(
c.Services.KubeController.ExtraEnv,
fmt.Sprintf("%s=%s", CloudConfigSumEnv, getCloudConfigChecksum(c.CloudProvider)))
fmt.Sprintf("%s=%s", CloudConfigSumEnv, getCloudConfigChecksum(c.CloudConfigFile)))
}
// check if our version has specific options for this component
serviceOptions := c.GetKubernetesServicesOptions()
@ -364,7 +364,7 @@ func (c *Cluster) BuildKubeletProcess(host *hosts.Host, prefixPath string) v3.Pr
if len(c.CloudProvider.Name) > 0 {
c.Services.Kubelet.ExtraEnv = append(
c.Services.Kubelet.ExtraEnv,
fmt.Sprintf("%s=%s", CloudConfigSumEnv, getCloudConfigChecksum(c.CloudProvider)))
fmt.Sprintf("%s=%s", CloudConfigSumEnv, getCloudConfigChecksum(c.CloudConfigFile)))
}
if len(c.PrivateRegistriesMap) > 0 {
kubeletDcokerConfig, _ := docker.GetKubeletDockerConfig(c.PrivateRegistriesMap)
@ -763,8 +763,8 @@ func getTagMajorVersion(tag string) string {
return strings.Join(splitTag[:2], ".")
}
func getCloudConfigChecksum(config v3.CloudProvider) string {
configByteSum := md5.Sum([]byte(fmt.Sprintf("%v", config)))
func getCloudConfigChecksum(config string) string {
configByteSum := md5.Sum([]byte(config))
return fmt.Sprintf("%x", configByteSum)
}