Merge pull request #8682 from liuming-dev/remove-duplicate-variable-definition

Remove duplicate variable definition
pull/8695/head
Matt Farina 4 years ago committed by GitHub
commit e454e6a910
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,18 +19,10 @@ package action
import (
"strings"
"helm.sh/helm/v3/pkg/kube"
"helm.sh/helm/v3/pkg/releaseutil"
)
// resourcePolicyAnno is the annotation name for a resource policy
const resourcePolicyAnno = "helm.sh/resource-policy"
// keepPolicy is the resource policy type for keep
//
// This resource policy type allows resources to skip being deleted
// during an uninstallRelease action.
const keepPolicy = "keep"
func filterManifestsToKeep(manifests []releaseutil.Manifest) (keep, remaining []releaseutil.Manifest) {
for _, m := range manifests {
if m.Head.Metadata == nil || m.Head.Metadata.Annotations == nil || len(m.Head.Metadata.Annotations) == 0 {
@ -38,14 +30,14 @@ func filterManifestsToKeep(manifests []releaseutil.Manifest) (keep, remaining []
continue
}
resourcePolicyType, ok := m.Head.Metadata.Annotations[resourcePolicyAnno]
resourcePolicyType, ok := m.Head.Metadata.Annotations[kube.ResourcePolicyAnno]
if !ok {
remaining = append(remaining, m)
continue
}
resourcePolicyType = strings.ToLower(strings.TrimSpace(resourcePolicyType))
if resourcePolicyType == keepPolicy {
if resourcePolicyType == kube.KeepPolicy {
keep = append(keep, m)
}

Loading…
Cancel
Save