Skip to content

Commit

Permalink
adding sheepdog
Browse files Browse the repository at this point in the history
  • Loading branch information
EliseCastle23 committed Mar 13, 2024
1 parent 5fd0bab commit 43b2058
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 3 deletions.
3 changes: 3 additions & 0 deletions gen3/bin/kube-setup-sheepdog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ fi
# deploy sheepdog
gen3 roll sheepdog
g3kubectl apply -f "${GEN3_HOME}/kube/services/sheepdog/sheepdog-service.yaml"
g3kubectl apply -f "${GEN3_HOME}/kube/services/sheepdog/sheepdog-nginx.conf"
g3kubectl apply -f "${GEN3_HOME}/kube/services/sheepdog/sheepdog-gunicorn.yaml"
g3kubectl apply -f "${GEN3_HOME}/kube/services/nginx-sidecar/nginx.conf"
gen3 roll sheepdog-canary || true
g3kubectl apply -f "${GEN3_HOME}/kube/services/sheepdog/sheepdog-canary-service.yaml"

Expand Down
39 changes: 36 additions & 3 deletions kube/services/sheepdog/sheepdog-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ spec:
GEN3_SHEEPDOG_VERSION
GEN3_DATE_LABEL
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down Expand Up @@ -73,6 +77,15 @@ spec:
- name: ca-volume
secret:
secretName: "service-ca"
- name: wsgi-config
configMap:
name: sheepdog-wsgi
- name: nginx-config
configMap:
name: sheepdog-nginx-configmap
- name: nginx-main-config
configMap:
name: sidecar-nginx-main
# sheepdog transactions take forever -
# try to let the complete before termination
terminationGracePeriodSeconds: 50
Expand All @@ -82,16 +95,16 @@ spec:
livenessProbe:
httpGet:
path: /_status?timeout=20
port: 80
port: 8000
initialDelaySeconds: 30
periodSeconds: 60
timeoutSeconds: 30
readinessProbe:
httpGet:
path: /_status?timeout=2
port: 80
port: 8000
ports:
- containerPort: 80
- containerPort: 8000
- containerPort: 443
env:
- name: GEN3_UWSGI_TIMEOUT
Expand Down Expand Up @@ -195,10 +208,30 @@ spec:
readOnly: true
mountPath: "/usr/local/share/ca-certificates/cdis/cdis-ca.crt"
subPath: "ca.pem"
- name: "wsgi-config"
mountPath: "/sheepdog/deployment/wsgi/gunicorn.conf.py"
subPath: gunicorn.conf.py
imagePullPolicy: Always
resources:
requests:
cpu: 100m
memory: 200Mi
limits:
memory: 800Mi
- name: sidecar-nginx
image: quay.io/cdis/nginx-sidecar:nginx-sidecar-feat_nginx-sidecar
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
readinessProbe:
httpGet:
path: /_status
port: http
volumeMounts:
- name: "nginx-main-config"
mountPath: "/etc/nginx/nginx.conf"
subPath: "nginx.conf"
- name: "nginx-config"
mountPath: "/etc/nginx/conf.d/default.conf"
subPath: default.conf
13 changes: 13 additions & 0 deletions kube/services/sheepdog/sheepdog-gunicorn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: sheepdog-wsgi
data:
gunicorn.conf.py: |
wsgi_app = "deployment.wsgi.wsgi:application"
bind = "0.0.0.0:8000"
workers = 1
user = 'gen3'
group = 'gen3'
timeout = 300
worker_class = "uvicorn.workers.UvicornWorker"
13 changes: 13 additions & 0 deletions kube/services/sheepdog/sheepdog-nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: sheepdog-nginx-configmap
data:
default.conf: |
server {
listen 8080;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:8000; # Gunicorn binds to this address
}
}

0 comments on commit 43b2058

Please sign in to comment.