Skip to content

Commit

Permalink
Address code review suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Periklis Tsirakidis <[email protected]>
  • Loading branch information
periklis committed Aug 1, 2024
1 parent b2f6972 commit 8f9ad06
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type MultiClusterObservabilitySpec struct {
type TShirtSize string

// PlatformLogsCollectionSpec defines the spec for the addon to collect and forward logs
// from fleet managed clusters.
// from fleet managed clusters using the ClusterLogForwarder custom resource.
type PlatformLogsCollectionSpec struct {
// Enabled defines a flag to enable/disable the platform log collection.
//
Expand All @@ -70,6 +70,18 @@ type PlatformLogsCollectionSpec struct {
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
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Collection"
Collection PlatformLogsCollectionSpec `json:"collection,omitempty"`
}

// PlatformCapabilitiesSpec defines the observability capabilities managed by the addon
// for platform components.
type PlatformCapabilitiesSpec struct {
Expand All @@ -79,7 +91,7 @@ type PlatformCapabilitiesSpec struct {
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Logs"
Logs PlatformLogsCollectionSpec `json:"logs,omitempty"`
Logs PlatformLogsSpec `json:"logs,omitempty"`
}

// ClusterLogForwarderSpec defines the spec for the addon to collect and forward logs
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ metadata:
}
]
capabilities: Basic Install
createdAt: "2024-07-29T07:45:11Z"
createdAt: "2024-07-29T12:28:25Z"
operators.operatorframework.io/builder: operator-sdk-v1.34.2
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
name: multicluster-observability-operator.v0.1.0
Expand Down Expand Up @@ -90,9 +90,13 @@ spec:
logs from platform components running on fleet managed clusters.
displayName: Logs
path: capabilities.platform.logs
- description: Collection defines the spec for the addon to collect and forward
logs from fleet managed clusters.
displayName: Collection
path: capabilities.platform.logs.collection
- description: Enabled defines a flag to enable/disable the platform log collection.
displayName: Enable
path: capabilities.platform.logs.enabled
path: capabilities.platform.logs.collection.enabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: UserWorkloads defines the spec for user workloads observability
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10211,10 +10211,15 @@ spec:
and storing logs from platform components running on fleet
managed clusters.
properties:
enabled:
description: Enabled defines a flag to enable/disable
the platform log collection.
type: boolean
collection:
description: Collection defines the spec for the addon
to collect and forward logs from fleet managed clusters.
properties:
enabled:
description: Enabled defines a flag to enable/disable
the platform log collection.
type: boolean
type: object
type: object
type: object
userWorkloads:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10195,10 +10195,15 @@ spec:
and storing logs from platform components running on fleet
managed clusters.
properties:
enabled:
description: Enabled defines a flag to enable/disable
the platform log collection.
type: boolean
collection:
description: Collection defines the spec for the addon
to collect and forward logs from fleet managed clusters.
properties:
enabled:
description: Enabled defines a flag to enable/disable
the platform log collection.
type: boolean
type: object
type: object
type: object
userWorkloads:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ spec:
logs from platform components running on fleet managed clusters.
displayName: Logs
path: capabilities.platform.logs
- description: Collection defines the spec for the addon to collect and forward
logs from fleet managed clusters.
displayName: Collection
path: capabilities.platform.logs.collection
- description: Enabled defines a flag to enable/disable the platform log collection.
displayName: Enable
path: capabilities.platform.logs.enabled
path: capabilities.platform.logs.collection.enabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: UserWorkloads defines the spec for user workloads observability
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (r *MCORenderer) renderAddonDeploymentConfig(
}

if cs.Platform != nil {
if cs.Platform.Logs.Enabled {
if cs.Platform.Logs.Collection.Enabled {
appendCustomVar(aodc, namePlatformLogsCollection, clfV1)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ func TestRenderAddonDeploymentConfig(t *testing.T) {
Spec: mcov1beta2.MultiClusterObservabilitySpec{
Capabilities: &mcov1beta2.CapabilitiesSpec{
Platform: &mcov1beta2.PlatformCapabilitiesSpec{
Logs: mcov1beta2.PlatformLogsCollectionSpec{
Enabled: true,
Logs: mcov1beta2.PlatformLogsSpec{
Collection: mcov1beta2.PlatformLogsCollectionSpec{
Enabled: true,
},
},
},
UserWorkloads: &mcov1beta2.UserWorkloadCapabilitiesSpec{
Expand Down

0 comments on commit 8f9ad06

Please sign in to comment.