From 343227cfd47c890113dde44df3952657a278ca26 Mon Sep 17 00:00:00 2001 From: Justin SB Date: Sat, 31 Jul 2021 12:15:43 +0000 Subject: [PATCH] Script for iterating development on GCE AWS one to follow! --- hack/dev-build-gce.sh | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 hack/dev-build-gce.sh diff --git a/hack/dev-build-gce.sh b/hack/dev-build-gce.sh new file mode 100644 index 0000000000..048bfe82cc --- /dev/null +++ b/hack/dev-build-gce.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Copyright 2021 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This is a convenience script for developing kOps on GCE. +# It builds the code, including nodeup, and uploads to a custom GCS bucket. +# It also sets KOPS_STATE_STORE and KOPS_BASE_URL to project-isolated values. +# To use, source the script. For example `. hack/dev-build-gce.sh` (note the initial `.`) + +# Can't use set -e in a script we want to source +#set -e + +#set -x + +# bazel caching doesn't work when when we switch architectures +KOPS_ARCH=amd64 +export KOPS_ARCH + +# Build and upload to bucket +UPLOAD_DEST_BUCKET="kops-dev-$(gcloud config get-value project)-${USER}" +export UPLOAD_DEST=gs://${UPLOAD_DEST_BUCKET} +gsutil ls "${UPLOAD_DEST}" || gsutil mb "${UPLOAD_DEST}" || return +make kops-install dev-upload-linux-${KOPS_ARCH} || return + +# Set KOPS_BASE_URL +(tools/get_version.sh | grep VERSION | awk '{print $2}') || return +KOPS_VERSION=$(tools/get_version.sh | grep VERSION | awk '{print $2}') +export KOPS_BASE_URL=https://storage.googleapis.com/${UPLOAD_DEST_BUCKET}/kops/${KOPS_VERSION}/ + +# Create the state-store bucket if it doesn't exist +KOPS_STATE_STORE="gs://kops-state-$(gcloud config get-value project)" +export KOPS_STATE_STORE +gsutil ls "${KOPS_STATE_STORE}" || gsutil mb "${KOPS_STATE_STORE}" || return + +# Set feature flags needed on GCE +export KOPS_FEATURE_FLAGS=AlphaAllowGCE + +echo "SUCCESS"