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 galaxy k8s recipe #110

Merged
merged 3 commits into from
Mar 4, 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
100 changes: 100 additions & 0 deletions artifacts/k8s_galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
- name: Install Galaxy
hosts: localhost
connection: local
vars:
NAMESPACE: galaxy
admin_users: "{{ galaxy_admin_users | default('[email protected]') }}"
tasks:
- name: Install Git
package: name=git

- 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
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 }}
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: |
persistence:
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
41 changes: 41 additions & 0 deletions templates/k8s_galaxy.yaml
Original file line number Diff line number Diff line change
@@ -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: '[email protected]'

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/' ] }
1 change: 1 addition & 0 deletions templates/kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ metadata:
- k8s_wget.yml
- yProv.yml
- flink.yaml
- k8s_galaxy.yaml
- dydns_egi_update_k8s.yml

topology_template:
Expand Down