Fix kube-apiserver anchor script rendering
This change corrects two rendering issues in the kube-apiserver anchor script. The details and impact are mentioned below. 1. The kube-apiserver anchor script fails to clean up some files from the host, because the path is incomplete. For example, the cleanup() function of the script includes: rm -f "/host/acconfig.yaml" instead of rm -f "/host/etc/kubernetes/apiserver/acconfig.yaml" 2. A recent change to allow fileless command options [0] caused some extraneous lines to end up in the script. For example, the rendered script includes: snapshot_files() { cp "/tmp/etc/" "${SNAPSHOT_DIR}/etc/kubernetes/apiserver/" } compare_copy_files() { SRC="${SNAPSHOT_DIR}/etc/kubernetes/apiserver/" DEST="/host/etc/kubernetes/apiserver/" if [ ! -e "${DEST}" ] || ! cmp -s "${SRC}" "${DEST}"; then mkdir -p $(dirname "${DEST}") cp "${SRC}" "${DEST}" chmod go-rwx "${DEST}" fi } cleanup() { rm -f "/host/" } Since the 'cp' and 'rm' commands don't include '-r', this is actually non-impacting, other than some log messages. 0: https://review.opendev.org/c/airship/promenade/+/788092 Change-Id: Id0a47727d56268d13ebb4718b8578d94272c2181
This commit is contained in:
parent
e79323f5e1
commit
3e28b0ee2d
@ -22,8 +22,10 @@ snapshot_files() {
|
||||
cp "{{ $source }}" "${SNAPSHOT_DIR}{{ $dest }}"
|
||||
{{- end }}
|
||||
{{ range $key, $val := .Values.conf }}
|
||||
{{- if $val.file }}
|
||||
cp "/tmp/etc/{{ $val.file }}" "${SNAPSHOT_DIR}/etc/kubernetes/apiserver/{{ $val.file }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
compare_copy_files() {
|
||||
@ -38,6 +40,7 @@ compare_copy_files() {
|
||||
fi
|
||||
{{- end}}
|
||||
{{ range $key, $val := .Values.conf }}
|
||||
{{- if $val.file }}
|
||||
SRC="${SNAPSHOT_DIR}/etc/kubernetes/apiserver/{{ $val.file }}"
|
||||
DEST="/host/etc/kubernetes/apiserver/{{ $val.file }}"
|
||||
if [ ! -e "${DEST}" ] || ! cmp -s "${SRC}" "${DEST}"; then
|
||||
@ -46,6 +49,7 @@ compare_copy_files() {
|
||||
chmod go-rwx "${DEST}"
|
||||
fi
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
@ -53,7 +57,9 @@ cleanup() {
|
||||
rm -f "/host{{ $dest }}"
|
||||
{{- end }}
|
||||
{{ range $key, $val := .Values.conf }}
|
||||
rm -f "/host/{{ $val.file }}"
|
||||
{{- if $val.file }}
|
||||
rm -f "/host/etc/kubernetes/apiserver/{{ $val.file }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user