Skip to content

Commit a034358

Browse files
committed
fix(nautobot): multiple corrections to nautobot sync job
The nautobot sync job never had a TTL set to clean up after it ran so now we clean up 5 minutes after it runs. It should also have a safety that it should not run for longer than 20 minutes so this defines that limit. Added a few more helm annotations for cleanup of the job and for being able to lookup the jobs by labels. Ensure the container runs securely by specifying a permission limited security context. Lastly fix the device-types role by mounting the data that the role needs into the container.
1 parent 7bf2dc7 commit a034358

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

components/nautobot/values.yaml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,45 @@ extraObjects:
107107
metadata:
108108
generateName: sync-nautobot-ansible-
109109
namespace: nautobot
110+
labels:
111+
app.kubernetes.io/name: nautobot
112+
app.kubernetes.io/component: sync-job
113+
app.kubernetes.io/managed-by: Helm
110114
annotations:
111115
"helm.sh/hook": post-install,post-upgrade
116+
"helm.sh/hook-weight": "1"
117+
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
112118
spec:
119+
ttlSecondsAfterFinished: 300
120+
# allow the ansible container to run for 20 minutes
121+
activeDeadlineSeconds: 1200
122+
backoffLimit: 1
113123
template:
114124
spec:
125+
securityContext:
126+
runAsNonRoot: true
127+
runAsUser: 1000
128+
fsGroup: 1000
129+
seccompProfile:
130+
type: RuntimeDefault
115131
containers:
116132
- name: ansible-runner
117133
image: ghcr.io/rackerlabs/understack/ansible:latest
118134
imagePullPolicy: Always
119135
command: ["ansible-runner", "run", "/runner", "--playbook", "nautobot-initial-setup.yaml"]
136+
resources:
137+
requests:
138+
cpu: "100m"
139+
memory: "512Mi"
140+
limits:
141+
cpu: "500m"
142+
memory: "512Mi"
143+
securityContext:
144+
allowPrivilegeEscalation: false
145+
capabilities:
146+
drop:
147+
- ALL
148+
readOnlyRootFilesystem: false
120149
env:
121150
- name: NAUTOBOT_TOKEN
122151
valueFrom:
@@ -130,6 +159,8 @@ extraObjects:
130159
mountPath: /runner/inventory/
131160
- name: ansible-group-vars
132161
mountPath: /runner/inventory/group_vars/
162+
- name: device-types
163+
mountPath: /runner/data/device-types/
133164
restartPolicy: Never
134165
volumes:
135166
- name: runner-data
@@ -140,4 +171,6 @@ extraObjects:
140171
- name: ansible-group-vars
141172
configMap:
142173
name: ansible-group-vars
143-
backoffLimit: 1
174+
- name: device-types
175+
configMap:
176+
name: device-types

0 commit comments

Comments
 (0)