From bf08cc38dabe2f4a6cbe2f85f872595b14f4d7ef Mon Sep 17 00:00:00 2001 From: Arnaud Meukam Date: Wed, 8 Feb 2023 22:50:26 +0100 Subject: [PATCH] Add retention policy to staging buckets Related to: - https://github.com/kubernetes/k8s.io/issues/4691 Ensure new staging bucketst are regional and apply lifecycle policy to the objects of each staging bucket. Signed-off-by: Arnaud Meukam --- cluster/gce/util.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 7df28267e03..fafdbfa02ea 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -326,16 +326,14 @@ function upload-tars() { local node_binary_tar_urls=() for region in "${PREFERRED_REGION[@]}"; do + retention_period="1d" # https://cloud.google.com/storage/docs/bucket-lock#retention-periods suffix="-${region}" - if [[ "${suffix}" == "-us-central1" ]]; then - suffix="" - fi local staging_bucket="gs://kubernetes-staging-${project_hash}${suffix}" # Ensure the buckets are created if ! gsutil ls "${staging_bucket}" >/dev/null; then echo "Creating ${staging_bucket}" - gsutil mb -l "${region}" -p "${PROJECT}" "${staging_bucket}" + gsutil mb -l "${region}" -p "${PROJECT}" --retention "${retention_period}" "${staging_bucket}" fi local staging_path="${staging_bucket}/${INSTANCE_PREFIX}-devel"