Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Add a flag to disable hived scheduler during installation #5198

Merged
merged 5 commits into from
Dec 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions contrib/kubespray/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ docker_image_tag: v1.5.0

# Optional

#######################################################################
# OpenPAI Customized Settings #
#######################################################################
# enable_hived_scheduler: true

#############################################
# Ansible-playbooks' inventory hosts' vars. #
#############################################
Expand Down
30 changes: 16 additions & 14 deletions contrib/kubespray/quick-start/services-configuration.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ webportal:

# If you want to customize the scheduling config, such add more virtual clusters or more gpu types, check:
# https://github.com/microsoft/pai/blob/master/docs/manual/cluster-admin/how-to-set-up-virtual-clusters.md
{% if env["cfg"]["enable_hived_scheduler"]|default(true) is sameas true %}
hivedscheduler:
config: |
physicalCluster:
skuTypes:
{% for sku_name, sku_spec in env["hived"]["skus"].items() -%}
{%- for sku_name, sku_spec in env["hived"]["skus"].items() %}
{{ sku_name }}:
{%- if sku_spec.gpu %}
gpu: 1
Expand All @@ -61,9 +62,9 @@ hivedscheduler:
cpu: 1
{%- endif %}
memory: {{ sku_spec.memory }}Mi
{% endfor %}
{%- endfor %}
cellTypes:
{% for sku_name, sku_spec in env["hived"]["skus"].items() -%}
{%- for sku_name, sku_spec in env["hived"]["skus"].items() %}
{{ sku_name }}-NODE:
childCellType: {{ sku_name }}
{%- if sku_spec.gpu %}
Expand All @@ -75,27 +76,28 @@ hivedscheduler:
{{ sku_name }}-NODE-POOL:
childCellType: {{ sku_name }}-NODE
childCellNumber: {{ sku_spec.workers|length }}
{% endfor %}
{%- endfor %}
physicalCells:
{% for sku_name, sku_spec in env["hived"]["skus"].items() -%}
{%- for sku_name, sku_spec in env["hived"]["skus"].items() %}
- cellType: {{ sku_name }}-NODE-POOL
cellChildren:
{% for worker in sku_spec.workers -%}
{%- for worker in sku_spec.workers %}
- cellAddress: {{ worker }}
{% endfor %}
{% endfor -%}

{%- endfor %}
{%- endfor %}
virtualClusters:
{% for sku_name, sku_spec in env["hived"]["skus"].items() -%}
{% if loop.index0 == 0 %}
{%- for sku_name, sku_spec in env["hived"]["skus"].items() %}
{%- if loop.index0 == 0 %}
default:
{% else %}
{%- else %}
{{ sku_name }}:
{% endif %}
{%- endif %}
virtualCells:
- cellType: {{ sku_name }}-NODE-POOL.{{ sku_name }}-NODE
cellNumber: {{ sku_spec.workers|length }}
{% endfor %}
{%- endfor %}
{% else %}
{% endif %}

# uncomment following section, if you want to customize the authentication solution.
authentication:
Expand Down
9 changes: 8 additions & 1 deletion contrib/kubespray/script/openpai_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,14 @@ def main():

masters, workers = get_masters_workers_from_layout(layout)
head_node = masters[0]
hived_config = get_hived_config(layout, cluster_config)

# Hivedscheduler is enabled by default.
# But if the user sets enable_hived_scheduler to false manually,
# we should disable it.
if 'enable_hived_scheduler' in cluster_config and cluster_config['enable_hived_scheduler'] is False:
hived_config = {}
else:
hived_config = get_hived_config(layout, cluster_config)

environment = {
'masters': masters,
Expand Down