From 33de6222c01015fd47e306d2c15682817c984b3a Mon Sep 17 00:00:00 2001 From: Alastair Firth Date: Mon, 27 Nov 2023 10:29:25 +0000 Subject: [PATCH] Helm and error message fixes (#17) * fix serviceaccountname * fix log typo * typo * bump chart and app version so that correct image is used. fix podMonitor --- charts/kubelet-stats-metrics/Chart.yaml | 4 ++-- charts/kubelet-stats-metrics/templates/deployment.yaml | 2 +- charts/kubelet-stats-metrics/templates/pod-monitor.yaml | 4 ++-- charts/kubelet-stats-metrics/values.yaml | 4 ++-- main.go | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/charts/kubelet-stats-metrics/Chart.yaml b/charts/kubelet-stats-metrics/Chart.yaml index a735556..bf482ab 100644 --- a/charts/kubelet-stats-metrics/Chart.yaml +++ b/charts/kubelet-stats-metrics/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: kubelet-stats-metrics -version: 0.1.0 -appVersion: "0.1.0" +version: 0.1.1 +appVersion: "0.6.0" kubeVersion: ">=1.21.0-0" description: Expose kubelet stats metrics to prometheus home: https://github.com/GDATASoftwareAG/kubelet-stats-metrics diff --git a/charts/kubelet-stats-metrics/templates/deployment.yaml b/charts/kubelet-stats-metrics/templates/deployment.yaml index 17800e1..d6ef571 100644 --- a/charts/kubelet-stats-metrics/templates/deployment.yaml +++ b/charts/kubelet-stats-metrics/templates/deployment.yaml @@ -16,7 +16,7 @@ spec: labels: {{- include "kubelet-stats-metrics.selectorLabels" . | nindent 8 }} spec: - serviceAccountName: kubelet-stats-metrics + serviceAccountName: {{ include "kubelet-stats-metrics.fullname" . }} containers: - name: metrics image: {{ .Values.image }} diff --git a/charts/kubelet-stats-metrics/templates/pod-monitor.yaml b/charts/kubelet-stats-metrics/templates/pod-monitor.yaml index 4452136..6a34eba 100644 --- a/charts/kubelet-stats-metrics/templates/pod-monitor.yaml +++ b/charts/kubelet-stats-metrics/templates/pod-monitor.yaml @@ -10,7 +10,7 @@ spec: - {{ .Release.Namespace }} selector: matchLabels: - k8s-app: {{ .Release.Name }} + {{- include "kubelet-stats-metrics.selectorLabels" . | nindent 8 }} podMetricsEndpoints: - port: http interval: 30s @@ -22,4 +22,4 @@ spec: # - action: replace # sourceLabels: # - __meta_kubernetes_pod_host_ip - # targetLabel: instance \ No newline at end of file + # targetLabel: instance diff --git a/charts/kubelet-stats-metrics/values.yaml b/charts/kubelet-stats-metrics/values.yaml index d00fdbb..c1cc486 100644 --- a/charts/kubelet-stats-metrics/values.yaml +++ b/charts/kubelet-stats-metrics/values.yaml @@ -1,2 +1,2 @@ -image: ghcr.io/gdatasoftwareag/kubelet-stats-metrics:v0.1.0 -logLevel: info \ No newline at end of file +image: ghcr.io/gdatasoftwareag/kubelet-stats-metrics:v0.6.0 +logLevel: info diff --git a/main.go b/main.go index cea324f..4fd8a18 100644 --- a/main.go +++ b/main.go @@ -129,7 +129,7 @@ func metricsLoop(interval time.Duration, cs *kubernetes.Clientset) { ctx := context.Background() err := singleRun(ctx, cs) if err != nil { - log.Errorf("ErrorBadRequst : %s", err.Error()) + log.Errorf("ErrorBadRequest : %s", err.Error()) } time.Sleep(interval) } @@ -149,7 +149,7 @@ func singleRun(ctx context.Context, cs *kubernetes.Clientset) error { currentNode := nodes.Items[i].Name node, err := scrapeSingleNode(ctx, cs, currentNode) if err != nil { - log.Errorf("ErrorBadRequst : %s", err.Error()) + log.Errorf("ErrorBadRequest : %s", err.Error()) continue } pods = append(pods, node...) @@ -309,6 +309,6 @@ func main() { http.Handle("/metrics", promhttp.Handler()) if err := http.ListenAndServe(fmt.Sprintf(":%d", cfg.metricsPort), nil); err != nil { - log.Fatalf("Listener Falied : %s\n", err.Error()) + log.Fatalf("Listener Failed : %s\n", err.Error()) } }