From 3914c513a8d55c5817a5484156db2a02d3419009 Mon Sep 17 00:00:00 2001
From: Anushka Mittal <55237170+anushkamittal20@users.noreply.github.com>
Date: Wed, 6 Oct 2021 23:02:48 +0530
Subject: [PATCH] Changing flag names for consistency (#2467)

* changing flag names for consistency

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>

* changes for backward compatibility

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>

* updated the CHANGELOG.md

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
---
 CHANGELOG.md                         |  7 +++++++
 charts/kyverno/values.yaml           |  2 +-
 cmd/kyverno/main.go                  | 17 +++++++++++++----
 definitions/manifest/deployment.yaml |  4 ++--
 4 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 433cf61b61..fa0332a35e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+## v1.5.0-rc1
+### Note
+- With the change of dynamic webhooks, the readiness of the policy is reflected by `.status.ready`, When ready, it means the policy is ready to serve the admission requests.
+
+### Deprecation
+- To add a consistent style in flag names the following flags have been deprecated `webhooktimeout`, `gen-workers`,`disable-metrics`, `background-scan`, `auto-update-webhooks` these will be removed in 1.6.0. The new flags are `webhookTimeout`, `genWorkers`, `disablMetrics`, `backgroundScan`, `autoUpdateWebhooks`.
+
 ## v1.4.3
 
 ## v1.4.3-rc2
diff --git a/charts/kyverno/values.yaml b/charts/kyverno/values.yaml
index df83b43f7a..ab6f7a0c42 100644
--- a/charts/kyverno/values.yaml
+++ b/charts/kyverno/values.yaml
@@ -80,7 +80,7 @@ envVarsInit: {}
 envVars: {}
 
 extraArgs: []
-# - --webhooktimeout=4
+# - --webhookTimeout=4
 
 resources:
   limits:
diff --git a/cmd/kyverno/main.go b/cmd/kyverno/main.go
index 75d5ebf8c2..e2096ebd0d 100755
--- a/cmd/kyverno/main.go
+++ b/cmd/kyverno/main.go
@@ -73,17 +73,26 @@ func main() {
 	flag.StringVar(&excludeUsername, "excludeUsername", "", "")
 	// deprecated
 	flag.IntVar(&webhookTimeout, "webhooktimeout", int(webhookconfig.DefaultWebhookTimeout), "Timeout for webhook configurations. Deprecated and will be removed in 1.6.0.")
-	flag.IntVar(&genWorkers, "gen-workers", 10, "Workers for generate controller")
+	flag.IntVar(&webhookTimeout, "webhookTimeout", int(webhookconfig.DefaultWebhookTimeout), "Timeout for webhook configurations.")
+	// deprecated
+	flag.IntVar(&genWorkers, "gen-workers", 10, "Workers for generate controller. Deprecated and will be removed in 1.6.0. ")
+	flag.IntVar(&genWorkers, "genWorkers", 10, "Workers for generate controller")
 	flag.StringVar(&kubeconfig, "kubeconfig", "", "Path to a kubeconfig. Only required if out-of-cluster.")
 	flag.StringVar(&serverIP, "serverIP", "", "IP address where Kyverno controller runs. Only required if out-of-cluster.")
 	flag.BoolVar(&profile, "profile", false, "Set this flag to 'true', to enable profiling.")
 	flag.StringVar(&profilePort, "profile-port", "6060", "Enable profiling at given port, defaults to 6060.")
-	flag.BoolVar(&disableMetricsExport, "disable-metrics", false, "Set this flag to 'true', to enable exposing the metrics.")
+	// deprecated
+	flag.BoolVar(&disableMetricsExport, "disable-metrics", false, "Set this flag to 'true', to enable exposing the metrics. Deprecated and will be removed in 1.6.0. ")
+	flag.BoolVar(&disableMetricsExport, "disableMetrics", false, "Set this flag to 'true', to enable exposing the metrics.")
 	flag.StringVar(&metricsPort, "metrics-port", "8000", "Expose prometheus metrics at the given port, default to 8000.")
-	flag.DurationVar(&policyControllerResyncPeriod, "background-scan", time.Hour, "Perform background scan every given interval, e.g., 30s, 15m, 1h.")
+	// deprecated
+	flag.DurationVar(&policyControllerResyncPeriod, "background-scan", time.Hour, "Perform background scan every given interval, e.g., 30s, 15m, 1h. Deprecated and will be removed in 1.6.0. ")
+	flag.DurationVar(&policyControllerResyncPeriod, "backgroundScan", time.Hour, "Perform background scan every given interval, e.g., 30s, 15m, 1h.")
 	flag.StringVar(&imagePullSecrets, "imagePullSecrets", "", "Secret resource names for image registry access credentials.")
 	flag.StringVar(&imageSignatureRepository, "imageSignatureRepository", "", "Alternate repository for image signatures. Can be overridden per rule via `verifyImages.Repository`.")
-	flag.BoolVar(&autoUpdateWebhooks, "auto-update-webhooks", true, "Set this flag to 'false' to disable auto-configuration of the webhook.")
+	// deprecated
+	flag.BoolVar(&autoUpdateWebhooks, "auto-update-webhooks", true, "Set this flag to 'false' to disable auto-configuration of the webhook. Deprecated and will be removed in 1.6.0.")
+	flag.BoolVar(&autoUpdateWebhooks, "autoUpdateWebhooks", true, "Set this flag to 'false' to disable auto-configuration of the webhook.")
 
 	if err := flag.Set("v", "2"); err != nil {
 		setupLog.Error(err, "failed to set log level")
diff --git a/definitions/manifest/deployment.yaml b/definitions/manifest/deployment.yaml
index c4d63c12d3..8c18387e2e 100755
--- a/definitions/manifest/deployment.yaml
+++ b/definitions/manifest/deployment.yaml
@@ -65,11 +65,11 @@ spec:
           args:
           - "--filterK8sResources=[Event,*,*][*,kube-system,*][*,kube-public,*][*,kube-node-lease,*][Node,*,*][APIService,*,*][TokenReview,*,*][SubjectAccessReview,*,*][*,kyverno,*][Binding,*,*][ReplicaSet,*,*][ReportChangeRequest,*,*][ClusterReportChangeRequest,*,*][PolicyReport,*,*][ClusterPolicyReport,*,*]"
           # customize webhook timeout
-          #- "--webhooktimeout=4"
+          #- "--webhookTimeout=4"
           # enable profiling
           # - "--profile"
           # configure the workers for generate controller
-          # - --gen-workers=20
+          # - --genWorkers=20
           - "-v=2"
           ports:
             - containerPort: 9443