Merge pull request #68143 from shyamjvs/garbage-collect-kubemark-image

Automatic merge from submit-queue (batch tested with PRs 68127, 68143). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

GC kubemark image after cluster starts up

Last piece to fix https://github.com/kubernetes/kubernetes/issues/59567

/cc @wojtek-t 

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-09-03 04:45:32 -07:00 committed by GitHub
commit 1cfeede6d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View File

@ -3072,3 +3072,8 @@ function ssh-to-node() {
function prepare-e2e() {
detect-project
}
# Delete the image given by $1.
function delete-image() {
gcloud container images delete --quiet "$1"
}

View File

@ -39,6 +39,7 @@ MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-gci}
NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-gci}
MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-cos-stable-65-10323-64-0}
MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-cos-cloud}
CLEANUP_KUBEMARK_IMAGE=${CLEANUP_KUBEMARK_IMAGE:-true}
# GPUs supported in GCE do not have compatible drivers in Debian 7.
if [[ "${NODE_OS_DISTRIBUTION}" == "debian" ]]; then

View File

@ -220,6 +220,14 @@ function create-and-upload-hollow-node-image {
cd $CURR_DIR
fi
echo "Created and uploaded the kubemark hollow-node image to docker registry."
# Cleanup the kubemark image after the script exits.
if [[ "${CLEANUP_KUBEMARK_IMAGE:-}" == "true" ]]; then
trap delete-kubemark-image EXIT
fi
}
function delete-kubemark-image {
delete-image "${KUBEMARK_IMAGE_REGISTRY}/kubemark:${KUBEMARK_IMAGE_TAG}"
}
# Generate secret and configMap for the hollow-node pods to work, prepare