Skip to content

Commit f3febc4

Browse files
feat(helm): In helm add update strategy value for deployments. (#27)
* feat(helm): Add example env vars for single threading * build: Only run github actions based on folder changes * build: Update helm github action
1 parent 264e425 commit f3febc4

File tree

7 files changed

+54
-10
lines changed

7 files changed

+54
-10
lines changed

.github/workflows/kubernetes-charts-build.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
name: Kubernetes - Lint, Test, and Publish Helm Charts
22

3-
on: pull_request
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
paths:
8+
- 'deployment/kubernetes/**'
9+
- '.github/workflows/kubernetes**'
10+
tags:
11+
- 'v*.*.*' # e.g., v0.1.1
12+
413
defaults:
514
run:
615
working-directory: ./deployment/kubernetes
716

8-
917
jobs:
1018
helm-lint-test:
1119
runs-on: ubuntu-latest
@@ -17,9 +25,9 @@ jobs:
1725
fetch-depth: 0
1826

1927
- name: Set up Helm
20-
uses: azure/setup-helm@v4.2.0
28+
uses: azure/setup-helm@v4.3.0
2129
with:
22-
version: v3.17.0
30+
version: v3.18.3
2331

2432
- uses: actions/setup-python@v5.3.0
2533
with:

.github/workflows/observability-docker.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ name: ci-build
22

33
on:
44
push:
5-
branches:
6-
- '**'
5+
branches: [ main ]
6+
pull_request:
7+
paths:
8+
- 'observability/**'
9+
- '.github/workflows/observability**'
710
tags:
811
- 'v*.*.*' # e.g., v0.1.1
912

deployment/kubernetes/charts/medcat-service-helm/templates/deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ spec:
1111
selector:
1212
matchLabels:
1313
{{- include "medcat-service.selectorLabels" . | nindent 6 }}
14+
strategy: {{ toYaml .Values.updateStrategy | nindent 4 }}
1415
template:
1516
metadata:
1617
{{- with .Values.podAnnotations }}

deployment/kubernetes/charts/medcat-service-helm/values.yaml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ env:
3131
# DEID_MODE: true
3232
# DEID_REDACT: true
3333

34+
# Set SERVER_GUNICORN_MAX_REQUESTS to a high number instead of the default 1000. Trust k8s instead to restart pod when needed.
35+
SERVER_GUNICORN_MAX_REQUESTS: 1000000
36+
37+
# Recommended env vars to set to try to limit to 1 CPU for scaling
38+
# OMP_NUM_THREADS: "1"
39+
# OPENBLAS_NUM_THREADS: "1"
40+
# MKL_NUM_THREADS: "1"
41+
# VECLIB_MAXIMUM_THREADS: "1"
42+
# NUMEXPR_NUM_THREADS: "1"
43+
# TOKENIZERS_PARALLELISM: "false"
44+
# PYTORCH_ENABLE_MPS_FALLBACK: "1"
45+
# SERVER_GUNICORN_EXTRA_ARGS: "--worker-connections 1 --backlog 1"
46+
3447
# Enable downloading of public models using wget on startup. Model will be downloaded to /models/<name> and used for APP_MEDCAT_MODEL_PACK
3548
model: {}
3649
# Public URL to download a model pack from
@@ -44,6 +57,14 @@ imagePullSecrets: []
4457
nameOverride: ""
4558
fullnameOverride: ""
4659

60+
updateStrategy:
61+
# Used for Kubernetes deployment .spec.strategy.type. Allowed values are "Recreate" or "RollingUpdate".
62+
type: RollingUpdate
63+
# RollingUpdate default options example
64+
# rollingUpdate:
65+
# maxSurge: 25%
66+
# maxUnavailable: 25%
67+
4768
# This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/
4869
serviceAccount:
4970
# Specifies whether a service account should be created
@@ -108,11 +129,11 @@ resources: {}
108129
# resources, such as Minikube. If you do want to specify resources, uncomment the following
109130
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
110131
# limits:
111-
# cpu: 100m
112-
# memory: 128Mi
132+
# cpu: 2 # Note one general k8s recommendation is to leave CPU limit unset
133+
# memory: 4Gi
113134
# requests:
114-
# cpu: 100m
115-
# memory: 128Mi
135+
# cpu: 1
136+
# memory: 2Gi
116137

117138
# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
118139
livenessProbe:
@@ -129,6 +150,7 @@ startupProbe:
129150
port: http
130151
failureThreshold: 30
131152
periodSeconds: 10
153+
initialDelaySeconds: 2
132154

133155
# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
134156
autoscaling:

deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ spec:
1313
matchLabels:
1414
{{- include "medcat-trainer-helm.selectorLabels" . | nindent 6 }}
1515
app.kubernetes.io/component: medcat-trainer
16+
strategy: {{ toYaml .Values.updateStrategy | nindent 4 }}
1617
template:
1718
metadata:
1819
{{- with .Values.podAnnotations }}

deployment/kubernetes/charts/medcat-trainer-helm/templates/nginx-deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ spec:
1313
matchLabels:
1414
{{- include "medcat-trainer-helm.selectorLabels" . | nindent 6 }}
1515
app.kubernetes.io/component: nginx
16+
strategy: {{ toYaml .Values.nginxUpdateStrategy | nindent 4 }}
1617
template:
1718
metadata:
1819
{{- with .Values.podAnnotations }}

deployment/kubernetes/charts/medcat-trainer-helm/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,14 @@ imagePullSecrets: []
111111
nameOverride: ""
112112
fullnameOverride: ""
113113

114+
updateStrategy:
115+
# Used for Kubernetes deployment .spec.strategy.type. Allowed values are "Recreate" or "RollingUpdate".
116+
type: RollingUpdate
117+
118+
nginxUpdateStrategy:
119+
# Used for Kubernetes deployment .spec.strategy.type. Allowed values are "Recreate" or "RollingUpdate".
120+
type: RollingUpdate
121+
114122
# This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/
115123
serviceAccount:
116124
# Specifies whether a service account should be created

0 commit comments

Comments
 (0)