Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
8aae8647
Commit
8aae8647
authored
Jun 06, 2015
by
Justin Santa Barbara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AWS: Support wheezy, for parity with GCE
parent
7ff4adb0
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
186 additions
and
39 deletions
+186
-39
config-default.sh
cluster/aws/config-default.sh
+1
-1
config-test.sh
cluster/aws/config-test.sh
+1
-1
util.sh
cluster/aws/coreos/util.sh
+2
-0
options.md
cluster/aws/options.md
+6
-0
common.sh
cluster/aws/templates/common.sh
+4
-0
format-disks.sh
cluster/aws/templates/format-disks.sh
+6
-0
common.sh
cluster/aws/ubuntu/common.sh
+51
-0
util.sh
cluster/aws/ubuntu/util.sh
+3
-30
util.sh
cluster/aws/util.sh
+31
-7
util.sh
cluster/aws/wheezy/util.sh
+81
-0
No files found.
cluster/aws/config-default.sh
View file @
8aae8647
...
...
@@ -87,7 +87,7 @@ ADMISSION_CONTROL=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContext
ENABLE_MINION_PUBLIC_IP
=
${
KUBE_ENABLE_MINION_PUBLIC_IP
:-
true
}
# OS options for minions
KUBE_OS_DISTRIBUTION
=
"
${
KUBE_OS_DISTRIBUTION
:-
ubuntu
}
"
KUBE_OS_DISTRIBUTION
=
"
${
KUBE_OS_DISTRIBUTION
:-
wheezy
}
"
KUBE_MINION_IMAGE
=
"
${
KUBE_MINION_IMAGE
:-}
"
COREOS_CHANNEL
=
"
${
COREOS_CHANNEL
:-
alpha
}
"
CONTAINER_RUNTIME
=
"
${
KUBE_CONTAINER_RUNTIME
:-
docker
}
"
...
...
cluster/aws/config-test.sh
View file @
8aae8647
...
...
@@ -84,7 +84,7 @@ ADMISSION_CONTROL=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContext
ENABLE_MINION_PUBLIC_IP
=
${
KUBE_ENABLE_MINION_PUBLIC_IP
:-
true
}
# OS options for minions
KUBE_OS_DISTRIBUTION
=
"
${
KUBE_OS_DISTRIBUTION
:-
ubuntu
}
"
KUBE_OS_DISTRIBUTION
=
"
${
KUBE_OS_DISTRIBUTION
:-
wheezy
}
"
KUBE_MINION_IMAGE
=
"
${
KUBE_MINION_IMAGE
:-}
"
COREOS_CHANNEL
=
"
${
COREOS_CHANNEL
:-
alpha
}
"
CONTAINER_RUNTIME
=
"
${
KUBE_CONTAINER_RUNTIME
:-
docker
}
"
...
...
cluster/aws/coreos/util.sh
View file @
8aae8647
...
...
@@ -16,6 +16,8 @@
# A library of helper functions for CoreOS.
SSH_USER
=
ubuntu
function
detect-minion-image
(){
if
[[
-z
"
${
KUBE_MINION_IMAGE
-
}
"
]]
;
then
KUBE_MINION_IMAGE
=
$(
curl
-s
-L
http://
${
COREOS_CHANNEL
}
.release.core-os.net/amd64-usr/current/coreos_production_ami_all.json | python
-c
"import json,sys;obj=json.load(sys.stdin);print filter(lambda t: t['name']=='
${
AWS_REGION
}
', obj['amis'])[0]['hvm']"
)
...
...
cluster/aws/options.md
View file @
8aae8647
...
...
@@ -70,4 +70,10 @@ will run on this storage if available, as typically the root disk is comparative
If your machines don't have any ephemeral disks, this will default to the aufs driver on your root disk (with no LVM).
**KUBE_OS_DISTRIBUTION**
The distribution to use. Valid options:
`wheezy`
,
`ubuntu`
,
`coreos`
.
Defaults to wheezy (Debian Wheezy), which is the same as is used by default on GCE.
[

]()
cluster/aws/templates/common.sh
View file @
8aae8647
...
...
@@ -14,6 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
apt-get update
apt-get
install
--yes
curl
# Retry a download until we get it.
#
# $1 is the URL to download
...
...
cluster/aws/templates/format-disks.sh
View file @
8aae8647
...
...
@@ -55,6 +55,12 @@ docker_storage=${DOCKER_STORAGE:-aufs}
if
[[
${#
block_devices
[@]
}
==
0
]]
;
then
echo
"No ephemeral block devices found; will use aufs on root"
docker_storage
=
"aufs"
# Install aufs kernel module (for ubuntu)
apt-get
install
--yes
linux-image-extra-
$(
uname
-r
)
# Install aufs tools (for debian)
apt-get
install
--yes
aufs-tools
else
echo
"Block devices:
${
block_devices
[@]
}
"
...
...
cluster/aws/ubuntu/common.sh
0 → 100644
View file @
8aae8647
#!/bin/bash
# Copyright 2015 The Kubernetes Authors 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 library of common helper functions for Ubuntus & Debians.
function
detect-minion-image
()
{
if
[[
-z
"
${
KUBE_MINION_IMAGE
=-
}
"
]]
;
then
detect-image
KUBE_MINION_IMAGE
=
$AWS_IMAGE
fi
}
function
generate-minion-user-data
{
i
=
$1
# We pipe this to the ami as a startup script in the user-data field. Requires a compatible ami
echo
"#! /bin/bash"
echo
"SALT_MASTER='
${
MASTER_INTERNAL_IP
}
'"
echo
"MINION_IP_RANGE='
${
MINION_IP_RANGES
[
$i
]
}
'"
echo
"DOCKER_OPTS='
${
EXTRA_DOCKER_OPTS
:-}
'"
echo
"readonly DOCKER_STORAGE='
${
DOCKER_STORAGE
:-}
'"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/aws/templates/common.sh"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/aws/templates/format-disks.sh"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/aws/templates/salt-minion.sh"
}
function
check-minion
()
{
local
minion_name
=
$1
local
minion_ip
=
$2
local
output
=
$(
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
${
SSH_USER
}
@
$minion_ip
sudo
docker ps
-a
2>/dev/null
)
if
[[
-z
"
${
output
}
"
]]
;
then
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
${
SSH_USER
}
@
$minion_ip
sudo
service docker start
>
$LOG
2>&1
echo
"not working yet"
else
echo
"working"
fi
}
cluster/aws/ubuntu/util.sh
View file @
8aae8647
...
...
@@ -17,35 +17,8 @@
# A library of helper functions for Ubuntu.
function
detect-minion-image
()
{
if
[[
-z
"
${
KUBE_MINION_IMAGE
=-
}
"
]]
;
then
detect-image
KUBE_MINION_IMAGE
=
$AWS_IMAGE
fi
}
source
"
${
KUBE_ROOT
}
/cluster/aws/ubuntu/common.sh"
function
generate-minion-user-data
{
i
=
$1
# We pipe this to the ami as a startup script in the user-data field. Requires a compatible ami
echo
"#! /bin/bash"
echo
"SALT_MASTER='
${
MASTER_INTERNAL_IP
}
'"
echo
"MINION_IP_RANGE='
${
MINION_IP_RANGES
[
$i
]
}
'"
echo
"DOCKER_OPTS='
${
EXTRA_DOCKER_OPTS
:-}
'"
echo
"readonly DOCKER_STORAGE='
${
DOCKER_STORAGE
:-}
'"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/aws/templates/common.sh"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/aws/templates/format-disks.sh"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/aws/templates/salt-minion.sh"
}
# TODO: Move image detection in here once it is no longer shared with CoreOS
function
check-minion
()
{
local
minion_name
=
$1
local
minion_ip
=
$2
local
output
=
$(
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
ubuntu@
$minion_ip
sudo
docker ps
-a
2>/dev/null
)
if
[[
-z
"
${
output
}
"
]]
;
then
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
ubuntu@
$minion_ip
sudo
service docker start
>
$LOG
2>&1
echo
"not working yet"
else
echo
"working"
fi
}
SSH_USER
=
ubuntu
cluster/aws/util.sh
View file @
8aae8647
...
...
@@ -23,7 +23,7 @@ source "${KUBE_ROOT}/cluster/aws/${KUBE_CONFIG_FILE-"config-default.sh"}"
source
"
${
KUBE_ROOT
}
/cluster/common.sh"
case
"
${
KUBE_OS_DISTRIBUTION
}
"
in
ubuntu|coreos
)
ubuntu|
wheezy|
coreos
)
source
"
${
KUBE_ROOT
}
/cluster/aws/
${
KUBE_OS_DISTRIBUTION
}
/util.sh"
;;
*
)
...
...
@@ -172,10 +172,34 @@ function detect-security-groups {
}
# Detects the AMI to use (considering the region)
# This really should be in the various distro-specific util functions,
# but CoreOS uses this for the master, so for now it is here.
#
# TODO: Remove this and just have each distro implement detect-image
#
# Vars set:
# AWS_IMAGE
function
detect-image
()
{
case
"
${
KUBE_OS_DISTRIBUTION
}
"
in
ubuntu|coreos
)
detect-ubuntu-image
;;
wheezy
)
detect-wheezy-image
;;
*
)
echo
"Please specify AWS_IMAGE directly (distro not recognized)"
exit
2
;;
esac
}
# Detects the AMI to use for ubuntu (considering the region)
# Used by CoreOS & Ubuntu
#
# Vars set:
# AWS_IMAGE
function
detect-ubuntu-image
()
{
# This is the ubuntu 14.04 image for <region>, amd64, hvm:ebs-ssd
# See here: http://cloud-images.ubuntu.com/locator/ec2/ for other images
# This will need to be updated from time to time as amis are deprecated
...
...
@@ -854,7 +878,7 @@ function kube-up {
sleep
10
done
echo
"Re-running salt highstate"
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
ubuntu
@
${
KUBE_MASTER_IP
}
sudo
salt
'*'
state.highstate
>
$LOG
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
${
SSH_USER
}
@
${
KUBE_MASTER_IP
}
sudo
salt
'*'
state.highstate
>
$LOG
echo
"Waiting for cluster initialization."
echo
...
...
@@ -883,9 +907,9 @@ function kube-up {
# config file. Distribute the same way the htpasswd is done.
(
umask
077
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
"
ubuntu
@
${
KUBE_MASTER_IP
}
"
sudo cat
/srv/kubernetes/kubecfg.crt
>
"
${
KUBE_CERT
}
"
2>
"
$LOG
"
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
"
ubuntu
@
${
KUBE_MASTER_IP
}
"
sudo cat
/srv/kubernetes/kubecfg.key
>
"
${
KUBE_KEY
}
"
2>
"
$LOG
"
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
"
ubuntu
@
${
KUBE_MASTER_IP
}
"
sudo cat
/srv/kubernetes/ca.crt
>
"
${
CA_CERT
}
"
2>
"
$LOG
"
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
"
${
SSH_USER
}
@
${
KUBE_MASTER_IP
}
"
sudo cat
/srv/kubernetes/kubecfg.crt
>
"
${
KUBE_CERT
}
"
2>
"
$LOG
"
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
"
${
SSH_USER
}
@
${
KUBE_MASTER_IP
}
"
sudo cat
/srv/kubernetes/kubecfg.key
>
"
${
KUBE_KEY
}
"
2>
"
$LOG
"
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
"
${
SSH_USER
}
@
${
KUBE_MASTER_IP
}
"
sudo cat
/srv/kubernetes/ca.crt
>
"
${
CA_CERT
}
"
2>
"
$LOG
"
create-kubeconfig
)
...
...
@@ -1064,7 +1088,7 @@ function kube-push {
echo
"echo Executing configuration"
echo
"sudo salt '*' mine.update"
echo
"sudo salt --force-color '*' state.highstate"
)
| ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
ubuntu
@
${
KUBE_MASTER_IP
}
sudo
bash
)
| ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
${
SSH_USER
}
@
${
KUBE_MASTER_IP
}
sudo
bash
get-password
...
...
@@ -1130,7 +1154,7 @@ function ssh-to-node {
fi
for
try
in
$(
seq
1 5
)
;
do
if
ssh
-oLogLevel
=
quiet
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
ubuntu
@
${
ip
}
"
${
cmd
}
"
;
then
if
ssh
-oLogLevel
=
quiet
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
${
SSH_USER
}
@
${
ip
}
"
${
cmd
}
"
;
then
break
fi
done
...
...
cluster/aws/wheezy/util.sh
0 → 100644
View file @
8aae8647
#!/bin/bash
# Copyright 2015 The Kubernetes Authors 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 library of helper functions for Wheezy.
source
"
${
KUBE_ROOT
}
/cluster/aws/ubuntu/common.sh"
SSH_USER
=
admin
# Detects the AMI to use for wheezy (considering the region)
# Source: https://wiki.debian.org/Cloud/AmazonEC2Image/Wheezy
#
# Vars set:
# AWS_IMAGE
function
detect-wheezy-image
()
{
if
[[
-z
"
${
AWS_IMAGE
-
}
"
]]
;
then
case
"
${
AWS_REGION
}
"
in
ap-northeast-1
)
AWS_IMAGE
=
ami-b25d44b3
;;
ap-southeast-1
)
AWS_IMAGE
=
ami-aeb49ffc
;;
ap-southeast-2
)
AWS_IMAGE
=
ami-6b770351
;;
eu-central-1
)
AWS_IMAGE
=
ami-98043785
;;
eu-west-1
)
AWS_IMAGE
=
ami-61e56916
;;
sa-east-1
)
AWS_IMAGE
=
ami-3d8b3720
;;
us-east-1
)
AWS_IMAGE
=
ami-e0efab88
;;
us-west-1
)
AWS_IMAGE
=
ami-b4869ff1
;;
us-west-2
)
AWS_IMAGE
=
ami-431a4273
;;
us-gov-west-1
)
AWS_IMAGE
=
ami-d13455f2
;;
cn-north-1
)
AWS_IMAGE
=
ami-48029071
;;
*
)
echo
"Please specify AWS_IMAGE directly (region not recognized)"
exit
1
esac
fi
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment