Skip to content

Agent Mesh

641 B
Raw Blame
{{- $secretName := printf "%s-api-token" (include "agentmesh-node.fullname" .) }}
{{- $existing := lookup "v1" "Secret" .Release.Namespace $secretName }}
{{- $apiToken := .Values.apiToken }}
{{- if not $apiToken }}
  {{- if and $existing (hasKey $existing "data") (hasKey $existing.data "api-token") }}
    {{- $apiToken = index $existing.data "api-token" | b64dec }}
  {{- else }}
    {{- $apiToken = randAlphaNum 32 }}
  {{- end }}
{{- end }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ $secretName }}
  labels:
    {{- include "agentmesh-node.labels" . | nindent 4 }}
type: Opaque
data:
  api-token: {{ $apiToken | b64enc | quote }}