Skip to content
Open
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
33 changes: 33 additions & 0 deletions content/en/docs/examples/hooks-and-jobs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "Hooks and jobs"
linkTitle: "hooks and jobs"
weight: 5
description: >
Basic example on running jobs using hooks.
---

## Introduction

Jobs only have some [mutable fields](https://kubernetes.io/docs/concepts/workloads/controllers/job/#mutable-scheduling-directives) making them tricky to patch/update this problem can be solved by using [hooks]({{% ref "docs/kluctl/deployments/hooks.md" %}}).


In the following [example](https://kubernetes.io/docs/concepts/workloads/controllers/job/) we've marked a `Job` to be ran after the deployment, we've also specified kluctl not to wait for its completion.

```yaml
apiVersion: batch/v1
kind: Job
metadata:
name: pi
annotations:
kluctl.io/hook: post-deploy
kluctl.io/hook-wait: false
spec:
template:
spec:
containers:
- name: pi
image: perl:5.34.0
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
restartPolicy: Never
backoffLimit: 4
```