add part two

This commit is contained in:
2023-01-31 14:20:06 +07:00
parent d718d71471
commit 60ea87cfe6
153 changed files with 26163 additions and 3 deletions

View File

@@ -0,0 +1,224 @@
{{- if .Values.dex.enabled }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "argocd.dex" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.dex.replicaCount }}
{{- if .Values.dex.updateStrategy }}
strategy: {{- toYaml .Values.dex.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: dex
template:
metadata:
{{- if .Values.dex.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.dex.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: dex
{{- if .Values.dex.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "argocd.dex.serviceAccountName" . }}
{{- include "argocd.imagePullSecrets" . | nindent 6 }}
{{- if .Values.dex.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.dex.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.dex.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.dex.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.dex.podAffinityPreset "component" "dex" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.dex.podAntiAffinityPreset "component" "dex" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.dex.nodeAffinityPreset.type "key" .Values.dex.nodeAffinityPreset.key "values" .Values.dex.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.dex.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.dex.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.dex.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.dex.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.dex.schedulerName }}
schedulerName: {{ .Values.dex.schedulerName }}
{{- end }}
{{- if .Values.dex.shareProcessNamespace }}
shareProcessNamespace: {{ .Values.dex.shareProcessNamespace }}
{{- end }}
{{- if .Values.dex.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.controller.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.dex.priorityClassName }}
priorityClassName: {{ .Values.dex.priorityClassName | quote }}
{{- end }}
{{- if .Values.dex.runtimeClassName }}
runtimeClassName: {{ .Values.dex.runtimeClassName }}
{{- end }}
{{- if .Values.dex.podSecurityContext.enabled }}
securityContext: {{- omit .Values.dex.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.volumePermissions.enabled }}
- name: volume-permissions
image: {{ include "argocd.volumePermissions.image" . }}
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
command:
- /bin/bash
- -ec
- |
chown -R {{ .Values.dex.containerSecurityContext.runAsUser }}:{{ .Values.dex.podSecurityContext.fsGroup }} /shared
chown -R {{ .Values.dex.containerSecurityContext.runAsUser }}:{{ .Values.dex.podSecurityContext.fsGroup }} /tmp
securityContext:
runAsUser: {{ .Values.volumePermissions.containerSecurityContext.runAsUser }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: static-files
mountPath: /shared
- name: tmp-dir
mountPath: /tmp
{{- end }}
- name: copyutil
image: {{ include "argocd.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.dex.resources }}
resources: {{- toYaml .Values.dex.resources | nindent 12 }}
{{- end }}
{{- if .Values.dex.containerSecurityContext }}
securityContext: {{- omit .Values.dex.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
command:
- cp
- -n
- /opt/bitnami/argo-cd/bin/argocd
- /shared/argocd-dex
volumeMounts:
- mountPath: /shared
name: static-files
{{- if .Values.dex.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: dex
image: {{ include "argocd.dex.image" . }}
imagePullPolicy: {{ .Values.dex.image.pullPolicy }}
{{- if .Values.dex.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.dex.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.dex.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.dex.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.dex.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.dex.command "context" $) | nindent 12 }}
{{- else }}
command:
- /shared/argocd-dex
{{- end }}
{{- if .Values.dex.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.dex.args "context" $) | nindent 12 }}
{{- else }}
args:
- rundex
{{- if .Values.dex.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.dex.containerPorts.http }}
protocol: TCP
- name: grpc
containerPort: {{ .Values.dex.containerPorts.grpc }}
protocol: TCP
{{- if .Values.dex.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.dex.containerPorts.metrics }}
protocol: TCP
{{- end }}
env:
{{- if .Values.dex.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.dex.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.dex.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.dex.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.dex.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.dex.resources }}
resources: {{- toYaml .Values.dex.resources | nindent 12 }}
{{- end }}
{{- if .Values.dex.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.dex.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.dex.startupProbe.enabled }}
startupProbe:
httpGet:
path: /healthz
port: {{ .Values.dex.containerPorts.http }}
initialDelaySeconds: {{ .Values.dex.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.dex.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.dex.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.dex.startupProbe.successThreshold }}
failureThreshold: {{ .Values.dex.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.dex.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.dex.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.dex.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /healthz
port: {{ .Values.dex.containerPorts.http }}
initialDelaySeconds: {{ .Values.dex.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.dex.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.dex.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.dex.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.dex.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.dex.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.dex.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.dex.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /healthz
port: {{ .Values.dex.containerPorts.http }}
initialDelaySeconds: {{ .Values.dex.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.dex.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.dex.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.dex.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.dex.readinessProbe.failureThreshold }}
{{- end }}
volumeMounts:
- name: static-files
mountPath: /shared
- name: tmp-dir
mountPath: /tmp
{{- if .Values.dex.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.dex.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.dex.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: tmp-dir
emptyDir: {}
- name: static-files
emptyDir: {}
{{- if .Values.dex.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,53 @@
{{- if and .Values.dex.enabled .Values.dex.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.dex" . }}-metrics
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.dex.metrics.service.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.dex.metrics.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.dex.metrics.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.dex.metrics.service.type }}
{{- if and .Values.dex.metrics.service.clusterIP (eq .Values.dex.metrics.service.type "ClusterIP") }}
clusterIP: {{ .Values.dex.metrics.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.dex.metrics.service.type "LoadBalancer") (eq .Values.dex.metrics.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.dex.metrics.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.dex.metrics.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.dex.metrics.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.dex.metrics.service.type "LoadBalancer") (not (empty .Values.dex.metrics.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.dex.metrics.service.loadBalancerIP }}
{{- end }}
{{- if .Values.dex.metrics.service.sessionAffinity }}
sessionAffinity: {{ .Values.dex.metrics.service.sessionAffinity }}
{{- end }}
{{- if .Values.dex.metrics.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.dex.metrics.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: metrics
port: {{ .Values.dex.metrics.service.port }}
targetPort: metrics
protocol: TCP
{{- if (and (or (eq .Values.dex.service.type "NodePort") (eq .Values.dex.service.type "LoadBalancer")) (not (empty .Values.dex.metrics.service.nodePort))) }}
nodePort: {{ .Values.dex.metrics.service.nodePort }}
{{- else if eq .Values.dex.metrics.service.type "ClusterIP" }}
nodePort: null
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- end }}

View File

@@ -0,0 +1,21 @@
{{- if and .Values.dex.enabled .Values.rbac.create }}
kind: Role
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.dex" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
- apiGroups:
- ""
resources:
- secrets
- configmaps
verbs:
- get
- list
- watch
{{- end }}

View File

@@ -0,0 +1,18 @@
{{- if and .Values.dex.enabled .Values.dex.serviceAccount.create .Values.rbac.create }}
kind: RoleBinding
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.dex" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ include "argocd.dex.serviceAccountName" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "argocd.dex" . }}
{{- end }}

View File

@@ -0,0 +1,22 @@
{{- if and .Values.dex.enabled .Values.rbac.create .Values.dex.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "argocd.dex.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.dex.serviceAccount.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.dex.serviceAccount.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.serviceAccount.annotations "context" $) | nindent 4 }}
{{- end }}
{{- end }}
automountServiceAccountToken: {{ .Values.dex.serviceAccount.automountServiceAccountToken }}
{{- end }}

View File

@@ -0,0 +1,65 @@
{{- if .Values.dex.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd.dex" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.dex.service.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.dex.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.dex.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.dex.service.type }}
{{- if and .Values.dex.service.clusterIP (eq .Values.dex.service.type "ClusterIP") }}
clusterIP: {{ .Values.dex.service.clusterIP }}
{{- end }}
{{- if (or (eq .Values.dex.service.type "LoadBalancer") (eq .Values.dex.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.dex.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if eq .Values.dex.service.type "LoadBalancer" }}
loadBalancerSourceRanges: {{ .Values.dex.service.loadBalancerSourceRanges }}
{{- end }}
{{- if (and (eq .Values.dex.service.type "LoadBalancer") (not (empty .Values.dex.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.dex.service.loadBalancerIP }}
{{- end }}
{{- if .Values.dex.service.sessionAffinity }}
sessionAffinity: {{ .Values.dex.service.sessionAffinity }}
{{- end }}
{{- if .Values.dex.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.dex.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
ports:
- name: http
port: {{ .Values.dex.service.ports.http }}
targetPort: http
protocol: TCP
{{- if (and (or (eq .Values.dex.service.type "NodePort") (eq .Values.dex.service.type "LoadBalancer")) (not (empty .Values.dex.service.nodePorts.http))) }}
nodePort: {{ .Values.dex.service.nodePorts.http }}
{{- else if eq .Values.dex.service.type "ClusterIP" }}
nodePort: null
{{- end }}
- name: grpc
port: {{ .Values.dex.service.ports.grpc }}
targetPort: grpc
protocol: TCP
{{- if (and (or (eq .Values.dex.service.type "NodePort") (eq .Values.dex.service.type "LoadBalancer")) (not (empty .Values.dex.service.nodePorts.grpc))) }}
nodePort: {{ .Values.dex.service.nodePorts.grpc }}
{{- else if eq .Values.dex.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.dex.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: dex
{{- end }}

View File

@@ -0,0 +1,50 @@
{{- if and .Values.dex.enabled .Values.dex.metrics.enabled .Values.dex.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "argocd.dex" . }}
{{- if .Values.dex.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.dex.metrics.serviceMonitor.namespace | quote }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.dex.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.dex.metrics.serviceMonitor.selector "context" $) | nindent 4 }}
{{- end }}
app.kubernetes.io/component: dex
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Values.dex.metrics.serviceMonitor.jobLabel | quote }}
endpoints:
- port: http-metrics
path: /metrics
{{- if .Values.dex.metrics.serviceMonitor.interval }}
interval: {{ .Values.dex.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.dex.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.dex.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.dex.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.dex.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.dex.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.dex.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.dex.metrics.serviceMonitor.relabelings }}
relabelings: {- include "common.tplvalues.render" ( dict "value" .Values.dex.metrics.serviceMonitor.relabelings "context" $) | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: dex
{{- end }}