Skip to content

Commit

Permalink
Change addon namespace to open-cluster-management-observability
Browse files Browse the repository at this point in the history
  • Loading branch information
periklis committed Jun 6, 2024
1 parent f8cdca1 commit ba409c0
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 93 deletions.
71 changes: 28 additions & 43 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -38,4 +38,4 @@ spec:
{{- end }}
outputRefs:
- {{ $dic.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -15,4 +15,4 @@ data:
{{- end }}
{{- end }}
---
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
{{- end }}
6 changes: 3 additions & 3 deletions demo/addon-install/templates/managed-cluster-addon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand All @@ -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 }}
{{- end }}
4 changes: 2 additions & 2 deletions demo/mcoa-demo/templates/logging-static-auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
{{- end }}
2 changes: 1 addition & 1 deletion deploy/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion deploy/resources/addondeploymentconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions deploy/resources/cluster-management-addon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion hack/addon-install/templates/aws-secret-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion hack/addon-install/templates/clf-instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions hack/addon-install/templates/instance-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -19,4 +19,4 @@ spec:
inputRefs:
- infrastructure
outputRefs:
- cw
- cw
2 changes: 1 addition & 1 deletion hack/addon-install/templates/otelcol-instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion internal/addon/authentication/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
17 changes: 4 additions & 13 deletions internal/addon/helm/values_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
Expand All @@ -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{},
Expand Down Expand Up @@ -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{},
},
}

Expand Down
2 changes: 1 addition & 1 deletion internal/addon/var.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions internal/logging/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
Expand All @@ -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",
},
},
Expand All @@ -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",
Expand Down Expand Up @@ -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"),
Expand All @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions internal/logging/manifests/logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
Expand Down Expand Up @@ -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{
Expand Down
Loading

0 comments on commit ba409c0

Please sign in to comment.