Skip to content

Commit

Permalink
Use local version variables in validateNoDeprecations
Browse files Browse the repository at this point in the history
Signed-off-by: Antoine Deschênes <antoine@antoinedeschenes.com>
  • Loading branch information
antoinedeschenes committed Jan 13, 2023
1 parent 00b9177 commit faa3237
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/lint/rules/deprecations.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ func validateNoDeprecations(resource *K8sYamlStruct, kubeVersion *chartutil.Kube
return nil
}

majorVersion := k8sVersionMajor
minorVersion := k8sVersionMinor

if kubeVersion != nil {
k8sVersionMajor = kubeVersion.Major
k8sVersionMinor = kubeVersion.Minor
majorVersion = kubeVersion.Major
minorVersion = kubeVersion.Minor
}

runtimeObject, err := resourceToRuntimeObject(resource)
Expand All @@ -70,11 +73,11 @@ func validateNoDeprecations(resource *K8sYamlStruct, kubeVersion *chartutil.Kube
return err
}

maj, err := strconv.Atoi(k8sVersionMajor)
maj, err := strconv.Atoi(majorVersion)
if err != nil {
return err
}
min, err := strconv.Atoi(k8sVersionMinor)
min, err := strconv.Atoi(minorVersion)
if err != nil {
return err
}
Expand Down

0 comments on commit faa3237

Please sign in to comment.