diff --git a/docs/content/en/docs/crd-ref/options/v1alpha1/_index.md b/docs/content/en/docs/crd-ref/options/v1alpha1/_index.md index aac8099d8e..611118d5c3 100644 --- a/docs/content/en/docs/crd-ref/options/v1alpha1/_index.md +++ b/docs/content/en/docs/crd-ref/options/v1alpha1/_index.md @@ -63,7 +63,7 @@ _Appears in:_ | Field | Description | | --- | --- | | `OTelCollectorUrl` _string_ | OTelCollectorUrl can be used to set the Open Telemetry collector that the operator should use | -| `keptnAppCreationRequestTimeout` _integer_ | KeptnAppCreationRequestTimeout is used to set the interval in which automatic app discovery searches for workload to put into the same auto-generated KeptnApp | +| `keptnAppCreationRequestTimeoutSeconds` _integer_ | KeptnAppCreationRequestTimeout is used to set the interval in which automatic app discovery searches for workload to put into the same auto-generated KeptnApp | diff --git a/operator/apis/options/v1alpha1/keptnconfig_types.go b/operator/apis/options/v1alpha1/keptnconfig_types.go index 622b68d7a7..9b6028624d 100644 --- a/operator/apis/options/v1alpha1/keptnconfig_types.go +++ b/operator/apis/options/v1alpha1/keptnconfig_types.go @@ -29,11 +29,13 @@ type KeptnConfigSpec struct { // Important: Run "make" to regenerate code after modifying this file // OTelCollectorUrl can be used to set the Open Telemetry collector that the operator should use + // +optional OTelCollectorUrl string `json:"OTelCollectorUrl,omitempty"` // KeptnAppCreationRequestTimeout is used to set the interval in which automatic app discovery // searches for workload to put into the same auto-generated KeptnApp // +kubebuilder:default:=30 - KeptnAppCreationRequestTimeout uint `json:"keptnAppCreationRequestTimeout,omitempty"` + // +optional + KeptnAppCreationRequestTimeoutSeconds uint `json:"keptnAppCreationRequestTimeoutSeconds,omitempty"` } // KeptnConfigStatus defines the observed state of KeptnConfig diff --git a/operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml b/operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml index 63ca3d07ca..5dfca17038 100644 --- a/operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml +++ b/operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml @@ -39,7 +39,7 @@ spec: description: OTelCollectorUrl can be used to set the Open Telemetry collector that the operator should use type: string - keptnAppCreationRequestTimeout: + keptnAppCreationRequestTimeoutSeconds: default: 30 description: KeptnAppCreationRequestTimeout is used to set the interval in which automatic app discovery searches for workload to put into diff --git a/operator/config/manager/manager.yaml b/operator/config/manager/manager.yaml index d6bf1b9203..24b5b52f79 100644 --- a/operator/config/manager/manager.yaml +++ b/operator/config/manager/manager.yaml @@ -67,10 +67,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.name - - name: OTEL_COLLECTOR_URL - value: otel-collector:4317 - name: FUNCTION_RUNNER_IMAGE value: ghcr.keptn.sh/keptn/functions-runtime:v0.7.0 #x-release-please-version + - name: OTEL_COLLECTOR_URL + value: otel-collector:4317 - name: KEPTN_APP_CONTROLLER_LOG_LEVEL value: "0" - name: KEPTN_APP_VERSION_CONTROLLER_LOG_LEVEL diff --git a/operator/config/samples/options_v1alpha1_keptnconfig.yaml b/operator/config/samples/options_v1alpha1_keptnconfig.yaml index 0c5861646c..b5510d3cf3 100644 --- a/operator/config/samples/options_v1alpha1_keptnconfig.yaml +++ b/operator/config/samples/options_v1alpha1_keptnconfig.yaml @@ -7,6 +7,8 @@ metadata: app.kubernetes.io/part-of: keptn-lifecycle-toolkit app.kuberentes.io/managed-by: kustomize app.kubernetes.io/created-by: keptn-lifecycle-toolkit + control-plane: lifecycle-operator name: keptnconfig-sample spec: OTelCollectorUrl: 'otel-collector:4317' + keptnAppCreationRequestTimeoutSeconds: 30 diff --git a/operator/controllers/options/keptnconfig_controller.go b/operator/controllers/options/keptnconfig_controller.go index 404eda5c2c..6dc5c238c1 100644 --- a/operator/controllers/options/keptnconfig_controller.go +++ b/operator/controllers/options/keptnconfig_controller.go @@ -35,9 +35,10 @@ import ( // KeptnConfigReconciler reconciles a KeptnConfig object type KeptnConfigReconciler struct { client.Client - Scheme *runtime.Scheme - Log logr.Logger - LastAppliedSpec *optionsv1alpha1.KeptnConfigSpec + Scheme *runtime.Scheme + Log logr.Logger + LastAppliedSpec *optionsv1alpha1.KeptnConfigSpec + DefaultCollectorURL string } // +kubebuilder:rbac:groups=options.keptn.sh,resources=keptnconfigs,verbs=get;list;watch;create;update;patch;delete @@ -88,7 +89,7 @@ func (r *KeptnConfigReconciler) reconcileOtelCollectorUrl(config *optionsv1alpha func (r *KeptnConfigReconciler) initConfig() { r.LastAppliedSpec = &optionsv1alpha1.KeptnConfigSpec{ - OTelCollectorUrl: "", + OTelCollectorUrl: r.DefaultCollectorURL, } } diff --git a/operator/main.go b/operator/main.go index d87f6d33e8..cdd6d104b2 100644 --- a/operator/main.go +++ b/operator/main.go @@ -79,7 +79,9 @@ type envConfig struct { 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"` - KptnOptionsControllerLogLevel int `envconfig:"OPTIONS_CONTROLLER_LOG_LEVEL" default:"0"` + KeptnOptionsControllerLogLevel int `envconfig:"OPTIONS_CONTROLLER_LOG_LEVEL" default:"0"` + + KeptnOptionsCollectorURL string `envconfig:"OTEL_COLLECTOR_URL" default:""` } //nolint:funlen,gocognit,gocyclo @@ -259,9 +261,10 @@ func main() { configLogger := ctrl.Log.WithName("KeptnConfig Controller") configReconciler := &controlleroptions.KeptnConfigReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - Log: configLogger.V(env.KptnOptionsControllerLogLevel), + Client: mgr.GetClient(), + Scheme: mgr.GetScheme(), + Log: configLogger.V(env.KeptnOptionsControllerLogLevel), + DefaultCollectorURL: env.KeptnOptionsCollectorURL, } if err = (configReconciler).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "KeptnConfig")