Skip to content

Commit

Permalink
Fix wront cluster_id in helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivaka committed Sep 24, 2024
1 parent 24b7181 commit a21284c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ metadata:
name: {{- include "gpu-metrics-exporter.config-map" . | indent 1}}
data:
{{- with .Values.gpuMetricsExporter.config }}
CLUSTER_ID: "{{ .Values.castai.clusterId | default .CLUSTER_ID }}"
CLUSTER_ID: "{{ $.Values.castai.clusterId | default .CLUSTER_ID }}"
{{- toYaml (omit . "CLUSTER_ID") | nindent 2 }}
{{- end }}
7 changes: 7 additions & 0 deletions internal/castai/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ type client struct {

func NewClient(cfg Config, log logrus.FieldLogger, restyClient *resty.Client, version string) Client {
restyClient.BaseURL = cfg.URL

fmt.Println("Client Config")
fmt.Println(fmt.Sprintf("%s%s", userAgent, version))

Check failure on line 62 in internal/castai/client.go

View workflow job for this annotation

GitHub Actions / lint

S1038: should use fmt.Printf instead of fmt.Println(fmt.Sprintf(...)) (but don't forget the newline) (gosimple)
fmt.Println(fmt.Sprintf("%s", cfg.APIKey))

Check failure on line 63 in internal/castai/client.go

View workflow job for this annotation

GitHub Actions / lint

S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
fmt.Println(fmt.Sprintf("%s", cfg.ClusterID))

Check failure on line 64 in internal/castai/client.go

View workflow job for this annotation

GitHub Actions / lint

S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
fmt.Println(fmt.Sprintf("%s", cfg.URL))

Check failure on line 65 in internal/castai/client.go

View workflow job for this annotation

GitHub Actions / lint

S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)

restyClient.SetHeaders(map[string]string{
tokenHeader: cfg.APIKey,
contentTypeHeader: contentType,
Expand Down
5 changes: 5 additions & 0 deletions internal/exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ func (e *exporter) getDCGMUrls(ctx context.Context) ([]string, error) {
fieldSelector = fmt.Sprintf("%s,spec.nodeName=%s", fieldSelector, e.cfg.NodeName)
}

e.log.Infof("getting DCGM exporter pods with field selector: %s", fieldSelector)

// TODO: consider using an informer and keeping a list of pods which match the selector
// at the moment seems like an overkill
dcgmExporterList, err := e.kube.CoreV1().Pods("").List(ctx, metav1.ListOptions{
Expand All @@ -122,6 +124,9 @@ func (e *exporter) getDCGMUrls(ctx context.Context) ([]string, error) {
urls[i] = fmt.Sprintf("http://%s:%d%s", dcgmExporter.Status.PodIP, e.cfg.DCGMExporterPort, e.cfg.DCGMExporterPath)
}

e.log.Infof("found %d DCGM exporter pods", len(urls))
e.log.Debugf("DCGM exporter urls: %v", urls)

return urls, nil
}

Expand Down

0 comments on commit a21284c

Please sign in to comment.