Additional logging for ownership verification in dry-run mode

Signed-off-by: Evans Mungai <mbuevans@gmail.com>
pull/31584/head
Evans Mungai 10 months ago
parent 906f87ce1d
commit 6d5b5aab32
No known key found for this signature in database
GPG Key ID: BBEB812143DD14E1

@ -95,8 +95,9 @@ func (u *Uninstall) Run(name string) (*releasei.UninstallReleaseResponse, error)
resources, err := u.cfg.KubeClient.Build(strings.NewReader(builder.String()), false) resources, err := u.cfg.KubeClient.Build(strings.NewReader(builder.String()), false)
if err == nil && len(resources) > 0 { if err == nil && len(resources) > 0 {
_, unownedResources, err := verifyOwnershipBeforeDelete(resources, r.Name, r.Namespace) ownedResources, unownedResources, err := verifyOwnershipBeforeDelete(resources, r.Name, r.Namespace)
if err == nil && len(unownedResources) > 0 { if err == nil {
if len(unownedResources) > 0 {
u.cfg.Logger().Warn("dry-run: resources would be skipped because they are not owned by this release", u.cfg.Logger().Warn("dry-run: resources would be skipped because they are not owned by this release",
"release", r.Name, "release", r.Name,
"count", len(unownedResources)) "count", len(unownedResources))
@ -107,6 +108,19 @@ func (u *Uninstall) Run(name string) (*releasei.UninstallReleaseResponse, error)
"namespace", info.Namespace) "namespace", info.Namespace)
} }
} }
if len(ownedResources) > 0 {
u.cfg.Logger().Debug("dry-run: resources would be deleted",
"release", r.Name,
"count", len(ownedResources))
for _, info := range ownedResources {
u.cfg.Logger().Debug("dry-run: would delete resource",
"kind", info.Mapping.GroupVersionKind.Kind,
"name", info.Name,
"namespace", info.Namespace)
}
}
}
} }
// Include kept resources in dry-run info // Include kept resources in dry-run info

Loading…
Cancel
Save