Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add support for custom resources #309

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: agent
description: Chart to install K8s collection stack based on Observe Agent
type: application
version: 0.38.1
version: 0.39.0
appVersion: "1.1.0"
dependencies:
- name: opentelemetry-collector
Expand Down
3 changes: 2 additions & 1 deletion charts/agent/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# agent

![Version: 0.38.1](https://img.shields.io/badge/Version-0.38.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.1.0](https://img.shields.io/badge/AppVersion-1.1.0-informational?style=flat-square)
![Version: 0.39.0](https://img.shields.io/badge/Version-0.39.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.1.0](https://img.shields.io/badge/AppVersion-1.1.0-informational?style=flat-square)

> [!CAUTION]
> This chart is under active development and is not meant to be installed yet.
Expand Down Expand Up @@ -186,6 +186,7 @@ Chart to install K8s collection stack based on Observe Agent
| cluster-metrics.serviceAccount.create | bool | `false` | |
| cluster-metrics.serviceAccount.name | string | `"observe-agent-service-account"` | |
| cluster-metrics.tolerations | list | `[]` | |
| cluster.events.additionalResources | string | `nil` | |
| cluster.events.enabled | bool | `true` | |
| cluster.events.pullInterval | string | `"20m"` | |
| cluster.metrics.enabled | bool | `true` | |
Expand Down
100 changes: 53 additions & 47 deletions charts/agent/templates/_cluster-events-config.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,57 @@
{{- define "observe.deployment.clusterEvents.config" -}}

{{ $resourcesList := list
(dict "name" "events" "mode" "pull" "interval" "15m")
(dict "name" "events" "mode" "watch")
(dict "name" "pods" "mode" "pull" "interval" "15m")
(dict "name" "pods" "mode" "watch" )
(dict "name" "namespaces" "mode" "pull" "interval" "15m")
(dict "name" "namespaces" "mode" "watch" )
(dict "name" "nodes" "mode" "pull" "interval" "15m")
(dict "name" "nodes" "mode" "watch" )
(dict "name" "deployments" "mode" "pull" "interval" "15m")
(dict "name" "deployments" "mode" "watch" )
(dict "name" "replicasets" "mode" "pull" "interval" "15m")
(dict "name" "replicasets" "mode" "watch" )
(dict "name" "configmaps" "mode" "pull" "interval" "15m")
(dict "name" "configmaps" "mode" "watch" )
(dict "name" "endpoints" "mode" "pull" "interval" "15m")
(dict "name" "endpoints" "mode" "watch" )
(dict "name" "jobs" "mode" "pull" "interval" "15m")
(dict "name" "jobs" "mode" "watch" )
(dict "name" "cronjobs" "mode" "pull" "interval" "15m")
(dict "name" "cronjobs" "mode" "watch" )
(dict "name" "daemonsets" "mode" "pull" "interval" "15m")
(dict "name" "daemonsets" "mode" "watch" )
(dict "name" "statefulsets" "mode" "pull" "interval" "15m")
(dict "name" "statefulsets" "mode" "watch" )
(dict "name" "services" "mode" "pull" "interval" "15m")
(dict "name" "services" "mode" "watch" )
(dict "name" "ingresses" "mode" "pull" "interval" "15m")
(dict "name" "ingresses" "mode" "watch" )
(dict "name" "secrets" "mode" "pull" "interval" "15m")
(dict "name" "secrets" "mode" "watch" )
(dict "name" "persistentvolumeclaims" "mode" "pull" "interval" "15m")
(dict "name" "persistentvolumeclaims" "mode" "watch" )
(dict "name" "persistentvolumes" "mode" "pull" "interval" "15m")
(dict "name" "persistentvolumes" "mode" "watch" )
(dict "name" "storageclasses" "mode" "pull" "interval" "15m")
(dict "name" "storageclasses" "mode" "watch" )
(dict "name" "roles" "mode" "pull" "interval" "15m")
(dict "name" "roles" "mode" "watch" )
(dict "name" "rolebindings" "mode" "pull" "interval" "15m")
(dict "name" "rolebindings" "mode" "watch" )
(dict "name" "clusterroles" "mode" "pull" "interval" "15m")
(dict "name" "clusterroles" "mode" "watch" )
(dict "name" "clusterrolebindings" "mode" "pull" "interval" "15m")
(dict "name" "clusterrolebindings" "mode" "watch" )
(dict "name" "serviceaccounts" "mode" "pull" "interval" "15m")
(dict "name" "serviceaccounts" "mode" "watch" )
}}
{{ if .Values.cluster.events.additionalResources }}
{{ $resourcesList = concat $resourcesList .Values.cluster.events.additionalResources }}
{{ end }}

extensions:
{{- include "config.extensions.health_check" . | nindent 2 }}

Expand All @@ -19,53 +71,7 @@ receivers:
# retrieves descriptions of all resources listed below
k8sobjects/objects:
auth_type: serviceAccount
objects:
- {name: events, mode: pull, interval: 15m}
- {name: events, mode: watch}
- {name: pods, mode: pull, interval: 15m}
- {name: pods, mode: watch}
- {name: namespaces, mode: pull, interval: 15m}
- {name: namespaces, mode: watch}
- {name: nodes, mode: pull, interval: 15m}
- {name: nodes, mode: watch}
- {name: deployments, mode: pull, interval: 15m}
- {name: deployments, mode: watch}
- {name: replicasets, mode: pull, interval: 15m}
- {name: replicasets, mode: watch}
- {name: configmaps, mode: pull, interval: 15m}
- {name: configmaps, mode: watch}
- {name: endpoints, mode: pull, interval: 15m}
- {name: endpoints, mode: watch}
- {name: jobs, mode: pull, interval: 15m}
- {name: jobs, mode: watch}
- {name: cronjobs, mode: pull, interval: 15m}
- {name: cronjobs, mode: watch}
- {name: daemonsets, mode: pull, interval: 15m}
- {name: daemonsets, mode: watch}
- {name: statefulsets, mode: pull, interval: 15m}
- {name: statefulsets, mode: watch}
- {name: services, mode: pull, interval: 15m}
- {name: services, mode: watch}
- {name: ingresses, mode: pull, interval: 15m}
- {name: ingresses, mode: watch}
- {name: secrets, mode: pull, interval: 15m}
- {name: secrets, mode: watch}
- {name: persistentvolumeclaims, mode: pull, interval: 15m}
- {name: persistentvolumeclaims, mode: watch}
- {name: persistentvolumes, mode: pull, interval: 15m}
- {name: persistentvolumes, mode: watch}
- {name: storageclasses, mode: pull, interval: 15m}
- {name: storageclasses, mode: watch}
- {name: roles, mode: pull, interval: 15m}
- {name: roles, mode: watch}
- {name: rolebindings, mode: pull, interval: 15m}
- {name: rolebindings, mode: watch}
- {name: clusterroles, mode: pull, interval: 15m}
- {name: clusterroles, mode: watch}
- {name: clusterrolebindings, mode: pull, interval: 15m}
- {name: clusterrolebindings, mode: watch}
- {name: serviceaccounts, mode: pull, interval: 15m}
- {name: serviceaccounts, mode: watch}
objects: {{ $resourcesList | toYaml | nindent 4 }}

processors:
{{- include "config.processors.memory_limiter" . | nindent 2 }}
Expand Down
2 changes: 2 additions & 0 deletions charts/agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ cluster:
# how often to pull resources from cluster
pullInterval: 20m
enabled: true
# additional custom resource definitions to gather events for
additionalResources:
# cluster-level metrics and entity events (as metrics) from the Kubernetes API server. It uses the K8s API to listen for updates.
metrics:
enabled: true
Expand Down
Loading