mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
chown on /mnt/disks/master-pd/var/etcd instead of /var/etcd
This commit is contained in:
parent
9f058079d2
commit
03f60f4b60
@ -1859,16 +1859,10 @@ function prepare-etcd-manifest {
|
|||||||
# Replace the volume host path.
|
# Replace the volume host path.
|
||||||
sed -i -e "s@/mnt/master-pd/var/etcd@/mnt/disks/master-pd/var/etcd@g" "${temp_file}"
|
sed -i -e "s@/mnt/master-pd/var/etcd@/mnt/disks/master-pd/var/etcd@g" "${temp_file}"
|
||||||
# Replace the run as user and run as group
|
# Replace the run as user and run as group
|
||||||
pod_run_as_user=""
|
|
||||||
pod_run_as_group=""
|
|
||||||
container_security_context=""
|
container_security_context=""
|
||||||
if [[ -n "${ETCD_RUNASUSER:-}" && -n "${ETCD_RUNASGROUP:-}" ]]; then
|
if [[ -n "${ETCD_RUNASUSER:-}" && -n "${ETCD_RUNASGROUP:-}" ]]; then
|
||||||
pod_run_as_user="\"runAsUser\": ${ETCD_RUNASUSER},"
|
container_security_context="\"securityContext\": {\"runAsUser\": ${ETCD_RUNASUSER}, \"runAsGroup\": ${ETCD_RUNASGROUP}, \"allowPrivilegeEscalation\": false, \"capabilities\": {\"drop\": [\"all\"]}},"
|
||||||
pod_run_as_group="\"runAsGroup\": ${ETCD_RUNASGROUP},"
|
|
||||||
container_security_context="\"securityContext\": {\"allowPrivilegeEscalation\": false, \"capabilities\": {\"drop\": [\"all\"]}},"
|
|
||||||
fi
|
fi
|
||||||
sed -i -e "s@{{ run_as_user }}@${pod_run_as_user}@g" "${temp_file}"
|
|
||||||
sed -i -e "s@{{ run_as_group }}@${pod_run_as_group}@g" "${temp_file}"
|
|
||||||
sed -i -e "s@{{security_context}}@${container_security_context}@g" "${temp_file}"
|
sed -i -e "s@{{security_context}}@${container_security_context}@g" "${temp_file}"
|
||||||
mv "${temp_file}" /etc/kubernetes/manifests
|
mv "${temp_file}" /etc/kubernetes/manifests
|
||||||
}
|
}
|
||||||
@ -1891,7 +1885,7 @@ function start-etcd-servers {
|
|||||||
rm -f /etc/init.d/etcd
|
rm -f /etc/init.d/etcd
|
||||||
fi
|
fi
|
||||||
if [[ -n "${ETCD_RUNASUSER:-}" && -n "${ETCD_RUNASGROUP:-}" ]]; then
|
if [[ -n "${ETCD_RUNASUSER:-}" && -n "${ETCD_RUNASGROUP:-}" ]]; then
|
||||||
chown -R "${ETCD_RUNASUSER}":"${ETCD_RUNASGROUP}" /var/etcd/
|
chown -R "${ETCD_RUNASUSER}":"${ETCD_RUNASGROUP}" /mnt/disks/master-pd/var/etcd
|
||||||
fi
|
fi
|
||||||
prepare-log-file /var/log/etcd.log "${ETCD_RUNASUSER:-0}"
|
prepare-log-file /var/log/etcd.log "${ETCD_RUNASUSER:-0}"
|
||||||
prepare-etcd-manifest "" "2379" "2380" "200m" "etcd.manifest"
|
prepare-etcd-manifest "" "2379" "2380" "200m" "etcd.manifest"
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
},
|
},
|
||||||
"spec":{
|
"spec":{
|
||||||
"securityContext": {
|
"securityContext": {
|
||||||
{{ run_as_user }}
|
|
||||||
{{ run_as_group }}
|
|
||||||
"seccompProfile": {
|
"seccompProfile": {
|
||||||
"type": "RuntimeDefault"
|
"type": "RuntimeDefault"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user