Skip to content

Commit e95b151

Browse files
farcallertamalsaha
authored andcommitted
Add support for initial backoff to the apiserver call on recover (#476)
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
1 parent 120e5de commit e95b151

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

recover.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package cmds
22

33
import (
4+
"time"
5+
46
"github.com/appscode/go/log"
57
"github.com/appscode/kutil/meta"
68
cs "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1"
@@ -15,6 +17,7 @@ func NewCmdRecover() *cobra.Command {
1517
masterURL string
1618
kubeconfigPath string
1719
recoveryName string
20+
backoffMaxWait time.Duration
1821
)
1922

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

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

4044
return cmd
4145
}

0 commit comments

Comments
 (0)