Skip to content

Commit

Permalink
Do not wait for App pause on package install pause if wait is disable…
Browse files Browse the repository at this point in the history
…d. Add wait flags to pkg i pause.

Signed-off-by: Soumik Majumder <[email protected]>
  • Loading branch information
100mik committed Feb 5, 2024
1 parent c4a9f9d commit a8f2428
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cli/pkg/kctrl/cmd/package/installed/create_or_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,9 @@ func (o *CreateOrUpdateOptions) unpauseReconciliation(client kcclient.Interface)
// TODO: Have common place for waiting logic and refactor based on
// https://github.com/carvel-dev/kapp-controller/issues/639
func (o *CreateOrUpdateOptions) waitForAppPause(client kcclient.Interface) error {
if !o.WaitFlags.Enabled {
return nil
}
if err := wait.Poll(o.WaitFlags.CheckInterval, o.WaitFlags.Timeout, func() (done bool, err error) {
appResource, err := client.KappctrlV1alpha1().Apps(o.NamespaceFlags.Name).Get(context.Background(), o.Name, metav1.GetOptions{})
if err != nil {
Expand Down
9 changes: 9 additions & 0 deletions cli/pkg/kctrl/cmd/package/installed/pause_or_kick.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ func NewPauseCmd(o *PauseOrKickOptions, flagsFactory cmdcore.FlagsFactory) *cobr
cmd.Use = "pause INSTALLED_PACKAGE_NAME"
}

o.WaitFlags.Set(cmd, flagsFactory, &cmdcore.WaitFlagsOpts{
AllowDisableWait: true,
DefaultInterval: 2 * time.Second,
DefaultTimeout: 5 * time.Minute,
})

return cmd
}

Expand Down Expand Up @@ -228,6 +234,9 @@ func (o *PauseOrKickOptions) unpause(client kcclient.Interface) error {
}

func (o *PauseOrKickOptions) waitForAppPause(client kcclient.Interface) error {
if !o.WaitFlags.Enabled {
return nil
}
if err := wait.Poll(o.WaitFlags.CheckInterval, o.WaitFlags.Timeout, func() (done bool, err error) {
appResource, err := client.KappctrlV1alpha1().Apps(o.NamespaceFlags.Name).Get(context.Background(), o.Name, metav1.GetOptions{})
if err != nil {
Expand Down

0 comments on commit a8f2428

Please sign in to comment.