Skip to content

Commit

Permalink
Add templateName to kube-env to ensure that correct value is cached
Browse files Browse the repository at this point in the history
  • Loading branch information
BigDarkClown authored and Edwinhr716 committed Mar 13, 2024
1 parent 52be5d2 commit d348ae8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cluster-autoscaler/cloudprovider/gce/kube_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,20 @@ func (ke KubeEnv) Var(name string) (string, bool) {
}

// ParseKubeEnv parses kube-env from its string representation
func ParseKubeEnv(kubeEnvValue string) (KubeEnv, error) {
kubeEnv := make(map[string]string)
err := yaml.Unmarshal([]byte(kubeEnvValue), &kubeEnv)
func ParseKubeEnv(templateName, kubeEnvValue string) (KubeEnv, error) {
env := make(map[string]string)
err := yaml.Unmarshal([]byte(kubeEnvValue), &env)
if err != nil {
return nil, fmt.Errorf("error unmarshalling kubeEnv: %v", err)
return KubeEnv{}, fmt.Errorf("error unmarshalling kubeEnv: %v", err)
}
return kubeEnv, nil
return KubeEnv{templateName: templateName, env: env}, nil
}

// Var extracts variable from KubeEnv
func (ke KubeEnv) Var(name string) (string, bool) {
if ke == nil {
if ke.env == nil {
return "", false
}
val, found := ke[name]
val, found := ke.env[name]
return val, found
}

0 comments on commit d348ae8

Please sign in to comment.