1
0
mirror of synced 2026-02-13 13:06:56 +00:00

Take into account the server-side inventory for local diff

If implemented users will be able to use a local kustomization file while
retrieving status from the live kustomization file.

Signed-off-by: Soule BA <soule@weave.works>
This commit is contained in:
Soule BA
2023-07-10 17:22:07 +02:00
parent e88577fe52
commit 90d95988aa
4 changed files with 173 additions and 16 deletions

View File

@@ -136,11 +136,14 @@ func (b *Builder) Diff() (string, bool, error) {
if b.kustomization.Spec.Prune && len(diffErrs) == 0 {
oldStatus := b.kustomization.Status.DeepCopy()
if oldStatus.Inventory != nil {
diffObjects, err := diffInventory(oldStatus.Inventory, newInventory)
staleObjects, err := diffInventory(oldStatus.Inventory, newInventory)
if err != nil {
return "", createdOrDrifted, err
}
for _, object := range diffObjects {
if len(staleObjects) > 0 {
createdOrDrifted = true
}
for _, object := range staleObjects {
output.WriteString(writeString(fmt.Sprintf("► %s deleted\n", ssa.FmtUnstructured(object)), bunt.OrangeRed))
}
}