{{- $secret := .Values.agent.secretEnv }}
{{- if and .Values.agent.enabled $secret.create (gt (len $secret.data) 0) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "pulse.agentSecretName" . }}
  labels:
    {{- include "pulse.labels" . | nindent 4 }}
type: Opaque
data:
  {{- range $key, $value := $secret.data }}
  {{ $key }}: {{ $value | toString | b64enc }}
  {{- end }}
{{- end }}
