Skip to content

Commit

Permalink
[release-2.12] Add support for mcoa-managed observability capabilities (
Browse files Browse the repository at this point in the history
#1470)

* Adds manifests for multicluster-observability-addon

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Add addon template renderer

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Address code review suggestions

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Fix deep copy

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Add missing operator RBAC

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Fix MCOA component image replacement

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Add update AddOnDeploymentConfig and ClusterManagementAddOn fns

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Fix deployer

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Regenerate bundle

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Apply code review suggestions

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Add support for t-shirt sizes

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Add missing license doc

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Regenerate bundles

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Fix sonar-lint

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Regenerate bundle

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Remove obsolete permissions for secrets

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Fix unit tests

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Fix last rebase

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Fix unit tests and sonar lint

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Update operators/multiclusterobservability/manifests/base/multicluster-observability-addon/deployment.yaml

Co-authored-by: Joao Marcal <[email protected]>
Signed-off-by: Periklis Tsirakidis <[email protected]>

* Fix e2e tests

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Address suggestions from code review

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Address code review suggestions

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Add missing generated code

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Address sonar lint issues

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Regenerate bundle

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Addressing sonar lint issues

Signed-off-by: Periklis Tsirakidis <[email protected]>

* Replace the mcoa image when running on a separate tagSuffix

Signed-off-by: Periklis Tsirakidis <[email protected]>

---------

Signed-off-by: Periklis Tsirakidis <[email protected]>
Co-authored-by: Joao Marcal <[email protected]>
  • Loading branch information
periklis and JoaoBraveCoding authored Aug 6, 2024
1 parent d00db24 commit f347ca9
Show file tree
Hide file tree
Showing 27 changed files with 1,667 additions and 55 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require (
github.com/golang/snappy v0.0.4
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-version v1.6.0
github.com/imdario/mergo v0.3.16
github.com/oklog/run v1.1.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.33.1
Expand Down Expand Up @@ -47,6 +48,7 @@ require (
k8s.io/client-go v0.31.0-alpha.2
k8s.io/klog v1.0.0
k8s.io/kubectl v0.29.3
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0
open-cluster-management.io/addon-framework v0.9.2
open-cluster-management.io/api v0.13.0
sigs.k8s.io/controller-runtime v0.18.1-0.20240626171621-700befecdffa
Expand Down Expand Up @@ -134,7 +136,6 @@ require (
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jhump/protoreflect v1.9.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand Down Expand Up @@ -242,7 +243,6 @@ require (
k8s.io/kms v0.31.0-alpha.1 // indirect
k8s.io/kube-aggregator v0.30.1 // indirect
k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b // indirect
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 // indirect
open-cluster-management.io/sdk-go v0.13.1-0.20240416030555-aa744f426379 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ import (

// MultiClusterObservabilitySpec defines the desired state of MultiClusterObservability.
type MultiClusterObservabilitySpec struct {
// Capabilities defines the platform and user workload observabilities capabilities
// managed exclusively by the multicluster-observability-addon. Enabling any of these
// capabilities will result in deploying the following resources:
// - The addon Deployment, ServiceAccount and RBAC.
// - A ClusterManagementAddon managing placement for capability related custom resources.
// - An AddonDeploymentConfig managing the addon feature gates for activated capabilities.
//
// +optional
// +kubebuilder:validation:Optional
Capabilities *CapabilitiesSpec `json:"capabilities,omitempty"`
// Advanced configurations for observability
// +optional
AdvancedConfig *AdvancedConfig `json:"advanced,omitempty"`
Expand Down Expand Up @@ -48,6 +58,159 @@ type MultiClusterObservabilitySpec struct {
// +kubebuilder:validation:Enum:={"default","minimal","small","medium","large","xlarge","2xlarge","4xlarge"}
type TShirtSize string

// PlatformLogsCollectionSpec defines the spec for the addon to collect and forward logs
// from fleet managed clusters using the ClusterLogForwarder custom resource.
type PlatformLogsCollectionSpec struct {
// Enabled defines a flag to enable/disable the platform log collection.
//
// +optional
// +kubebuilder:validation:Optional
Enabled bool `json:"enabled,omitempty"`
}

// PlatformLogsSpec defines the spec for the addon to collect, forward and store logs
// from fleet managed clusters.
type PlatformLogsSpec struct {
// Collection defines the spec for the addon to collect and forward logs
// from fleet managed clusters.
//
// +optional
// +kubebuilder:validation:Optional
Collection PlatformLogsCollectionSpec `json:"collection,omitempty"`
}

// PlatformCapabilitiesSpec defines the observability capabilities managed by the addon
// for platform components.
type PlatformCapabilitiesSpec struct {
// Logs defines the configuration spec for collecting and storing logs from
// platform components running on fleet managed clusters.
//
// +optional
// +kubebuilder:validation:Optional
Logs PlatformLogsSpec `json:"logs,omitempty"`
}

// ClusterLogForwarderSpec defines the spec for the addon to collect and forward logs
// using the ClusterLogForwarder custom resource.
type ClusterLogForwarderSpec struct {
// Enabled defines a flag to enable/disable the platform log collection using the ClusterLogForwarder resource.
//
// +optional
// +kubebuilder:validation:Optional
Enabled bool `json:"enabled,omitempty"`
}

// UserWorkloadLogsCollectionSpec defines the spec for the addon to collect and forward logs
// from user workloads hosted on fleet managed clusters.
type UserWorkloadLogsCollectionSpec struct {
// Enabled defines a flag to enable/disable the platform log collection using the ClusterLogForwarder resource.
//
// +optional
// +kubebuilder:validation:Optional
ClusterLogForwarder ClusterLogForwarderSpec `json:"clusterLogForwarder,omitempty"`
}

// UserWorkloadLogsSpec defines the spec for the addon to collect,forward and store logs
// from user workloads hosted on fleet managed clusters.
type UserWorkloadLogsSpec struct {
// Collection defines the spec for the addon to collect and forward logs
// from user workloads hosted on fleet managed clusters.
//
// +optional
// +kubebuilder:validation:Optional
Collection UserWorkloadLogsCollectionSpec `json:"collection,omitempty"`
}

// OpenTelemetryCollectorSpec defines the spec for the addon to collect and forward observability signals
// using the OpenTelemetryCollector custom resource.
type OpenTelemetryCollectorSpec struct {
// Enabled defines a flag to enable/disable the user workload observability collection using the OpenTelemetryCollector resource.
//
// +optional
// +kubebuilder:validation:Optional
Enabled bool `json:"enabled,omitempty"`
}

// OpenTelemetryCollectorSpec defines the spec for the addon to collect observability signals
// using the Instrumentation custom resource.
type InstrumentationSpec struct {
// Enabled defines a flag to enable/disable the user workload observability collection using the Instrumentation resource.
//
// +optional
// +kubebuilder:validation:Optional
Enabled bool `json:"enabled,omitempty"`
}

// OpenTelemetryCollectionSpec defines the spec for the addon to collect and forward observability signals
// from user workloads hosted on fleet managed clusters using the OpenTelemetryCollector with or without
// instrumentation.
type OpenTelemetryCollectionSpec struct {
// Collector defines the spec for the user workload observability collection using the OpenTelemetryCollector resource.
//
// +optional
// +kubebuilder:validation:Optional
Collector OpenTelemetryCollectorSpec `json:"collector,omitempty"`
// Instrumentation defines the spec for the user workload observability collection using the Instrumentation resource.
//
// +optional
// +kubebuilder:validation:Optional
Instrumentation InstrumentationSpec `json:"instrumentation,omitempty"`
}

// UserWorkloadTracesSpec defines the spec for the addon to collect, forward and store traces
// from user workloads hosted on fleet managed clusters.
type UserWorkloadTracesSpec struct {
// Collection defines the spec for the addon to collect and forward traces
// from user workloads hosted on fleet managed clusters.
//
// +optional
// +kubebuilder:validation:Optional
Collection OpenTelemetryCollectionSpec `json:"collection,omitempty"`
}

// UserWorkloadCapabilitiesSpec defines the spec for user workload observability capabilities managed by the addon.
type UserWorkloadCapabilitiesSpec struct {
// Logs defines the spec for the addon to collect, forward and store logs
// from user workloads hosted on fleet managed clusters.
//
// +optional
// +kubebuilder:validation:Optional
Logs UserWorkloadLogsSpec `json:"logs,omitempty"`
// Traces defines the spec for the addon to collect, forward and store traces
// from user workloads hosted on fleet managed clusters.
//
// +optional
// +kubebuilder:validation:Optional
Traces UserWorkloadTracesSpec `json:"traces,omitempty"`
}

// CapabilitiesSpec defines the platform and user workload observabilities capabilities
// managed exclusively by the multicluster-observability-addon. Enabling any of these
// capabilities will result in deploying the following resources:
// - The addon Deployment, ServiceAccount and RBAC.
// - A ClusterManagementAddon managing placement for capability related custom resources.
// - An AddonDeploymentConfig managing the addon feature gates for activated capabilities.
type CapabilitiesSpec struct {
// Platform defines the spec for platform observability capabilities managed by the addon.
// The platform is defined as the ACM/OCM/OCP components running on managed clusters to run,
// manage and observe the managed clusters themselves locally as well as remotely from a hub.
// Such components live on namespaces with prefixes for example:
// - openshift-
// - open-cluster-management-
// - default
//
// +optional
// +kubebuilder:validation:Optional
Platform *PlatformCapabilitiesSpec `json:"platform,omitempty"`
// UserWorkloads defines the spec for user workloads observability capabilities managed by the addon.
// As user workloads are defined any containers hosted on spoke clusters and execute any task unrelated
// to managing the fleet or the individual managed cluster itself.
//
// +optional
// +kubebuilder:validation:Optional
UserWorkloads *UserWorkloadCapabilitiesSpec `json:"userWorkloads,omitempty"`
}

type AdvancedConfig struct {
// CustomObservabilityHubURL overrides the endpoint used by the metrics-collector to send
// metrics to the hub server.
Expand Down Expand Up @@ -98,6 +261,9 @@ type AdvancedConfig struct {
// spec for thanos-store-shard
// +optional
Store *StoreSpec `json:"store,omitempty"`
// spec for multicluster-obervability-addon
// +optional
MultiClusterObservabilityAddon *CommonSpec `json:"multiClusterObservabilityAddon,omitempty"`
}

type CommonSpec struct {
Expand Down
Loading

0 comments on commit f347ca9

Please sign in to comment.