Skip to content

Commit 253b866

Browse files
authored
Merge pull request #47039 from sochotnicky/add-ttlSecondsAfterFinished-to-auto-ldapsync
Add ttlSecondsAfterFinished into LDAP sync cron job
2 parents 1f01920 + f0bf6b0 commit 253b866

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

modules/ldap-auto-syncing.adoc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ spec:
175175
jobTemplate:
176176
spec:
177177
backoffLimit: 0
178+
ttlSecondsAfterFinished: 1800 <3>
178179
template:
179180
spec:
180181
containers:
@@ -183,7 +184,7 @@ spec:
183184
command:
184185
- "/bin/bash"
185186
- "-c"
186-
- "oc adm groups sync --sync-config=/etc/config/sync.yaml --confirm" <3>
187+
- "oc adm groups sync --sync-config=/etc/config/sync.yaml --confirm" <4>
187188
volumeMounts:
188189
- mountPath: "/etc/config"
189190
name: "ldap-sync-volume"
@@ -197,10 +198,10 @@ spec:
197198
name: "ldap-group-syncer"
198199
- name: "ldap-bind-password"
199200
secret:
200-
secretName: "ldap-secret" <4>
201+
secretName: "ldap-secret" <5>
201202
- name: "ldap-ca"
202203
configMap:
203-
name: "ca-config-map" <5>
204+
name: "ca-config-map" <6>
204205
restartPolicy: "Never"
205206
terminationGracePeriodSeconds: 30
206207
activeDeadlineSeconds: 500
@@ -209,9 +210,10 @@ spec:
209210
----
210211
<1> Configure the settings for the cron job. See "Creating cron jobs" for more information on cron job settings.
211212
<2> The schedule for the job specified in link:https://en.wikipedia.org/wiki/Cron[cron format]. This example cron job runs every 30 minutes. Adjust the frequency as necessary, making sure to take into account how long the sync takes to run.
212-
<3> The LDAP sync command for the cron job to run. Passes in the sync configuration file that was defined in the config map.
213-
<4> This secret was created when the LDAP IDP was configured.
214-
<5> This config map was created when the LDAP IDP was configured.
213+
<3> How long, in seconds, to keep finished jobs. This should match the period of the job schedule in order to clean old failed jobs and prevent unnecessary alerts. For more information, see link:https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished[TTL-after-finished Controller] in the Kubernetes documentation.
214+
<4> The LDAP sync command for the cron job to run. Passes in the sync configuration file that was defined in the config map.
215+
<5> This secret was created when the LDAP IDP was configured.
216+
<6> This config map was created when the LDAP IDP was configured.
215217
216218
. Create the cron job:
217219
+

0 commit comments

Comments
 (0)