Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base etcd-empty-dir-cleanup on busybox, run as nobody, and update to etcdctl 3.0.14 #41674

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ spec:
dnsPolicy: Default
containers:
- 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
14 changes: 8 additions & 6 deletions cluster/images/etcd-empty-dir-cleanup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gliderlabs/alpine
FROM busybox

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with busybox is we don't currently have a way to track CVEs. It's not so much an issue with this particular image, but something to think about...

I'm tempted to put the version number in here (busybox:1.26.2). On the one hand, it would make it easier to see which version images were on. On the other hand, it makes it easier for the versions to be left behind.... what are your thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure what is best - we seem to have a mix of both, though unversioned busybox is generally more common.

I'm also generally less worried about CVEs affecting busybox, since historically there have been very few affecting it.


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 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"]
6 changes: 3 additions & 3 deletions cluster/images/etcd-empty-dir-cleanup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

.PHONY: build push

ETCD_VERSION = 2.2.1
IMAGE = gcr.io/google_containers/etcd-empty-dir-cleanup
TAG = 0.0.1
ETCD_VERSION = 3.0.14
IMAGE = gcr.io/google-containers/etcd-empty-dir-cleanup
TAG = 3.0.14.0

clean:
rm -rf etcdctl etcd-v$(ETCD_VERSION)-linux-amd64 etcd-v$(ETCD_VERSION)-linux-amd64.tar.gz
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Copyright 2016 The Kubernetes Authors.
#
Expand All @@ -17,7 +17,7 @@
echo "Removing empty directories from etcd..."

cleanup_empty_dirs () {
if [[ $(${ETCDCTL} ls $1) ]]; then
if [ "$(${ETCDCTL} ls $1)" ]; then
for SUBDIR in $(${ETCDCTL} ls -p $1 | grep "/$")
do
cleanup_empty_dirs ${SUBDIR}
Expand All @@ -34,4 +34,4 @@ do
cleanup_empty_dirs "/registry"
echo "Done with cleanup."
sleep ${SLEEP_SECOND}
done
done