mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Merge pull request #41674 from ixdy/etcd-empty-dir-cleanup-busybox
Automatic merge from submit-queue Base etcd-empty-dir-cleanup on busybox, run as nobody, and update to etcdctl 3.0.14 **What this PR does / why we need it**: since the `etcd-empty-dir-cleanup` image just uses a simple shell script and `etcdctl`, we can base it on busybox, which is a smaller target than alpine. I've also updated this to use an `etcdctl` from etcd 3.0.14, which matches the version of etcd we're running in 1.6 clusters (I believe), and changed the tag to match the `etcdctl` version. Tested in my own e2e cluster, where it seems to work. I haven't pushed the image yet, so e2e tests *may* fail. Tagging `do-not-merge`; if you think this looks good, I'll push the image and retest. **Release note**: ```release-note ``` cc @timstclair @mml @wojtek-t
This commit is contained in:
commit
84b74074a4
@ -10,4 +10,4 @@ spec:
|
|||||||
dnsPolicy: Default
|
dnsPolicy: Default
|
||||||
containers:
|
containers:
|
||||||
- name: etcd-empty-dir-cleanup
|
- name: etcd-empty-dir-cleanup
|
||||||
image: gcr.io/google_containers/etcd-empty-dir-cleanup:0.0.1
|
image: gcr.io/google-containers/etcd-empty-dir-cleanup:3.0.14.0
|
||||||
|
@ -12,12 +12,14 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
FROM gliderlabs/alpine
|
FROM busybox
|
||||||
|
|
||||||
|
COPY etcdctl etcd-empty-dir-cleanup.sh /
|
||||||
|
RUN chmod a+rx /etcdctl /etcd-empty-dir-cleanup.sh
|
||||||
|
|
||||||
RUN apk-install bash
|
|
||||||
ADD etcd-empty-dir-cleanup.sh etcd-empty-dir-cleanup.sh
|
|
||||||
ADD etcdctl etcdctl
|
|
||||||
ENV ETCDCTL /etcdctl
|
ENV ETCDCTL /etcdctl
|
||||||
ENV SLEEP_SECOND 3600
|
ENV SLEEP_SECOND 3600
|
||||||
RUN chmod +x etcd-empty-dir-cleanup.sh
|
|
||||||
CMD bash /etcd-empty-dir-cleanup.sh
|
USER nobody:nogroup
|
||||||
|
|
||||||
|
ENTRYPOINT ["/etcd-empty-dir-cleanup.sh"]
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
.PHONY: build push
|
.PHONY: build push
|
||||||
|
|
||||||
ETCD_VERSION = 2.2.1
|
ETCD_VERSION = 3.0.14
|
||||||
IMAGE = gcr.io/google_containers/etcd-empty-dir-cleanup
|
IMAGE = gcr.io/google-containers/etcd-empty-dir-cleanup
|
||||||
TAG = 0.0.1
|
TAG = 3.0.14.0
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf etcdctl etcd-v$(ETCD_VERSION)-linux-amd64 etcd-v$(ETCD_VERSION)-linux-amd64.tar.gz
|
rm -rf etcdctl etcd-v$(ETCD_VERSION)-linux-amd64 etcd-v$(ETCD_VERSION)-linux-amd64.tar.gz
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Copyright 2016 The Kubernetes Authors.
|
# Copyright 2016 The Kubernetes Authors.
|
||||||
#
|
#
|
||||||
@ -17,7 +17,7 @@
|
|||||||
echo "Removing empty directories from etcd..."
|
echo "Removing empty directories from etcd..."
|
||||||
|
|
||||||
cleanup_empty_dirs () {
|
cleanup_empty_dirs () {
|
||||||
if [[ $(${ETCDCTL} ls $1) ]]; then
|
if [ "$(${ETCDCTL} ls $1)" ]; then
|
||||||
for SUBDIR in $(${ETCDCTL} ls -p $1 | grep "/$")
|
for SUBDIR in $(${ETCDCTL} ls -p $1 | grep "/$")
|
||||||
do
|
do
|
||||||
cleanup_empty_dirs ${SUBDIR}
|
cleanup_empty_dirs ${SUBDIR}
|
||||||
@ -34,4 +34,4 @@ do
|
|||||||
cleanup_empty_dirs "/registry"
|
cleanup_empty_dirs "/registry"
|
||||||
echo "Done with cleanup."
|
echo "Done with cleanup."
|
||||||
sleep ${SLEEP_SECOND}
|
sleep ${SLEEP_SECOND}
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user