Cronjob
Definition
workload:
kind: Deployment
replicas: 3
clusterRole: application
cronjobs:
cleanup:
spec:
schedule: 0 6 * * *
jobTemplate:
spec:
template:
metadata:
labels:
custom-label: "custom label"
annotations:
custom-annotation: "custom annotation"
# cronjob containers
containers:
main:
spec:
args:
- "tag"
- "delete"
- "--registry"
# cronjob init containers
initContainers:
"cleanup-init":
image:
repository: cicd-sample/cleanup-init
version: 1.0.0
# cronjob volumes
volumes:
volume2:
spec:
emptyDir:
sizeLimit: 300Mi
mounts:
main: /some-data
apiVersion: batch/v1
kind: CronJob
metadata:
annotations: {}
labels:
app.kubernetes.io/component: cicd-sample
app.kubernetes.io/instance: docs
app.kubernetes.io/managed-by: helm
app.kubernetes.io/name: cicd-sample
app.kubernetes.io/part-of: cicd
app.kubernetes.io/version: 1.0.0
exordis/application: cicd-sample
exordis/application-instance: docs
exordis/application-type: service
exordis/environment: test
exordis/product: Some Product
exordis/subsystem: cicd
helm.sh/chart: cicd-subsystem-application-0.1.0
name: cicd-sample-docs-cleanup
namespace: cicd-test
spec:
concurrencyPolicy: Forbid
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
metadata:
annotations:
custom-annotation: custom annotation
labels:
app.kubernetes.io/component: cicd-sample
app.kubernetes.io/instance: docs
app.kubernetes.io/managed-by: helm
app.kubernetes.io/name: cicd-sample
app.kubernetes.io/part-of: cicd
app.kubernetes.io/version: 1.0.0
custom-label: custom label
exordis/application: cicd-sample
exordis/application-instance: docs
exordis/application-type: service
exordis/environment: test
exordis/product: Some Product
exordis/subsystem: cicd
helm.sh/chart: cicd-subsystem-application-0.1.0
spec:
containers:
- args:
- tag
- delete
- --registry
envFrom:
- secretRef:
name: cicd-sample-docs-external-full
- secretRef:
name: cicd-sample-docs-secret-without-containers
- secretRef:
name: cicd-sample-docs-secret-with-containers
- configMapRef:
name: cicd-sample-docs-envs
- configMapRef:
name: cicd-sample-docs-config-map-without-containers
image: registry.gitlab.com/cicd-unittests:1.0.0
imagePullPolicy: IfNotPresent
name: main
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 50m
memory: 64Mi
volumeMounts:
- mountPath: /some-data
name: volume2
initContainers:
- envFrom:
- secretRef:
name: cicd-sample-docs-external-full
- secretRef:
name: cicd-sample-docs-secret-without-containers
- configMapRef:
name: cicd-sample-docs-envs
- configMapRef:
name: cicd-sample-docs-config-map-without-containers
image: registry.gitlab.com/cicd-sample/cleanup-init:1.0.0
imagePullPolicy: IfNotPresent
name: cleanup-init
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 50m
memory: 64Mi
volumeMounts: []
restartPolicy: Never
serviceAccountName: default
volumes:
- emptyDir:
sizeLimit: 300Mi
name: volume2
ttlSecondsAfterFinished: 86400
schedule: 0 6 * * *
enabled
-
if set to false cronjob is excluded from rendering
default: true
namespace
-
cronjob namespace
default: subsystem namespace generated by convention
labels
-
list of labels to add to secret in addition to common labels
default: empty dict
annotations
-
list of annotations to add to secret in addition to common labels
default: empty dict
clusterRole
-
Cronjob cluster role. If value contains
id
of Cluster Role defined in.Values.clusterRoles
it is expanded to full name, otherwise value considered as pre-created Cluster Role and kept as is. IfclusterRole
is defined, ServiceAccount and binding to this role is created for cronjobdefault: null (no explicit cluster role to be assigned)
containers
-
cronjob Containers
default: empty dict
initContainers
-
cronjob Init Containers
default: empty dict
volumes
-
cronjob Volumes
default: empty dict
spec
-
Cronjob kubernetes manifests
spec
field value. (spec.jobTemplate.spec.template.spec.containers
,spec.jobTemplate.spec.template.spec.initContainers
,spec.jobTemplate.spec.template.spec.volumes
are ignored, see overrides and manifest generation bellow)default:
schedule: "0 0 31 2 *" concurrencyPolicy: Forbid failedJobsHistoryLimit: 1 jobTemplate: spec: ttlSecondsAfterFinished: 86400 template: spec: serviceAccountName: default restartPolicy: "Never"
Validations
None
Overrides
name
-
generated with naming conventions with
workload
as deploymentid
spec.jobTemplate.spec.template.spec.containers
-
generated from
.containers
spec.jobTemplate.spec.template.spec.initContainers
-
generated from
.initContainers
spec.jobTemplate.spec.template.spec.volumes
-
generated from
.volumes
Manifests Generation
- common labels are added to
metadata
andspec.jobTemplate.spec.template.metadata
spec.jobTemplate.spec.template.spec.containers
is generated from.containers
. See Containersspec.template.spec.initContainers
is generated from.initContainers
. See Containersspec.template.spec.volumes
is generated from.volumes
. See Volumes