Merge pull request #211 from xing-yang/remove_retrycount
Remove createSnapshotContentRetryCount and createSnapshotContentInterval
This commit is contained in:
@@ -46,11 +46,9 @@ const (
|
|||||||
|
|
||||||
// Command line flags
|
// Command line flags
|
||||||
var (
|
var (
|
||||||
kubeconfig = flag.String("kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
|
kubeconfig = flag.String("kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
|
||||||
createSnapshotContentRetryCount = flag.Int("create-snapshotcontent-retrycount", 5, "Number of retries when we create a snapshot content object for a snapshot.")
|
resyncPeriod = flag.Duration("resync-period", 60*time.Second, "Resync interval of the controller.")
|
||||||
createSnapshotContentInterval = flag.Duration("create-snapshotcontent-interval", 10*time.Second, "Interval between retries when we create a snapshot content object for a snapshot.")
|
showVersion = flag.Bool("version", false, "Show version.")
|
||||||
resyncPeriod = flag.Duration("resync-period", 60*time.Second, "Resync interval of the controller.")
|
|
||||||
showVersion = flag.Bool("version", false, "Show version.")
|
|
||||||
|
|
||||||
leaderElection = flag.Bool("leader-election", false, "Enables leader election.")
|
leaderElection = flag.Bool("leader-election", false, "Enables leader election.")
|
||||||
leaderElectionNamespace = flag.String("leader-election-namespace", "", "The namespace where the leader election resource exists. Defaults to the pod namespace if not set.")
|
leaderElectionNamespace = flag.String("leader-election-namespace", "", "The namespace where the leader election resource exists. Defaults to the pod namespace if not set.")
|
||||||
@@ -96,7 +94,7 @@ func main() {
|
|||||||
// Add Snapshot types to the defualt Kubernetes so events can be logged for them
|
// Add Snapshot types to the defualt Kubernetes so events can be logged for them
|
||||||
snapshotscheme.AddToScheme(scheme.Scheme)
|
snapshotscheme.AddToScheme(scheme.Scheme)
|
||||||
|
|
||||||
klog.V(2).Infof("Start NewCSISnapshotController with kubeconfig [%s] createSnapshotContentRetryCount [%d] createSnapshotContentInterval [%d] resyncPeriod [%+v]", *kubeconfig, *createSnapshotContentRetryCount, *createSnapshotContentInterval, *resyncPeriod)
|
klog.V(2).Infof("Start NewCSISnapshotController with kubeconfig [%s] resyncPeriod [%+v]", *kubeconfig, *resyncPeriod)
|
||||||
|
|
||||||
ctrl := controller.NewCSISnapshotCommonController(
|
ctrl := controller.NewCSISnapshotCommonController(
|
||||||
snapClient,
|
snapClient,
|
||||||
@@ -105,8 +103,6 @@ func main() {
|
|||||||
factory.Snapshot().V1beta1().VolumeSnapshotContents(),
|
factory.Snapshot().V1beta1().VolumeSnapshotContents(),
|
||||||
factory.Snapshot().V1beta1().VolumeSnapshotClasses(),
|
factory.Snapshot().V1beta1().VolumeSnapshotClasses(),
|
||||||
coreFactory.Core().V1().PersistentVolumeClaims(),
|
coreFactory.Core().V1().PersistentVolumeClaims(),
|
||||||
*createSnapshotContentRetryCount,
|
|
||||||
*createSnapshotContentInterval,
|
|
||||||
*resyncPeriod,
|
*resyncPeriod,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -761,8 +761,6 @@ func newTestController(kubeClient kubernetes.Interface, clientset clientset.Inte
|
|||||||
informerFactory.Snapshot().V1beta1().VolumeSnapshotContents(),
|
informerFactory.Snapshot().V1beta1().VolumeSnapshotContents(),
|
||||||
informerFactory.Snapshot().V1beta1().VolumeSnapshotClasses(),
|
informerFactory.Snapshot().V1beta1().VolumeSnapshotClasses(),
|
||||||
coreFactory.Core().V1().PersistentVolumeClaims(),
|
coreFactory.Core().V1().PersistentVolumeClaims(),
|
||||||
3,
|
|
||||||
5*time.Millisecond,
|
|
||||||
60*time.Second,
|
60*time.Second,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -42,6 +42,12 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/util/goroutinemap"
|
"k8s.io/kubernetes/pkg/util/goroutinemap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Number of retries when we create a VolumeSnapshotContent object
|
||||||
|
const createSnapshotContentRetryCount = 5
|
||||||
|
|
||||||
|
// Interval between retries when we create a VolumeSnapshotContent object
|
||||||
|
const createSnapshotContentInterval = 10 * time.Second
|
||||||
|
|
||||||
type csiSnapshotCommonController struct {
|
type csiSnapshotCommonController struct {
|
||||||
clientset clientset.Interface
|
clientset clientset.Interface
|
||||||
client kubernetes.Interface
|
client kubernetes.Interface
|
||||||
@@ -77,8 +83,6 @@ func NewCSISnapshotCommonController(
|
|||||||
volumeSnapshotContentInformer storageinformers.VolumeSnapshotContentInformer,
|
volumeSnapshotContentInformer storageinformers.VolumeSnapshotContentInformer,
|
||||||
volumeSnapshotClassInformer storageinformers.VolumeSnapshotClassInformer,
|
volumeSnapshotClassInformer storageinformers.VolumeSnapshotClassInformer,
|
||||||
pvcInformer coreinformers.PersistentVolumeClaimInformer,
|
pvcInformer coreinformers.PersistentVolumeClaimInformer,
|
||||||
createSnapshotContentRetryCount int,
|
|
||||||
createSnapshotContentInterval time.Duration,
|
|
||||||
resyncPeriod time.Duration,
|
resyncPeriod time.Duration,
|
||||||
) *csiSnapshotCommonController {
|
) *csiSnapshotCommonController {
|
||||||
broadcaster := record.NewBroadcaster()
|
broadcaster := record.NewBroadcaster()
|
||||||
|
Reference in New Issue
Block a user