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
ea675621
Commit
ea675621
authored
Jun 10, 2015
by
Jeff Lowdermilk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow gke provider to handle internal gcloud versions for testing.
parent
d2b17a5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
14 deletions
+23
-14
config-common.sh
cluster/gke/config-common.sh
+1
-0
util.sh
cluster/gke/util.sh
+22
-14
No files found.
cluster/gke/config-common.sh
View file @
ea675621
...
...
@@ -28,6 +28,7 @@ NETWORK="${NETWORK:-default}"
NETWORK_RANGE
=
"
${
NETWORK_RANGE
:-
10
.240.0.0/16
}
"
FIREWALL_SSH
=
"
${
FIREWALL_SSH
:-${
NETWORK
}
-allow-ssh
}
"
GCLOUD
=
"
${
GCLOUD
:-
gcloud
}
"
CMD_GROUP
=
"
${
CMD_GROUP
:-
alpha
}
"
GCLOUD_CONFIG_DIR
=
"
${
GCLOUD_CONFIG_DIR
:-${
HOME
}
/.config/gcloud/kubernetes
}
"
ENABLE_CLUSTER_DNS
=
false
...
...
cluster/gke/util.sh
View file @
ea675621
...
...
@@ -100,6 +100,7 @@ function verify-prereqs() {
fi
${
sudo_prefix
}
gcloud
${
gcloud_prompt
:-}
components update preview
||
true
${
sudo_prefix
}
gcloud
${
gcloud_prompt
:-}
components update alpha||
true
${
sudo_prefix
}
gcloud
${
gcloud_prompt
:-}
components update kubectl||
true
${
sudo_prefix
}
gcloud
${
gcloud_prompt
:-}
components update
||
true
}
...
...
@@ -116,18 +117,18 @@ function kube-up() {
detect-project
>
&2
# Make the specified network if we need to.
if
!
gcloud
compute networks
--project
"
${
PROJECT
}
"
describe
"
${
NETWORK
}
"
&>/dev/null
;
then
if
!
"
${
GCLOUD
}
"
compute networks
--project
"
${
PROJECT
}
"
describe
"
${
NETWORK
}
"
&>/dev/null
;
then
echo
"Creating new network:
${
NETWORK
}
"
>
&2
gcloud
compute networks create
"
${
NETWORK
}
"
--project
=
"
${
PROJECT
}
"
--range
"
${
NETWORK_RANGE
}
"
"
${
GCLOUD
}
"
compute networks create
"
${
NETWORK
}
"
--project
=
"
${
PROJECT
}
"
--range
"
${
NETWORK_RANGE
}
"
else
echo
"Using network:
${
NETWORK
}
"
>
&2
fi
# Allow SSH on all nodes in the network. This doesn't actually check whether
# such a rule exists, only whether we've created this exact rule.
if
!
gcloud
compute firewall-rules
--project
"
${
PROJECT
}
"
describe
"
${
FIREWALL_SSH
}
"
&>/dev/null
;
then
if
!
"
${
GCLOUD
}
"
compute firewall-rules
--project
"
${
PROJECT
}
"
describe
"
${
FIREWALL_SSH
}
"
&>/dev/null
;
then
echo
"Creating new firewall for SSH:
${
FIREWALL_SSH
}
"
>
&2
gcloud
compute firewall-rules create
"
${
FIREWALL_SSH
}
"
\
"
${
GCLOUD
}
"
compute firewall-rules create
"
${
FIREWALL_SSH
}
"
\
--allow
=
"tcp:22"
\
--network
=
"
${
NETWORK
}
"
\
--project
=
"
${
PROJECT
}
"
\
...
...
@@ -136,13 +137,20 @@ function kube-up() {
echo
"Using firewall-rule:
${
FIREWALL_SSH
}
"
>
&2
fi
local
create_args
=(
"--zone=
${
ZONE
}
"
"--project=
${
PROJECT
}
"
"--num-nodes=
${
NUM_MINIONS
}
"
"--network=
${
NETWORK
}
"
)
if
[[
!
-z
"
${
DOGFOOD_GCLOUD
:-}
"
]]
;
then
create_args+
=(
"--cluster-version=
${
CLUSTER_API_VERSION
:-}
"
)
else
create_args+
=(
"--cluster-api-version=
${
CLUSTER_API_VERSION
:-}
"
)
fi
# Bring up the cluster.
"
${
GCLOUD
}
"
alpha container clusters create
"
${
CLUSTER_NAME
}
"
\
--zone
=
"
${
ZONE
}
"
\
--project
=
"
${
PROJECT
}
"
\
--cluster-api-version
=
"
${
CLUSTER_API_VERSION
:-}
"
\
--num-nodes
=
"
${
NUM_MINIONS
}
"
\
--network
=
"
${
NETWORK
}
"
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters create
"
${
CLUSTER_NAME
}
"
"
${
create_args
[@]
}
"
}
# Execute prior to running tests to initialize required structure. This is
...
...
@@ -191,10 +199,10 @@ function test-setup() {
function
get-password
()
{
echo
"... in get-password()"
>
&2
detect-project
>
&2
KUBE_USER
=
$(
"
${
GCLOUD
}
"
alpha
container clusters describe
\
KUBE_USER
=
$(
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters describe
\
--project
=
"
${
PROJECT
}
"
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
\
|
grep
user |
cut
-f
4
-d
' '
)
KUBE_PASSWORD
=
$(
"
${
GCLOUD
}
"
alpha
container clusters describe
\
KUBE_PASSWORD
=
$(
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters describe
\
--project
=
"
${
PROJECT
}
"
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
\
|
grep
password |
cut
-f
4
-d
' '
)
}
...
...
@@ -211,7 +219,7 @@ function detect-master() {
echo
"... in detect-master()"
>
&2
detect-project
>
&2
KUBE_MASTER
=
"k8s-
${
CLUSTER_NAME
}
-master"
KUBE_MASTER_IP
=
$(
"
${
GCLOUD
}
"
alpha
container clusters describe
\
KUBE_MASTER_IP
=
$(
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters describe
\
--project
=
"
${
PROJECT
}
"
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
\
|
grep
endpoint |
cut
-f
2
-d
' '
)
}
...
...
@@ -310,6 +318,6 @@ function test-teardown() {
function
kube-down
()
{
echo
"... in kube-down()"
>
&2
detect-project
>
&2
"
${
GCLOUD
}
"
alpha
container clusters delete
--project
=
"
${
PROJECT
}
"
\
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters delete
--project
=
"
${
PROJECT
}
"
\
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
--quiet
}
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