Skip to content

Commit

Permalink
Merge pull request #5071 from milas/diff-kustomization-recursive-remote
Browse files Browse the repository at this point in the history
fix: skip remote Kustomizations on recursive diff
  • Loading branch information
stefanprodan authored Nov 14, 2024
2 parents 9f854cb + 7697699 commit f42a17d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions internal/build/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,18 @@ func (b *Builder) diff() (string, bool, error) {
}

if !kustomizationsEqual(k, b.kustomization) {
subOutput, subCreatedOrDrifted, err := b.kustomizationDiff(k)
if err != nil {
diffErrs = append(diffErrs, err)
}
if subCreatedOrDrifted {
createdOrDrifted = true
output.WriteString(bunt.Sprint(fmt.Sprintf("📁 %s changed\n", ssautil.FmtUnstructured(obj))))
output.WriteString(subOutput)
if k.Spec.KubeConfig != nil {
output.WriteString(writeString(fmt.Sprintf("⚠️ %s skipped: diff not supported for remote clusters\n", ssautil.FmtUnstructured(obj)), bunt.Orange))
} else {
subOutput, subCreatedOrDrifted, err := b.kustomizationDiff(k)
if err != nil {
diffErrs = append(diffErrs, err)
}
if subCreatedOrDrifted {
createdOrDrifted = true
output.WriteString(bunt.Sprint(fmt.Sprintf("📁 %s changed\n", ssautil.FmtUnstructured(obj))))
output.WriteString(subOutput)
}
}

// finished with Kustomization diff
Expand Down

0 comments on commit f42a17d

Please sign in to comment.