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
205ed2bf
Commit
205ed2bf
authored
May 08, 2015
by
Manfred Geiler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AWS: make it possible to disable minion public ip association
parent
e5b9f742
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
config-default.sh
cluster/aws/config-default.sh
+4
-0
util.sh
cluster/aws/util.sh
+23
-2
No files found.
cluster/aws/config-default.sh
View file @
205ed2bf
...
@@ -73,3 +73,7 @@ DNS_REPLICAS=1
...
@@ -73,3 +73,7 @@ DNS_REPLICAS=1
# Admission Controllers to invoke prior to persisting objects in cluster
# Admission Controllers to invoke prior to persisting objects in cluster
ADMISSION_CONTROL
=
NamespaceLifecycle,NamespaceAutoProvision,LimitRanger,SecurityContextDeny,ResourceQuota
ADMISSION_CONTROL
=
NamespaceLifecycle,NamespaceAutoProvision,LimitRanger,SecurityContextDeny,ResourceQuota
# Optional: Enable/disable public IP assignment for minions.
# Important Note: disable only if you have setup a NAT instance for internet access and configured appropriate routes!
ENABLE_MINION_PUBLIC_IP
=
${
KUBE_ENABLE_MINION_PUBLIC_IP
:-
true
}
cluster/aws/util.sh
View file @
205ed2bf
...
@@ -82,6 +82,14 @@ function get_instance_public_ip {
...
@@ -82,6 +82,14 @@ function get_instance_public_ip {
--query
Reservations[].Instances[].NetworkInterfaces[0].Association.PublicIp
--query
Reservations[].Instances[].NetworkInterfaces[0].Association.PublicIp
}
}
function
get_instance_private_ip
{
local
tagName
=
$1
$AWS_CMD
--output
text describe-instances
\
--filters
Name
=
tag:Name,Values
=
${
tagName
}
\
Name
=
instance-state-name,Values
=
running
\
Name
=
tag:KubernetesCluster,Values
=
${
CLUSTER_ID
}
\
--query
Reservations[].Instances[].NetworkInterfaces[0].PrivateIpAddress
}
function
detect-master
()
{
function
detect-master
()
{
KUBE_MASTER
=
${
MASTER_NAME
}
KUBE_MASTER
=
${
MASTER_NAME
}
...
@@ -98,7 +106,12 @@ function detect-master () {
...
@@ -98,7 +106,12 @@ function detect-master () {
function
detect-minions
()
{
function
detect-minions
()
{
KUBE_MINION_IP_ADDRESSES
=()
KUBE_MINION_IP_ADDRESSES
=()
for
((
i
=
0
;
i<
${#
MINION_NAMES
[@]
}
;
i++
))
;
do
for
((
i
=
0
;
i<
${#
MINION_NAMES
[@]
}
;
i++
))
;
do
local
minion_ip
=
$(
get_instance_public_ip
${
MINION_NAMES
[
$i
]
})
local
minion_ip
if
[[
"ENABLE_MINION_PUBLIC_IP"
==
"true"
]]
;
then
minion_ip
=
$(
get_instance_public_ip
${
MINION_NAMES
[
$i
]
})
else
minion_ip
=
$(
get_instance_private_ip
${
MINION_NAMES
[
$i
]
})
fi
echo
"Found
${
MINION_NAMES
[
$i
]
}
at
${
minion_ip
}
"
echo
"Found
${
MINION_NAMES
[
$i
]
}
at
${
minion_ip
}
"
KUBE_MINION_IP_ADDRESSES+
=(
"
${
minion_ip
}
"
)
KUBE_MINION_IP_ADDRESSES+
=(
"
${
minion_ip
}
"
)
done
done
...
@@ -542,6 +555,14 @@ function kube-up {
...
@@ -542,6 +555,14 @@ function kube-up {
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/aws/templates/format-disks.sh"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/aws/templates/format-disks.sh"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/aws/templates/salt-minion.sh"
grep
-v
"^#"
"
${
KUBE_ROOT
}
/cluster/aws/templates/salt-minion.sh"
)
>
"
${
KUBE_TEMP
}
/minion-start-
${
i
}
.sh"
)
>
"
${
KUBE_TEMP
}
/minion-start-
${
i
}
.sh"
local
public_ip_option
if
[[
"ENABLE_MINION_PUBLIC_IP"
==
"true"
]]
;
then
public_ip_option
=
"--associate-public-ip-address"
else
public_ip_option
=
"--no-associate-public-ip-address"
fi
minion_id
=
$(
$AWS_CMD
run-instances
\
minion_id
=
$(
$AWS_CMD
run-instances
\
--image-id
$AWS_IMAGE
\
--image-id
$AWS_IMAGE
\
--iam-instance-profile
Name
=
$IAM_PROFILE_MINION
\
--iam-instance-profile
Name
=
$IAM_PROFILE_MINION
\
...
@@ -550,7 +571,7 @@ function kube-up {
...
@@ -550,7 +571,7 @@ function kube-up {
--private-ip-address
$INTERNAL_IP_BASE
.1
${
i
}
\
--private-ip-address
$INTERNAL_IP_BASE
.1
${
i
}
\
--key-name
kubernetes
\
--key-name
kubernetes
\
--security-group-ids
$SEC_GROUP_ID
\
--security-group-ids
$SEC_GROUP_ID
\
--associate-public-ip-address
\
${
public_ip_option
}
\
--user-data
file://
${
KUBE_TEMP
}
/minion-start-
${
i
}
.sh | json_val
'["Instances"][0]["InstanceId"]'
)
--user-data
file://
${
KUBE_TEMP
}
/minion-start-
${
i
}
.sh | json_val
'["Instances"][0]["InstanceId"]'
)
add-tag
$minion_id
Name
${
MINION_NAMES
[
$i
]
}
add-tag
$minion_id
Name
${
MINION_NAMES
[
$i
]
}
...
...
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