Skip to content

Commit 15dee5b

Browse files
authored
Merge pull request #371 from wimi/custom_resync_periods
Custom resync periods
2 parents 44777ae + 9c9cb94 commit 15dee5b

File tree

1 file changed

+12
-8
lines changed
  • cmd/azure-keyvault-controller

1 file changed

+12
-8
lines changed

cmd/azure-keyvault-controller/main.go

+12-8
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,14 @@ import (
5757
const controllerAgentName = "azurekeyvaultcontroller"
5858

5959
var (
60-
version string
61-
kubeconfig string
62-
masterURL string
63-
cloudconfig string
64-
logFormat string
65-
watchAllNamespaces bool
60+
version string
61+
kubeconfig string
62+
masterURL string
63+
cloudconfig string
64+
logFormat string
65+
watchAllNamespaces bool
66+
kubeResyncPeriod int
67+
azureKeyVaultResyncPeriod int
6668
)
6769

6870
func initConfig() {
@@ -82,6 +84,8 @@ func init() {
8284
flag.StringVar(&masterURL, "master", "", "The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.")
8385
flag.StringVar(&cloudconfig, "cloudconfig", "/etc/kubernetes/azure.json", "Path to cloud config. Only required if this is not at default location /etc/kubernetes/azure.json")
8486
flag.BoolVar(&watchAllNamespaces, "watch-all-namespaces", true, "Watch for custom resources in all namespaces, if set to false it will only watch the runtime namespace.")
87+
flag.IntVar(&kubeResyncPeriod, "kube-resync-period", 30, "Resync period for kubernetes changes, in seconds. Defaults to 30.")
88+
flag.IntVar(&azureKeyVaultResyncPeriod, "azure-resync-period", 30, "Resync period for Azure Key Vault changes, in seconds. Defaults to 30.")
8589
}
8690

8791
func main() {
@@ -158,8 +162,8 @@ func main() {
158162
options.LabelSelector = labelSelectorAppender(options.LabelSelector, objectLabelSet)
159163
}))
160164
}
161-
kubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClient, time.Second*30, kubeInformerOptions...)
162-
azureKeyVaultSecretInformerFactory := informers.NewSharedInformerFactoryWithOptions(azureKeyVaultSecretClient, time.Second*30, akvInformerOptions...)
165+
kubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClient, time.Second*time.Duration(kubeResyncPeriod), kubeInformerOptions...)
166+
azureKeyVaultSecretInformerFactory := informers.NewSharedInformerFactoryWithOptions(azureKeyVaultSecretClient, time.Second*time.Duration(azureKeyVaultResyncPeriod), akvInformerOptions...)
163167

164168
klog.InfoS("Creating event broadcaster")
165169
eventBroadcaster := record.NewBroadcaster()

0 commit comments

Comments
 (0)