diff --git a/images/agent/README.md b/images/agent/README.md index 23a52a01..10472fdc 100644 --- a/images/agent/README.md +++ b/images/agent/README.md @@ -22,7 +22,7 @@ `NODE_NAME` -`METRICS_PORT` - default : 9695 +`METRICS_PORT` - default : 4202 #### Metrics diff --git a/images/agent/config/config.go b/images/agent/config/config.go index 6dd8c441..416832e7 100644 --- a/images/agent/config/config.go +++ b/images/agent/config/config.go @@ -38,7 +38,7 @@ const ( ThrottleInterval = "THROTTLER_INTERVAL" CmdDeadlineDuration = "CMD_DEADLINE_DURATION" DefaultHealthProbeBindAddressEnvName = "HEALTH_PROBE_BIND_ADDRESS" - DefaultHealthProbeBindAddress = ":8081" + DefaultHealthProbeBindAddress = ":4228" ) type Options struct { @@ -77,7 +77,7 @@ func NewConfig() (*Options, error) { opts.MetricsPort = os.Getenv(MetricsPort) if opts.MetricsPort == "" { - opts.MetricsPort = ":9695" + opts.MetricsPort = ":4202" } opts.HealthProbeBindAddress = os.Getenv(DefaultHealthProbeBindAddressEnvName) diff --git a/images/agent/config/config_test.go b/images/agent/config/config_test.go index 37e1a1cb..32ddbfda 100644 --- a/images/agent/config/config_test.go +++ b/images/agent/config/config_test.go @@ -107,7 +107,7 @@ func TestNewConfig(t *testing.T) { t.Run("MetricsPortNotSet_ReturnsDefaultPort", func(t *testing.T) { expNodeName := "test-node" - expMetricsPort := ":9695" + expMetricsPort := ":4202" expMachineId := "test-id" err := os.Setenv(NodeName, expNodeName) diff --git a/images/sds-health-watcher-controller/config/config.go b/images/sds-health-watcher-controller/config/config.go index 905486c3..fa0b865c 100644 --- a/images/sds-health-watcher-controller/config/config.go +++ b/images/sds-health-watcher-controller/config/config.go @@ -54,7 +54,7 @@ func NewConfig() (*Options, error) { opts.MetricsPort = os.Getenv(MetricsPort) if opts.MetricsPort == "" { - opts.MetricsPort = ":9695" + opts.MetricsPort = ":8080" } opts.HealthProbeBindAddress = os.Getenv(DefaultHealthProbeBindAddressEnvName) diff --git a/images/sds-health-watcher-controller/config/config_test.go b/images/sds-health-watcher-controller/config/config_test.go index 37e1a1cb..8885fda6 100644 --- a/images/sds-health-watcher-controller/config/config_test.go +++ b/images/sds-health-watcher-controller/config/config_test.go @@ -107,7 +107,7 @@ func TestNewConfig(t *testing.T) { t.Run("MetricsPortNotSet_ReturnsDefaultPort", func(t *testing.T) { expNodeName := "test-node" - expMetricsPort := ":9695" + expMetricsPort := ":8080" expMachineId := "test-id" err := os.Setenv(NodeName, expNodeName) diff --git a/templates/agent/daemonset.yaml b/templates/agent/daemonset.yaml index 897066e4..f3d62bc7 100644 --- a/templates/agent/daemonset.yaml +++ b/templates/agent/daemonset.yaml @@ -72,7 +72,7 @@ spec: readinessProbe: httpGet: path: /readyz - port: 8081 + port: 4228 scheme: HTTP initialDelaySeconds: 5 failureThreshold: 2 @@ -80,10 +80,14 @@ spec: livenessProbe: httpGet: path: /healthz - port: 8081 + port: 4228 scheme: HTTP periodSeconds: 1 failureThreshold: 3 + ports: + - name: metrics + containerPort: 4202 + protocol: TCP securityContext: privileged: true seLinuxOptions: diff --git a/templates/agent/podmonitor.yaml b/templates/agent/podmonitor.yaml new file mode 100644 index 00000000..8ef60eed --- /dev/null +++ b/templates/agent/podmonitor.yaml @@ -0,0 +1,32 @@ +{{- if (.Values.global.enabledModules | has "operator-prometheus-crd") }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: sds-node-configurator + namespace: d8-monitoring + {{- include "helm_lib_module_labels" (list $ (dict "prometheus" "main")) | nindent 2 }} +spec: + podMetricsEndpoints: + - targetPort: metrics + scheme: http + path: /metrics + relabelings: + - regex: endpoint|namespace|pod|container + action: labeldrop + - targetLabel: job + replacement: sds-node-configurator + - sourceLabels: [__meta_kubernetes_pod_node_name] + targetLabel: node + - targetLabel: tier + replacement: cluster + - sourceLabels: [__meta_kubernetes_pod_ready] + regex: "true" + action: keep + selector: + matchLabels: + app: sds-node-configurator + namespaceSelector: + matchNames: + - d8-{{ .Chart.Name }} +{{- end }} diff --git a/templates/sds-health-watcher-controller/deployment.yaml b/templates/sds-health-watcher-controller/deployment.yaml index 72aac9b3..f0c78ed0 100644 --- a/templates/sds-health-watcher-controller/deployment.yaml +++ b/templates/sds-health-watcher-controller/deployment.yaml @@ -83,6 +83,10 @@ spec: scheme: HTTP periodSeconds: 1 failureThreshold: 3 + ports: + - name: metrics + containerPort: 8080 + protocol: TCP resources: requests: {{- include "helm_lib_module_ephemeral_storage_only_logs" . | nindent 14 }} diff --git a/templates/sds-health-watcher-controller/servicemonitor.yaml b/templates/sds-health-watcher-controller/servicemonitor.yaml new file mode 100644 index 00000000..7bdd7702 --- /dev/null +++ b/templates/sds-health-watcher-controller/servicemonitor.yaml @@ -0,0 +1,36 @@ +{{- if (.Values.global.enabledModules | has "operator-prometheus-crd") }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: sds-health-watcher-controller + namespace: d8-monitoring + {{- include "helm_lib_module_labels" (list $ (dict "prometheus" "main")) | nindent 2 }} +spec: + endpoints: + - port: metrics + scheme: http + path: /metrics + bearerTokenSecret: + name: "prometheus-token" + key: "token" + tlsConfig: + insecureSkipVerify: true + relabelings: + - regex: endpoint|namespace|pod|container + action: labeldrop + - targetLabel: job + replacement: sds-health-watcher-controller + - targetLabel: tier + replacement: cluster + - sourceLabels: [__meta_kubernetes_endpointslice_endpoint_conditions_ready] + regex: "true" + action: keep + selector: + matchLabels: + app.kubernetes.io/instance: sds-health-watcher-controller + app.kubernetes.io/managed-by: Helm + namespaceSelector: + matchNames: + - d8-{{ .Chart.Name }} +{{- end }}