From ccc66c2bc574ad0e66ed7e4f82f73f7c841a0365 Mon Sep 17 00:00:00 2001 From: CircleCI Date: Tue, 24 Dec 2024 20:48:48 +0200 Subject: [PATCH 1/2] rename clusterCollection.logs -> .logFiles --- README.md | 3 +-- .../templates/cluster-agent-daemonset.yaml | 6 +++--- .../cluster-agent-otel-collector-config.yaml.tpl | 8 ++++---- charts/lumigo-operator/values.yaml | 2 +- .../kubernetes-distros/kind/internal/install_operator.go | 6 +++--- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b50b716..30adeb4 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ spec: enabled: true # enables log forwarding for pods with tracing injected ``` -#### Logging support via pod log files +#### Fetching container logs via files Workloads that are using runtimes not supported by current Lumigo OTEL distro (e.g. Go, Rust) can still send logs to Lumigo, via logs files from containers that k8s manages on each node in the cluster. The Lumigo Kubernetes operator will automatically collect logs from those files and send them to Lumigo, once the following setting is applied when installing the operator: @@ -232,7 +232,6 @@ lumigoToken: clusterCollection: logFiles: enabled: true - logs: include: - namespacePattern: some-ns podPattern: some-pod-* diff --git a/charts/lumigo-operator/templates/cluster-agent-daemonset.yaml b/charts/lumigo-operator/templates/cluster-agent-daemonset.yaml index 0c13255..029a82f 100644 --- a/charts/lumigo-operator/templates/cluster-agent-daemonset.yaml +++ b/charts/lumigo-operator/templates/cluster-agent-daemonset.yaml @@ -1,4 +1,4 @@ -{{- if or .Values.clusterCollection.logs.enabled .Values.clusterCollection.metrics.enabled }} +{{- if or .Values.clusterCollection.logFiles.enabled .Values.clusterCollection.metrics.enabled }} apiVersion: v1 kind: ConfigMap metadata: @@ -34,7 +34,7 @@ spec: lumigo.auto-trace: 'false' # We don't want the operator to inject itself into pods from this daemonset spec: containers: -{{- if .Values.clusterCollection.logs.enabled }} +{{- if .Values.clusterCollection.logFiles.enabled }} - name: otel-collector image: {{ .Values.logFileCollector.image.repository }}:{{ .Values.logFileCollector.image.tag }} env: @@ -88,7 +88,7 @@ spec: - name: collector-config configMap: name: {{ include "helm.fullname" . }}-cluster-agent-config -{{- if .Values.clusterCollection.logs.enabled }} +{{- if .Values.clusterCollection.logFiles.enabled }} - name: varlogpods hostPath: path: /var/log/pods/ diff --git a/charts/lumigo-operator/templates/cluster-agent-otel-collector-config.yaml.tpl b/charts/lumigo-operator/templates/cluster-agent-otel-collector-config.yaml.tpl index 28fe02d..dcdf19f 100644 --- a/charts/lumigo-operator/templates/cluster-agent-otel-collector-config.yaml.tpl +++ b/charts/lumigo-operator/templates/cluster-agent-otel-collector-config.yaml.tpl @@ -2,8 +2,8 @@ receivers: filelog: include: - {{ if .Values.clusterCollection.logs.include }} - {{- range .Values.clusterCollection.logs.include }} + {{ if .Values.clusterCollection.logFiles.include }} + {{- range .Values.clusterCollection.logFiles.include }} - /var/log/pods/{{ .namespacePattern | default "*" }}_{{ .podPattern | default "*" }}_*/{{ .containerPattern | default "*" }}/*.log {{- end }} {{- else }} @@ -15,8 +15,8 @@ receivers: # Exclude logs from the otlp-sink in tests (Kind cluster) - /var/log/pods/local-path-storage_*/*/*.log - /var/log/pods/otlp-sink_*/*/*.log - {{ if .Values.clusterCollection.logs.exclude }} - {{- range .Values.clusterCollection.logs.exclude }} + {{ if .Values.clusterCollection.logFiles.exclude }} + {{- range .Values.clusterCollection.logFiles.exclude }} - /var/log/pods/{{ .namespacePattern | default "*" }}_{{ .podPattern | default "*" }}_*/{{ .containerPattern | default "*" }}/*.log {{- end }} {{- end }} diff --git a/charts/lumigo-operator/values.yaml b/charts/lumigo-operator/values.yaml index 20eb659..27ed8af 100644 --- a/charts/lumigo-operator/values.yaml +++ b/charts/lumigo-operator/values.yaml @@ -99,7 +99,7 @@ clusterCollection: metrics: enabled: true frequency: 15s - logs: + logFiles: enabled: false # controls the port in the KSM sub-chart kube-state-metrics: diff --git a/tests/kubernetes-distros/kind/internal/install_operator.go b/tests/kubernetes-distros/kind/internal/install_operator.go index 7828d46..2b7be7e 100644 --- a/tests/kubernetes-distros/kind/internal/install_operator.go +++ b/tests/kubernetes-distros/kind/internal/install_operator.go @@ -60,9 +60,9 @@ func installLumigoOperator(ctx context.Context, client klient.Client, kubeconfig helm.WithArgs(fmt.Sprintf("--set endpoint.otlp.metrics_url=%s", otlpSinkUrl)), helm.WithArgs(fmt.Sprintf("--set lumigoToken.value=%s", lumigoToken)), // Use the the test-token for infra metrics as well helm.WithArgs(fmt.Sprintf("--set debug.enabled=%v", operatorDebug)), // Operator debug logging at runtime - helm.WithArgs(fmt.Sprintf("--set clusterCollection.logs.enabled=%v", true)), // Enable log collection via pod logs-files - helm.WithArgs(fmt.Sprintf("--set clusterCollection.logs.exclude[0].namespacePattern=%s*", testNamespacePrefix)), - helm.WithArgs(fmt.Sprintf("--set clusterCollection.logs.exclude[0].containerPattern=%s*", busyboxExcludedContainerNamePrefix)), + helm.WithArgs(fmt.Sprintf("--set clusterCollection.logFiles.enabled=%v", true)), // Enable log collection via pod logs-files + helm.WithArgs(fmt.Sprintf("--set clusterCollection.logFiles.exclude[0].namespacePattern=%s*", testNamespacePrefix)), + helm.WithArgs(fmt.Sprintf("--set clusterCollection.logFiles.exclude[0].containerPattern=%s*", busyboxExcludedContainerNamePrefix)), helm.WithArgs("--debug"), // Helm debug output on install helm.WithWait(), helm.WithTimeout("3m"), From 5e2188f6333dc9554a6e2bc6d30007ab025d0b57 Mon Sep 17 00:00:00 2001 From: CircleCI Date: Wed, 25 Dec 2024 09:54:36 +0200 Subject: [PATCH 2/2] revert naming change --- README.md | 4 ++-- .../templates/cluster-agent-daemonset.yaml | 6 +++--- .../cluster-agent-otel-collector-config.yaml.tpl | 8 ++++---- charts/lumigo-operator/values.yaml | 2 +- .../kubernetes-distros/kind/internal/install_operator.go | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 30adeb4..31980e5 100644 --- a/README.md +++ b/README.md @@ -218,7 +218,7 @@ The Lumigo Kubernetes operator will automatically collect logs from those files ```sh helm upgrade -i lumigo lumigo/lumigo-operator \ # ... - --set "clusterCollection.logFiles.enabled=true" + --set "clusterCollection.logs.enabled=true" --set "lumigoToken.value=t_123456789012345678901" ``` @@ -230,7 +230,7 @@ echo " lumigoToken: value: t_123456789012345678901 clusterCollection: - logFiles: + logs: enabled: true include: - namespacePattern: some-ns diff --git a/charts/lumigo-operator/templates/cluster-agent-daemonset.yaml b/charts/lumigo-operator/templates/cluster-agent-daemonset.yaml index 029a82f..0c13255 100644 --- a/charts/lumigo-operator/templates/cluster-agent-daemonset.yaml +++ b/charts/lumigo-operator/templates/cluster-agent-daemonset.yaml @@ -1,4 +1,4 @@ -{{- if or .Values.clusterCollection.logFiles.enabled .Values.clusterCollection.metrics.enabled }} +{{- if or .Values.clusterCollection.logs.enabled .Values.clusterCollection.metrics.enabled }} apiVersion: v1 kind: ConfigMap metadata: @@ -34,7 +34,7 @@ spec: lumigo.auto-trace: 'false' # We don't want the operator to inject itself into pods from this daemonset spec: containers: -{{- if .Values.clusterCollection.logFiles.enabled }} +{{- if .Values.clusterCollection.logs.enabled }} - name: otel-collector image: {{ .Values.logFileCollector.image.repository }}:{{ .Values.logFileCollector.image.tag }} env: @@ -88,7 +88,7 @@ spec: - name: collector-config configMap: name: {{ include "helm.fullname" . }}-cluster-agent-config -{{- if .Values.clusterCollection.logFiles.enabled }} +{{- if .Values.clusterCollection.logs.enabled }} - name: varlogpods hostPath: path: /var/log/pods/ diff --git a/charts/lumigo-operator/templates/cluster-agent-otel-collector-config.yaml.tpl b/charts/lumigo-operator/templates/cluster-agent-otel-collector-config.yaml.tpl index dcdf19f..28fe02d 100644 --- a/charts/lumigo-operator/templates/cluster-agent-otel-collector-config.yaml.tpl +++ b/charts/lumigo-operator/templates/cluster-agent-otel-collector-config.yaml.tpl @@ -2,8 +2,8 @@ receivers: filelog: include: - {{ if .Values.clusterCollection.logFiles.include }} - {{- range .Values.clusterCollection.logFiles.include }} + {{ if .Values.clusterCollection.logs.include }} + {{- range .Values.clusterCollection.logs.include }} - /var/log/pods/{{ .namespacePattern | default "*" }}_{{ .podPattern | default "*" }}_*/{{ .containerPattern | default "*" }}/*.log {{- end }} {{- else }} @@ -15,8 +15,8 @@ receivers: # Exclude logs from the otlp-sink in tests (Kind cluster) - /var/log/pods/local-path-storage_*/*/*.log - /var/log/pods/otlp-sink_*/*/*.log - {{ if .Values.clusterCollection.logFiles.exclude }} - {{- range .Values.clusterCollection.logFiles.exclude }} + {{ if .Values.clusterCollection.logs.exclude }} + {{- range .Values.clusterCollection.logs.exclude }} - /var/log/pods/{{ .namespacePattern | default "*" }}_{{ .podPattern | default "*" }}_*/{{ .containerPattern | default "*" }}/*.log {{- end }} {{- end }} diff --git a/charts/lumigo-operator/values.yaml b/charts/lumigo-operator/values.yaml index 27ed8af..20eb659 100644 --- a/charts/lumigo-operator/values.yaml +++ b/charts/lumigo-operator/values.yaml @@ -99,7 +99,7 @@ clusterCollection: metrics: enabled: true frequency: 15s - logFiles: + logs: enabled: false # controls the port in the KSM sub-chart kube-state-metrics: diff --git a/tests/kubernetes-distros/kind/internal/install_operator.go b/tests/kubernetes-distros/kind/internal/install_operator.go index 2b7be7e..7828d46 100644 --- a/tests/kubernetes-distros/kind/internal/install_operator.go +++ b/tests/kubernetes-distros/kind/internal/install_operator.go @@ -60,9 +60,9 @@ func installLumigoOperator(ctx context.Context, client klient.Client, kubeconfig helm.WithArgs(fmt.Sprintf("--set endpoint.otlp.metrics_url=%s", otlpSinkUrl)), helm.WithArgs(fmt.Sprintf("--set lumigoToken.value=%s", lumigoToken)), // Use the the test-token for infra metrics as well helm.WithArgs(fmt.Sprintf("--set debug.enabled=%v", operatorDebug)), // Operator debug logging at runtime - helm.WithArgs(fmt.Sprintf("--set clusterCollection.logFiles.enabled=%v", true)), // Enable log collection via pod logs-files - helm.WithArgs(fmt.Sprintf("--set clusterCollection.logFiles.exclude[0].namespacePattern=%s*", testNamespacePrefix)), - helm.WithArgs(fmt.Sprintf("--set clusterCollection.logFiles.exclude[0].containerPattern=%s*", busyboxExcludedContainerNamePrefix)), + helm.WithArgs(fmt.Sprintf("--set clusterCollection.logs.enabled=%v", true)), // Enable log collection via pod logs-files + helm.WithArgs(fmt.Sprintf("--set clusterCollection.logs.exclude[0].namespacePattern=%s*", testNamespacePrefix)), + helm.WithArgs(fmt.Sprintf("--set clusterCollection.logs.exclude[0].containerPattern=%s*", busyboxExcludedContainerNamePrefix)), helm.WithArgs("--debug"), // Helm debug output on install helm.WithWait(), helm.WithTimeout("3m"),