blob: 41c2e156a311f135b2baf970cb17272303e13992 [file] [log] [blame]
Hyunsun Mooned19c092019-07-10 15:24:45 -06001{{/*
2Copyright 2019-present Open Networking Foundation
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
Hyunsun Mooned19c092019-07-10 15:24:45 -060017---
18apiVersion: batch/v1
19kind: Job
20metadata:
Hyunsun Moon10152302019-10-24 20:23:35 -050021 name: ue-teardown-if
Hyunsun Mooned19c092019-07-10 15:24:45 -060022 labels:
Hyunsun Moon10152302019-10-24 20:23:35 -050023{{ tuple "ue" . | include "oaisim.metadata_labels" | indent 4 }}
Hyunsun Mooned19c092019-07-10 15:24:45 -060024 annotations:
Hyunsun Moon10152302019-10-24 20:23:35 -050025 "helm.sh/hook": "post-delete"
26 "helm.sh/hook-delete-policy": "before-hook-creation"
Hyunsun Mooned19c092019-07-10 15:24:45 -060027spec:
28 template:
29 metadata:
30 labels:
Hyunsun Moon10152302019-10-24 20:23:35 -050031{{ tuple "ue" . | include "oaisim.metadata_labels" | indent 8 }}
Hyunsun Mooned19c092019-07-10 15:24:45 -060032 spec:
Hyunsun Moon43eadcc2019-08-20 16:16:08 -060033 {{- if .Values.nodeSelectors.enabled }}
34 nodeSelector:
35 {{ .Values.nodeSelectors.ue.label }}: {{ .Values.nodeSelectors.ue.value }}
36 {{- end }}
Hyunsun Mooned19c092019-07-10 15:24:45 -060037 restartPolicy: Never
38 containers:
39 - name: ue-teardown-if-job
40 image: {{ .Values.images.tags.ue | quote }}
41 securityContext:
42 privileged: true
43 runAsUser: 0
44 command: ["bash", "-xc"]
45 args:
46 - if chroot /mnt/host-rootfs lsmod | grep -q ue_ip;then chroot /mnt/host-rootfs rmmod ue_ip;fi
47 volumeMounts:
48 - name: host-rootfs
49 mountPath: /mnt/host-rootfs
50 volumes:
51 - name: host-rootfs
52 hostPath:
53 path: /