diff --git a/helm/chart/README.md b/helm/chart/README.md index 7726ced6fb..924471c533 100644 --- a/helm/chart/README.md +++ b/helm/chart/README.md @@ -6,6 +6,20 @@ checks ## Parameters +### Controller Log level + +| Name | Description | Value | +| --------------------------------------------------- | -------------------------------------------------------- | ----- | +| `operator.keptnappController.logLevel` | Sets the log level of Keptn App Controller | `0` | +| `operator.keptnappversionController.logLevel` | Sets the log level of Keptn Version Controller | `0` | +| `operator.keptnevaluationController.logLevel` | Sets the log level of Keptn Evaluation Controller | `0` | +| `operator.keptntaskController.logLevel` | Sets the log level of Keptn Task Controller | `0` | +| `operator.keptntaskdefinitionController.logLevel` | Sets the log level of Keptn Task Defintion Controller | `0` | +| `operator.keptnworkloadController.logLevel` | Sets the log level of Keptn Workload Controller | `0` | +| `operator.keptnworkloadinstanceController.logLevel` | Sets the log level of Keptn Workload Instance Controller | `0` | +| `operator.metricsController.logLevel` | Sets the log level of Keptn Metrics Controller | `0` | +| `operator.optionsController.logLevel` | Sets the log level of Keptn Options Controller | `0` | + ### OpenTelemetry | Name | Description | Value | @@ -18,3 +32,7 @@ checks | ---------------------------- | ---------------------------------------------------- | -------- | | `deployment.imagePullPolicy` | Sets the image pull policy for kubernetes deployment | `Always` | + +## Other info + + diff --git a/helm/chart/values.yaml b/helm/chart/values.yaml index c3d01d30b4..0c1cc414e4 100644 --- a/helm/chart/values.yaml +++ b/helm/chart/values.yaml @@ -3,3 +3,33 @@ otelCollector: deployment: imagePullPolicy: Always + +## @section Controller Log level +operator: + keptnappController: + ## @param operator.keptnappController.logLevel Sets the log level of Keptn App Controller + logLevel: 0 + keptnappversionController: + ## @param operator.keptnappversionController.logLevel Sets the log level of Keptn Version Controller + logLevel: 0 + keptnevaluationController: + ## @param operator.keptnevaluationController.logLevel Sets the log level of Keptn Evaluation Controller + logLevel: 0 + keptntaskController: + ## @param operator.keptntaskController.logLevel Sets the log level of Keptn Task Controller + logLevel: 0 + keptntaskdefinitionController: + ## @param operator.keptntaskdefinitionController.logLevel Sets the log level of Keptn Task Defintion Controller + logLevel: 0 + keptnworkloadController: + ## @param operator.keptnworkloadController.logLevel Sets the log level of Keptn Workload Controller + logLevel: 0 + keptnworkloadinstanceController: + ## @param operator.keptnworkloadinstanceController.logLevel Sets the log level of Keptn Workload Instance Controller + logLevel: 0 + metricsController: + ## @param operator.metricsController.logLevel Sets the log level of Keptn Metrics Controller + logLevel: 0 + optionsController: + ## @param operator.optionsController.logLevel Sets the log level of Keptn Options Controller + logLevel: 0 diff --git a/helm/overlay/patches/patch_deployment.yaml b/helm/overlay/patches/patch_deployment.yaml index adab1ab431..fb7140d5fd 100644 --- a/helm/overlay/patches/patch_deployment.yaml +++ b/helm/overlay/patches/patch_deployment.yaml @@ -12,6 +12,24 @@ spec: env: - name: OTEL_COLLECTOR_URL value: "{{ .Values.otelCollector.url }}" + - name: KEPTN_APP_CONTROLLER_LOG_LEVEL + value: "{{ .Values.operator.keptnappController.logLevel }}" + - name: KEPTN_APP_VERSION_CONTROLLER_LOG_LEVEL + value: "{{ .Values.operator.keptnappversionController.logLevel }}" + - name: KEPTN_EVALUATION_CONTROLLER_LOG_LEVEL + value: "{{ .Values.operator.keptnevaluationController.logLevel }}" + - name: KEPTN_TASK_CONTROLLER_LOG_LEVEL + value: "{{ .Values.operator.keptntaskController.logLevel }}" + - name: KEPTN_TASK_DEFINITION_CONTROLLER_LOG_LEVEL + value: "{{ .Values.operator.keptntaskdefinitionController.logLevel }}" + - name: KEPTN_WORKLOAD_CONTROLLER_LOG_LEVEL + value: "{{ .Values.operator.keptnworkloadController.logLevel }}" + - name: KEPTN_WORKLOAD_INSTANCE_CONTROLLER_LOG_LEVEL + value: "{{ .Values.operator.keptnworkloadinstanceController.logLevel }}" + - name: METRICS_CONTROLLER_LOG_LEVEL + value: "{{ .Values.operator.metricsController.logLevel }}" + - name: OPTIONS_CONTROLLER_LOG_LEVEL + value: "{{ .Values.operator.optionsController.logLevel }}" diff --git a/operator/main.go b/operator/main.go index 67e94abc14..2eb62ebe2c 100644 --- a/operator/main.go +++ b/operator/main.go @@ -80,6 +80,16 @@ type envConfig struct { PodNamespace string `envconfig:"POD_NAMESPACE" default:""` PodName string `envconfig:"POD_NAME" default:""` ExposeKeptnMetrics bool `envconfig:"EXPOSE_KEPTN_METRICS" default:"true"` + + KeptnAppControllerLogLevel int `envconfig:"KEPTN_APP_CONTROLLER_LOG_LEVEL" default:"0"` + KeptnAppVersionControllerLogLevel int `envconfig:"KEPTN_APP_VERSION_CONTROLLER_LOG_LEVEL" default:"0"` + KeptnEvaluationControllerLogLevel int `envconfig:"KEPTN_EVALUATION_CONTROLLER_LOG_LEVEL" default:"0"` + KeptnTaskControllerLogLevel int `envconfig:"KEPTN_TASK_CONTROLLER_LOG_LEVEL" default:"0"` + KeptnTaskDefinitionControllerLogLevel int `envconfig:"KEPTN_TASK_DEFINITION_CONTROLLER_LOG_LEVEL" default:"0"` + KeptnWorkloadControllerLogLevel int `envconfig:"KEPTN_WORKLOAD_CONTROLLER_LOG_LEVEL" default:"0"` + KeptnWorkloadInstanceControllerLogLevel int `envconfig:"KEPTN_WORKLOAD_INSTANCE_CONTROLLER_LOG_LEVEL" default:"0"` + KeptnMetricControllerLogLevel int `envconfig:"METRICS_CONTROLLER_LOG_LEVEL" default:"0"` + KptnOptionsControllerLogLevel int `envconfig:"OPTIONS_CONTROLLER_LOG_LEVEL" default:"0"` } //nolint:funlen,gocognit,gocyclo @@ -167,10 +177,11 @@ func main() { spanHandler := &controllercommon.SpanHandler{} + taskLogger := ctrl.Log.WithName("KeptnTask Controller") taskReconciler := &keptntask.KeptnTaskReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), - Log: ctrl.Log.WithName("KeptnTask Controller"), + Log: taskLogger.V(env.KeptnTaskControllerLogLevel), Recorder: mgr.GetEventRecorderFor("keptntask-controller"), Meters: keptnMeters, TracerFactory: controllercommon.GetOtelInstance(), @@ -180,10 +191,11 @@ func main() { os.Exit(1) } + taskDefinitionLogger := ctrl.Log.WithName("KeptnTaskDefinition Controller") taskDefinitionReconciler := &keptntaskdefinition.KeptnTaskDefinitionReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), - Log: ctrl.Log.WithName("KeptnTaskDefinition Controller"), + Log: taskDefinitionLogger.V(env.KeptnTaskDefinitionControllerLogLevel), Recorder: mgr.GetEventRecorderFor("keptntaskdefinition-controller"), } if err = (taskDefinitionReconciler).SetupWithManager(mgr); err != nil { @@ -191,10 +203,11 @@ func main() { os.Exit(1) } + appLogger := ctrl.Log.WithName("KeptnApp Controller") appReconciler := &keptnapp.KeptnAppReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), - Log: ctrl.Log.WithName("KeptnApp Controller"), + Log: appLogger.V(env.KeptnAppControllerLogLevel), Recorder: mgr.GetEventRecorderFor("keptnapp-controller"), TracerFactory: controllercommon.GetOtelInstance(), } @@ -203,10 +216,11 @@ func main() { os.Exit(1) } + workloadLogger := ctrl.Log.WithName("KeptnWorkload Controller") workloadReconciler := &keptnworkload.KeptnWorkloadReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), - Log: ctrl.Log.WithName("KeptnWorkload Controller"), + Log: workloadLogger.V(env.KeptnWorkloadControllerLogLevel), Recorder: mgr.GetEventRecorderFor("keptnworkload-controller"), TracerFactory: controllercommon.GetOtelInstance(), } @@ -215,10 +229,11 @@ func main() { os.Exit(1) } + workloadInstanceLogger := ctrl.Log.WithName("KeptnWorkloadInstance Controller") workloadInstanceReconciler := &keptnworkloadinstance.KeptnWorkloadInstanceReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), - Log: ctrl.Log.WithName("KeptnWorkloadInstance Controller"), + Log: workloadInstanceLogger.V(env.KeptnWorkloadInstanceControllerLogLevel), Recorder: mgr.GetEventRecorderFor("keptnworkloadinstance-controller"), Meters: keptnMeters, TracerFactory: controllercommon.GetOtelInstance(), @@ -229,10 +244,11 @@ func main() { os.Exit(1) } + appVersionLogger := ctrl.Log.WithName("KeptnAppVersion Controller") appVersionReconciler := &keptnappversion.KeptnAppVersionReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), - Log: ctrl.Log.WithName("KeptnAppVersion Controller"), + Log: appVersionLogger.V(env.KeptnAppVersionControllerLogLevel), Recorder: mgr.GetEventRecorderFor("keptnappversion-controller"), TracerFactory: controllercommon.GetOtelInstance(), Meters: keptnMeters, @@ -243,10 +259,11 @@ func main() { os.Exit(1) } + evaluationLogger := ctrl.Log.WithName("KeptnEvaluation Controller") evaluationReconciler := &keptnevaluation.KeptnEvaluationReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), - Log: ctrl.Log.WithName("KeptnEvaluation Controller"), + Log: evaluationLogger.V(env.KeptnEvaluationControllerLogLevel), Recorder: mgr.GetEventRecorderFor("keptnevaluation-controller"), TracerFactory: controllercommon.GetOtelInstance(), Meters: keptnMeters, @@ -257,20 +274,22 @@ func main() { os.Exit(1) } + metricsLogger := ctrl.Log.WithName("KeptnMetric Controller") metricsReconciler := &keptnmetric.KeptnMetricReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), - Log: ctrl.Log.WithName("KeptnMetric Controller"), + Log: metricsLogger.V(env.KeptnMetricControllerLogLevel), } if err = (metricsReconciler).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "KeptnMetric") os.Exit(1) } + configLogger := ctrl.Log.WithName("KeptnConfig Controller") configReconciler := &controlleroptions.KeptnConfigReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), - Log: ctrl.Log.WithName("KeptnConfig Controller"), + Log: configLogger.V(env.KptnOptionsControllerLogLevel), } if err = (configReconciler).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "KeptnConfig")