Skip to content

Commit

Permalink
fix: OB-35984-add-namespace-name-to-cluster-role
Browse files Browse the repository at this point in the history
- Add the namespace name to cluster role and cluster role binding
- Make configmap creation conditional based on enabled flag for deployment/daemonset
- Make entity token use value drive exporter creation
  • Loading branch information
arthur-observe committed Aug 30, 2024
1 parent 2da0abb commit 7cda13d
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 7 deletions.
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.8.0
version: 0.8.1
appVersion: "1.0.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.8.0](https://img.shields.io/badge/Version-0.8.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)
![Version: 0.8.1](https://img.shields.io/badge/Version-0.8.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)

> [!CAUTION]
> This chart is under active development and is not meant to be installed yet.
Expand Down Expand Up @@ -305,6 +305,7 @@ Chart to install K8s collection stack based on Observe Agent
| deployment-cluster-metrics.serviceAccount.name | string | `"observe-agent-service-account"` | |
| observe.collectionEndpoint.value | string | `""` | |
| observe.entityToken.create | bool | `false` | |
| observe.entityToken.use | bool | `false` | |
| observe.entityToken.value | string | `""` | |
| observe.token.create | bool | `true` | |
| observe.token.value | string | `""` | |
Expand Down
4 changes: 4 additions & 0 deletions charts/agent/templates/_config-processors.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ attributes/observe_common:
value: ${env:OBSERVE_CLUSTER_NAME}
- key: k8s.cluster.uid
action: insert
{{ if .Values.cluster.uidOverride.value -}}
value: {{ .Values.cluster.uidOverride.value }}
{{ else -}}
value: ${env:OBSERVE_CLUSTER_UID}
{{ end -}}
{{- end -}}

{{- define "config.processors.memory_limiter" -}}
Expand Down
4 changes: 2 additions & 2 deletions charts/agent/templates/_deployment-cluster-events-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extensions:

exporters:
{{- include "config.exporters.debug" . | nindent 2 }}
{{ if .Values.observe.entityToken.create }}
{{ if .Values.observe.entityToken.use }}
{{- include "config.exporters.otlphttp.observe.entity" . | nindent 2 }}
{{ end }}
{{- include "config.exporters.otlphttp.observe.base" . | nindent 2 }}
Expand Down Expand Up @@ -295,7 +295,7 @@ service:
receivers: [k8sobjects/cluster]
processors: [memory_limiter, batch, attributes/observe_common, filter/cluster, transform/cluster]
exporters: [otlphttp/observe/base, debug/override]
{{ if .Values.observe.entityToken.create -}}
{{ if .Values.observe.entityToken.use -}}
logs/entity:
receivers: [k8sobjects/objects]
processors: [memory_limiter, batch, attributes/observe_common, transform/object, observek8sattributes]
Expand Down
6 changes: 3 additions & 3 deletions charts/agent/templates/cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: observe-agent-cluster-role
name: observe-agent-cluster-role-{{ template "observe-agent.namespace" . }}
labels:
app.kubernetes.io/name: observe-agent-cluster-role
app.kubernetes.io/instance: observe-agent
Expand Down Expand Up @@ -38,12 +38,12 @@ kind: ClusterRoleBinding
metadata:
name: observe-agent-cluster-role-binding
labels:
app.kubernetes.io/name: observe-agent-cluster-role-binding
app.kubernetes.io/name: observe-agent-cluster-role-binding-{{ template "observe-agent.namespace" . }}
app.kubernetes.io/instance: observe-agent
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: observe-agent-cluster-role
name: observe-agent-cluster-role-{{ template "observe-agent.namespace" . }}
subjects:
- kind: ServiceAccount
name: observe-agent-service-account
Expand Down
3 changes: 3 additions & 0 deletions charts/agent/templates/daemonset-logs-metrics-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ if .Values.containers.logs.enabled -}}
# TO DO: seperate logs and metrics
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -6,3 +8,4 @@ metadata:
data:
relay: |
{{- include "observe.daemonset.logsMetrics.config" . | nindent 4 -}}
{{ end -}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.agent.selfMonitor.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -6,3 +7,4 @@ metadata:
data:
relay: |
{{- include "observe.deployment.agentMonitor.config" . | nindent 4 -}}
{{ end -}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.cluster.events.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -6,3 +7,4 @@ metadata:
data:
relay: |
{{- include "observe.deployment.clusterEvents.config" . | nindent 4 -}}
{{ end -}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.cluster.metrics.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -6,3 +7,4 @@ metadata:
data:
relay: |
{{- include "observe.deployment.clusterMetrics.config" . | nindent 4 -}}
{{ end -}}
6 changes: 6 additions & 0 deletions charts/agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ observe:
value: ""
# this is temporary and will be removed
entityToken:
# To create secret
create: false
value: ""
# To use exporter
use: false


cluster:
name: observe-agent-monitored-cluster
Expand All @@ -22,6 +26,8 @@ cluster:
namespaceOverride:
# ! This needs to have same value as namespaceOverride in deployments and daemonsets below
value: observe
uidOverride:
value: ""

containers:
logs:
Expand Down

0 comments on commit 7cda13d

Please sign in to comment.