Exclude skipped resources from apply events
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
parent
0fe37838c8
commit
b1d2b72b11
|
|
@ -741,7 +741,7 @@ func (r *KustomizationReconciler) apply(ctx context.Context,
|
|||
if changeSet != nil && len(changeSet.Entries) > 0 {
|
||||
log.Info("server-side apply for cluster definitions completed", "output", changeSet.ToMap())
|
||||
for _, change := range changeSet.Entries {
|
||||
if change.Action != ssa.UnchangedAction {
|
||||
if HasChanged(change.Action) {
|
||||
changeSetLog.WriteString(change.String() + "\n")
|
||||
}
|
||||
}
|
||||
|
|
@ -766,7 +766,7 @@ func (r *KustomizationReconciler) apply(ctx context.Context,
|
|||
if changeSet != nil && len(changeSet.Entries) > 0 {
|
||||
log.Info("server-side apply for cluster class types completed", "output", changeSet.ToMap())
|
||||
for _, change := range changeSet.Entries {
|
||||
if change.Action != ssa.UnchangedAction {
|
||||
if HasChanged(change.Action) {
|
||||
changeSetLog.WriteString(change.String() + "\n")
|
||||
}
|
||||
}
|
||||
|
|
@ -792,7 +792,7 @@ func (r *KustomizationReconciler) apply(ctx context.Context,
|
|||
if changeSet != nil && len(changeSet.Entries) > 0 {
|
||||
log.Info("server-side apply completed", "output", changeSet.ToMap(), "revision", revision)
|
||||
for _, change := range changeSet.Entries {
|
||||
if change.Action != ssa.UnchangedAction {
|
||||
if HasChanged(change.Action) {
|
||||
changeSetLog.WriteString(change.String() + "\n")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/fluxcd/pkg/ssa"
|
||||
)
|
||||
|
||||
// MkdirTempAbs creates a tmp dir and returns the absolute path to the dir.
|
||||
|
|
@ -36,3 +38,16 @@ func MkdirTempAbs(dir, pattern string) (string, error) {
|
|||
}
|
||||
return tmpDir, nil
|
||||
}
|
||||
|
||||
// HasChanged evaluates the given action and returns true
|
||||
// if the action type matches a resource mutation or deletion.
|
||||
func HasChanged(action ssa.Action) bool {
|
||||
switch action {
|
||||
case ssa.SkippedAction:
|
||||
return false
|
||||
case ssa.UnchangedAction:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue