Skip to content

Commit

Permalink
Merge pull request #371 from wimi/custom_resync_periods
Browse files Browse the repository at this point in the history
Custom resync periods
  • Loading branch information
181192 authored Aug 17, 2022
2 parents 44777ae + 9c9cb94 commit 15dee5b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions cmd/azure-keyvault-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ import (
const controllerAgentName = "azurekeyvaultcontroller"

var (
version string
kubeconfig string
masterURL string
cloudconfig string
logFormat string
watchAllNamespaces bool
version string
kubeconfig string
masterURL string
cloudconfig string
logFormat string
watchAllNamespaces bool
kubeResyncPeriod int
azureKeyVaultResyncPeriod int
)

func initConfig() {
Expand All @@ -82,6 +84,8 @@ func init() {
flag.StringVar(&masterURL, "master", "", "The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.")
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")
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.")
flag.IntVar(&kubeResyncPeriod, "kube-resync-period", 30, "Resync period for kubernetes changes, in seconds. Defaults to 30.")
flag.IntVar(&azureKeyVaultResyncPeriod, "azure-resync-period", 30, "Resync period for Azure Key Vault changes, in seconds. Defaults to 30.")
}

func main() {
Expand Down Expand Up @@ -158,8 +162,8 @@ func main() {
options.LabelSelector = labelSelectorAppender(options.LabelSelector, objectLabelSet)
}))
}
kubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClient, time.Second*30, kubeInformerOptions...)
azureKeyVaultSecretInformerFactory := informers.NewSharedInformerFactoryWithOptions(azureKeyVaultSecretClient, time.Second*30, akvInformerOptions...)
kubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClient, time.Second*time.Duration(kubeResyncPeriod), kubeInformerOptions...)
azureKeyVaultSecretInformerFactory := informers.NewSharedInformerFactoryWithOptions(azureKeyVaultSecretClient, time.Second*time.Duration(azureKeyVaultResyncPeriod), akvInformerOptions...)

klog.InfoS("Creating event broadcaster")
eventBroadcaster := record.NewBroadcaster()
Expand Down

0 comments on commit 15dee5b

Please sign in to comment.