From 080f9b4a752290b45de7d6723c7d4e43008189fd Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Tue, 24 Jan 2023 17:35:16 +0200 Subject: [PATCH] more docs and remove not used keys from a test --- docs/common/values/jobs-cronjobs.md | 97 +++++++++++++++++++ .../tests/job_standalone/generic_test.yaml | 5 - ...py.yaml => cronJobSpecContainer_test.yaml} | 0 library/common/1.0.0/values.yaml | 5 - 4 files changed, 97 insertions(+), 10 deletions(-) create mode 100644 docs/common/values/jobs-cronjobs.md rename library/common-test/tests/jobs/{cronJobSpecContainer_test copy.yaml => cronJobSpecContainer_test.yaml} (100%) diff --git a/docs/common/values/jobs-cronjobs.md b/docs/common/values/jobs-cronjobs.md new file mode 100644 index 0000000000..50aa9fadb7 --- /dev/null +++ b/docs/common/values/jobs-cronjobs.md @@ -0,0 +1,97 @@ +# Jobs - CronJobs + +## Key: jobs + +Info: + +- Type: `dict` +- Default `{}` +- Helm Template: ✅|❌ + - Supports almost every key the main container supports, + except probes and lifecycle hooks. + +Can be defined in: + +- `.Values`.jobs + +--- + +For each (cron)job under `jobs` it will spin up a Job or CronJob. + +> Under `container.[container-name]` you can use all keys that you would use +> in a normal container. Except `probes` and `lifecycle` hooks. + +Examples: + +```yaml +jobs: + job-name: + enabled: true + labels: {} + annotations: {} + backoffLimit: 1 + ttlSecondsAfterFinished: 100 + completionMode: NonIndexed + activeDeadLineSeconds: 120 + parallelism: 2 + completions: 1 + podSpec: + podSecurityContext: + fsGroup: 1000 + containers: + main: + imageSelector: imageDict + env: + var: blabla + cron-job-name: + enabled: true + labels: {} + annotations: {} + # All job options still go here + cron: + enabled: true + schedule: "* * * * *" + timezone: UTC + failedJobsHistoryLimit: 2 + successfulJobsHistoryLimit: 3 + startingDeadlineSeconds: 5 + podSpec: + podSecurityContext: + fsGroup: 1000 + containers: + main: + imageSelector: imageDict + env: + var: blabla +``` + +--- +--- + +## Stand alone Jobs - Cron Jobs + +We can also define jobs and cronjobs that are standalone. +No "main" pod required. + +`podSpec` now goes into `.Values` + +Examples: + +```yaml +controller: + type: Job + labels: {} + annotations: {} + backoffLimit: 1 + ttlSecondsAfterFinished: 100 + completionMode: NonIndexed + activeDeadLineSeconds: 120 + parallelism: 2 + completions: 1 + +podSecurityContext: + fsGroup: 1000 + +env: + var: blabla +``` diff --git a/library/common-test/tests/job_standalone/generic_test.yaml b/library/common-test/tests/job_standalone/generic_test.yaml index 98fb9a3851..5dba87bf1e 100644 --- a/library/common-test/tests/job_standalone/generic_test.yaml +++ b/library/common-test/tests/job_standalone/generic_test.yaml @@ -7,7 +7,6 @@ tests: set: controller: type: Job - schedule: "*/5 * * * *" asserts: - hasDocuments: count: 3 @@ -21,7 +20,6 @@ tests: set: controller: type: Job - schedule: "* * * * *" podSecurityContext: fsGroup: 0 fsGroupChangePolicy: Always @@ -41,7 +39,6 @@ tests: set: controller: type: Job - schedule: "* * * * *" securityContext: runAsUser: 1000 runAsGroup: 1000 @@ -69,7 +66,6 @@ tests: set: controller: type: Job - schedule: "* * * * *" some_string: a_string some_int: 123 some_bool: false @@ -140,7 +136,6 @@ tests: set: controller: type: Job - schedule: "* * * * *" persistence: volume0: type: pvc diff --git a/library/common-test/tests/jobs/cronJobSpecContainer_test copy.yaml b/library/common-test/tests/jobs/cronJobSpecContainer_test.yaml similarity index 100% rename from library/common-test/tests/jobs/cronJobSpecContainer_test copy.yaml rename to library/common-test/tests/jobs/cronJobSpecContainer_test.yaml diff --git a/library/common/1.0.0/values.yaml b/library/common/1.0.0/values.yaml index f423ba4245..628da29b31 100644 --- a/library/common/1.0.0/values.yaml +++ b/library/common/1.0.0/values.yaml @@ -408,8 +408,3 @@ volumeClaimTemplates: {} # mountPath: /data # accessMode: "ReadWriteOnce" # size: 1Gi - -# TODO: Add docs for: -# - *xxContainers -# - jobs and cronjobs running with a main pod -# - jobs and cronjobs running standalone