Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kubespray
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Kubespray
Commits
5707f79b
Commit
5707f79b
authored
5 years ago
by
Matthew Mosesohn
Committed by
Kubernetes Prow Robot
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Allow to configure number of kube-masters (#5073)
Change-Id: Ia3f30a1216b3ea063cd72c839ef6dff753cf10c6
parent
0a2f4edf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/inventory_builder/inventory.py
+6
-4
6 additions, 4 deletions
contrib/inventory_builder/inventory.py
with
6 additions
and
4 deletions
contrib/inventory_builder/inventory.py
+
6
−
4
View file @
5707f79b
...
...
@@ -59,6 +59,7 @@ def get_var_as_bool(name, default):
CONFIG_FILE
=
os
.
environ
.
get
(
"
CONFIG_FILE
"
,
"
./inventory/sample/hosts.yaml
"
)
KUBE_MASTERS
=
int
(
os
.
environ
.
get
(
"
KUBE_MASTERS_MASTERS
"
,
2
))
# Reconfigures cluster distribution at scale
SCALE_THRESHOLD
=
int
(
os
.
environ
.
get
(
"
SCALE_THRESHOLD
"
,
50
))
MASSIVE_SCALE_THRESHOLD
=
int
(
os
.
environ
.
get
(
"
SCALE_THRESHOLD
"
,
200
))
...
...
@@ -96,9 +97,10 @@ class KubesprayInventory(object):
etcd_hosts_count
=
3
if
len
(
self
.
hosts
.
keys
())
>=
3
else
1
self
.
set_etcd
(
list
(
self
.
hosts
.
keys
())[:
etcd_hosts_count
])
if
len
(
self
.
hosts
)
>=
SCALE_THRESHOLD
:
self
.
set_kube_master
(
list
(
self
.
hosts
.
keys
())[
etcd_hosts_count
:
5
])
self
.
set_kube_master
(
list
(
self
.
hosts
.
keys
())[
etcd_hosts_count
:(
etcd_hosts_count
+
KUBE_MASTERS
)])
else
:
self
.
set_kube_master
(
list
(
self
.
hosts
.
keys
())[:
2
])
self
.
set_kube_master
(
list
(
self
.
hosts
.
keys
())[:
KUBE_MASTERS
])
self
.
set_kube_node
(
self
.
hosts
.
keys
())
if
len
(
self
.
hosts
)
>=
SCALE_THRESHOLD
:
self
.
set_calico_rr
(
list
(
self
.
hosts
.
keys
())[:
etcd_hosts_count
])
...
...
@@ -203,11 +205,11 @@ class KubesprayInventory(object):
try
:
# Python 3.x
start
=
int
(
ip_address
(
start_address
))
end
=
int
(
ip_address
(
end_address
))
end
=
int
(
ip_address
(
end_address
))
except
:
# Python 2.7
start
=
int
(
ip_address
(
unicode
(
start_address
)))
end
=
int
(
ip_address
(
unicode
(
end_address
)))
end
=
int
(
ip_address
(
unicode
(
end_address
)))
return
[
ip_address
(
ip
).
exploded
for
ip
in
range
(
start
,
end
+
1
)]
for
host
in
hosts
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment