From 7ec6d614e31cc36a002e27aee961af6217da8cac Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Thu, 18 Apr 2024 10:23:17 -0500 Subject: [PATCH] Turn off clustering for log gathering alloy. Move PodLogs control to the primary alloy, which does use clustering. (#474) Also add some instructions for setting the storage path for logs instance Signed-off-by: Pete Wall --- .gitignore | 1 + .../templates/_config_validations.tpl | 39 +++++++++++++++++++ charts/k8s-monitoring/templates/_configs.tpl | 12 +++--- charts/k8s-monitoring/values.yaml | 4 +- .../alloy-autoscaling-and-storage/README.md | 20 ++++++++++ .../alloy-autoscaling-and-storage/output.yaml | 37 ++---------------- .../alloy-autoscaling-and-storage/values.yaml | 22 ++++++++++- examples/control-plane-metrics/output.yaml | 32 --------------- examples/custom-config/output.yaml | 32 --------------- examples/custom-pricing/output.yaml | 32 --------------- examples/default-values/output.yaml | 32 --------------- examples/extra-rules/output.yaml | 32 --------------- examples/gke-autopilot/output.yaml | 32 --------------- examples/ibm-cloud/output.yaml | 32 --------------- examples/kube-pod-labels/output.yaml | 32 --------------- examples/logs-only/output.yaml | 32 --------------- examples/openshift-compatible/output.yaml | 32 --------------- examples/otel-metrics-service/output.yaml | 32 --------------- examples/private-image-registry/output.yaml | 32 --------------- examples/profiles-enabled/output.yaml | 32 --------------- examples/proxies/output.yaml | 32 --------------- examples/service-integrations/output.yaml | 32 --------------- examples/specific-namespace/output.yaml | 32 --------------- examples/traces-enabled/output.yaml | 32 --------------- examples/windows-exporter/output.yaml | 32 --------------- ...-config-volumes-and-clustering-values.yaml | 23 +++++++++++ .../spec/invalid-logs-configurations_spec.sh | 13 +++++++ 27 files changed, 129 insertions(+), 618 deletions(-) create mode 100644 .gitignore create mode 100644 tests/spec/fixtures/invalid-logs-config-volumes-and-clustering-values.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..b431c365e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +data-alloy diff --git a/charts/k8s-monitoring/templates/_config_validations.tpl b/charts/k8s-monitoring/templates/_config_validations.tpl index 67f1dbf80..0a9d053e0 100644 --- a/charts/k8s-monitoring/templates/_config_validations.tpl +++ b/charts/k8s-monitoring/templates/_config_validations.tpl @@ -2,15 +2,54 @@ {{- if and .Values.logs.enabled .Values.logs.pod_logs.enabled }} {{- if eq .Values.logs.pod_logs.gatherMethod "volumes" }} {{- if ne (index .Values "alloy-logs").controller.type "daemonset" }} +{{/* +Invalid configuration for gathering pod logs! When using logs.pod_logs.gatherMethod: "volumes", Grafana Alloy for Logs must be a Daemonset. Otherwise, logs will be missing! +Please set: +logs: + pod_logs: + gatherMethod: api +or +alloy-logs: + controller: + type: daemonset +*/}} {{ fail "Invalid configuration for gathering pod logs! When using logs.pod_logs.gatherMethod: \"volumes\", Grafana Alloy for Logs must be a Daemonset. Otherwise, logs will be missing!\nPlease set:\nlogs:\n pod_logs:\n gatherMethod: api\n or\nalloy-logs:\n controller:\n type: daemonset"}} {{- end }} + {{- if (index .Values "alloy-logs").alloy.clustering.enabled }} +{{/* +Invalid configuration for gathering pod logs! When using logs.pod_logs.gatherMethod: "volumes", Grafana Alloy for Logs should not utilize clustering. Otherwise, performance will suffer! +Please set: +alloy-logs: + alloy: + clustering: + enabled: false +*/}} + {{ fail "Invalid configuration for gathering pod logs! When using logs.pod_logs.gatherMethod: \"volumes\", Grafana Alloy for Logs should not utilize clustering. Otherwise, performance will suffer!\nPlease set:\nalloy-logs:\n alloy:\n clustering:\n enabled: false"}} + {{- end }} + {{- else if eq .Values.logs.pod_logs.gatherMethod "api" }} {{- if not (index .Values "alloy-logs").alloy.clustering.enabled }} {{- if eq (index .Values "alloy-logs").controller.type "daemonset" }} +{{/* +Invalid configuration for gathering pod logs! When using logs.pod_logs.gatherMethod: "api" and the Grafana Alloy for Logs is a Daemonset, you must enable clustering. Otherwise, log files may be duplicated! +Please set: +alloy-logs: + alloy: + clustering: + enabled: true +*/}} {{ fail "Invalid configuration for gathering pod logs! When using logs.pod_logs.gatherMethod: \"api\" and the Grafana Alloy for Logs is a Daemonset, you must enable clustering. Otherwise, log files may be duplicated!\nPlease set:\nalloy-logs:\n alloy:\n clustering:\n enabled: true"}} {{- end }} {{- if gt (int (index .Values "alloy-logs").controller.replicas) 1 }} +{{/* +Invalid configuration for gathering pod logs! When using logs.pod_logs.gatherMethod: "api" and the Grafana Alloy for Logs has multiple replicas, you must enable clustering. Otherwise, log files will be duplicated! +Please set: +alloy-logs: + alloy: + clustering: + enabled: true +*/}} {{ fail "Invalid configuration for gathering pod logs! When using logs.pod_logs.gatherMethod: \"api\" and the Grafana Alloy for Logs has multiple replicas, you must enable clustering. Otherwise, log files will be duplicated!\nPlease set:\nalloy-logs:\n alloy:\n clustering:\n enabled: true"}} {{- end }} diff --git a/charts/k8s-monitoring/templates/_configs.tpl b/charts/k8s-monitoring/templates/_configs.tpl index 64c93a669..72181e148 100644 --- a/charts/k8s-monitoring/templates/_configs.tpl +++ b/charts/k8s-monitoring/templates/_configs.tpl @@ -80,7 +80,11 @@ {{- include "alloy.config.metricsService" . }} {{- end }} - {{- if and .Values.logs.enabled (or .Values.receivers.grpc.enabled .Values.receivers.http.enabled .Values.receivers.zipkin.enabled) }} + {{- if and .Values.logs.enabled (or .Values.logs.podLogsObjects.enabled .Values.receivers.grpc.enabled .Values.receivers.http.enabled) }} + {{- if .Values.logs.podLogsObjects.enabled }} + {{- include "alloy.config.pod_log_objects" . }} + {{- end }} + {{- include "alloy.config.logs.pod_logs_processor" . }} {{- include "alloy.config.logsService" . }} {{- end }} @@ -100,14 +104,10 @@ {{- include "alloy.config.logsService" . }} {{- end -}} -{{/* Grafana Allyo for Logs config */}} +{{/* Grafana Alloy for Logs config */}} {{- define "alloyLogsConfig" -}} {{- include "alloy.config.logs.pod_logs_discovery" . }} {{- include "alloy.config.logs.pod_logs_processor" . }} - {{- if .Values.logs.podLogsObjects.enabled }} - {{- include "alloy.config.pod_log_objects" . }} - {{- end }} - {{- include "alloy.config.logsService" . }} {{- if .Values.logs.extraConfig }} diff --git a/charts/k8s-monitoring/values.yaml b/charts/k8s-monitoring/values.yaml index e72f80a8c..8ec1dd5d8 100644 --- a/charts/k8s-monitoring/values.yaml +++ b/charts/k8s-monitoring/values.yaml @@ -1272,8 +1272,8 @@ alloy-logs: # This chart is creating the configuration, so the alloy chart does not need to. configMap: {create: false} - # Enable clustering by default to make it simpler when using API-based log gathering. - clustering: {enabled: true} + # Disabling clustering by default, because the default log gathering format does not require clusters. + clustering: {enabled: false} mounts: # Mount /var/log from the host into the container for log collection. diff --git a/examples/alloy-autoscaling-and-storage/README.md b/examples/alloy-autoscaling-and-storage/README.md index 491aba919..0e71325c5 100644 --- a/examples/alloy-autoscaling-and-storage/README.md +++ b/examples/alloy-autoscaling-and-storage/README.md @@ -54,4 +54,24 @@ alloy: resources: requests: storage: 5Gi + +alloy-logs: + alloy: + storagePath: /var/lib/alloy + mounts: + extra: + - mountPath: /var/lib/alloy + name: alloy-log-positions + + controller: + enableStatefulSetAutoDeletePVC: true + volumeClaimTemplates: + - metadata: + name: alloy-log-positions + spec: + accessModes: ["ReadWriteOnce"] + storageClassName: "standard" + resources: + requests: + storage: 100Mi ``` diff --git a/examples/alloy-autoscaling-and-storage/output.yaml b/examples/alloy-autoscaling-and-storage/output.yaml index f743b3cab..903523654 100644 --- a/examples/alloy-autoscaling-and-storage/output.yaml +++ b/examples/alloy-autoscaling-and-storage/output.yaml @@ -48736,36 +48736,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49073,11 +49043,9 @@ spec: args: - run - /etc/alloy/config.alloy - - --storage.path=/tmp/alloy + - --storage.path=/var/lib/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE @@ -49102,6 +49070,9 @@ spec: - name: varlog mountPath: /var/log readOnly: true + - + mountPath: /var/lib/alloy + name: alloy-log-positions - name: config-reloader image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 args: diff --git a/examples/alloy-autoscaling-and-storage/values.yaml b/examples/alloy-autoscaling-and-storage/values.yaml index 69189f004..739dcc7eb 100644 --- a/examples/alloy-autoscaling-and-storage/values.yaml +++ b/examples/alloy-autoscaling-and-storage/values.yaml @@ -42,4 +42,24 @@ alloy: storageClassName: "standard" resources: requests: - storage: 5Gi \ No newline at end of file + storage: 5Gi + +alloy-logs: + alloy: + storagePath: /var/lib/alloy + mounts: + extra: + - mountPath: /var/lib/alloy + name: alloy-log-positions + + controller: + enableStatefulSetAutoDeletePVC: true + volumeClaimTemplates: + - metadata: + name: alloy-log-positions + spec: + accessModes: ["ReadWriteOnce"] + storageClassName: "standard" + resources: + requests: + storage: 100Mi diff --git a/examples/control-plane-metrics/output.yaml b/examples/control-plane-metrics/output.yaml index f530a48b1..124c36922 100644 --- a/examples/control-plane-metrics/output.yaml +++ b/examples/control-plane-metrics/output.yaml @@ -48889,36 +48889,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49229,8 +49199,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/custom-config/output.yaml b/examples/custom-config/output.yaml index 246cce643..723ff66e2 100644 --- a/examples/custom-config/output.yaml +++ b/examples/custom-config/output.yaml @@ -48806,36 +48806,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49146,8 +49116,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/custom-pricing/output.yaml b/examples/custom-pricing/output.yaml index bf0d6ba18..18feca0ad 100644 --- a/examples/custom-pricing/output.yaml +++ b/examples/custom-pricing/output.yaml @@ -48758,36 +48758,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49098,8 +49068,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/default-values/output.yaml b/examples/default-values/output.yaml index dc4dcec19..4f1f70483 100644 --- a/examples/default-values/output.yaml +++ b/examples/default-values/output.yaml @@ -48736,36 +48736,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49076,8 +49046,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/extra-rules/output.yaml b/examples/extra-rules/output.yaml index 7182e1db5..d95fb1dc9 100644 --- a/examples/extra-rules/output.yaml +++ b/examples/extra-rules/output.yaml @@ -48843,36 +48843,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49183,8 +49153,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/gke-autopilot/output.yaml b/examples/gke-autopilot/output.yaml index c36cba981..76ad5394b 100644 --- a/examples/gke-autopilot/output.yaml +++ b/examples/gke-autopilot/output.yaml @@ -48675,36 +48675,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -48990,8 +48960,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/ibm-cloud/output.yaml b/examples/ibm-cloud/output.yaml index 1510c57d5..d081f4d46 100644 --- a/examples/ibm-cloud/output.yaml +++ b/examples/ibm-cloud/output.yaml @@ -48736,36 +48736,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49076,8 +49046,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/kube-pod-labels/output.yaml b/examples/kube-pod-labels/output.yaml index c137e6274..f48919726 100644 --- a/examples/kube-pod-labels/output.yaml +++ b/examples/kube-pod-labels/output.yaml @@ -48736,36 +48736,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49076,8 +49046,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/logs-only/output.yaml b/examples/logs-only/output.yaml index 0bbb53464..6c57e06a6 100644 --- a/examples/logs-only/output.yaml +++ b/examples/logs-only/output.yaml @@ -822,36 +822,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -1087,8 +1057,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/openshift-compatible/output.yaml b/examples/openshift-compatible/output.yaml index 7d8240adb..81c95b9bc 100644 --- a/examples/openshift-compatible/output.yaml +++ b/examples/openshift-compatible/output.yaml @@ -48563,36 +48563,6 @@ spec: targetPort: 8080 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 8080 - targetPort: 8080 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -48854,8 +48824,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:8080 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/otel-metrics-service/output.yaml b/examples/otel-metrics-service/output.yaml index bc52afc39..6d929227f 100644 --- a/examples/otel-metrics-service/output.yaml +++ b/examples/otel-metrics-service/output.yaml @@ -48765,36 +48765,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49105,8 +49075,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/private-image-registry/output.yaml b/examples/private-image-registry/output.yaml index 69adbb7fe..56b0d7a00 100644 --- a/examples/private-image-registry/output.yaml +++ b/examples/private-image-registry/output.yaml @@ -48740,36 +48740,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49082,8 +49052,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/profiles-enabled/output.yaml b/examples/profiles-enabled/output.yaml index 320e05956..c978c63fa 100644 --- a/examples/profiles-enabled/output.yaml +++ b/examples/profiles-enabled/output.yaml @@ -49678,36 +49678,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -50042,8 +50012,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/proxies/output.yaml b/examples/proxies/output.yaml index 4539e8110..18b49a8e2 100644 --- a/examples/proxies/output.yaml +++ b/examples/proxies/output.yaml @@ -48752,36 +48752,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49092,8 +49062,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/service-integrations/output.yaml b/examples/service-integrations/output.yaml index 0583b38ee..c5ecf2be0 100644 --- a/examples/service-integrations/output.yaml +++ b/examples/service-integrations/output.yaml @@ -48771,36 +48771,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49111,8 +49081,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/specific-namespace/output.yaml b/examples/specific-namespace/output.yaml index 9950423ce..45b2d8e3d 100644 --- a/examples/specific-namespace/output.yaml +++ b/examples/specific-namespace/output.yaml @@ -48800,36 +48800,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49140,8 +49110,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/traces-enabled/output.yaml b/examples/traces-enabled/output.yaml index 4f5559be6..1a2ea2b02 100644 --- a/examples/traces-enabled/output.yaml +++ b/examples/traces-enabled/output.yaml @@ -48854,36 +48854,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49194,8 +49164,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/examples/windows-exporter/output.yaml b/examples/windows-exporter/output.yaml index 85be5d827..6738696a9 100644 --- a/examples/windows-exporter/output.yaml +++ b/examples/windows-exporter/output.yaml @@ -48841,36 +48841,6 @@ spec: targetPort: 12345 protocol: "TCP" --- -# Source: k8s-monitoring/charts/alloy-logs/templates/cluster_service.yaml -apiVersion: v1 -kind: Service -metadata: - name: k8smon-alloy-logs-cluster - labels: - helm.sh/chart: alloy-logs-0.1.1 - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - - app.kubernetes.io/version: "v1.0.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - clusterIP: 'None' - selector: - app.kubernetes.io/name: alloy-logs - app.kubernetes.io/instance: k8smon - ports: - # Do not include the -metrics suffix in the port name, otherwise metrics - # can be double-collected with the non-headless Service if it's also - # enabled. - # - # This service should only be used for clustering, and not metric - # collection. - - name: http - port: 12345 - targetPort: 12345 - protocol: "TCP" ---- # Source: k8s-monitoring/charts/alloy-logs/templates/service.yaml apiVersion: v1 kind: Service @@ -49209,8 +49179,6 @@ spec: - --storage.path=/tmp/alloy - --server.http.listen-addr=0.0.0.0:12345 - --server.http.ui-path-prefix=/ - - --cluster.enabled=true - - --cluster.join-addresses=k8smon-alloy-logs-cluster - --stability.level=generally-available env: - name: ALLOY_DEPLOY_MODE diff --git a/tests/spec/fixtures/invalid-logs-config-volumes-and-clustering-values.yaml b/tests/spec/fixtures/invalid-logs-config-volumes-and-clustering-values.yaml new file mode 100644 index 000000000..5efbabc9c --- /dev/null +++ b/tests/spec/fixtures/invalid-logs-config-volumes-and-clustering-values.yaml @@ -0,0 +1,23 @@ +cluster: + name: invalid-logs-config-volumes-and-clustering + +externalServices: + prometheus: + host: https://prometheus.example.com + basicAuth: + username: 12345 + password: "It's a secret to everyone" + loki: + host: https://loki.example.com + basicAuth: + username: 12345 + password: "It's a secret to everyone" + +logs: + pod_logs: + gatherMethod: volumes + +alloy-logs: + alloy: + clustering: + enabled: true diff --git a/tests/spec/invalid-logs-configurations_spec.sh b/tests/spec/invalid-logs-configurations_spec.sh index 664f5f9a8..a85f93f3e 100644 --- a/tests/spec/invalid-logs-configurations_spec.sh +++ b/tests/spec/invalid-logs-configurations_spec.sh @@ -12,6 +12,19 @@ alloy-logs: End End + Describe 'Using volume log gathering and clustering' + It 'prints a friendly error message' + When call helm template k8smon ../charts/k8s-monitoring -f "spec/fixtures/invalid-logs-config-volumes-and-clustering-values.yaml" + The status should be failure + The error should include 'Invalid configuration for gathering pod logs! When using logs.pod_logs.gatherMethod: "volumes", Grafana Alloy for Logs should not utilize clustering. Otherwise, performance will suffer! +Please set: +alloy-logs: + alloy: + clustering: + enabled: false' + End + End + Describe 'Using multiple replicas with API log gathering and no clustering' It 'prints a friendly error message' When call helm template k8smon ../charts/k8s-monitoring -f "spec/fixtures/invalid-logs-config-multiple-replicas-and-api_values.yaml"