blob: 0d5ce477cbbf4360a7894c55a96c88eb3e86d9da [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 Moon43eadcc2019-08-20 16:16:08 -060017{{- $name := .Values.config.ue.name }}
Hyunsun Mooned19c092019-07-10 15:24:45 -060018---
19apiVersion: batch/v1
20kind: Job
21metadata:
22 name: {{ $name }}-teardown-if
23 labels:
24 app: {{ $name }}
25 annotations:
26 "helm.sh/hook": post-delete
27 "helm.sh/hook-delete-policy": hook-succeeded
28spec:
29 template:
30 metadata:
31 labels:
32 app: {{ $name }}
33 spec:
Hyunsun Moon43eadcc2019-08-20 16:16:08 -060034 {{- if .Values.nodeSelectors.enabled }}
35 nodeSelector:
36 {{ .Values.nodeSelectors.ue.label }}: {{ .Values.nodeSelectors.ue.value }}
37 {{- end }}
Hyunsun Mooned19c092019-07-10 15:24:45 -060038 restartPolicy: Never
39 containers:
40 - name: ue-teardown-if-job
41 image: {{ .Values.images.tags.ue | quote }}
42 securityContext:
43 privileged: true
44 runAsUser: 0
45 command: ["bash", "-xc"]
46 args:
47 - if chroot /mnt/host-rootfs lsmod | grep -q ue_ip;then chroot /mnt/host-rootfs rmmod ue_ip;fi
48 volumeMounts:
49 - name: host-rootfs
50 mountPath: /mnt/host-rootfs
51 volumes:
52 - name: host-rootfs
53 hostPath:
54 path: /