From 1af0ea6554edcba9906ce26f08f75ea20a98a5ca Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 4 Mar 2024 13:29:10 +0100 Subject: [PATCH 1/3] Add galaxy k8s recipe --- artifacts/k8s_galaxy.yml | 100 ++++++++++++++++++++++++++++++++++++++ templates/k8s_galaxy.yaml | 41 ++++++++++++++++ templates/kubernetes.yaml | 1 + 3 files changed, 142 insertions(+) create mode 100644 artifacts/k8s_galaxy.yml create mode 100644 templates/k8s_galaxy.yaml diff --git a/artifacts/k8s_galaxy.yml b/artifacts/k8s_galaxy.yml new file mode 100644 index 0000000..ec9b717 --- /dev/null +++ b/artifacts/k8s_galaxy.yml @@ -0,0 +1,100 @@ +--- +- name: Install Galaxy + hosts: localhost + connection: local + vars: + VERSION: "{{ kubeflow_manifests_version | default('v1.6.1') }}" + NAMESPACE: galaxy + admin_users: "{{ galaxy_admin_users | default('admin@galaxy.com') }}" + tasks: + - name: Install Git + package: name=git + + - name: Git clone galaxy-cvmfs-csi-helm repo + git: + repo: https://github.com/CloudVE/galaxy-cvmfs-csi-helm + dest: /opt/galaxy-cvmfs-csi-helm + update: false + + - name: Git clone galaxy-helm repo + git: + repo: https://github.com/galaxyproject/galaxy-helm + dest: /opt/galaxy-helm + update: false + + - name: "Check if galaxy-cvmfs is already deployed" + command: helm status galaxy-cvmfs -n {{ NAMESPACE }} + register: deployed + failed_when: deployed.rc != 0 and deployed.rc != 1 + changed_when: false + environment: + KUBECONFIG: /etc/kubernetes/admin.conf + + - when: deployed.rc == 1 + block: + + - name: Update Galaxy CVMFS CSI chart dependencies + command: helm dep up + args: + chdir: /opt/galaxy-cvmfs-csi-helm/galaxy-cvmfs-csi + creates: /opt/galaxy-cvmfs-csi-helm/galaxy-cvmfs-csi/charts + environment: + KUBECONFIG: /etc/kubernetes/admin.conf + + - name: Deploy Galaxy CVMFS CSI + command: helm install --create-namespace -n {{ NAMESPACE }} galaxy-cvmfs . --wait --set storageClassName="galaxy-cvmfs" --set cvmfscsi.cache.alien.pvc.storageClass=managed-nfs-storage --set cvmfscsi.cache.alien.pvc.name="cvmfs-alien-cache" + args: + chdir: /opt/galaxy-cvmfs-csi-helm/galaxy-cvmfs-csi + environment: + KUBECONFIG: /etc/kubernetes/admin.conf + + - name: "Check if galaxy is already deployed" + command: helm status galaxy -n {{ NAMESPACE }} + register: deployed + changed_when: false + failed_when: deployed.rc != 0 and deployed.rc != 1 + environment: + KUBECONFIG: /etc/kubernetes/admin.conf + + - when: deployed.rc == 1 + block: + + - name: Update Galaxy chart dependencies + command: helm dep up + args: + chdir: /opt/galaxy-helm/galaxy + creates: /opt/galaxy-helm/galaxy/charts + environment: + KUBECONFIG: /etc/kubernetes/admin.conf + + + - name: Create flink K8s resources file + copy: + dest: /opt/galaxy_values.yaml + mode: '644' + content: | + persistebnce: + accessMode: ReadWriteOnce + cvmfs: + deploy: false + storageClassName: galaxy-cvmfs + configs: + galaxy.yaml: + galaxy: + admin_users: {{ admin_users }} + + - name: Deploy Galaxy + command: helm install --create-namespace -n {{ NAMESPACE }} my-galaxy . --timeout 10m -f /opt/galaxy_values.yaml + args: + chdir: /opt/galaxy-helm/galaxy + environment: + KUBECONFIG: /etc/kubernetes/admin.conf + + - name: Wait a bit for pods to start + pause: + seconds: 120 + + - name: Delete CreateContainerConfigError pods + command: kubectl delete pods -n {{ NAMESPACE }} --field-selector="status.phase=Pending" + register: error_pods + changed_when: error_pods.stdout_lines | length > 1 diff --git a/templates/k8s_galaxy.yaml b/templates/k8s_galaxy.yaml new file mode 100644 index 0000000..abdbc8e --- /dev/null +++ b/templates/k8s_galaxy.yaml @@ -0,0 +1,41 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +imports: + - grycap_custom_types: https://raw.githubusercontent.com/grycap/tosca/main/custom_types.yaml + +description: Deploy Galaxy on top of a Kubernetes Virtual Cluster. + +metadata: + template_version: "0.1.0" + template_name: Galaxy + display_name: Galaxy on top of a Kubernetes Virtual Cluster + icon: images/galaxy.png + parents: + - kubernetes.yaml + +topology_template: + + inputs: + galaxy_admin_users: + type: string + description: Administrative users - set this to a comma-separated list of valid Galaxy users (email addresses). + default: 'admin@admin.com' + + node_templates: + + galaxy: + type: tosca.nodes.ec3.Application + requirements: + - host: front + - dependency: lrms_front_end + interfaces: + Standard: + configure: + implementation: https://raw.githubusercontent.com/grycap/tosca/main/artifacts/k8s_galaxy.yml + inputs: + galaxy_admin_users: { get_input: galaxy_admin_users } + + + outputs: + grafana_endpoint: + value: { concat: [ 'https://', get_attribute: [ front, public_address, 0 ], '/galaxy/' ] } diff --git a/templates/kubernetes.yaml b/templates/kubernetes.yaml index e77b306..9e1088d 100644 --- a/templates/kubernetes.yaml +++ b/templates/kubernetes.yaml @@ -41,6 +41,7 @@ metadata: - k8s_wget.yml - yProv.yml - flink.yaml + - k8s_galaxy.yaml - dydns_egi_update_k8s.yml topology_template: From 2b32393fc206675072930e0810391b91f9af76fe Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 4 Mar 2024 13:42:57 +0100 Subject: [PATCH 2/3] Fix lint --- artifacts/k8s_galaxy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artifacts/k8s_galaxy.yml b/artifacts/k8s_galaxy.yml index ec9b717..4f74e51 100644 --- a/artifacts/k8s_galaxy.yml +++ b/artifacts/k8s_galaxy.yml @@ -10,13 +10,13 @@ - name: Install Git package: name=git - - name: Git clone galaxy-cvmfs-csi-helm repo + - name: Clone galaxy-cvmfs-csi-helm git repo git: repo: https://github.com/CloudVE/galaxy-cvmfs-csi-helm dest: /opt/galaxy-cvmfs-csi-helm update: false - - name: Git clone galaxy-helm repo + - name: Clone galaxy-helm git repo git: repo: https://github.com/galaxyproject/galaxy-helm dest: /opt/galaxy-helm From f34149a45afbb41a8c81e4667e78d4532feb9db8 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 4 Mar 2024 13:48:34 +0100 Subject: [PATCH 3/3] Fix lint --- artifacts/k8s_galaxy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/artifacts/k8s_galaxy.yml b/artifacts/k8s_galaxy.yml index 4f74e51..8987533 100644 --- a/artifacts/k8s_galaxy.yml +++ b/artifacts/k8s_galaxy.yml @@ -3,7 +3,6 @@ hosts: localhost connection: local vars: - VERSION: "{{ kubeflow_manifests_version | default('v1.6.1') }}" NAMESPACE: galaxy admin_users: "{{ galaxy_admin_users | default('admin@galaxy.com') }}" tasks: @@ -15,12 +14,14 @@ repo: https://github.com/CloudVE/galaxy-cvmfs-csi-helm dest: /opt/galaxy-cvmfs-csi-helm update: false + version: "master" - name: Clone galaxy-helm git repo git: repo: https://github.com/galaxyproject/galaxy-helm dest: /opt/galaxy-helm update: false + version: "master" - name: "Check if galaxy-cvmfs is already deployed" command: helm status galaxy-cvmfs -n {{ NAMESPACE }} @@ -32,7 +33,7 @@ - when: deployed.rc == 1 block: - + - name: Update Galaxy CVMFS CSI chart dependencies command: helm dep up args: @@ -67,13 +68,12 @@ environment: KUBECONFIG: /etc/kubernetes/admin.conf - - name: Create flink K8s resources file copy: dest: /opt/galaxy_values.yaml mode: '644' content: | - persistebnce: + persistence: accessMode: ReadWriteOnce cvmfs: deploy: false