A MutatingWebhook that will avoid Linkerd injection on your CronJobs and Jobs.
-
Apply the
deployment.yaml
file to your cluster. This will create theantivax
namespace and deploy the mutating webhook. -
Add the
antivax: enabled
label to the namespaces you want to avoid Linkerd injection.
Then you'll need to manually add the annotation to that resource:
- CronJob example:
apiVersion: batch/v1
kind: CronJob
metadata:
name: testcronjob
namespace: antivax
spec:
schedule: "* * * * *" # Run every minute
jobTemplate:
spec:
template:
metadata:
annotations:
linkerd.io/inject: enabled
spec:
containers:
- name: testcronjob
image: busybox:latest
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- date; echo Hello!
restartPolicy: OnFailure
- Job example:
apiVersion: batch/v1
kind: Job
metadata:
name: testjob
namespace: antivax
spec:
template:
metadata:
annotations:
linkerd.io/inject: enabled
spec:
automountServiceAccountToken: false
containers:
- name: testjob
image: busybox:latest
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- date; echo Hello!
restartPolicy: OnFailure