Skip to content

Commit

Permalink
[egressd] add support for clusterIDSecretRef (#621)
Browse files Browse the repository at this point in the history
* [egressd] add support for clusterIDSecretRef

* [egressd] add support for clusterIDSecretRef

- fix bug allow passing of both apiKey and apiKeySecretRef

* Add support for clusterIdSecretKeyRef.key

* Bump version in Chart.yaml

---------

Co-authored-by: Shivangi Pandey <[email protected]>
Co-authored-by: Shivangi Pandey <[email protected]>
  • Loading branch information
3 people authored Jan 8, 2025
1 parent 9817be4 commit c2792bb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/egressd/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: egressd
description: Kubernetes aware network traffic monitoring
type: application
version: 0.1.40
version: 0.2.0
appVersion: "v0.13.2"
19 changes: 19 additions & 0 deletions charts/egressd/templates/exporter/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.castai.clusterID }}
{{- if ne .Values.castai.clusterIdSecretKeyRef.name "" }}
{{- fail "clusterID and clusterIdSecretKeyRef are mutually exclusive" }}
{{- end }}
- name: CLUSTER_ID
value: {{ .Values.castai.clusterID | quote }}
{{- else }}
{{- if not .Values.castai.clusterIdSecretKeyRef.name }}
{{- fail "either clusterID or clusterIdSecretKeyRef should be passed" }}
{{- end }}
- name: CLUSTER_ID
valueFrom:
secretKeyRef:
name: {{ .Values.castai.clusterIdSecretKeyRef.name }}
key: {{ .Values.castai.clusterIdSecretKeyRef.key }}
{{- end }}
{{- if or .Values.castai.apiKey .Values.castai.apiKeySecretRef }}
- name: API_KEY
valueFrom:
Expand All @@ -69,6 +85,9 @@ spec:
{{- fail "`collector.extraArgs.send-traffic-delta` should be set to `true` when CAST AI is used as sink" }}
{{- else }}
{{- if .Values.castai.apiKey }}
{{- if ne .Values.castai.apiKeySecretRef "" }}
{{- fail "apiKey and apiKeySecretRef are mutually exclusive" }}
{{- end }}
name: "{{- include "egressd.fullname" . }}"
key: API_KEY
{{- else if .Values.castai.apiKeySecretRef }}
Expand Down
8 changes: 7 additions & 1 deletion charts/egressd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ castai:
apiURL: "https://api.cast.ai"

# CASTAI Cluster unique identifier.
# clusterID and clusterIdSecretKeyRef are mutually exclusive
clusterID: ""
# clusterIdSecretKeyRef -- Name of secret with ClusterID
# The referenced secret must provide the ClusterID in .data[<<.Values.castai.clusterIdSecretKeyRef.key>>]
clusterIdSecretKeyRef:
name: ""
key: "CLUSTER_ID"

imagePullSecrets: []
nameOverride: ""
Expand Down Expand Up @@ -126,7 +132,7 @@ exporter:
{{- if or .Values.castai.apiKey .Values.castai.apiKeySecretRef }}
castai:
http:
url: "{{.Values.castai.apiURL}}/v1/kubernetes/clusters/{{.Values.castai.clusterID}}/egressd-metrics"
url: "{{.Values.castai.apiURL}}/v1/kubernetes/clusters/${CLUSTER_ID}/egressd-metrics"
compression: gzip
encoding: protobuf
method: POST
Expand Down

0 comments on commit c2792bb

Please sign in to comment.