Clean up READMEs and broken stuff.

Move all support for clouds that are broken with this change into an `icebox` directory.  We'll move that stuff back out as we fix it up.
This commit is contained in:
Joe Beda
2014-10-01 16:17:51 -07:00
parent 29e42991c2
commit 38d5906044
49 changed files with 118 additions and 139 deletions

View File

@@ -0,0 +1,40 @@
# Copyright 2014 Google Inc. All rights reserved.
#
# 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.
INSTANCE_PREFIX=kubenertes
AZ_LOCATION='West US'
TAG=testing
if [ -z "$(which azure)" ]; then
echo "Couldn't find azure in PATH"
echo " please install with 'npm install azure-cli'"
exit 1
fi
if [ -z "$(azure account list | grep true)" ]; then
echo "Default azure account not set"
echo " please set with 'azure account set'"
exit 1
fi
account=$(azure account list | grep true | awk '{ print $2 }')
if which md5 > /dev/null 2>&1; then
AZ_HSH=$(md5 -q -s $account)
else
AZ_HSH=$(echo -n "$account" | md5sum)
fi
AZ_HSH=${AZ_HSH:0:7}
AZ_STG=kube$AZ_HSH
CONTAINER=kube-$TAG
FULL_URL="https://${AZ_STG}.blob.core.windows.net/$CONTAINER/master-release.tgz"

63
icebox/release/azure/release.sh Executable file
View File

@@ -0,0 +1,63 @@
#!/bin/bash
# Copyright 2014 Google Inc. All rights reserved.
#
# 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 script will build and release Kubernetes.
set -eu
set -o pipefail
IFS=$'\n\t'
SCRIPT_DIR=$(CDPATH="" cd $(dirname $0); pwd)
function json_val () {
python -c 'import json,sys;obj=json.load(sys.stdin);print obj'$1'';
}
source $SCRIPT_DIR/config.sh
$SCRIPT_DIR/../build-release.sh $INSTANCE_PREFIX
if [ -z "$(azure storage account show $AZ_STG 2>/dev/null | \
grep data)" ]; then
azure storage account create -l "$AZ_LOCATION" $AZ_STG
fi
stg_key=$(azure storage account keys list $AZ_STG --json | \
json_val '["primaryKey"]')
if [ -z "$(azure storage container show -a $AZ_STG -k "$stg_key" \
$CONTAINER 2>/dev/null | grep data)" ]; then
azure storage container create \
-a $AZ_STG \
-k "$stg_key" \
-p Blob \
$CONTAINER
fi
if [ -n "$(azure storage blob show -a $AZ_STG -k "$stg_key" \
$CONTAINER master-release.tgz 2>/dev/null | grep data)" ]; then
azure storage blob delete \
-a $AZ_STG \
-k "$stg_key" \
$CONTAINER \
master-release.tgz
fi
azure storage blob upload \
-a $AZ_STG \
-k "$stg_key" \
$SCRIPT_DIR/../../_output/release/master-release.tgz \
$CONTAINER \
master-release.tgz

74
icebox/release/build-release.sh Executable file
View File

@@ -0,0 +1,74 @@
#!/bin/bash
# Copyright 2014 Google Inc. All rights reserved.
#
# 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 script will build a Kubernetes release tarball
# exit on any error
set -eu
set -o pipefail
SCRIPT_DIR=$(CDPATH="" cd $(dirname $0); pwd)
INSTANCE_PREFIX=$1
KUBE_DIR=$SCRIPT_DIR/..
. "${KUBE_DIR}/hack/config-go.sh"
# Next build the release tar. This gets copied on to the master and installed
# from there. It includes the go source for the necessary servers along with
# the salt configs.
rm -rf $KUBE_DIR/_output/release/*
MASTER_RELEASE_DIR=$KUBE_DIR/_output/release/master-release
mkdir -p $MASTER_RELEASE_DIR/bin
mkdir -p $MASTER_RELEASE_DIR/src/scripts
echo "Building release tree"
cp $KUBE_DIR/release/master-release-install.sh $MASTER_RELEASE_DIR/src/scripts/master-release-install.sh
cp -r $KUBE_DIR/cluster/saltbase $MASTER_RELEASE_DIR/src/saltbase
# Capture the same version we are using to build the client tools and pass that
# on.
version_ldflags=$(kube::version_ldflags)
# Note: go_opt must stay in sync with the flags in hack/build-go.sh.
cat << EOF > $MASTER_RELEASE_DIR/src/saltbase/pillar/common.sls
instance_prefix: $INSTANCE_PREFIX-minion
go_opt: -ldflags '${version_ldflags}'
EOF
function find_go_files() {
find * -not \( \
\( \
-wholename 'release' \
-o -wholename 'output' \
-o -wholename '_output' \
-o -wholename 'examples' \
-o -wholename 'test' \
\) -prune \
\) -name '*.go'
}
# find_go_files is directory dependent
pushd $KUBE_DIR >/dev/null
for f in $(find_go_files); do
mkdir -p $MASTER_RELEASE_DIR/src/go/$(dirname ${f})
cp ${f} ${MASTER_RELEASE_DIR}/src/go/${f}
done
popd >/dev/null
echo "Packaging release"
tar cz -C $KUBE_DIR/_output/release -f $KUBE_DIR/_output/release/master-release.tgz master-release

98
icebox/release/config.sh Executable file
View File

@@ -0,0 +1,98 @@
# Copyright 2014 Google Inc. All rights reserved.
#
# 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.
# A set of defaults for Kubernetes releases
if [ "$(which gcloud)" == "" ]; then
echo "Couldn't find gcloud in PATH"
exit 1
fi
if [ -n "$(gcloud auth list 2>&1 | grep 'No credentialed accounts')" ]; then
gcloud auth login
fi
PROJECT=$(gcloud config list project | tail -n 1 | cut -f 3 -d ' ')
if [ ! -n "$PROJECT" ]; then
echo "Default project is not set."
echo "Please run gcloud config set project <project>"
exit 1
fi
if which md5 > /dev/null 2>&1; then
HASH=$(md5 -q -s $PROJECT)
else
HASH=$(echo -n "$PROJECT" | md5sum)
fi
HASH=${HASH:0:5}
RELEASE_BUCKET=${RELEASE_BUCKET-gs://kubernetes-releases-$HASH/}
RELEASE_PREFIX=${RELEASE_PREFIX-devel/$USER/}
RELEASE_NAME=${RELEASE_NAME-r$(date -u +%Y%m%d-%H%M%S)}
# This is a 'soft link' to the release in question. It is a single line file to
# the full GS path for a release.
RELEASE_TAG=${RELEASE_TAG-testing}
RELEASE_TAR_FILE=master-release.tgz
RELEASE_FULL_PATH=$RELEASE_BUCKET$RELEASE_PREFIX$RELEASE_NAME
RELEASE_FULL_TAG_PATH=$RELEASE_BUCKET$RELEASE_PREFIX$RELEASE_TAG
# Takes a release path ($1 if passed, otherwise $RELEASE_FULL_TAG_PATH) and
# computes the normalized release path. Results are stored in
# $RELEASE_NORMALIZED. Returns 0 if a valid release can be found.
function normalize_release() {
RELEASE_NORMALIZED=${1-$RELEASE_FULL_TAG_PATH}
# First test to see if there is a valid release at this path.
if gsutil -q stat $RELEASE_NORMALIZED/$RELEASE_TAR_FILE; then
return 0
fi
# Check if this is a simple file. If so, read it and use the result as the
# new RELEASE_NORMALIZED.
if gsutil -q stat $RELEASE_NORMALIZED; then
RELEASE_NORMALIZED=$(gsutil -q cat $RELEASE_NORMALIZED)
normalize_release $RELEASE_NORMALIZED
return
fi
return 1
}
# Sets a tag ($1) to a release ($2)
function set_tag() {
echo $2 | gsutil -q cp - $1
gsutil -q setmeta -h "Cache-Control:private, max-age=0, no-transform" $1
make_public_readable $1
}
# Makes a GCS object ($1) publicly readable
function make_public_readable() {
# Ideally we'd run the command below. But this is currently broken in the
# newest version of gsutil. Instead, download the ACL and edit the json
# quickly.
# gsutil -q acl ch -g AllUsers:R $1
TMPFILE=$(mktemp -t release 2>/dev/null || mktemp -t release.XXXX)
gsutil -q acl get $1 \
| python $(dirname $0)/make-public-gcs-acl.py \
> $TMPFILE
gsutil -q acl set $TMPFILE $RELEASE_FULL_PATH/$x
rm $TMPFILE
}

View File

@@ -0,0 +1,26 @@
# Copyright 2014 Google Inc. All rights reserved.
#
# 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 quick script that adds AllUsers as READER to a JSON file
# representing an ACL on a GCS object. This is a quick workaround for a bug in
# gsutil.
import json
import sys
acl = json.load(sys.stdin)
acl.append({
"entity": "allUsers",
"role": "READER"
})
json.dump(acl, sys.stdout)

View File

@@ -0,0 +1,44 @@
#!/bin/bash
# Copyright 2014 Google Inc. All rights reserved.
#
# 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 file is meant to run on the master. It takes the release in the current
# directory and installs everything that needs to be installed. It will then
# also kick off a saltstack config pass
RELEASE_BASE=$(dirname $0)/../..
echo "Installing release files"
# Put all of the salt stuff under /srv
mkdir -p /srv
cp -R --preserve=mode $RELEASE_BASE/src/saltbase/* /srv
# Copy various go source code into the right places in the salt directory
# hieararchy so it can be downloaded/built on all the nodes.
mkdir -p /srv/salt/apiserver/go
cp -R --preserve=mode $RELEASE_BASE/src/go/* /srv/salt/apiserver/go
mkdir -p /srv/salt/kube-proxy/go
cp -R --preserve=mode $RELEASE_BASE/src/go/* /srv/salt/kube-proxy/go
mkdir -p /srv/salt/controller-manager/go
cp -R --preserve=mode $RELEASE_BASE/src/go/* /srv/salt/controller-manager/go
mkdir -p /srv/salt/scheduler/go
cp -R --preserve=mode $RELEASE_BASE/src/go/* /srv/salt/scheduler/go
mkdir -p /srv/salt/kubelet/go
cp -R --preserve=mode $RELEASE_BASE/src/go/* /srv/salt/kubelet/go

View File

@@ -0,0 +1,26 @@
# Copyright 2014 Google Inc. All rights reserved.
#
# 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.
# A set of Cloud Files defaults for which Kubernetes releases will be uploaded to
# Make sure swiftly is installed and available
if [ "$(which swiftly)" == "" ]; then
echo "release/rackspace/config.sh: Couldn't find swiftly in PATH. Please install swiftly:"
echo -e "\tpip install swiftly"
exit 1
fi
CONTAINER="kubernetes-releases-${OS_USERNAME}"
TAR_FILE=master-release.tgz

View File

@@ -0,0 +1,49 @@
#!/bin/bash
# Copyright 2014 Google Inc. All rights reserved.
#
# 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 script will build and release Kubernetes.
#
# The main parameters to this script come from the config.sh file. This is set
# up by default for development releases. Feel free to edit it or override some
# of the variables there.
# exit on any error
set -e
SCRIPT_DIR=$(CDPATH="" cd $(dirname $0); pwd)
source $SCRIPT_DIR/config.sh
KUBE_REPO_ROOT="$(cd "$(dirname "$0")/../../" && pwd -P)"
source "${KUBE_REPO_ROOT}/cluster/kube-env.sh"
source $SCRIPT_DIR/../../cluster/rackspace/${KUBE_CONFIG_FILE-"config-default.sh"}
source $SCRIPT_DIR/../../cluster/rackspace/util.sh
$SCRIPT_DIR/../build-release.sh $INSTANCE_PREFIX
# Copy everything up to swift object store
echo "release/rackspace/release.sh: Uploading to Cloud Files"
if ! swiftly -A $OS_AUTH_URL -U $OS_USERNAME -K $OS_PASSWORD get $CONTAINER > /dev/null 2>&1 ; then
echo "release/rackspace/release.sh: Container doesn't exist. Creating..."
swiftly -A $OS_AUTH_URL -U $OS_USERNAME -K $OS_PASSWORD put $CONTAINER > /dev/null 2>&1
fi
for x in master-release.tgz; do
swiftly -A $OS_AUTH_URL -U $OS_USERNAME -K $OS_PASSWORD put -i _output/release/$x $CONTAINER/output/release/$x > /dev/null 2>&1
done
echo "Release pushed."

86
icebox/release/release.sh Executable file
View File

@@ -0,0 +1,86 @@
#!/bin/bash
# Copyright 2014 Google Inc. All rights reserved.
#
# 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 script will build and release Kubernetes.
#
# The main parameters to this script come from the config.sh file. This is set
# up by default for development releases. Feel free to edit it or override some
# of the variables there.
# exit on any error
set -e
gsutil_version=$(gsutil version | awk '{split($0,a," "); print a[3]}')
# Warning! uses lexical comparison. This really only works for major versions, or minor versions up to x.9
min_gsutil_version="4.0"
if [[ "$gsutil_version" < "$min_gsutil_version" ]]; then
echo "gsutil version $min_gsutil_version or greater is required, please run 'gcloud components upgrade'"
exit 1
fi
SCRIPT_DIR=$(CDPATH="" cd $(dirname $0); pwd)
source $SCRIPT_DIR/config.sh
KUBE_REPO_ROOT="$(cd "$(dirname "$0")/../" && pwd -P)"
source "${KUBE_REPO_ROOT}/cluster/kube-env.sh"
source $(dirname ${BASH_SOURCE})/../cluster/${KUBERNETES_PROVIDER}/${KUBE_CONFIG_FILE-"config-default.sh"}
cd $SCRIPT_DIR/..
$SCRIPT_DIR/build-release.sh $INSTANCE_PREFIX
echo "Building launch script"
# Create the local install script. These are the tools to install the local
# tools and launch a new cluster.
LOCAL_RELEASE_DIR=_output/release/local-release
mkdir -p $LOCAL_RELEASE_DIR/src/scripts
cp -r cluster/templates $LOCAL_RELEASE_DIR/src/templates
cp -r cluster/*.sh $LOCAL_RELEASE_DIR/src/scripts
tar cz -C $LOCAL_RELEASE_DIR -f _output/release/launch-kubernetes.tgz .
echo "#!/bin/bash" >> _output/release/launch-kubernetes.sh
echo "RELEASE_TAG=$RELEASE_TAG" >> _output/release/launch-kubernetes.sh
echo "RELEASE_PREFIX=$RELEASE_PREFIX" >> _output/release/launch-kubernetes.sh
echo "RELEASE_NAME=$RELEASE_NAME" >> _output/release/launch-kubernetes.sh
echo "RELEASE_FULL_PATH=$RELEASE_FULL_PATH" >> _output/release/launch-kubernetes.sh
cat release/launch-kubernetes-base.sh >> _output/release/launch-kubernetes.sh
chmod a+x _output/release/launch-kubernetes.sh
# Now copy everything up to the release structure on GS
echo "Uploading to Google Storage"
if ! gsutil ls $RELEASE_BUCKET > /dev/null 2>&1 ; then
echo "Creating $RELEASE_BUCKET"
gsutil mb $RELEASE_BUCKET
fi
for x in master-release.tgz launch-kubernetes.tgz launch-kubernetes.sh; do
gsutil -q cp _output/release/$x $RELEASE_FULL_PATH/$x
make_public_readable $RELEASE_FULL_PATH/$x
done
set_tag $RELEASE_FULL_TAG_PATH $RELEASE_FULL_PATH
echo "Release pushed ($RELEASE_PREFIX$RELEASE_NAME)."
# This isn't quite working right now. Need to figure out packaging the kubecfg tool.
# echo " Launch with:"
# echo
# echo " curl -s -L ${RELEASE_FULL_PATH/gs:\/\//http://storage.googleapis.com/}/launch-kubernetes.sh | bash"
# echo