Skip to content

Commit

Permalink
Add support for initial backoff to the apiserver call on recover (#476)
Browse files Browse the repository at this point in the history
Stash will wait to connect to the apiserver until the delay expires. The default is set to forever as it's reasonable to expect that the apiserver will come back; until it doesn't the restore pod has nothing else to do, really.

Fixes #475
  • Loading branch information
farcaller authored and tamalsaha committed May 16, 2018
1 parent 120e5de commit e95b151
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion recover.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cmds

import (
"time"

"github.com/appscode/go/log"
"github.com/appscode/kutil/meta"
cs "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1"
Expand All @@ -15,6 +17,7 @@ func NewCmdRecover() *cobra.Command {
masterURL string
kubeconfigPath string
recoveryName string
backoffMaxWait time.Duration
)

cmd := &cobra.Command{
Expand All @@ -29,13 +32,14 @@ func NewCmdRecover() *cobra.Command {
kubeClient := kubernetes.NewForConfigOrDie(config)
stashClient := cs.NewForConfigOrDie(config)

c := recovery.New(kubeClient, stashClient, meta.Namespace(), recoveryName)
c := recovery.New(kubeClient, stashClient, meta.Namespace(), recoveryName, backoffMaxWait)
c.Run()
},
}
cmd.Flags().StringVar(&masterURL, "master", masterURL, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
cmd.Flags().StringVar(&kubeconfigPath, "kubeconfig", kubeconfigPath, "Path to kubeconfig file with authorization information (the master location is set by the master flag).")
cmd.Flags().StringVar(&recoveryName, "recovery-name", recoveryName, "Name of the Recovery CRD.")
cmd.Flags().DurationVar(&backoffMaxWait, "backoff-max-wait", 0, "Maximum wait for initial response from kube apiserver; 0 disables the timeout")

return cmd
}

0 comments on commit e95b151

Please sign in to comment.