longhorn/deploy/prerequisite/longhorn-nfs-installation.yaml
Rayan Das 6c631417a1 update k8s.gcr.io to registry.k8s.io
Signed-off-by: Rayan Das <rayandas91@gmail.com>
(cherry picked from commit e1ea3d7515)
2023-03-01 15:07:33 +08:00

37 lines
1.4 KiB
YAML

apiVersion: apps/v1
kind: DaemonSet
metadata:
name: longhorn-nfs-installation
labels:
app: longhorn-nfs-installation
annotations:
command: &cmd OS=$(grep -E "^ID_LIKE=" /etc/os-release | cut -d '=' -f 2); if [[ -z "${OS}" ]]; then OS=$(grep -E "^ID=" /etc/os-release | cut -d '=' -f 2); fi; if [[ "${OS}" == *"debian"* ]]; then sudo apt-get update -q -y && sudo apt-get install -q -y nfs-common && sudo modprobe nfs; elif [[ "${OS}" == *"suse"* ]]; then sudo zypper --gpg-auto-import-keys -q refresh && sudo zypper --gpg-auto-import-keys -q install -y nfs-client && sudo modprobe nfs; else sudo yum makecache -q -y && sudo yum --setopt=tsflags=noscripts install -q -y nfs-utils && sudo modprobe nfs; fi && if [ $? -eq 0 ]; then echo "nfs install successfully"; else echo "nfs install failed error code $?"; fi
spec:
selector:
matchLabels:
app: longhorn-nfs-installation
template:
metadata:
labels:
app: longhorn-nfs-installation
spec:
hostNetwork: true
hostPID: true
initContainers:
- name: nfs-installation
command:
- nsenter
- --mount=/proc/1/ns/mnt
- --
- bash
- -c
- *cmd
image: alpine:3.12
securityContext:
privileged: true
containers:
- name: sleep
image: registry.k8s.io/pause:3.1
updateStrategy:
type: RollingUpdate