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,284 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "argocd.repo-server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: repo-server
{{- 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.repoServer.replicaCount }}
{{- if .Values.repoServer.updateStrategy }}
strategy: {{- toYaml .Values.repoServer.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: repo-server
template:
metadata:
{{- if .Values.repoServer.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: repo-server
{{- if .Values.repoServer.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "argocd.repo-server.serviceAccountName" . }}
{{- include "argocd.imagePullSecrets" . | nindent 6 }}
{{- if .Values.repoServer.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.repoServer.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.repoServer.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.repoServer.podAffinityPreset "component" "repo-server" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.repoServer.podAntiAffinityPreset "component" "repo-server" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.repoServer.nodeAffinityPreset.type "key" .Values.repoServer.nodeAffinityPreset.key "values" .Values.repoServer.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.repoServer.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.repoServer.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.repoServer.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.repoServer.schedulerName }}
schedulerName: {{ .Values.repoServer.schedulerName }}
{{- end }}
{{- if .Values.repoServer.shareProcessNamespace }}
shareProcessNamespace: {{ .Values.repoServer.shareProcessNamespace }}
{{- end }}
{{- if .Values.repoServer.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.controller.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.repoServer.priorityClassName }}
priorityClassName: {{ .Values.repoServer.priorityClassName | quote }}
{{- end }}
{{- if .Values.repoServer.runtimeClassName }}
runtimeClassName: {{ .Values.repoServer.runtimeClassName }}
{{- end }}
{{- if .Values.repoServer.podSecurityContext.enabled }}
securityContext: {{- omit .Values.repoServer.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.repoServer.containerSecurityContext.runAsUser }}:{{ .Values.repoServer.podSecurityContext.fsGroup }} /tmp
securityContext:
runAsUser: {{ .Values.volumePermissions.containerSecurityContext.runAsUser }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: tmp-dir
mountPath: /tmp
{{- end }}
{{- if .Values.redisWait.enabled }}
- name: wait-for-redis
image: {{ include "common.images.image" (dict "imageRoot" .Values.redis.image "global" .Values.global) }}
imagePullPolicy: {{ .Values.redis.image.pullPolicy | quote }}
{{- with .Values.redisWait.securityContext }}
securityContext: {{ . | toYaml }}
{{- end }}
command:
- /bin/bash
args:
- -ec
- |
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
. /opt/bitnami/scripts/libos.sh
. /opt/bitnami/scripts/liblog.sh
check_redis_connection() {
local result="$(redis-cli -h {{ include "argocd.redisHost" . }} -p {{ include "argocd.redisPort" . }} {{ .Values.redisWait.extraArgs }} PING)"
if [[ "$result" != "PONG" ]]; then
false
fi
}
info "Checking redis connection..."
if ! retry_while "check_redis_connection"; then
error "Could not connect to the Redis server"
return 1
else
info "Connected to the Redis instance"
fi
{{- if include "argocd.redis.auth.enabled" . }}
env:
- name: REDISCLI_AUTH
valueFrom:
secretKeyRef:
name: {{ include "argocd.redis.secretName" . }}
key: {{ include "argocd.redis.secretPasswordKey" . }}
{{- end }}
{{- end }}
{{- if .Values.repoServer.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: argocd-repo-server
image: {{ include "argocd.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.repoServer.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.repoServer.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.repoServer.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.repoServer.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.repoServer.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.args "context" $) | nindent 12 }}
{{- else }}
args:
- argocd-repo-server
- --logformat
- {{ .Values.repoServer.logFormat | quote }}
- --loglevel
- {{ .Values.repoServer.logLevel | quote }}
- --redis
- {{ include "argocd.redisHost" . }}:{{ include "argocd.redisPort" . }}
{{- if .Values.repoServer.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
ports:
- name: repo-server
containerPort: {{ .Values.repoServer.containerPorts.repoServer }}
protocol: TCP
{{- if .Values.repoServer.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.repoServer.containerPorts.metrics }}
protocol: TCP
{{- end }}
env:
{{- if and .Values.redis.enabled (include "argocd.redis.auth.enabled" .) }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "argocd.redis.secretName" . }}
key: {{ include "argocd.redis.secretPasswordKey" . }}
{{- end }}
{{- if .Values.repoServer.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.repoServer.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.repoServer.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.repoServer.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.repoServer.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.repoServer.resources }}
resources: {{- toYaml .Values.repoServer.resources | nindent 12 }}
{{- end }}
{{- if .Values.repoServer.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.repoServer.startupProbe.enabled }}
startupProbe:
tcpSocket:
port: {{ .Values.repoServer.containerPorts.repoServer }}
initialDelaySeconds: {{ .Values.repoServer.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.repoServer.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.repoServer.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.repoServer.startupProbe.successThreshold }}
failureThreshold: {{ .Values.repoServer.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.repoServer.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.repoServer.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
port: {{ .Values.repoServer.containerPorts.repoServer }}
initialDelaySeconds: {{ .Values.repoServer.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.repoServer.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.repoServer.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.repoServer.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.repoServer.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.repoServer.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.repoServer.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.repoServer.readinessProbe.enabled }}
readinessProbe:
tcpSocket:
port: {{ .Values.repoServer.containerPorts.repoServer }}
initialDelaySeconds: {{ .Values.repoServer.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.repoServer.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.repoServer.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.repoServer.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.repoServer.readinessProbe.failureThreshold }}
{{- end }}
volumeMounts:
# Mounting into a path that will be read by Argo CD
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#ssh-known-host-public-keys
- name: ssh-known-hosts
mountPath: /app/config/ssh
{{- if .Values.config.tlsCerts }}
# Mounting into a path that will be read by Argo CD
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#repositories-using-self-signed-tls-certificates-or-are-signed-by-custom-ca
- mountPath: /app/config/tls
name: tls-certs
{{- end }}
# Mounting into a path that will be read by Argo CD.
# This secret will be autogenerated by Argo CD repo server unless it already exists. Users can create its own certificate to override it.
# Ref: https://argoproj.github.io/argo-cd/operator-manual/tls/#inbound-tls-certificates-used-by-argocd-repo-sever
- mountPath: /app/config/server/tls
name: argocd-repo-server-tls
- mountPath: /app/config/gpg/keys
name: gpg-keyring
- mountPath: /tmp
name: tmp-dir
{{- if .Values.repoServer.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.repoServer.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.repoServer.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: ssh-known-hosts
configMap:
name: argocd-ssh-known-hosts-cm
{{- if .Values.config.tlsCerts }}
- configMap:
name: argocd-tls-certs-cm
name: tls-certs
{{- end }}
- name: argocd-repo-server-tls
secret:
items:
- key: tls.crt
path: tls.crt
- key: tls.key
path: tls.key
- key: ca.crt
path: ca.crt
optional: true
secretName: argocd-repo-server-tls
- emptyDir: {}
name: tmp-dir
- emptyDir: {}
name: gpg-keyring
{{- if .Values.repoServer.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.repoServer.extraVolumes "context" $) | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,47 @@
{{- if .Values.repoServer.autoscaling.enabled }}
apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "argocd.repo-server" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: repo-server
{{- 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:
scaleTargetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ include "argocd.repo-server" . }}
minReplicas: {{ .Values.repoServer.autoscaling.minReplicas }}
maxReplicas: {{ .Values.repoServer.autoscaling.maxReplicas }}
metrics:
{{- if .Values.repoServer.autoscaling.targetCPU }}
- type: Resource
resource:
name: cpu
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.repoServer.autoscaling.targetCPU }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.repoServer.autoscaling.targetCPU }}
{{- end }}
{{- end }}
{{- if .Values.repoServer.autoscaling.targetMemory }}
- type: Resource
resource:
name: memory
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
targetAverageUtilization: {{ .Values.repoServer.autoscaling.targetMemory }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .Values.repoServer.autoscaling.targetMemory }}
{{- end }}
{{- end }}
{{- end }}

View File

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

View File

@@ -0,0 +1,25 @@
{{- if .Values.config.secret.repositoryCredentials }}
apiVersion: v1
kind: Secret
metadata:
# Mandatory hardcoded name.
# Ref: https://github.com/argoproj/argo-helm/blob/master/charts/argo-cd/templates/argocd-repo-server/repository-credentials-secret.yaml
name: argocd-repository-credentials
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: repo-server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
# Mandatory label
# Ref: https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#atomic-configuration
app.kubernetes.io/part-of: argocd
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: Opaque
data:
{{- range $key, $value := .Values.config.secret.repositoryCredentials }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,21 @@
{{- if .Values.rbac.create }}
kind: Role
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.repo-server" . }}
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:
- argoproj.io
resources:
- applications
- applicationset
verbs:
- get
- list
- watch
{{- end }}

View File

@@ -0,0 +1,18 @@
{{- if and .Values.repoServer.serviceAccount.create .Values.rbac.create }}
kind: RoleBinding
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
metadata:
name: {{ include "argocd.repo-server" . }}
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.repo-server.serviceAccountName" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "argocd.repo-server" . }}
{{- end }}

View File

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

View File

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

View File

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