forked from carvel-dev/kapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
correct waiting for changes that are apply=noop, wait=reconcile
- Loading branch information
1 parent
381d5ce
commit 1d83f73
Showing
3 changed files
with
34 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package clusterapply | ||
|
||
import ( | ||
ctldiff "github.com/k14s/kapp/pkg/kapp/diff" | ||
"github.com/k14s/kapp/pkg/kapp/logger" | ||
ctlres "github.com/k14s/kapp/pkg/kapp/resources" | ||
ctlresm "github.com/k14s/kapp/pkg/kapp/resourcesmisc" | ||
) | ||
|
||
type ReconcilingChange struct { | ||
change ctldiff.Change | ||
identifiedResources ctlres.IdentifiedResources | ||
convergedResFactory ConvergedResourceFactory | ||
} | ||
|
||
type SpecificResource interface { | ||
IsDoneApplying() ctlresm.DoneApplyState | ||
} | ||
|
||
func (c ReconcilingChange) IsDoneApplying() (ctlresm.DoneApplyState, []string, error) { | ||
labeledResources := ctlres.NewLabeledResources(nil, c.identifiedResources, logger.NewTODOLogger()) | ||
|
||
// Refresh resource with latest changes from the server | ||
// Pick up new or existing resource (and not just new resource), | ||
// as some changes may be apply->noop, wait->reconcile. | ||
parentRes, err := c.identifiedResources.Get(c.change.NewOrExistingResource()) | ||
if err != nil { | ||
return ctlresm.DoneApplyState{}, nil, err | ||
} | ||
|
||
return c.convergedResFactory.New(parentRes, labeledResources.GetAssociated).IsDoneApplying() | ||
} |