Skip to content

Commit

Permalink
feat: Add support for all workloads: Deployment, Daemonset, Jobs, Sta…
Browse files Browse the repository at this point in the history
…tefulsets (#1530)

Co-authored-by: Korbinian Stoemmer <[email protected]>
Co-authored-by: Hisar Balik <[email protected]>
Co-authored-by: Mostafa Shorim <[email protected]>
  • Loading branch information
4 people authored Oct 28, 2024
1 parent 82dc218 commit 849cdec
Show file tree
Hide file tree
Showing 34 changed files with 1,814 additions and 708 deletions.
6 changes: 3 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ linters-settings:
gocyclo:
# Minimal code complexity to report.
# Default: 30
# The max complexity while enabling this linter is 15. Please check if this can be reduced. Increase the threshold only if it is absolutely necessary.
min-complexity: 15
# The max complexity while enabling this linter is 17. Please check if this can be reduced. Increase the threshold only if it is absolutely necessary.
min-complexity: 17

wsl:
allow-trailing-comment: true
Expand Down Expand Up @@ -228,7 +228,7 @@ issues:
- linters: [ errcheck ]
path: test/testkit/otel/traces/traces.go
- linters: [ dupl ]
path: test/testkit/assert/(deployment|daemon_set|metrics|traces).go
path: test/testkit/assert/(deployment|daemon_set|metrics|traces|stateful_set|jobs).go
- linters: [ dupl ]
path: main.go
- linters:
Expand Down
18 changes: 17 additions & 1 deletion apis/telemetry/v1alpha1/metricpipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type MetricPipelineRuntimeInput struct {
Namespaces *NamespaceSelector `json:"namespaces,omitempty"`
// Describes the Kubernetes resources for which runtime metrics are scraped.
// +optional
// +kubebuilder:default={pod: {enabled: true}, container: {enabled: true}, node: {enabled: false}, volume: {enabled: false}}
// +kubebuilder:default={pod: {enabled: true}, container: {enabled: true}, node: {enabled: false}, volume: {enabled: false}, daemonset: {enabled: false}, deployment: {enabled: false}, statefulset: {enabled: false}, job: {enabled: false}}
Resources *MetricPipelineRuntimeInputResources `json:"resources,omitempty"`
}

Expand All @@ -124,6 +124,22 @@ type MetricPipelineRuntimeInputResources struct {
// +optional
// +kubebuilder:default={enabled: false}
Volume *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"volume,omitempty"`
// Configures DaemonSet runtime metrics scraping.
// +optional
// +kubebuilder:default={enabled: false}
DaemonSet *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"daemonset,omitempty"`
// Configures Deployment runtime metrics scraping.
// +optional
// +kubebuilder:default={enabled: false}
Deployment *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"deployment,omitempty"`
// Configures StatefulSet runtime metrics scraping.
// +optional
// +kubebuilder:default={enabled: false}
StatefulSet *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"statefulset,omitempty"`
// Configures Job runtime metrics scraping.
// +optional
// +kubebuilder:default={enabled: false}
Job *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"job,omitempty"`
}

// MetricPipelineRuntimeInputResourceEnabledByDefault defines if the scraping of runtime metrics is enabled for a specific resource. The scraping is enabled by default.
Expand Down
20 changes: 20 additions & 0 deletions apis/telemetry/v1alpha1/zz_generated.deepcopy.go

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

18 changes: 17 additions & 1 deletion apis/telemetry/v1beta1/metricpipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type MetricPipelineRuntimeInput struct {
Namespaces *NamespaceSelector `json:"namespaces,omitempty"`
// Describes the Kubernetes resources for which runtime metrics are scraped.
// +optional
// +kubebuilder:default={pod: {enabled: true}, container: {enabled: true}, node: {enabled: false}, volume: {enabled: false}}
// +kubebuilder:default={pod: {enabled: true}, container: {enabled: true}, node: {enabled: false}, volume: {enabled: false}, daemonset: {enabled: false}, deployment: {enabled: false}, statefulset: {enabled: false}, job: {enabled: false}}
Resources *MetricPipelineRuntimeInputResources `json:"resources,omitempty"`
}

Expand All @@ -124,6 +124,22 @@ type MetricPipelineRuntimeInputResources struct {
// +optional
// +kubebuilder:default={enabled: false}
Volume *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"volume,omitempty"`
// Configures DaemonSet runtime metrics scraping.
// +optional
// +kubebuilder:default={enabled: false}
DaemonSet *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"daemonset,omitempty"`
// Configures Deployment runtime metrics scraping.
// +optional
// +kubebuilder:default={enabled: false}
Deployment *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"deployment,omitempty"`
// Configures StatefulSet runtime metrics scraping.
// +optional
// +kubebuilder:default={enabled: false}
StatefulSet *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"statefulset,omitempty"`
// Configures Job runtime metrics scraping.
// +optional
// +kubebuilder:default={enabled: false}
Job *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"job,omitempty"`
}

// MetricPipelineRuntimeInputResourceEnabledByDefault defines if the scraping of runtime metrics is enabled for a specific resource. The scraping is enabled by default.
Expand Down
20 changes: 20 additions & 0 deletions apis/telemetry/v1beta1/zz_generated.deepcopy.go

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

24 changes: 24 additions & 0 deletions config/busola/metricpipeline_busola_extension_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ data:
- name: Volume
visibility: $exists(spec.input.runtime.resources.volume)
source: spec.input.runtime.resources.volume.enabled
- name: DaemonSet
visibility: $exists(spec.input.runtime.resources.daemonset)
source: spec.input.runtime.resources.daemonset.enabled
- name: Deployment
visibility: $exists(spec.input.runtime.resources.deployment)
source: spec.input.runtime.resources.deployment.enabled
- name: StatefulSet
visibility: $exists(spec.input.runtime.resources.statefulset)
source: spec.input.runtime.resources.statefulset.enabled
- name: Job
visibility: $exists(spec.input.runtime.resources.job)
source: spec.input.runtime.resources.job.enabled
- name: OTLP
widget: Panel
visibility: $exists(spec.input.otlp)
Expand Down Expand Up @@ -350,6 +362,18 @@ data:
- name: Enable Volume Metrics
path: volume.enabled
simple: true
- name: Enable DaemonSet Metrics
path: daemonset.enabled
simple: true
- name: Enable Deployment Metrics
path: deployment.enabled
simple: true
- name: Enable StatefulSet Metrics
path: statefulset.enabled
simple: true
- name: Enable Job Metrics
path: job.enabled
simple: true
- name: OTLP
path: otlp
widget: FormGroup
Expand Down
52 changes: 52 additions & 0 deletions config/crd/bases/telemetry.kyma-project.io_metricpipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,18 @@ spec:
default:
container:
enabled: true
daemonset:
enabled: false
deployment:
enabled: false
job:
enabled: false
node:
enabled: false
pod:
enabled: true
statefulset:
enabled: false
volume:
enabled: false
description: Describes the Kubernetes resources for which
Expand All @@ -239,6 +247,39 @@ spec:
resource are scraped. The default is `true`.
type: boolean
type: object
daemonset:
default:
enabled: false
description: Configures DaemonSet runtime metrics scraping.
properties:
enabled:
default: false
description: If enabled, the runtime metrics for the
resource are scraped. The default is `false`.
type: boolean
type: object
deployment:
default:
enabled: false
description: Configures Deployment runtime metrics scraping.
properties:
enabled:
default: false
description: If enabled, the runtime metrics for the
resource are scraped. The default is `false`.
type: boolean
type: object
job:
default:
enabled: false
description: Configures Job runtime metrics scraping.
properties:
enabled:
default: false
description: If enabled, the runtime metrics for the
resource are scraped. The default is `false`.
type: boolean
type: object
node:
default:
enabled: false
Expand All @@ -261,6 +302,17 @@ spec:
resource are scraped. The default is `true`.
type: boolean
type: object
statefulset:
default:
enabled: false
description: Configures StatefulSet runtime metrics scraping.
properties:
enabled:
default: false
description: If enabled, the runtime metrics for the
resource are scraped. The default is `false`.
type: boolean
type: object
volume:
default:
enabled: false
Expand Down
Loading

0 comments on commit 849cdec

Please sign in to comment.