-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use backoffLimit to actually fail cronjobs
- Loading branch information
Showing
6 changed files
with
282 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
images/oc-build-deploy-dind/openshift-templates/cli/custom-cronjob.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
apiVersion: v1 | ||
kind: Template | ||
metadata: | ||
creationTimestamp: null | ||
name: lagoon-openshift-template-cli-cronjob | ||
parameters: | ||
- name: SERVICE_NAME | ||
description: Name of this service | ||
required: true | ||
- name: SAFE_BRANCH | ||
description: Which branch this belongs to, special chars replaced with dashes | ||
required: true | ||
- name: SAFE_PROJECT | ||
description: Which project this belongs to, special chars replaced with dashes | ||
required: true | ||
- name: BRANCH | ||
description: Which branch this belongs to, original value | ||
required: true | ||
- name: PROJECT | ||
description: Which project this belongs to, original value | ||
required: true | ||
- name: LAGOON_GIT_SHA | ||
description: git hash sha of the current deployment | ||
required: true | ||
- name: SERVICE_ROUTER_URL | ||
description: URL of the Router for this service | ||
value: "" | ||
- name: OPENSHIFT_PROJECT | ||
description: Name of the Project that this service is in | ||
required: true | ||
- name: REGISTRY | ||
description: Registry where Images are pushed to | ||
required: true | ||
- name: DEPLOYMENT_STRATEGY | ||
description: Strategy of Deploymentconfig | ||
value: "Rolling" | ||
- name: SERVICE_IMAGE | ||
description: Pullable image of service | ||
required: true | ||
- name: CRONJOB_NAME | ||
description: Name of this cronjob | ||
required: true | ||
- name: CRONJOB_SCHEDULE | ||
description: Schedule of this cronjob | ||
required: true | ||
- name: CRONJOB_COMMAND | ||
description: Command of this cronjob | ||
required: true | ||
objects: | ||
- apiVersion: batch/v1beta1 | ||
kind: CronJob | ||
metadata: | ||
name: cronjob-${SERVICE_NAME}-${CRONJOB_NAME} | ||
spec: | ||
schedule: "${CRONJOB_SCHEDULE}" | ||
concurrencyPolicy: Forbid | ||
successfulJobsHistoryLimit: 0 | ||
failedJobsHistoryLimit: 1 | ||
jobTemplate: | ||
metadata: | ||
labels: | ||
cronjob: ${CRONJOB_NAME} | ||
branch: ${SAFE_BRANCH} | ||
project: ${SAFE_PROJECT} | ||
parent: ${SERVICE_NAME} | ||
spec: | ||
backoffLimit: 1 | ||
template: | ||
metadata: | ||
labels: | ||
cronjob: ${CRONJOB_NAME} | ||
branch: ${SAFE_BRANCH} | ||
project: ${SAFE_PROJECT} | ||
parent: ${SERVICE_NAME} | ||
spec: | ||
tolerations: | ||
- effect: NoSchedule | ||
key: autoscaled | ||
operator: Equal | ||
value: 'true' | ||
- effect: NoSchedule | ||
key: appuio.ch/autoscaled | ||
operator: Equal | ||
value: 'true' | ||
volumes: | ||
- name: lagoon-sshkey | ||
secret: | ||
defaultMode: 420 | ||
secretName: lagoon-sshkey | ||
containers: | ||
- image: ${SERVICE_IMAGE} | ||
command: | ||
- /lagoon/cronjob.sh | ||
- "${CRONJOB_COMMAND}" | ||
name: cronjob-${SERVICE_NAME}-${CRONJOB_NAME} | ||
envFrom: | ||
- configMapRef: | ||
name: lagoon-env | ||
env: | ||
## LAGOON_GIT_SHA is injected directly and not loaded via `lagoon-env` config | ||
## This will cause the cli to redeploy on every deployment, even the files have not changed | ||
- name: LAGOON_GIT_SHA | ||
value: ${LAGOON_GIT_SHA} | ||
- name: SERVICE_NAME | ||
value: ${SERVICE_NAME} | ||
volumeMounts: | ||
- mountPath: /var/run/secrets/lagoon/sshkey/ | ||
name: lagoon-sshkey | ||
readOnly: true | ||
resources: | ||
requests: | ||
cpu: 10m | ||
memory: 10Mi | ||
restartPolicy: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.