Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nomad join template #142

Merged
merged 11 commits into from
May 7, 2024
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
2 changes: 1 addition & 1 deletion artifacts/lrms/helm_chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

- name: Create params fact
set_fact:
helm_params: "{{ item.key }}={{ item.value }},{{ helm_params }}"
helm_params: "{{ item.key }}='{{ item.value }}',{{ helm_params }}"
with_dict: "{{ helm_values }}"

- name: Create values file
Expand Down
7 changes: 6 additions & 1 deletion artifacts/lrms/kube_fe_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
export_hosts: "*.localdomain"
export_line: "(fsid=0,rw,async,no_root_squash,no_subtree_check,insecure)"
nfs_path: "{{ kube_nfs_path | default('/pv') }}"
csi_driver: "{{ kube_csi_driver | default('NFS') }}"

pre_tasks:
- name: Create dir for the NFS PV
Expand All @@ -22,11 +23,15 @@
set_fact:
export_hosts: "{{ ansible_default_ipv4.network }}/{{ ansible_default_ipv4.netmask }}"
when: IM_NODE_CLOUD_TYPE is defined and IM_NODE_CLOUD_TYPE == 'EC2'

- name: Set to install Longhorn CSI driver
set_fact:
kube_install_longhorn: true
when: csi_driver == 'Longhorn'
roles:
- role: grycap.nfs
nfs_mode: 'front'
nfs_exports: [{path: '{{ nfs_path }}', export: '{{ export_hosts }}{{ export_line }}'}]
when: csi_driver == 'NFS'
- role: grycap.kubernetes
kube_server: '{{ kube_front_end_ip }}'
kube_api_server: '{{ kube_front_end_ip }}'
Expand Down
2 changes: 2 additions & 0 deletions artifacts/lrms/kube_wn_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
connection: local
vars:
vnode_prefix: vnode-
csi_driver: "{{ kube_csi_driver | default('NFS') }}"
roles:
- role: grycap.nfs
nfs_mode: 'wn'
when: csi_driver == 'NFS'
- role: 'grycap.kubernetes'
kube_type_of_node: 'wn'
kube_server: '{{ kube_front_end_ip }}'
Expand Down
13 changes: 11 additions & 2 deletions artifacts/lrms/nomad_ai4eosc_fe_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@
pre_tasks:
- name: Convert server_list to list
set_fact:
server_list: [server_list]
when: server_list is string
server_list:
- "{{ server_list }}"
when:
- consul_server_join is not defined or consul_server_join == ''
- server_list is string

- name: Use consul_server_join to join the consul cluster
set_fact:
server_list:
- "{{ consul_server_join }}"
when: consul_server_join is defined and consul_server_join != ''
roles:
- role: 'grycap.consul'
consul_server: true
Expand Down
14 changes: 12 additions & 2 deletions artifacts/lrms/nomad_ai4eosc_wn_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@
pre_tasks:
- name: Convert server_list to list
set_fact:
server_list: [server_list]
when: server_list is string
server_list:
- "{{ server_list }}"
when:
- consul_server_join is not defined or consul_server_join == ''
- server_list is string

- name: Use consul_server_join to join the consul cluster
set_fact:
server_list:
- "{{ consul_server_join }}"
when: consul_server_join is defined and consul_server_join != ''

- name: Set nomad plugins var
set_fact:
nomad_plugins_var:
Expand Down
18 changes: 16 additions & 2 deletions custom_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,13 @@ node_types:
type: string
default: "docker"
constraints:
- valid_values: [ docker, containerd ]
- valid_values: [ docker, containerd, crio ]
csi_driver:
required: no
type: string
default: "NFS"
constraints:
- valid_values: [ NFS, Longhorn ]
artifacts:
kube_role:
file: grycap.kubernetes
Expand All @@ -601,6 +607,7 @@ node_types:
kube_version: { get_property: [ SELF, version ] }
kube_nvidia_support: { get_property: [ SELF, nvidia_support ] }
kube_cri_runtime: { get_property: [ SELF, cri_runtime ] }
kube_csi_driver: { get_property: [ SELF, csi_driver ] }

tosca.nodes.indigo.LRMS.FrontEnd.Kubernetes:
derived_from: tosca.nodes.indigo.LRMS.FrontEnd
Expand Down Expand Up @@ -686,7 +693,13 @@ node_types:
type: string
default: "docker"
constraints:
- valid_values: [ docker, containerd ]
- valid_values: [ docker, containerd, crio ]
csi_driver:
required: no
type: string
default: "NFS"
constraints:
- valid_values: [ NFS, Longhorn ]
artifacts:
kube_role:
file: grycap.kubernetes
Expand Down Expand Up @@ -728,6 +741,7 @@ node_types:
kube_cri_runtime: { get_property: [ SELF, cri_runtime ] }
kube_install_yunikorn: { get_property: [ SELF, install_yunikorn ] }
kube_deploy_dashboard: { get_property: [ SELF, install_dashboard ] }
kube_csi_driver: { get_property: [ SELF, csi_driver ] }

tosca.nodes.indigo.LRMS.WorkerNode.Slurm:
derived_from: tosca.nodes.indigo.LRMS.WorkerNode
Expand Down
1 change: 1 addition & 0 deletions templates/k8s_new_wn_type.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ topology_template:
version: { get_input: kube_version }
nvidia_support: { get_input: wng_kube_nvidia_support }
cri_runtime: { get_input: kube_cri_runtime }
csi_driver: { get_input: kube_csi_driver }
requirements:
- host: wng

Expand Down
17 changes: 13 additions & 4 deletions templates/kubernetes.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tosca_definitions_version: tosca_simple_yaml_1_0

imports:
- grycap_custom_types: https://raw.githubusercontent.com/grycap/tosca/main/custom_types.yaml
- grycap_custom_types: https://raw.githubusercontent.com/grycap/tosca/devel/custom_types.yaml

description: Deploy a Kubernetes Virtual Cluster.

Expand Down Expand Up @@ -164,11 +164,18 @@ topology_template:
description: DNS name of the public interface of the FE node to generate the certificate
default: ""

allowed_cidr:
kube_allowed_cidr:
type: string
description: Allowed remote CIDR to extenal access
default: "0.0.0.0/0"

kube_csi_driver:
type: string
description: Name of the CSI driver to install
default: NFS
constraints:
- valid_values: [ NFS, Longhorn ]

node_templates:

lrms_front_end:
Expand All @@ -180,11 +187,11 @@ topology_template:
http_port:
protocol: tcp
source: 80
remote_cidr: { get_input: allowed_cidr }
remote_cidr: { get_input: kube_allowed_cidr }
https_port:
protocol: tcp
source: 443
remote_cidr: { get_input: allowed_cidr }
remote_cidr: { get_input: kube_allowed_cidr }
properties:
admin_username: kubeuser
install_nfs_client: true
Expand All @@ -196,6 +203,7 @@ topology_template:
cert_user_email: { get_input: kube_cert_user_email }
public_dns_name: { get_input: kube_public_dns_name}
cri_runtime: { get_input: kube_cri_runtime }
csi_driver: { get_input: kube_csi_driver }
requirements:
- host: front

Expand Down Expand Up @@ -236,6 +244,7 @@ topology_template:
version: { get_input: kube_version }
nvidia_support: { get_input: wn_kube_nvidia_support }
cri_runtime: { get_input: kube_cri_runtime }
csi_driver: { get_input: kube_csi_driver }
requirements:
- host: wn

Expand Down
Loading