Skip to content

Commit f283848

Browse files
committed
Add Rackspace to build/release.sh
Updates to the build/release.sh scripts to upload build binaries to Cloud Files.
1 parent a8bae68 commit f283848

File tree

7 files changed

+37
-86
lines changed

7 files changed

+37
-86
lines changed

build/common.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -672,13 +672,15 @@ function kube::release::rackspace::release() {
672672
[[ ${KUBE_RACKSPACE_UPLOAD_RELEASE-y} =~ ^[yY]$ ]] || return 0
673673

674674
CLOUDFILES_CONTAINER="kubernetes-releases-${OS_USERNAME}"
675+
KUBE_RACKSPACE_RELEASE_BUCKET=${KUBE_RACKSPACE_RELEASE_BUCKET-kubernetes-releases-${OS_USERNAME}}
676+
KUBE_RACKSPACE_RELEASE_PREFIX=${KUBE_RACKSPACE_RELEASE_PREFIX-devel/}
675677

676678
kube::release::rackspace::verify_prereqs
677679
kube::release::rackspace::ensure_release_container
678680
kube::release::rackspace::copy_release_tarballs
679681
}
680682

681-
# Verify things are set up for uploading to GCS
683+
# Verify things are set up for uploading to Rackspace
682684
function kube::release::rackspace::verify_prereqs() {
683685

684686
# Make sure swiftly is installed and available
@@ -709,9 +711,6 @@ function kube::release::rackspace::verify_prereqs() {
709711

710712
function kube::release::rackspace::ensure_release_container() {
711713

712-
KUBE_RACKSPACE_RELEASE_BUCKET=${KUBE_RACKSPACE_RELEASE_BUCKET-kubernetes-releases-${OS_USERNAME}}
713-
KUBE_RACKSPACE_RELEASE_PREFIX=${KUBE_RACKSPACE_RELEASE_PREFIX-devel/}
714-
715714
SWIFTLY_CMD="swiftly -A ${OS_AUTH_URL} -U ${OS_USERNAME} -K ${OS_PASSWORD}"
716715

717716
if ! ${SWIFTLY_CMD} get ${CLOUDFILES_CONTAINER} > /dev/null 2>&1 ; then
@@ -720,9 +719,9 @@ function kube::release::rackspace::ensure_release_container() {
720719
fi
721720
}
722721

722+
# Copy kubernetes-server-linux-amd64.tar.gz to cloud files object store
723723
function kube::release::rackspace::copy_release_tarballs() {
724724

725-
# Copy release tar.gz to cloud files object store
726725
echo "build/common.sh: Uploading to Cloud Files"
727726
${SWIFTLY_CMD} put -i ${RELEASE_DIR}/kubernetes-server-linux-amd64.tar.gz ${CLOUDFILES_CONTAINER}/devel/kubernetes-server-linux-amd64.tar.gz > /dev/null 2>&1
728727

build/release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ kube::build::copy_output
4141
kube::build::run_image
4242
kube::release::package_tarballs
4343

44-
kube::release::${KUBERNETES_PROVIDER}::release
44+
kube::release::${KUBERNETES_PROVIDER-gce}::release

cluster/rackspace/cloud-config/master-cloud-config.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ write_files:
2222
#!/bin/bash
2323
OBJECT_URL="CLOUD_FILES_URL"
2424
echo "Downloading release ($OBJECT_URL)"
25-
wget $OBJECT_URL -O /opt/kubernetes.tar.gz
25+
wget "${OBJECT_URL}" -O /opt/kubernetes.tar.gz
2626
echo "Unpacking release"
2727
rm -rf /opt/kubernetes || false
2828
tar xzf /opt/kubernetes.tar.gz -C /opt/
@@ -47,8 +47,6 @@ coreos:
4747
reboot-strategy: etcd-lock
4848

4949
units:
50-
#- name: nova-agent-watcher.service
51-
# command: try-restart
5250
- name: etcd.service
5351
command: start
5452
- name: fleet.service
@@ -78,8 +76,8 @@ coreos:
7876
Requires=download-release.service
7977
[Service]
8078
EnvironmentFile=-/run/apiserver/minions.env
81-
ExecStartPre=/usr/bin/ln -sf /opt/kubernetes/platforms/linux/amd64/apiserver /opt/bin/apiserver
82-
ExecStart=/opt/bin/apiserver --address=127.0.0.1 --port=8080 --machines=${MINIONS} --etcd_servers=http://127.0.0.1:4001 --logtostderr=true
79+
ExecStartPre=/usr/bin/ln -sf /opt/kubernetes/server/bin/apiserver /opt/bin/apiserver
80+
ExecStart=/opt/bin/apiserver --address=127.0.0.1 --port=8080 --machines=${MINIONS} --etcd_servers=http://127.0.0.1:4001 --portal_net="PORTAL_NET" --logtostderr=true
8381
Restart=always
8482
RestartSec=2
8583
- name: master-apiserver-sighup.path
@@ -117,7 +115,7 @@ coreos:
117115
After=master-apiserver.service
118116
Requires=master-apiserver.service
119117
[Service]
120-
ExecStartPre=/usr/bin/ln -sf /opt/kubernetes/platforms/linux/amd64/controller-manager /opt/bin/controller-manager
118+
ExecStartPre=/usr/bin/ln -sf /opt/kubernetes/server/bin/controller-manager /opt/bin/controller-manager
121119
ExecStart=/opt/bin/controller-manager --master=127.0.0.1:8080 --logtostderr=true
122120
Restart=always
123121
RestartSec=2
@@ -132,10 +130,11 @@ coreos:
132130
After=master-apiserver.service
133131
Requires=master-apiserver.service
134132
[Service]
135-
ExecStartPre=/usr/bin/ln -sf /opt/kubernetes/platforms/linux/amd64/scheduler /opt/bin/scheduler
133+
ExecStartPre=/usr/bin/ln -sf /opt/kubernetes/server/bin/scheduler /opt/bin/scheduler
136134
ExecStart=/opt/bin/scheduler --master=127.0.0.1:8080 --logtostderr=true
137135
Restart=always
138136
RestartSec=10
137+
#Running nginx service with --net="host" is a necessary evil until running all k8s services in docker.
139138
- name: kubernetes-nginx.service
140139
command: start
141140
content: |

cluster/rackspace/cloud-config/minion-cloud-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ write_files:
1616
permissions: 0755
1717
content: |
1818
#!/bin/bash
19-
OBJECT_URL="http://storage.googleapis.com/kubernetes-releases-56726/devel/kubernetes.tar.gz"
19+
OBJECT_URL="CLOUD_FILES_URL"
2020
echo "Downloading release ($OBJECT_URL)"
21-
wget $OBJECT_URL -O /opt/kubernetes.tar.gz
21+
wget "${OBJECT_URL}" -O /opt/kubernetes.tar.gz
2222
echo "Unpacking release"
2323
rm -rf /opt/kubernetes || false
2424
tar xzf /opt/kubernetes.tar.gz -C /opt/
@@ -102,7 +102,7 @@ coreos:
102102
After=download-release.service
103103
Requires=download-release.service
104104
[Service]
105-
ExecStartPre=/usr/bin/ln -sf /opt/kubernetes/platforms/linux/amd64/kubelet /opt/bin/kubelet
105+
ExecStartPre=/usr/bin/ln -sf /opt/kubernetes/server/bin/kubelet /opt/bin/kubelet
106106
ExecStart=/opt/bin/kubelet --address=$private_ipv4 --hostname_override=$private_ipv4 --etcd_servers=http://127.0.0.1:4001 --logtostderr=true --config=/opt/kubernetes-manifests
107107
Restart=always
108108
RestartSec=2
@@ -119,7 +119,7 @@ coreos:
119119
After=download-release.service
120120
Requires=download-release.service
121121
[Service]
122-
ExecStartPre=/usr/bin/ln -sf /opt/kubernetes/platforms/linux/amd64/proxy /opt/bin/proxy
122+
ExecStartPre=/usr/bin/ln -sf /opt/kubernetes/server/bin/proxy /opt/bin/proxy
123123
ExecStart=/opt/bin/proxy --bind_address=$private_ipv4 --etcd_servers=http://127.0.0.1:4001 --logtostderr=true
124124
Restart=always
125125
RestartSec=2

cluster/rackspace/util.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,14 @@ find-release-tars() {
8383
fi
8484
}
8585

86+
# Retrieves a tempurl from cloudfiles to make the release object publicly accessible for 6 hours.
8687
find-object-url() {
8788

8889
RELEASE=kubernetes-releases-${OS_USERNAME}/devel/kubernetes-server-linux-amd64.tar.gz
8990

90-
TEMP_URL=$(swiftly -A ${OS_AUTH_URL} -U ${OS_USERNAME} -K ${OS_PASSWORD} tempurl GET $RELEASE)
91+
RELEASE_TMP_URL=$(swiftly -A ${OS_AUTH_URL} -U ${OS_USERNAME} -K ${OS_PASSWORD} tempurl GET ${RELEASE})
9192
echo "cluster/rackspace/util.sh: Object temp URL:"
92-
echo -e "\t${TEMP_URL}"
93+
echo -e "\t${RELEASE_TMP_URL}"
9394

9495
}
9596

@@ -99,19 +100,16 @@ rax-boot-master() {
99100
DISCOVERY_ID=$(echo "${DISCOVERY_URL}" | cut -f 4 -d /)
100101
echo "cluster/rackspace/util.sh: etcd discovery URL: ${DISCOVERY_URL}"
101102

102-
get-password
103-
find-object-url
104-
105103
# Copy cloud-config to KUBE_TEMP and work some sed magic
106104
sed -e "s|DISCOVERY_ID|${DISCOVERY_ID}|" \
107-
-e "s|CLOUD_FILES_URL|${TEMP_URL}|" \
105+
-e "s|CLOUD_FILES_URL|${RELEASE_TMP_URL//&/\&}|" \
108106
-e "s|KUBE_USER|${KUBE_USER}|" \
109107
-e "s|KUBE_PASSWORD|${KUBE_PASSWORD}|" \
110108
-e "s|PORTAL_NET|${PORTAL_NET}|" \
111109
$(dirname $0)/rackspace/cloud-config/master-cloud-config.yaml > $KUBE_TEMP/master-cloud-config.yaml
112110

113111

114-
MASTER_BOOT_CMD="nova boot \
112+
MASTER_BOOT_CMD="nova boot
115113
--key-name ${SSH_KEY_NAME} \
116114
--flavor ${KUBE_MASTER_FLAVOR} \
117115
--image ${KUBE_IMAGE} \
@@ -136,7 +134,7 @@ rax-boot-minions() {
136134

137135
sed -e "s|DISCOVERY_ID|${DISCOVERY_ID}|" \
138136
-e "s|INDEX|$((i + 1))|g" \
139-
-e "s|CLOUD_FILES_URL|${TEMP_URL}|" \
137+
-e "s|CLOUD_FILES_URL|${RELEASE_TMP_URL//&/\&}|" \
140138
$(dirname $0)/rackspace/cloud-config/minion-cloud-config.yaml > $KUBE_TEMP/minion-cloud-config-$(($i + 1)).yaml
141139

142140

@@ -204,7 +202,7 @@ kube-up() {
204202
# Find the release to use. Generally it will be passed when doing a 'prod'
205203
# install and will default to the release/config.sh version when doing a
206204
# developer up.
207-
#find-object-url $CONTAINER output/release/$TAR_FILE
205+
find-object-url
208206

209207
# Create a temp directory to hold scripts that will be uploaded to master/minions
210208
KUBE_TEMP=$(mktemp -d -t kubernetes.XXXXXX)
Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# Rackspace
2-
In general, the dev-build-and-up.sh workflow for Rackspace is the similar to GCE. The specific implementation is different due to the use of CoreOS and network design.
2+
In general, the dev-build-and-up.sh workflow for Rackspace is the similar to GCE. The specific implementation is different due to the use of CoreOS, Rackspace Cloud Files and network design.
33

4+
These scripts should be used to deploy development environments for Kubernetes. If your account leverages RackConnect or non-standard networking, these scripts will most likely not work without modification.
45

5-
NOTE: The rackspace scripts do NOT rely on saltstack.
6-
7-
For older versions please either:
8-
* Sync back to `v0.3` with `git checkout v0.3`
9-
* Download a [snapshot of `v0.3`](https://github.com/GoogleCloudPlatform/kubernetes/archive/v0.3.tar.gz)
6+
NOTE: The rackspace scripts do NOT rely on `saltstack`.
107

118
The current cluster design is inspired by:
129
- [corekube](https://github.com/metral/corekube/)
@@ -15,17 +12,16 @@ The current cluster design is inspired by:
1512
## Prerequisites
1613
1. You need to have both `nova` and `swiftly` installed. It's recommended to use a python virtualenv to install these packages into.
1714
2. Make sure you have the appropriate environment variables set to interact with the OpenStack APIs. See [Rackspace Documentation](http://docs.rackspace.com/servers/api/v2/cs-gettingstarted/content/section_gs_install_nova.html) for more details.
18-
3. You can test this by running `nova list` to make sure you're authenticated successfully.
1915

2016
## Provider: Rackspace
2117
- To use Rackspace as the provider, set the KUBERNETES_PROVIDER ENV variable:
22-
`export KUBERNETES_PROVIDER=rackspace` and run the `bash cluster/kube-up.sh` script.
18+
`export KUBERNETES_PROVIDER=rackspace` and run the `bash hack/dev-build-and-up.sh` script.
2319

2420
## Build
25-
1. The kubernetes binaries will be built via the common build scripts in `release/`. There is a specific `release/rackspace` directory with scripts for the following steps:
21+
1. The kubernetes binaries will be built via the common build scripts in `build/`.
22+
2. If you've set the ENV `KUBERNETES_PROVIDER=rackspace`, the scripts will upload `kubernetes-server-linux-amd64.tar.gz` to Cloud Files.
2623
2. A cloud files container will be created via the `swiftly` CLI and a temp URL will be enabled on the object.
27-
3. The built `master-release.tar.gz` will be uploaded to this container and the URL will be passed to master/minions nodes when booted.
28-
- NOTE: RELEASE tagging and launch scripts are not used currently.
24+
3. The built `kubernetes-server-linux-amd64.tar.gz` will be uploaded to this container and the URL will be passed to master/minions nodes when booted.
2925

3026
## Cluster
3127
1. There is a specific `cluster/rackspace` directory with the scripts for the following steps:
@@ -37,3 +33,11 @@ The current cluster design is inspired by:
3733
## Some notes:
3834
- The scripts expect `eth2` to be the cloud network that the containers will communicate across.
3935
- A number of the items in `config-default.sh` are overridable via environment variables.
36+
- For older versions please either:
37+
* Sync back to `v0.3` with `git checkout v0.3`
38+
* Download a [snapshot of `v0.3`](https://github.com/GoogleCloudPlatform/kubernetes/archive/v0.3.tar.gz)
39+
40+
## Network Design
41+
- eth0 - Public Interface used for servers/containers to reach the internet
42+
- eth1 - ServiceNet - Intra-cluster communication (k8s, etcd, etc) communicate via this interface. The `cloud-config` files use the special CoreOS identifier `$private_ipv4` to configure the services.
43+
- eth2 - Cloud Network - Used for k8s pods to communicate with one another. The proxy service will pass traffic via this interface.

icebox/release/rackspace/release.sh

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)