mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
only check existence for the possibly kept manifests
This commit is contained in:
parent
e6d907ed28
commit
81eaf2f263
1 changed files with 6 additions and 6 deletions
|
|
@ -38,12 +38,6 @@ func filterManifestsToKeep(manifests []Manifest, kubeClient environment.KubeClie
|
|||
keep := []Manifest{}
|
||||
|
||||
for _, m := range manifests {
|
||||
// check if m is in fact present from k8s client's POV.
|
||||
output, err := kubeClient.Get(namespace, bytes.NewBufferString(m.Content))
|
||||
if err != nil || strings.Contains(output, kube.MissingGetHeader) {
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Head.Metadata == nil || m.Head.Metadata.Annotations == nil || len(m.Head.Metadata.Annotations) == 0 {
|
||||
remaining = append(remaining, m)
|
||||
continue
|
||||
|
|
@ -67,6 +61,12 @@ func filterManifestsToKeep(manifests []Manifest, kubeClient environment.KubeClie
|
|||
func summarizeKeptManifests(manifests []Manifest) string {
|
||||
message := "These resources were kept due to the resource policy:\n"
|
||||
for _, m := range manifests {
|
||||
// check if m is in fact present from k8s client's POV.
|
||||
output, err := kubeClient.Get(namespace, bytes.NewBufferString(m.Content))
|
||||
if err != nil || strings.Contains(output, kube.MissingGetHeader) {
|
||||
continue
|
||||
}
|
||||
|
||||
details := "[" + m.Head.Kind + "] " + m.Head.Metadata.Name + "\n"
|
||||
message = message + details
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue