Skip to content
Closed
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
93 changes: 93 additions & 0 deletions charts/dso-console/templates/repo-synchronizer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{{- if .Values.autoSynchronizer.enabled }}
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "cpnConsole.name" . }}-repo-synchronizer
spec:
{{- if eq .Values.autoSynchronizer.schedule "-" }}
suspend: true
{{- else }}
schedule: "{{ .Values.autoSynchronizer.schedule }}"
{{- end }}
jobTemplate:
metadata:
{{- with .Values.autoSynchronizer.job.labels }}
labels:
{{ . | toYaml | nindent 8 }}
{{- end }}
{{- with .Values.autoSynchronizer.job.annotations }}
annotations:
{{ . | toYaml | nindent 8 }}
{{- end }}
spec:
completions: {{ .Values.autoSynchronizer.job.completions }}
parallelism: {{ .Values.autoSynchronizer.job.parallelism }}
backoffLimit: {{ .Values.autoSynchronizer.job.backoffLimit }}
ttlSecondsAfterFinished: {{ .Values.autoSynchronizer.job.ttlSecondsAfterFinished }}
template:
metadata:
{{- with .Values.autoSynchronizer.pod.labels }}
labels:
{{ . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.autoSynchronizer.pod.annotations }}
annotations:
{{ . | toYaml | nindent 12 }}
{{- end }}
spec:
{{- with .Values.autoSynchronizer.pod.affinity }}
affinity:
{{ . | toYaml | nindent 12 }}
{{- end }}
automountServiceAccountToken: false
{{- with .Values.autoSynchronizer.pod.imagePullSecrets }}
imagePullSecrets:
{{ . | toYaml | nindent 12 }}
{{- end }}
containers:
- name: repo-synchronizer
{{- with .Values.autoSynchronizer.pod.command }}
command:
{{ . | toYaml | nindent 14 }}
{{- end }}
{{- with .Values.autoSynchronizer.pod.args }}
args:
{{ . | toYaml | nindent 14 }}
{{- end }}
env: {{ not (empty .Values.autoSynchronizer.pod.env) | ternary nil "[]" }}
{{- range $key, $value := .Values.autoSynchronizer.pod.env }}
- name: {{ $key }}
{{- toYaml $value | nindent 14 }}
{{- end }}
image: "{{ .Values.autoSynchronizer.pod.image.registry }}/{{ .Values.autoSynchronizer.pod.image.repository }}:{{ .Values.autoSynchronizer.pod.image.tag }}"
imagePullPolicy: "{{ .Values.autoSynchronizer.pod.image.pullPolicy }}"
{{- with .Values.autoSynchronizer.pod.resources }}
resources:
{{ . | toYaml | nindent 14 }}
{{- end }}
{{- with .Values.autoSynchronizer.pod.containerSecurityContext }}
securityContext:
{{ . | toYaml | nindent 14 }}
{{- end }}
{{- with .Values.autoSynchronizer.pod.extraVolumeMounts }}
volumeMounts:
{{ . | toYaml | nindent 14 }}
{{- end }}
restartPolicy: {{ .Values.autoSynchronizer.pod.restartPolicy }}
{{- with .Values.autoSynchronizer.pod.podSecurityContext }}
securityContext:
{{ . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.autoSynchronizer.pod.tolerations }}
tolerations:
{{ . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.autoSynchronizer.pod.topologySpreadConstraints }}
topologySpreadConstraints:
{{ . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.autoSynchronizer.pod.extraVolumes }}
volumes:
{{ . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
107 changes: 107 additions & 0 deletions charts/dso-console/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -670,3 +670,110 @@ keycloak:
readReplicas:
persistence:
size: "1Gi"

# Console CPN auto-sync configuration.
autoSynchronizer:
# -- Enable or disable the auto-sync CronJob deployment
enabled: false
# -- Cron schedule for the synchronization job (runs every 15 minutes by default)
# To disable the cronjob without deleting the resource, set to '-'
schedule: "*/15 * * * *"
# -- Number of successful job executions to retain in history
successfulJobsHistoryLimit: 3
# -- Number of failed job executions to retain in history
failedJobsHistoryLimit: 1

job:
# -- Additional labels to apply to the CronJob resource
labels: {}
# -- Additional annotations to apply to the CronJob resource
annotations: {}
# -- Number of retries before considering the job as failed
backoffLimit: 6
# -- Number of successful completions required for the job to be considered complete
completions: 1
# -- Number of pods that can run in parallel
parallelism: 1
# -- Time (in seconds) before automatically deleting finished jobs
ttlSecondsAfterFinished: 30

pod:
# -- Additional labels to apply to the pod
labels: {}
# -- Additional annotations to apply to the pod
annotations: {}
# -- Affinity rules for pod scheduling
affinity: {}
# -- Image pull secrets for private registries
imagePullSecrets: []
# -- Resource requests and limits for the container
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 200m
memory: 256Mi
# -- Restart policy for the pod (OnFailure or Never)
restartPolicy: OnFailure
# -- Security context at the pod level
podSecurityContext: {}
# -- Security context at the container level (follows security best practices)
containerSecurityContext:
readOnlyRootFilesystem: true
privileged: false
capabilities:
drop: ["ALL"]
allowPrivilegeEscalation: false
# -- Tolerations for pod scheduling on tainted nodes
tolerations: []
# -- Topology spread constraints for pod distribution
topologySpreadConstraints: []
# -- Additional volumes to mount in the pod
extraVolumes: []
# -- Additional volume mounts for the container
extraVolumeMounts: []
# -- Environment variables for the container
# Required: DSO_TOKEN for API authentication
# Optional: CONSOLE_URL to override default Console API URL
env: {}
# CONSOLE_URL:
# value: https://console.dso.local
# DSO_TOKEN:
# valueFrom:
# secretKeyRef:
# name: console-secrets
# key: DSO_TOKEN
# -- Command to execute in the container
command:
- sh
- -c
# -- Arguments containing the synchronization script
# The script calls the /api/v1/repositories/sync endpoint which handles
# the synchronization logic for all projects marked as auto-sync
args:
- |
SYNC_ENDPOINT="${CONSOLE_URL:-http://console.dso.local}/api/v1/repositories/sync"
echo "Synchronisation des projets auto-sync..."
HTTP_CODE=$(curl -X 'POST' \
"${SYNC_ENDPOINT}" \
-H 'accept: application/json' \
-H "x-dso-token: ${DSO_TOKEN}" \
-w "%{http_code}" \
-s -o /dev/null)
if [ "$HTTP_CODE" -eq 204 ]; then
echo "✓ Synchronisation réussie (HTTP $HTTP_CODE)"
exit 0
else
echo "✗ Erreur lors de la synchronisation (HTTP $HTTP_CODE)"
exit 1
fi
image:
# -- Docker registry for the image
registry: docker.io
# -- Image repository (alpine/curl contains curl and sh)
repository: alpine/curl
# -- Image tag
tag: 8.14.1
# -- Image pull policy
pullPolicy: IfNotPresent
Loading