Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for reading Cluster ID from a secret #458

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions charts/kvisor/templates/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ spec:
{{- end }}
envFrom:
{{- if .Values.castai.enabled }}
- secretRef:
name: {{ include "kvisor.castaiSecretName" . }}
- secretRef:
name: {{ include "kvisor.castaiSecretName" . }}
{{- end }}
{{- if.Values.clickhouse.enabled }}
- secretRef:
name: {{ include "kvisor.clickhouse.fullname" . }}
- secretRef:
name: {{ include "kvisor.clickhouse.fullname" . }}
{{- end }}
env:
- name: NODE_NAME
Expand All @@ -107,8 +107,24 @@ spec:
{{- else -}}
{{ .Values.castai.grpcAddr | quote }}
{{- end }}
{{- if .Values.castai.clusterIdSecretKeyRef.name }}
{{- if ne .Values.castai.clusterID "" }}
{{- fail "clusterID and clusterIdSecretKeyRef are mutually exclusive" }}
{{- end }}
- name: CASTAI_CLUSTER_ID
valueFrom:
secretKeyRef:
name: {{ required "clusterID or clusterIdSecretKeyRef must be provided" .Values.castai.clusterIdSecretKeyRef.name }}
key: {{ .Values.castai.clusterIdSecretKeyRef.key }}
{{- else }}
{{- if not .Values.castai.clusterID }}
{{- fail "either clusterID or clusterIdSecretKeyRef must be provided" }}
{{- end }}
{{- if .Values.castai.clusterID }}
- name: CASTAI_CLUSTER_ID
value: {{ .Values.castai.clusterID | quote }}
{{- end }}
{{- end }}
{{- if .Values.agent.debug.ebpf }}
- name: KVISOR_EBPF_DEBUG
value: "1"
Expand Down Expand Up @@ -247,14 +263,14 @@ subjects:
apiVersion: v1
kind: ResourceQuota
metadata:
name: {{ include "kvisor.agent.fullname" . }}-critical-pods
namespace: {{ .Release.Namespace }}
name: {{ include "kvisor.agent.fullname" . }}-critical-pods
namespace: {{ .Release.Namespace }}
spec:
scopeSelector:
matchExpressions:
- operator: In
scopeName: PriorityClass
values:
- {{ .Values.agent.priorityClass }}
scopeSelector:
matchExpressions:
- operator: In
scopeName: PriorityClass
values:
- {{ .Values.agent.priorityClass }}
{{- end }}
{{- end }}
18 changes: 17 additions & 1 deletion charts/kvisor/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,24 @@ spec:
{{- else -}}
{{ .Values.castai.grpcAddr | quote }}
{{- end }}
{{- if .Values.castai.clusterIdSecretKeyRef.name }}
{{- if ne .Values.castai.clusterID "" }}
{{- fail "clusterID and clusterIdSecretKeyRef are mutually exclusive" }}
{{- end }}
- name: CASTAI_CLUSTER_ID
valueFrom:
secretKeyRef:
name: {{ required "clusterID or clusterIdSecretKeyRef must be provided" .Values.castai.clusterIdSecretKeyRef.name }}
key: {{ .Values.castai.clusterIdSecretKeyRef.key }}
{{- else }}
{{- if not .Values.castai.clusterID }}
{{- fail "either clusterID or clusterIdSecretKeyRef must be provided" }}
{{- end }}
{{- if .Values.castai.clusterID }}
- name: CASTAI_CLUSTER_ID
value: {{ .Values.castai.clusterID | quote }}
value: {{ .Values.castai.clusterID | quote }}
{{- end }}
{{- end }}
{{- range $key, $value := .Values.controller.extraEnv }}
- name: {{ $key }}
value: {{ $value }}
Expand Down
23 changes: 14 additions & 9 deletions charts/kvisor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ castai:
# CASTAI grpc public api address.
grpcAddr: "kvisor.prod-master.cast.ai:443"

# CASTAI Cluster unique identifier.
# clusterID and clusterIdSecretKeyRef are mutually exclusive
clusterID: ""
# clusterIdSecretKeyRef -- Name and Key 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 @@ -96,7 +101,7 @@ agent:
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# requests:
# cpu: 100m
# memory: 128Mi

Expand Down Expand Up @@ -156,17 +161,17 @@ controller:
securityContext:
fsGroup: 1001
runAsNonRoot: true
# fsGroup: 10001
# runAsGroup: 10001
# runAsUser: 10001
# seccompProfile:
# type: RuntimeDefault
# fsGroup: 10001
# runAsGroup: 10001
# runAsUser: 10001
# seccompProfile:
# type: RuntimeDefault

containerSecurityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
# capabilities:
# drop: [ ALL ]
# capabilities:
# drop: [ ALL ]

resources:
requests:
Expand Down