2019-09-27 00:18:37 +00:00
|
|
|
apiVersion: v1
|
|
|
|
kind: ServiceAccount
|
|
|
|
metadata:
|
|
|
|
name: local-path-provisioner-service-account
|
|
|
|
namespace: kube-system
|
|
|
|
---
|
2021-07-03 09:03:50 +00:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
2019-09-27 00:18:37 +00:00
|
|
|
kind: ClusterRole
|
|
|
|
metadata:
|
|
|
|
name: local-path-provisioner-role
|
|
|
|
rules:
|
|
|
|
- apiGroups: [""]
|
2021-02-04 18:49:25 +00:00
|
|
|
resources: ["nodes", "persistentvolumeclaims", "configmaps"]
|
2019-09-27 00:18:37 +00:00
|
|
|
verbs: ["get", "list", "watch"]
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: ["endpoints", "persistentvolumes", "pods"]
|
|
|
|
verbs: ["*"]
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: ["events"]
|
|
|
|
verbs: ["create", "patch"]
|
|
|
|
- apiGroups: ["storage.k8s.io"]
|
|
|
|
resources: ["storageclasses"]
|
|
|
|
verbs: ["get", "list", "watch"]
|
|
|
|
---
|
2021-07-03 09:03:50 +00:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
2019-09-27 00:18:37 +00:00
|
|
|
kind: ClusterRoleBinding
|
|
|
|
metadata:
|
|
|
|
name: local-path-provisioner-bind
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: local-path-provisioner-role
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: local-path-provisioner-service-account
|
|
|
|
namespace: kube-system
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: local-path-provisioner
|
|
|
|
namespace: kube-system
|
|
|
|
spec:
|
2022-11-24 00:37:25 +00:00
|
|
|
revisionHistoryLimit: 0
|
|
|
|
strategy:
|
|
|
|
type: RollingUpdate
|
|
|
|
rollingUpdate:
|
|
|
|
maxUnavailable: 1
|
2019-09-27 00:18:37 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: local-path-provisioner
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: local-path-provisioner
|
|
|
|
spec:
|
2020-11-19 22:43:49 +00:00
|
|
|
priorityClassName: "system-node-critical"
|
2019-09-27 00:18:37 +00:00
|
|
|
serviceAccountName: local-path-provisioner-service-account
|
2020-01-08 21:09:20 +00:00
|
|
|
tolerations:
|
|
|
|
- key: "CriticalAddonsOnly"
|
|
|
|
operator: "Exists"
|
2020-12-02 19:54:13 +00:00
|
|
|
- key: "node-role.kubernetes.io/control-plane"
|
|
|
|
operator: "Exists"
|
|
|
|
effect: "NoSchedule"
|
2020-01-08 21:09:20 +00:00
|
|
|
- key: "node-role.kubernetes.io/master"
|
|
|
|
operator: "Exists"
|
|
|
|
effect: "NoSchedule"
|
2019-09-27 00:18:37 +00:00
|
|
|
containers:
|
|
|
|
- name: local-path-provisioner
|
2024-02-06 22:57:07 +00:00
|
|
|
image: %{SYSTEM_DEFAULT_REGISTRY}%rancher/local-path-provisioner:v0.0.26
|
2019-09-27 00:18:37 +00:00
|
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
command:
|
|
|
|
- local-path-provisioner
|
|
|
|
- start
|
|
|
|
- --config
|
|
|
|
- /etc/config/config.json
|
|
|
|
volumeMounts:
|
|
|
|
- name: config-volume
|
|
|
|
mountPath: /etc/config/
|
|
|
|
env:
|
|
|
|
- name: POD_NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
|
|
|
volumes:
|
|
|
|
- name: config-volume
|
|
|
|
configMap:
|
|
|
|
name: local-path-config
|
|
|
|
---
|
|
|
|
apiVersion: storage.k8s.io/v1
|
|
|
|
kind: StorageClass
|
|
|
|
metadata:
|
|
|
|
name: local-path
|
|
|
|
annotations:
|
|
|
|
storageclass.kubernetes.io/is-default-class: "true"
|
|
|
|
provisioner: rancher.io/local-path
|
|
|
|
volumeBindingMode: WaitForFirstConsumer
|
|
|
|
reclaimPolicy: Delete
|
|
|
|
---
|
|
|
|
kind: ConfigMap
|
|
|
|
apiVersion: v1
|
|
|
|
metadata:
|
|
|
|
name: local-path-config
|
|
|
|
namespace: kube-system
|
|
|
|
data:
|
|
|
|
config.json: |-
|
2021-02-04 18:49:25 +00:00
|
|
|
{
|
|
|
|
"nodePathMap":[
|
|
|
|
{
|
|
|
|
"node":"DEFAULT_PATH_FOR_NON_LISTED_NODES",
|
|
|
|
"paths":["%{DEFAULT_LOCAL_STORAGE_PATH}%"]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
setup: |-
|
|
|
|
#!/bin/sh
|
|
|
|
while getopts "m:s:p:" opt
|
|
|
|
do
|
|
|
|
case $opt in
|
|
|
|
p)
|
|
|
|
absolutePath=$OPTARG
|
|
|
|
;;
|
|
|
|
s)
|
|
|
|
sizeInBytes=$OPTARG
|
|
|
|
;;
|
|
|
|
m)
|
|
|
|
volMode=$OPTARG
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2021-07-28 17:25:34 +00:00
|
|
|
mkdir -m 0777 -p ${absolutePath}
|
2023-05-04 17:43:54 +00:00
|
|
|
chmod 700 ${absolutePath}/..
|
2021-02-04 18:49:25 +00:00
|
|
|
teardown: |-
|
|
|
|
#!/bin/sh
|
|
|
|
while getopts "m:s:p:" opt
|
|
|
|
do
|
|
|
|
case $opt in
|
|
|
|
p)
|
|
|
|
absolutePath=$OPTARG
|
|
|
|
;;
|
|
|
|
s)
|
|
|
|
sizeInBytes=$OPTARG
|
|
|
|
;;
|
|
|
|
m)
|
|
|
|
volMode=$OPTARG
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
rm -rf ${absolutePath}
|
|
|
|
helperPod.yaml: |-
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Pod
|
|
|
|
metadata:
|
|
|
|
name: helper-pod
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: helper-pod
|
2023-10-12 20:18:48 +00:00
|
|
|
image: %{SYSTEM_DEFAULT_REGISTRY}%rancher/mirrored-library-busybox:1.36.1
|
2022-11-02 15:47:20 +00:00
|
|
|
imagePullPolicy: IfNotPresent
|