From ba409c0ab55fa15dfeac1cecf7959ccfcf32a9f4 Mon Sep 17 00:00:00 2001 From: Periklis Tsirakidis Date: Tue, 4 Jun 2024 11:07:31 +0200 Subject: [PATCH] Change addon namespace to open-cluster-management-observability --- CONTRIBUTING.md | 71 ++++++++----------- .../templates/clusterlogforwarder.yaml | 4 +- .../templates/logging-auth-configmap.yaml | 4 +- .../tracing/templates/otel-collector.yaml | 2 +- .../templates/tracing-auth-configmap.yaml | 4 +- .../templates/managed-cluster-addon.yaml | 6 +- .../templates/logging-static-auth.yaml | 4 +- deploy/kustomization.yaml | 2 +- deploy/resources/addondeploymentconfig.yaml | 2 +- .../resources/cluster-management-addon.yaml | 6 +- .../templates/aws-secret-default.yaml | 2 +- .../addon-install/templates/clf-instance.yaml | 2 +- .../templates/instance-default.yaml | 4 +- .../templates/otelcol-instance.yaml | 2 +- .../addon/authentication/provider_test.go | 2 +- internal/addon/helm/values_test.go | 17 ++--- internal/addon/var.go | 2 +- internal/logging/helm_test.go | 10 +-- internal/logging/manifests/logging_test.go | 4 +- internal/tracing/helm_test.go | 12 ++-- 20 files changed, 69 insertions(+), 93 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9cd0c97..1b91946 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,75 +66,60 @@ Then every time you want to test a new version, you can just: ```shell make oci # Delete the mcoa pod which will make the Deployment pull the new image -oc -n open-cluster-management delete pod -l app=multicluster-observability-addon-manager +oc -n open-cluster-management-observability delete pod -l app=multicluster-observability-addon-manager ``` -### Disabeling specific signals +### Enable specific Observability Capabilities -The addon supports disabling signals using the resource `AddOnDeploymentConfig`. For instance, to disable the logging signal create the following resource on the hub cluster: +The addon supports enabling observability capabilities using the resource `AddOnDeploymentConfig`. For instance, to enable platform and user workloads logging/tracing/instrumentation create the following resource on the hub cluster: ```yaml apiVersion: addon.open-cluster-management.io/v1alpha1 kind: AddOnDeploymentConfig metadata: name: multicluster-observability-addon - namespace: open-cluster-management + namespace: open-cluster-management-observability spec: customizedVariables: - - name: loggingDisabled - value: "true" + # Platform Observability + - name: platformLogsCollection + value: clusterlogforwarders.v1.logging.openshift.io + # User Workloads Observability + - name: userWorkloadLogsCollection + value: clusterlogforwarders.v1.logging.openshift.io + - name: userWorkloadTracesCollection + value: opentelemetrycollectors.v1alpha1.opentelemetry.io + - name: userWorkloadInstrumentation + value: instrumentations.v1alpha1.opentelemetry.io ``` -Supported keys are `metricsDisabled`, `loggingDisabled` and `tracingDisabled` +Supported keys are: +- `platformLogsCollection`: Supports values `clusterlogforwarders.v1.logging.openshift.io` +- `userWorkloadLogsCollection`: Supports values `clusterlogforwarders.v1.logging.openshift.io` +- `userWorkloadTracesCollection`: Supports values `opentelemetrycollectors.v1alpha1.opentelemetry.io` +- `userWorkloadTracesInstrumentation`: Supports values `instrumentations.v1alpha1.opentelemetry.io` -## Install the addon on a Spoke Cluster +__Note__: Keys can hold multiple values separated by semicolon, e.g. `clusterlogforwarders.v1.logging.openshift.io;opentelemetrycollectors.v1alpha1.opentelemetry.io`. -To actually install the addon on a spoke cluster, you need to: +### Configuring Platform Observability Capabilities -1. Have the addon manager running on the hub cluster. -2. Create the necessary Kubernetes resources in the namespace of the spoke - cluster that will be used by the addon to generate the `ManifestWorks`, e.g., - `secrets`, `configmaps`. -3. Create the `ManagedClusterAddon` resource in the namespace of the spoke - cluster. +#### Logs Collection -```yaml -apiVersion: addon.open-cluster-management.io/v1alpha1 -kind: ManagedClusterAddOn -metadata: - name: multicluster-observability-addon - namespace: spoke-1 -spec: - installNamespace: open-cluster-management-agent-addon - configs: - - resource: configmaps - name: spoke-1 - namespace: spoke-1 - - resource: secrets - name: spoke-1 - namespace: spoke-1 -``` - -4. Once a `ManagedClusterAddon` is reconciled successfuly by the addon we can - look for the `ManifestWorks` - -```shell -oc -n spoke-1 get manifestworks addon-multicluster-observability-addon-deploy-0 -``` +Currently the addon supports configuration to send logs either to: -### Configuring Metrics +- CloudWatch: requires the auth configmap to be specified +- Loki: requires the auth configmap, the url configmap and optionally the inject ca configmap -Currently the addon doesn't support any configuration, so no configuration is needed at the `ManagedClusterAddOn` level. However, the addon has a dependency with MCO. -Nowadays the addon supports the collection of metrics from the spoke clusters. These metrics are sent to an MCO instance running in the Hub. +### Configuring User Workloads Observability Capabilities -### Configuring Logs +#### Logs Collection Currently the addon supports configuration to send logs either to: - CloudWatch: requires the auth configmap to be specified - Loki: requires the auth configmap, the url configmap and optionally the inject ca configmap -### Configuring Traces +### Traces Collection & Instrumentation Currently the addon supports configuration to send traces to: diff --git a/demo/addon-config/charts/logging/templates/clusterlogforwarder.yaml b/demo/addon-config/charts/logging/templates/clusterlogforwarder.yaml index 0ea0932..14f1396 100644 --- a/demo/addon-config/charts/logging/templates/clusterlogforwarder.yaml +++ b/demo/addon-config/charts/logging/templates/clusterlogforwarder.yaml @@ -2,7 +2,7 @@ apiVersion: logging.openshift.io/v1 kind: ClusterLogForwarder metadata: name: instance - namespace: open-cluster-management + namespace: open-cluster-management-observability spec: outputs: {{- range $_, $dic := .Values.outputs }} @@ -38,4 +38,4 @@ spec: {{- end }} outputRefs: - {{ $dic.name }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/demo/addon-config/charts/logging/templates/logging-auth-configmap.yaml b/demo/addon-config/charts/logging/templates/logging-auth-configmap.yaml index 1d897a5..315ccd2 100644 --- a/demo/addon-config/charts/logging/templates/logging-auth-configmap.yaml +++ b/demo/addon-config/charts/logging/templates/logging-auth-configmap.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: logging-auth - namespace: open-cluster-management + namespace: open-cluster-management-observability labels: mcoa.openshift.io/signal: logging data: @@ -15,4 +15,4 @@ data: {{- end }} {{- end }} --- -{{- end }} \ No newline at end of file +{{- end }} diff --git a/demo/addon-config/charts/tracing/templates/otel-collector.yaml b/demo/addon-config/charts/tracing/templates/otel-collector.yaml index 92a7002..f0f93d1 100644 --- a/demo/addon-config/charts/tracing/templates/otel-collector.yaml +++ b/demo/addon-config/charts/tracing/templates/otel-collector.yaml @@ -2,7 +2,7 @@ apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: name: spoke-otelcol - namespace: open-cluster-management + namespace: open-cluster-management-observability spec: config: | receivers: diff --git a/demo/addon-config/charts/tracing/templates/tracing-auth-configmap.yaml b/demo/addon-config/charts/tracing/templates/tracing-auth-configmap.yaml index 266d0a6..9e2d9d8 100644 --- a/demo/addon-config/charts/tracing/templates/tracing-auth-configmap.yaml +++ b/demo/addon-config/charts/tracing/templates/tracing-auth-configmap.yaml @@ -3,9 +3,9 @@ apiVersion: v1 kind: ConfigMap metadata: name: tracing-auth - namespace: open-cluster-management + namespace: open-cluster-management-observability labels: mcoa.openshift.io/signal: tracing data: otlp: mTLS -{{- end }} \ No newline at end of file +{{- end }} diff --git a/demo/addon-install/templates/managed-cluster-addon.yaml b/demo/addon-install/templates/managed-cluster-addon.yaml index 83b1750..ca8e6d7 100644 --- a/demo/addon-install/templates/managed-cluster-addon.yaml +++ b/demo/addon-install/templates/managed-cluster-addon.yaml @@ -11,7 +11,7 @@ spec: # Logging Auth ConfigMap - resource: configmaps name: logging-auth - namespace: open-cluster-management + namespace: open-cluster-management-observability # Logging URLs for Loki ConfigMap {{- range $_, $dic := $.Values.logging.outputs }} {{- if eq $dic.type "loki" }} @@ -38,10 +38,10 @@ spec: # Tracing Auth ConfigMap - resource: configmaps name: tracing-auth - namespace: open-cluster-management + namespace: open-cluster-management-observability # Tracing ca-bundle configmap - resource: secrets name: otel-gateway namespace: observability {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/demo/mcoa-demo/templates/logging-static-auth.yaml b/demo/mcoa-demo/templates/logging-static-auth.yaml index 873b3e6..47cfe38 100644 --- a/demo/mcoa-demo/templates/logging-static-auth.yaml +++ b/demo/mcoa-demo/templates/logging-static-auth.yaml @@ -3,8 +3,8 @@ apiVersion: v1 kind: Secret metadata: name: static-authentication - namespace: open-cluster-management + namespace: open-cluster-management-observability data: aws_access_key_id: {{ .Values.logging.aws.keyID | b64enc }} aws_secret_access_key: {{ .Values.logging.aws.keySecret | b64enc }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/deploy/kustomization.yaml b/deploy/kustomization.yaml index ed0049a..10b7885 100644 --- a/deploy/kustomization.yaml +++ b/deploy/kustomization.yaml @@ -3,7 +3,7 @@ images: newName: quay.io/rhobs/multicluster-observability-addon newTag: v0.0.1 -namespace: open-cluster-management +namespace: open-cluster-management-observability resources: - resources/cluster_role_binding.yaml diff --git a/deploy/resources/addondeploymentconfig.yaml b/deploy/resources/addondeploymentconfig.yaml index 2398994..6f87645 100644 --- a/deploy/resources/addondeploymentconfig.yaml +++ b/deploy/resources/addondeploymentconfig.yaml @@ -2,7 +2,7 @@ apiVersion: addon.open-cluster-management.io/v1alpha1 kind: AddOnDeploymentConfig metadata: name: multicluster-observability-addon - namespace: open-cluster-management + namespace: open-cluster-management-observability spec: customizedVariables: # Operator Subscription Channels diff --git a/deploy/resources/cluster-management-addon.yaml b/deploy/resources/cluster-management-addon.yaml index 9703da3..6da07c7 100644 --- a/deploy/resources/cluster-management-addon.yaml +++ b/deploy/resources/cluster-management-addon.yaml @@ -16,7 +16,7 @@ spec: resource: addondeploymentconfigs defaultConfig: name: multicluster-observability-addon - namespace: open-cluster-management + namespace: open-cluster-management-observability # Describes the default log forwarding outputs for each log type applied to all managed clusters. - group: logging.openshift.io resource: clusterlogforwarders @@ -32,8 +32,8 @@ spec: - group: logging.openshift.io resource: clusterlogforwarders name: instance - namespace: open-cluster-management + namespace: open-cluster-management-observability - group: opentelemetry.io resource: opentelemetrycollectors name: instance - namespace: open-cluster-management + namespace: open-cluster-management-observability diff --git a/hack/addon-install/templates/aws-secret-default.yaml b/hack/addon-install/templates/aws-secret-default.yaml index 8acee2a..13b36ed 100644 --- a/hack/addon-install/templates/aws-secret-default.yaml +++ b/hack/addon-install/templates/aws-secret-default.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: name: aws-credentials-default - namespace: open-cluster-management + namespace: open-cluster-management-observability type: Opaque data: aws_access_key_id: {{ .Values.awsCredentials.accessKeyID | b64enc }} diff --git a/hack/addon-install/templates/clf-instance.yaml b/hack/addon-install/templates/clf-instance.yaml index 4df6a8a..6ba66a3 100644 --- a/hack/addon-install/templates/clf-instance.yaml +++ b/hack/addon-install/templates/clf-instance.yaml @@ -2,7 +2,7 @@ apiVersion: logging.openshift.io/v1 kind: ClusterLogForwarder metadata: name: instance - namespace: open-cluster-management + namespace: open-cluster-management-observability annotations: authentication.mcoa.openshift.io/cw: SecretReference spec: diff --git a/hack/addon-install/templates/instance-default.yaml b/hack/addon-install/templates/instance-default.yaml index 745f7c0..8c616d8 100644 --- a/hack/addon-install/templates/instance-default.yaml +++ b/hack/addon-install/templates/instance-default.yaml @@ -2,7 +2,7 @@ apiVersion: logging.openshift.io/v1 kind: ClusterLogForwarder metadata: name: instance-default - namespace: open-cluster-management + namespace: open-cluster-management-observability annotations: authentication.mcoa.openshift.io/cw: SecretReference spec: @@ -19,4 +19,4 @@ spec: inputRefs: - infrastructure outputRefs: - - cw \ No newline at end of file + - cw diff --git a/hack/addon-install/templates/otelcol-instance.yaml b/hack/addon-install/templates/otelcol-instance.yaml index f0feb0d..e43c033 100644 --- a/hack/addon-install/templates/otelcol-instance.yaml +++ b/hack/addon-install/templates/otelcol-instance.yaml @@ -2,7 +2,7 @@ apiVersion: opentelemetry.io/v1beta1 kind: OpenTelemetryCollector metadata: name: instance - namespace: open-cluster-management + namespace: open-cluster-management-observability annotations: authentication.mcoa.openshift.io/otlp: SecretReference spec: diff --git a/internal/addon/authentication/provider_test.go b/internal/addon/authentication/provider_test.go index 45fb0be..dca67f1 100644 --- a/internal/addon/authentication/provider_test.go +++ b/internal/addon/authentication/provider_test.go @@ -105,7 +105,7 @@ func Test_buildAuthenticationFromAnnotations(t *testing.T) { func Test_getSecretReference(t *testing.T) { var ( - defaultNamespace = "open-cluster-management" + defaultNamespace = "open-cluster-management-observability" clusterSecret = &corev1.Secret{ ObjectMeta: v1.ObjectMeta{ Name: "foo", diff --git a/internal/addon/helm/values_test.go b/internal/addon/helm/values_test.go index f198d0c..013ff20 100644 --- a/internal/addon/helm/values_test.go +++ b/internal/addon/helm/values_test.go @@ -47,7 +47,7 @@ func Test_Mcoa_Disable_Charts(t *testing.T) { Resource: "addondeploymentconfigs", }, ConfigReferent: addonapiv1alpha1.ConfigReferent{ - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", Name: "multicluster-observability-addon", }, }, @@ -56,7 +56,7 @@ func Test_Mcoa_Disable_Charts(t *testing.T) { addOnDeploymentConfig = &addonapiv1alpha1.AddOnDeploymentConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "multicluster-observability-addon", - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", }, Spec: addonapiv1alpha1.AddOnDeploymentConfigSpec{ CustomizedVariables: []addonapiv1alpha1.CustomizedVariable{}, @@ -111,19 +111,10 @@ func Test_Mcoa_Disable_Chart_Hub(t *testing.T) { addOnDeploymentConfig = &addonapiv1alpha1.AddOnDeploymentConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "multicluster-observability-addon", - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", }, Spec: addonapiv1alpha1.AddOnDeploymentConfigSpec{ - CustomizedVariables: []addonapiv1alpha1.CustomizedVariable{ - { - Name: "loggingDisabled", - Value: "true", - }, - { - Name: "tracingDisabled", - Value: "true", - }, - }, + CustomizedVariables: []addonapiv1alpha1.CustomizedVariable{}, }, } diff --git a/internal/addon/var.go b/internal/addon/var.go index c59b635..8c5b5e6 100644 --- a/internal/addon/var.go +++ b/internal/addon/var.go @@ -6,7 +6,7 @@ import ( const ( Name = "multicluster-observability-addon" - InstallNamespace = "open-cluster-management" + InstallNamespace = "open-cluster-management-observability" McoaChartDir = "manifests/charts/mcoa" LoggingChartDir = "manifests/charts/mcoa/charts/logging" diff --git a/internal/logging/helm_test.go b/internal/logging/helm_test.go index 20fe1d4..a312172 100644 --- a/internal/logging/helm_test.go +++ b/internal/logging/helm_test.go @@ -81,7 +81,7 @@ func Test_Logging_AllConfigsTogether_AllResources(t *testing.T) { Resource: "addondeploymentconfigs", }, ConfigReferent: addonapiv1alpha1.ConfigReferent{ - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", Name: "multicluster-observability-addon", }, }, @@ -91,7 +91,7 @@ func Test_Logging_AllConfigsTogether_AllResources(t *testing.T) { Resource: "clusterlogforwarders", }, ConfigReferent: addonapiv1alpha1.ConfigReferent{ - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", Name: "mcoa-instance", }, }, @@ -101,7 +101,7 @@ func Test_Logging_AllConfigsTogether_AllResources(t *testing.T) { clf = &loggingv1.ClusterLogForwarder{ ObjectMeta: metav1.ObjectMeta{ Name: "mcoa-instance", - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", Annotations: map[string]string{ "authentication.mcoa.openshift.io/app-logs": "SecretReference", "authentication.mcoa.openshift.io/cluster-logs": "SecretReference", @@ -166,7 +166,7 @@ func Test_Logging_AllConfigsTogether_AllResources(t *testing.T) { staticCred = &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "static-authentication", - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", }, Data: map[string][]byte{ "key": []byte("data"), @@ -177,7 +177,7 @@ func Test_Logging_AllConfigsTogether_AllResources(t *testing.T) { addOnDeploymentConfig = &addonapiv1alpha1.AddOnDeploymentConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "multicluster-observability-addon", - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", }, Spec: addonapiv1alpha1.AddOnDeploymentConfigSpec{ CustomizedVariables: []addonapiv1alpha1.CustomizedVariable{ diff --git a/internal/logging/manifests/logging_test.go b/internal/logging/manifests/logging_test.go index a34ab22..211da90 100644 --- a/internal/logging/manifests/logging_test.go +++ b/internal/logging/manifests/logging_test.go @@ -106,7 +106,7 @@ func Test_BuildCLFSpec(t *testing.T) { Resource: "clusterlogforwarders", }, ConfigReferent: addonapiv1alpha1.ConfigReferent{ - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", Name: "mcoa-instance", }, }, @@ -136,7 +136,7 @@ func Test_BuildCLFSpec(t *testing.T) { clf = &loggingv1.ClusterLogForwarder{ ObjectMeta: metav1.ObjectMeta{ Name: "mcoa-instance", - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", }, Spec: loggingv1.ClusterLogForwarderSpec{ Inputs: []loggingv1.InputSpec{ diff --git a/internal/tracing/helm_test.go b/internal/tracing/helm_test.go index df09fee..64a7e0d 100644 --- a/internal/tracing/helm_test.go +++ b/internal/tracing/helm_test.go @@ -77,7 +77,7 @@ func Test_Tracing_AllConfigsTogether_AllResources(t *testing.T) { Resource: "configmaps", }, ConfigReferent: addonapiv1alpha1.ConfigReferent{ - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", Name: "tracing-auth", }, }, @@ -89,7 +89,7 @@ func Test_Tracing_AllConfigsTogether_AllResources(t *testing.T) { Resource: "addondeploymentconfigs", }, ConfigReferent: addonapiv1alpha1.ConfigReferent{ - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", Name: "multicluster-observability-addon", }, }, @@ -99,7 +99,7 @@ func Test_Tracing_AllConfigsTogether_AllResources(t *testing.T) { Resource: "opentelemetrycollectors", }, ConfigReferent: addonapiv1alpha1.ConfigReferent{ - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", Name: "mcoa-instance", }, }, @@ -109,7 +109,7 @@ func Test_Tracing_AllConfigsTogether_AllResources(t *testing.T) { otelCol := otelv1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "mcoa-instance", - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", }, Spec: otelv1beta1.OpenTelemetryCollectorSpec{ Config: otelv1beta1.Config{ @@ -130,7 +130,7 @@ func Test_Tracing_AllConfigsTogether_AllResources(t *testing.T) { addOnDeploymentConfig = &addonapiv1alpha1.AddOnDeploymentConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "multicluster-observability-addon", - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", }, Spec: addonapiv1alpha1.AddOnDeploymentConfigSpec{}, } @@ -138,7 +138,7 @@ func Test_Tracing_AllConfigsTogether_AllResources(t *testing.T) { authCM = &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Name: "tracing-auth", - Namespace: "open-cluster-management", + Namespace: "open-cluster-management-observability", Labels: map[string]string{ "mcoa.openshift.io/signal": "tracing", },