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

Streamline deployment of GESIS stage server #3090

Open
wants to merge 89 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
3d12173
Add Ansible inventory for GESIS stage cluster
rgaiacs Sep 6, 2024
615616c
Add k8s-common role
rgaiacs Sep 6, 2024
4425d65
Add Ansible playbook for GESIS
rgaiacs Sep 6, 2024
ae31186
Merge branch '2-add-ansible' into 'gesis'
rgaiacs Sep 6, 2024
c958b24
Add GitLab CI
rgaiacs Sep 6, 2024
6f8395c
Add GitLab CI Kubernetes agent for stage
rgaiacs Sep 6, 2024
37aa3ec
Merge branch '3-add-kubernetes-agent' into 'gesis'
rgaiacs Sep 6, 2024
021a460
Add Ansible vault
rgaiacs Sep 6, 2024
fe4ea58
Remove manual option for GitLab CI
rgaiacs Sep 6, 2024
117388d
Remove ssh-key-type from GitLab CI
rgaiacs Sep 6, 2024
7116f3d
Upgrade Ansible Component
rgaiacs Sep 6, 2024
d0d5e2c
Upgrade Ansible Component
rgaiacs Sep 6, 2024
8309a9d
Add smoke test
rgaiacs Sep 6, 2024
83be832
Add EditorConfig
rgaiacs Sep 6, 2024
7c53fb9
Fix warming from Ansible
rgaiacs Sep 6, 2024
80504b1
Remove rules for debug
rgaiacs Sep 6, 2024
b6446ff
Fix Ansible Vault
rgaiacs Sep 6, 2024
8bc5dae
Fix SSH key type
rgaiacs Sep 6, 2024
df28ecc
Enable root for Ansible
rgaiacs Sep 6, 2024
a7cad6e
Merge branch '3-add-gitlab-ci' into 'gesis'
rgaiacs Sep 6, 2024
4b166bc
Configure Kubernetes control panel
rgaiacs Sep 6, 2024
ea58fd9
Configure Kubernetes worker
rgaiacs Sep 6, 2024
4e7ed15
Configure kernels modules at boot
rgaiacs Sep 6, 2024
2022823
Configure Calico
rgaiacs Sep 6, 2024
6f8bb6f
Configure JupyterHub worker
rgaiacs Sep 6, 2024
0cf34cc
Add labels to Kubernetes nodes
rgaiacs Sep 6, 2024
05b9c61
Fix Ansible warnings
rgaiacs Sep 6, 2024
f8153f8
Fix path to calico custom resources
rgaiacs Sep 6, 2024
96761ea
Fix loopup based on ChatGPT answer
rgaiacs Sep 6, 2024
c5a00dc
Fix missing / in path
rgaiacs Sep 6, 2024
51ab533
Fix file location
rgaiacs Sep 6, 2024
12b2004
Add shebang to file
rgaiacs Sep 6, 2024
cf71456
Add more configuration to Kubernetes control node
rgaiacs Sep 6, 2024
db0a3b0
Merge branch '1-streamline-gesis-deployment' into 'gesis'
rgaiacs Sep 6, 2024
6c9cd16
Configure Helm deploy
rgaiacs Sep 6, 2024
4e27fb0
Remove GitLab CI conditions
rgaiacs Sep 6, 2024
aae82c4
Fix Helm lint
rgaiacs Sep 6, 2024
3c12ac8
Fix Helm lint
rgaiacs Sep 6, 2024
6078f82
Move helm lint to deploy
rgaiacs Sep 6, 2024
3e00c3b
Deploy secondary Helm chart
rgaiacs Sep 6, 2024
aacb307
More Helm configuration
rgaiacs Sep 6, 2024
585d36d
Fix Docker registry
rgaiacs Sep 6, 2024
44a908f
Fix shell for loop
rgaiacs Sep 6, 2024
7a59c8b
Fix another shell for loop
rgaiacs Sep 6, 2024
0a0777f
Fix name of helm release
rgaiacs Sep 6, 2024
26fe00f
Add hosts to Helm configuration
rgaiacs Sep 6, 2024
bb93d9a
Clean git repository
rgaiacs Sep 6, 2024
092ad7c
Do a clean clone of repository
rgaiacs Sep 6, 2024
65e374e
Fix Helm lint
rgaiacs Sep 6, 2024
178fbfe
Install Cert Manager
rgaiacs Sep 6, 2024
edb74ad
Add ingress-nginx
rgaiacs Sep 6, 2024
a072fa7
Fix NGINX ingress resources
rgaiacs Sep 6, 2024
511bf6e
Merge branch '1-add-helm-deploy' into 'gesis'
rgaiacs Sep 6, 2024
2a0406e
Remove duplicated resource
rgaiacs Sep 6, 2024
ebd4e08
Change externalTrafficPolicy
rgaiacs Sep 6, 2024
d05e4b2
Reduce replica
rgaiacs Sep 6, 2024
1fd8a9d
Merge branch '1-fix-network' into 'gesis'
rgaiacs Sep 6, 2024
dc609fe
Remove externalTrafficPolicy
rgaiacs Sep 6, 2024
98cca57
Merge branch '7-externalTrafficPolicy' into 'gesis'
rgaiacs Sep 6, 2024
ad430e1
Add nodeSelector to Helm
rgaiacs Sep 6, 2024
be0e078
Node selector must be string
rgaiacs Sep 6, 2024
77dc966
Add serviceAccountKey
rgaiacs Sep 9, 2024
ef55444
Disable analyticsPublisher
rgaiacs Sep 9, 2024
aa2c522
Reformat GESIS configuration
rgaiacs Sep 9, 2024
0a27dd6
Add persistent volume
rgaiacs Sep 10, 2024
b7b0065
Add more Persistent Volume
rgaiacs Sep 10, 2024
d702e4c
Break long task list
rgaiacs Sep 10, 2024
7e8b68b
Avoid code duplication
rgaiacs Sep 10, 2024
8157371
Update labels
rgaiacs Sep 10, 2024
f03e8f3
Fix role name
rgaiacs Sep 10, 2024
5f94ef7
Use variables
rgaiacs Sep 10, 2024
df49925
Fix Prometheus storage
rgaiacs Sep 10, 2024
25a3c6e
Fix 'You cannot use loops on 'import_tasks' statements.'
rgaiacs Sep 10, 2024
a8befce
Fix variables in Ansible inventory
rgaiacs Sep 10, 2024
18ca405
Remove NGINX
rgaiacs Sep 10, 2024
4379fa3
Change persistentVolumeReclaimPolicy to Retain
rgaiacs Sep 10, 2024
e55b2e9
Add storage class name
rgaiacs Sep 10, 2024
ef2f224
Disable storage for grafana
rgaiacs Sep 10, 2024
4dcbe9d
Update GESIS configuration
rgaiacs Sep 10, 2024
dd2d484
Add common config to GESIS to deployment
rgaiacs Sep 10, 2024
bfb7d6b
Remove custom dashboard for GESIS
rgaiacs Sep 10, 2024
53070fe
Change Prometheus to ClusterIP
rgaiacs Sep 10, 2024
f34c54c
Reduce NGINX ingress to one
rgaiacs Sep 10, 2024
639912b
Reduce replica of NGINX
rgaiacs Sep 10, 2024
f72a7d0
Bind NGINX Ingress Pod port to host
rgaiacs Sep 10, 2024
ba31e01
Configure ingress to avoid conflict
rgaiacs Sep 10, 2024
7ee9360
Fix Helm lint
rgaiacs Sep 10, 2024
a7374e5
Fix values don't meet the specifications
rgaiacs Sep 10, 2024
556188d
Avoid conflic with static badge
rgaiacs Sep 10, 2024
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
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[ansible/**]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
81 changes: 81 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
variables:
GIT_STRATEGY: clone
GIT_CLEAN_FLAGS: "-ffdx"

stages:
- build
- deploy-stage-ansible
- deploy-stage-helm
- test-stage
- deploy-prod-nginx
- deploy-prod-helm

include:
- component: $CI_SERVER_FQDN/rse/docker/images/ansible/ansible-lint@10.2.6
inputs:
stage: build
dir: ansible

- component: $CI_SERVER_FQDN/rse/docker/images/ansible/ansible-deploy@10.2.6
inputs:
stage: deploy-stage-ansible
dir: ansible
inventory: gesis-stage
playbook: gesis.yml
ssh-user: ansible
ssh-key-type: ed25519

.gesis helm deploy:
image:
name: docker-private.gesis.intra/gesis/ilcm/orc2/k8s:latest
entrypoint: [""]
variables:
HELM_ENVIRONMENT: template
script:
- cat $git_crypt_secret_key | base64 -d > git_crypt_secret_key
- git-crypt unlock git_crypt_secret_key
- kubectl config use-context ${CI_PROJECT_PATH}:${HELM_ENVIRONMENT}
- helm version
- |
for d in ./mybinder*/; do
helm dependency update "$d";
done
- |
for chart in mybinder-kube-system mybinder-tigera-operator; do
helm upgrade \
${chart:9} ./${chart} \
--cleanup-on-fail \
--create-namespace \
--history-max 3 \
--install \
--namespace=${chart};
done
- |
helm lint ./mybinder \
--values ./config/gesis-${HELM_ENVIRONMENT}.yaml
- |
helm upgrade \
binderhub ./mybinder \
--cleanup-on-fail \
--create-namespace \
--history-max 3 \
--install \
--namespace=gesis \
--render-subchart-notes \
--values ./config/gesis-${HELM_ENVIRONMENT}.yaml \
--values ./secrets/config/common/common.yaml \
--values ./secrets/config/common/cryptnono.yaml \
--values ./secrets/config/gesis-${HELM_ENVIRONMENT}.yaml

gesis helm stage deploy:
resource_group: stage
stage: deploy-stage-helm
variables:
HELM_ENVIRONMENT: stage
extends:
- .gesis helm deploy

smoke test to stage cluster:
stage: test-stage
script:
- curl https://notebooks-test.gesis.org/binder/
3 changes: 3 additions & 0 deletions .gitlab/agents/stage/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ci_access:
projects:
- id: methods-hub/interactive-environment
29 changes: 29 additions & 0 deletions ansible/gesis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- name: Configure servers that are part of Kubernetes cluster
hosts: all
gather_facts: false
become: true
roles:
- k8s-common
- name: Configure Kubernetes control panel
hosts: kubernetes_control_panel
gather_facts: false
become: true
roles:
- k8s-control-panel
- name: Configure Kubernetes workers
hosts: kubernetes_workers
gather_facts: false
become: true
roles:
- k8s-worker
- name: Configure JupyterHub workers
hosts: jupyterhub_single_user
gather_facts: false
become: true
roles:
- k8s-worker
- name: Configure mybinder.org Kubernetes cluster
hosts: kubernetes_control_panel
gather_facts: false
roles:
- mybinder
41 changes: 41 additions & 0 deletions ansible/inventories/gesis-stage
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[all]
#svko-ilcm04 ansible_host=194.95.75.14 ansible_ssh_user=ansible ansible_become_pass='{{ become_pass_194_95_75_14 }}'
svko-css-backup-node ansible_host=194.95.75.20 ansible_ssh_user=ansible ansible_become_pass='{{ become_pass_194_95_75_20 }}'
svko-k8s-test01 ansible_host=194.95.75.21 ansible_ssh_user=ansible ansible_become_pass='{{ become_pass_194_95_75_21 }}'
svko-k8s-test02 ansible_host=194.95.75.22 ansible_ssh_user=ansible ansible_become_pass='{{ become_pass_194_95_75_22 }}'
svko-k8s-test03 ansible_host=194.95.75.23 ansible_ssh_user=ansible ansible_become_pass='{{ become_pass_194_95_75_23 }}'

[all:vars]
INVENTORY_NAME=stage
K8S_CONTROL_PLANE_ENDPOINT=194.95.75.21
K8S_CONTROL_PLANE_ALIAS=svko-k8s-test01

[notebooks_gesis_org]
svko-css-backup-node

[kubernetes_control_panel]
svko-k8s-test01

[kubernetes_workers]
#svko-ilcm04
svko-css-backup-node
svko-k8s-test02
svko-k8s-test03

[ingress]
svko-css-backup-node

[harbor]
svko-css-backup-node

[binderhub]
svko-k8s-test02

[jupyterhub_single_user]
svko-k8s-test03

[prometheus]
svko-css-backup-node

[grafana]
svko-css-backup-node
45 changes: 45 additions & 0 deletions ansible/roles/jupyterhub/files/var/lib/kubelet/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:
anonymous:
enabled: false
webhook:
cacheTTL: 0s
enabled: true
x509:
clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:
mode: Webhook
webhook:
cacheAuthorizedTTL: 0s
cacheUnauthorizedTTL: 0s
cgroupDriver: systemd
clusterDNS:
- 10.96.0.10
clusterDomain: cluster.local
cpuManagerReconcilePeriod: 0s
evictionPressureTransitionPeriod: 0s
fileCheckFrequency: 0s
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 0s
imageMinimumGCAge: 0s
kind: KubeletConfiguration
logging:
flushFrequency: 0
options:
json:
infoBufferSize: "0"
verbosity: 0
memorySwap: {}
nodeStatusReportFrequency: 0s
nodeStatusUpdateFrequency: 0s
resolvConf: /run/systemd/resolve/resolv.conf
rotateCertificates: true
runtimeRequestTimeout: 0s
shutdownGracePeriod: 0s
shutdownGracePeriodCriticalPods: 0s
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 0s
syncFrequency: 0s
volumeStatsAggPeriod: 0s
maxPods: 500
15 changes: 15 additions & 0 deletions ansible/roles/jupyterhub/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- name: Stop kubelet service
ansible.builtin.systemd:
name: kubelet
state: stopped
- name: Copy kubelet configuration
ansible.builtin.copy:
src: ../var/lib/kubelet/config.yaml
dest: /var/lib/kubelet/config.yaml
owner: root
group: root
mode: u=rw,g=r,o=r
- name: Restarted kubelet service
ansible.builtin.systemd:
name: kubelet
state: restarted
Loading