diff --git a/charts/linkerd-control-plane/debug.values.yaml b/charts/linkerd-control-plane/debug.values.yaml new file mode 100644 index 0000000000000..9e7b068b778fa --- /dev/null +++ b/charts/linkerd-control-plane/debug.values.yaml @@ -0,0 +1,174 @@ +# ============================================================================= +# Linkerd Control Plane Chart - Debug Values +# ============================================================================= +# This file contains test configurations for debugging and validating +# +# Usage: +# helm template . -f debug.values.yaml +# ============================================================================= + +# ----------------------------------------------------------------------------- +# Required Identity Configuration (Minimal for testing) +# ----------------------------------------------------------------------------- +identityTrustAnchorsPEM: | + -----BEGIN CERTIFICATE----- + MIIB8TCCAZegAwIBAgIUHj2... + [test certificate] + -----END CERTIFICATE----- + +identity: + issuer: + tls: + crtPEM: | + -----BEGIN CERTIFICATE----- + MIIB8TCCAZegAwIBAgIUHj2... + [test certificate] + -----END CERTIFICATE----- + keyPEM: | + -----BEGIN PRIVATE KEY----- + MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg... + [test private key] + -----END PRIVATE KEY----- + +# ----------------------------------------------------------------------------- +# Basic Chart Configuration +# ----------------------------------------------------------------------------- +controllerReplicas: 1 +controllerLogLevel: "debug" +controllerLogFormat: "json" + +# Enable debug features +enablePprof: true +enablePodDisruptionBudget: true + +# ----------------------------------------------------------------------------- +# PodMonitor Configuration - Main Feature Testing +# ----------------------------------------------------------------------------- +podMonitor: + # Enable PodMonitor creation + enabled: true + + # Global PodMonitor settings + scrapeInterval: "15s" + scrapeTimeout: "10s" + labels: + environment: "debug" + team: "platform" + + # ----------------------------------------------------------------------------- + # Controller PodMonitor Configuration + # ----------------------------------------------------------------------------- + controller: + enabled: true + + # Test metricRelabelings for controller + metricRelabelings: + # Drop high cardinality histogram buckets + - sourceLabels: [__name__] + regex: 'controller_.*_duration_seconds_bucket' + action: drop + # Drop specific controller metrics + - sourceLabels: [__name__] + regex: 'controller_k8s_api_.*_latency_.*' + action: drop + # Rename metrics + + # Test additionalRelabelings for controller + additionalRelabelings: + # Add environment labels + - sourceLabels: [__meta_kubernetes_pod_label_environment] + targetLabel: environment + action: replace + # Drop unwanted labels + - action: labeldrop + regex: 'pod_template_hash|controller_revision_hash' + # Add version information + + + # ----------------------------------------------------------------------------- + # Service Mirror PodMonitor Configuration + # ----------------------------------------------------------------------------- + serviceMirror: + enabled: true + + # Test metricRelabelings for service mirror + metricRelabelings: + # Drop error metrics for testing + - sourceLabels: [__name__] + regex: 'service_mirror_.*_errors_total' + action: drop + # Drop verbose connection metrics + - sourceLabels: [__name__] + regex: 'service_mirror_connection_.*_histogram' + action: drop + + # Test additionalRelabelings for service mirror + additionalRelabelings: + # Add source cluster information + - sourceLabels: [__meta_kubernetes_pod_label_source_cluster] + targetLabel: source_cluster + action: replace + # Add destination cluster + - sourceLabels: [__meta_kubernetes_pod_label_dest_cluster] + targetLabel: dest_cluster + action: replace + + # ----------------------------------------------------------------------------- + # Proxy PodMonitor Configuration (Most Important) + # ----------------------------------------------------------------------------- + proxy: + enabled: true + + # Test metricRelabelings for proxy (cardinality control) + metricRelabelings: + # Drop high cardinality histogram buckets (production optimization) + - sourceLabels: [le] + regex: '2\.[0-9]+|3\.[0-9]+|4\.[0-9]+|5\.[0-9]+' + action: drop + + # Drop verbose TCP metrics that cause high cardinality + - sourceLabels: [__name__] + regex: 'tcp_(read|write)_bytes_total|tcp_connection_.*' + action: drop + + # Test additionalRelabelings for proxy + additionalRelabelings: + # Clean up temporary labels + - action: labeldrop + regex: '__tmp_.*' + + # Add deployment information + - sourceLabels: [__meta_kubernetes_pod_label_pod_template_hash] + targetLabel: deployment_generation + action: replace + +# ----------------------------------------------------------------------------- +# Test Resource Configurations +# ----------------------------------------------------------------------------- +proxy: + logLevel: "debug" + logFormat: "json" + resources: + cpu: + request: "50m" + limit: "100m" + memory: + request: "64Mi" + limit: "128Mi" + +# Controller resources for testing +destinationResources: + cpu: + request: "50m" + limit: "100m" + memory: + request: "64Mi" + limit: "128Mi" + +identityResources: + cpu: + request: "25m" + limit: "50m" + memory: + request: "32Mi" + limit: "64Mi" diff --git a/charts/linkerd-control-plane/templates/podmonitor.yaml b/charts/linkerd-control-plane/templates/podmonitor.yaml index 0909c8d44962f..9118392800557 100644 --- a/charts/linkerd-control-plane/templates/podmonitor.yaml +++ b/charts/linkerd-control-plane/templates/podmonitor.yaml @@ -22,6 +22,10 @@ spec: podMetricsEndpoints: - interval: {{ $podMonitor.scrapeInterval }} scrapeTimeout: {{ $podMonitor.scrapeTimeout }} + {{- with $podMonitor.controller.metricRelabelings }} + metricRelabelings: + {{- toYaml . | nindent 8 }} + {{- end }} relabelings: - sourceLabels: - __meta_kubernetes_pod_container_port_name @@ -35,6 +39,10 @@ spec: - __meta_kubernetes_pod_container_name action: replace targetLabel: component + {{- with $podMonitor.controller.additionalRelabelings }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end }} {{- if and $podMonitor.enabled $podMonitor.serviceMirror.enabled }} --- @@ -60,6 +68,10 @@ spec: podMetricsEndpoints: - interval: {{ $podMonitor.scrapeInterval }} scrapeTimeout: {{ $podMonitor.scrapeTimeout }} + {{- with $podMonitor.serviceMirror.metricRelabelings }} + metricRelabelings: + {{- toYaml . | nindent 8 }} + {{- end }} relabelings: - sourceLabels: - __meta_kubernetes_pod_label_linkerd_io_control_plane_component @@ -74,6 +86,9 @@ spec: - __meta_kubernetes_pod_container_name action: replace targetLabel: component + {{- with $podMonitor.serviceMirror.additionalRelabelings }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} {{- if and $podMonitor.enabled $podMonitor.proxy.enabled }} --- @@ -99,6 +114,10 @@ spec: podMetricsEndpoints: - interval: {{ $podMonitor.scrapeInterval }} scrapeTimeout: {{ $podMonitor.scrapeTimeout }} + {{- with $podMonitor.proxy.metricRelabelings }} + metricRelabelings: + {{- toYaml . | nindent 8 }} + {{- end }} relabelings: - sourceLabels: - __meta_kubernetes_pod_container_name @@ -133,4 +152,7 @@ spec: regex: __tmp_pod_label_linkerd_io_(.+) - action: labelmap regex: __tmp_pod_label_(.+) + {{- with $podMonitor.proxy.additionalRelabelings }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} diff --git a/charts/linkerd-control-plane/values.yaml b/charts/linkerd-control-plane/values.yaml index a021e3586f8dd..a9a54a0a05236 100644 --- a/charts/linkerd-control-plane/values.yaml +++ b/charts/linkerd-control-plane/values.yaml @@ -732,14 +732,44 @@ podMonitor: matchNames: - {{ .Release.Namespace }} - linkerd-viz + + # -- Custom metric relabelings for controller metrics + metricRelabelings: [] + # Example: + # metricRelabelings: + # - sourceLabels: [__name__] + # regex: 'controller_.*_duration_seconds_bucket' + # action: drop + + # -- Additional relabelings appended to default ones + additionalRelabelings: [] + # Example: + # additionalRelabelings: + # - action: labeldrop + # regex: 'unwanted_label' + # - sourceLabels: [__meta_kubernetes_pod_label_version] + # targetLabel: app_version + # action: replace + serviceMirror: # -- Enables the creation of PodMonitor for the Service Mirror component enabled: true + + # -- Custom metric relabelings for service mirror metrics + metricRelabelings: [] + + # -- Additional relabelings appended to default ones + additionalRelabelings: [] + proxy: # -- Enables the creation of PodMonitor for the data-plane enabled: true + # -- Custom metric relabelings for proxy metrics (recommended for cardinality control) + metricRelabelings: [] + # -- Additional relabelings appended to default ones + additionalRelabelings: [] # Egress related configuration egress: # -- The namespace that is used to store egress configuration that affects all client workloads in the cluster