diff --git a/.github/workflows/kubernetes-charts-build.yaml b/.github/workflows/kubernetes-charts-build.yaml index 8cb139b..2e2bae6 100644 --- a/.github/workflows/kubernetes-charts-build.yaml +++ b/.github/workflows/kubernetes-charts-build.yaml @@ -1,11 +1,19 @@ name: Kubernetes - Lint, Test, and Publish Helm Charts -on: pull_request +on: + push: + branches: [ main ] + pull_request: + paths: + - 'deployment/kubernetes/**' + - '.github/workflows/kubernetes**' + tags: + - 'v*.*.*' # e.g., v0.1.1 + defaults: run: working-directory: ./deployment/kubernetes - jobs: helm-lint-test: runs-on: ubuntu-latest @@ -17,9 +25,9 @@ jobs: fetch-depth: 0 - name: Set up Helm - uses: azure/setup-helm@v4.2.0 + uses: azure/setup-helm@v4.3.0 with: - version: v3.17.0 + version: v3.18.3 - uses: actions/setup-python@v5.3.0 with: diff --git a/.github/workflows/observability-docker.yml b/.github/workflows/observability-docker.yml index 58c5ce0..f4ece9f 100644 --- a/.github/workflows/observability-docker.yml +++ b/.github/workflows/observability-docker.yml @@ -2,8 +2,11 @@ name: ci-build on: push: - branches: - - '**' + branches: [ main ] + pull_request: + paths: + - 'observability/**' + - '.github/workflows/observability**' tags: - 'v*.*.*' # e.g., v0.1.1 diff --git a/deployment/kubernetes/charts/medcat-service-helm/templates/deployment.yaml b/deployment/kubernetes/charts/medcat-service-helm/templates/deployment.yaml index 695153e..c005668 100644 --- a/deployment/kubernetes/charts/medcat-service-helm/templates/deployment.yaml +++ b/deployment/kubernetes/charts/medcat-service-helm/templates/deployment.yaml @@ -11,6 +11,7 @@ spec: selector: matchLabels: {{- include "medcat-service.selectorLabels" . | nindent 6 }} + strategy: {{ toYaml .Values.updateStrategy | nindent 4 }} template: metadata: {{- with .Values.podAnnotations }} diff --git a/deployment/kubernetes/charts/medcat-service-helm/values.yaml b/deployment/kubernetes/charts/medcat-service-helm/values.yaml index 40864e8..9e3a8ae 100644 --- a/deployment/kubernetes/charts/medcat-service-helm/values.yaml +++ b/deployment/kubernetes/charts/medcat-service-helm/values.yaml @@ -31,6 +31,19 @@ env: # DEID_MODE: true # DEID_REDACT: true + # Set SERVER_GUNICORN_MAX_REQUESTS to a high number instead of the default 1000. Trust k8s instead to restart pod when needed. + SERVER_GUNICORN_MAX_REQUESTS: 1000000 + + # Recommended env vars to set to try to limit to 1 CPU for scaling + # OMP_NUM_THREADS: "1" + # OPENBLAS_NUM_THREADS: "1" + # MKL_NUM_THREADS: "1" + # VECLIB_MAXIMUM_THREADS: "1" + # NUMEXPR_NUM_THREADS: "1" + # TOKENIZERS_PARALLELISM: "false" + # PYTORCH_ENABLE_MPS_FALLBACK: "1" + # SERVER_GUNICORN_EXTRA_ARGS: "--worker-connections 1 --backlog 1" + # Enable downloading of public models using wget on startup. Model will be downloaded to /models/ and used for APP_MEDCAT_MODEL_PACK model: {} # Public URL to download a model pack from @@ -44,6 +57,14 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +updateStrategy: + # Used for Kubernetes deployment .spec.strategy.type. Allowed values are "Recreate" or "RollingUpdate". + type: RollingUpdate + # RollingUpdate default options example + # rollingUpdate: + # maxSurge: 25% + # maxUnavailable: 25% + # This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/ serviceAccount: # Specifies whether a service account should be created @@ -108,11 +129,11 @@ resources: {} # resources, such as Minikube. If you do want to specify resources, uncomment the following # lines, adjust them as necessary, and remove the curly braces after 'resources:'. # limits: - # cpu: 100m - # memory: 128Mi + # cpu: 2 # Note one general k8s recommendation is to leave CPU limit unset + # memory: 4Gi # requests: - # cpu: 100m - # memory: 128Mi + # cpu: 1 + # memory: 2Gi # 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/ livenessProbe: @@ -129,6 +150,7 @@ startupProbe: port: http failureThreshold: 30 periodSeconds: 10 + initialDelaySeconds: 2 # This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/ autoscaling: diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml index 0949545..49e676b 100644 --- a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml +++ b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml @@ -13,6 +13,7 @@ spec: matchLabels: {{- include "medcat-trainer-helm.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: medcat-trainer + strategy: {{ toYaml .Values.updateStrategy | nindent 4 }} template: metadata: {{- with .Values.podAnnotations }} diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/templates/nginx-deployment.yaml b/deployment/kubernetes/charts/medcat-trainer-helm/templates/nginx-deployment.yaml index daecee0..31cf545 100644 --- a/deployment/kubernetes/charts/medcat-trainer-helm/templates/nginx-deployment.yaml +++ b/deployment/kubernetes/charts/medcat-trainer-helm/templates/nginx-deployment.yaml @@ -13,6 +13,7 @@ spec: matchLabels: {{- include "medcat-trainer-helm.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: nginx + strategy: {{ toYaml .Values.nginxUpdateStrategy | nindent 4 }} template: metadata: {{- with .Values.podAnnotations }} diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml b/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml index 9188777..13c80c3 100644 --- a/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml +++ b/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml @@ -111,6 +111,14 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +updateStrategy: + # Used for Kubernetes deployment .spec.strategy.type. Allowed values are "Recreate" or "RollingUpdate". + type: RollingUpdate + +nginxUpdateStrategy: + # Used for Kubernetes deployment .spec.strategy.type. Allowed values are "Recreate" or "RollingUpdate". + type: RollingUpdate + # This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/ serviceAccount: # Specifies whether a service account should be created