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
6c7ee0b5
Commit
6c7ee0b5
authored
Jun 11, 2015
by
Abhi Shah
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9639 from jlowdermilk/gke-provider
Allow gke provider to handle internal gcloud versions for testing.
parents
562c756b
ea675621
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 @
6c7ee0b5
...
@@ -28,6 +28,7 @@ NETWORK="${NETWORK:-default}"
...
@@ -28,6 +28,7 @@ NETWORK="${NETWORK:-default}"
NETWORK_RANGE
=
"
${
NETWORK_RANGE
:-
10
.240.0.0/16
}
"
NETWORK_RANGE
=
"
${
NETWORK_RANGE
:-
10
.240.0.0/16
}
"
FIREWALL_SSH
=
"
${
FIREWALL_SSH
:-${
NETWORK
}
-allow-ssh
}
"
FIREWALL_SSH
=
"
${
FIREWALL_SSH
:-${
NETWORK
}
-allow-ssh
}
"
GCLOUD
=
"
${
GCLOUD
:-
gcloud
}
"
GCLOUD
=
"
${
GCLOUD
:-
gcloud
}
"
CMD_GROUP
=
"
${
CMD_GROUP
:-
alpha
}
"
GCLOUD_CONFIG_DIR
=
"
${
GCLOUD_CONFIG_DIR
:-${
HOME
}
/.config/gcloud/kubernetes
}
"
GCLOUD_CONFIG_DIR
=
"
${
GCLOUD_CONFIG_DIR
:-${
HOME
}
/.config/gcloud/kubernetes
}
"
ENABLE_CLUSTER_DNS
=
false
ENABLE_CLUSTER_DNS
=
false
...
...
cluster/gke/util.sh
View file @
6c7ee0b5
...
@@ -100,6 +100,7 @@ function verify-prereqs() {
...
@@ -100,6 +100,7 @@ function verify-prereqs() {
fi
fi
${
sudo_prefix
}
gcloud
${
gcloud_prompt
:-}
components update preview
||
true
${
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 alpha||
true
${
sudo_prefix
}
gcloud
${
gcloud_prompt
:-}
components update kubectl||
true
${
sudo_prefix
}
gcloud
${
gcloud_prompt
:-}
components update
||
true
${
sudo_prefix
}
gcloud
${
gcloud_prompt
:-}
components update
||
true
}
}
...
@@ -116,18 +117,18 @@ function kube-up() {
...
@@ -116,18 +117,18 @@ function kube-up() {
detect-project
>
&2
detect-project
>
&2
# Make the specified network if we need to.
# 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
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
else
echo
"Using network:
${
NETWORK
}
"
>
&2
echo
"Using network:
${
NETWORK
}
"
>
&2
fi
fi
# Allow SSH on all nodes in the network. This doesn't actually check whether
# 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.
# 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
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"
\
--allow
=
"tcp:22"
\
--network
=
"
${
NETWORK
}
"
\
--network
=
"
${
NETWORK
}
"
\
--project
=
"
${
PROJECT
}
"
\
--project
=
"
${
PROJECT
}
"
\
...
@@ -136,13 +137,20 @@ function kube-up() {
...
@@ -136,13 +137,20 @@ function kube-up() {
echo
"Using firewall-rule:
${
FIREWALL_SSH
}
"
>
&2
echo
"Using firewall-rule:
${
FIREWALL_SSH
}
"
>
&2
fi
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.
# Bring up the cluster.
"
${
GCLOUD
}
"
alpha container clusters create
"
${
CLUSTER_NAME
}
"
\
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters create
"
${
CLUSTER_NAME
}
"
"
${
create_args
[@]
}
"
--zone
=
"
${
ZONE
}
"
\
--project
=
"
${
PROJECT
}
"
\
--cluster-api-version
=
"
${
CLUSTER_API_VERSION
:-}
"
\
--num-nodes
=
"
${
NUM_MINIONS
}
"
\
--network
=
"
${
NETWORK
}
"
}
}
# Execute prior to running tests to initialize required structure. This is
# Execute prior to running tests to initialize required structure. This is
...
@@ -191,10 +199,10 @@ function test-setup() {
...
@@ -191,10 +199,10 @@ function test-setup() {
function
get-password
()
{
function
get-password
()
{
echo
"... in get-password()"
>
&2
echo
"... in get-password()"
>
&2
detect-project
>
&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
}
"
\
--project
=
"
${
PROJECT
}
"
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
\
|
grep
user |
cut
-f
4
-d
' '
)
|
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
}
"
\
--project
=
"
${
PROJECT
}
"
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
\
|
grep
password |
cut
-f
4
-d
' '
)
|
grep
password |
cut
-f
4
-d
' '
)
}
}
...
@@ -211,7 +219,7 @@ function detect-master() {
...
@@ -211,7 +219,7 @@ function detect-master() {
echo
"... in detect-master()"
>
&2
echo
"... in detect-master()"
>
&2
detect-project
>
&2
detect-project
>
&2
KUBE_MASTER
=
"k8s-
${
CLUSTER_NAME
}
-master"
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
}
"
\
--project
=
"
${
PROJECT
}
"
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
\
|
grep
endpoint |
cut
-f
2
-d
' '
)
|
grep
endpoint |
cut
-f
2
-d
' '
)
}
}
...
@@ -310,6 +318,6 @@ function test-teardown() {
...
@@ -310,6 +318,6 @@ function test-teardown() {
function
kube-down
()
{
function
kube-down
()
{
echo
"... in kube-down()"
>
&2
echo
"... in kube-down()"
>
&2
detect-project
>
&2
detect-project
>
&2
"
${
GCLOUD
}
"
alpha
container clusters delete
--project
=
"
${
PROJECT
}
"
\
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters delete
--project
=
"
${
PROJECT
}
"
\
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
--quiet
--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