Skip to content

Commit

Permalink
fix: allow to setup resources limits (#40)
Browse files Browse the repository at this point in the history
* fix: use default resources

* release: 3.1.1

* fix: remove empty resource

* fix: init containers to fix permission

* fix: meets the job requirement

* fix: post job increase limits

* fix: increase memory endpoint

* fix: increase persistence limits

* fix: improve values

* fix: remove docker

* fix: separate pvc ensemble manager

* fix: add access mode

* release

* fix: upgrade image ensemble manager

* fix: reduce memory endpoint

* fix: test remove limits

* fix: disable read write many as default

* fix: remove comments

* fix: default readwrite once
  • Loading branch information
mosoriob authored Aug 30, 2024
1 parent c43ab7f commit b33c119
Show file tree
Hide file tree
Showing 12 changed files with 212 additions and 213 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kubeconfig
2 changes: 1 addition & 1 deletion charts/mint/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 3.1.0
version: 3.2.0-alpha.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
45 changes: 20 additions & 25 deletions charts/mint/templates/ensemble-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ spec:
selector:
app: {{ include "mint.prefix" . }}-ensemble-manager
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "mint.prefix" . }}-kubeconfig
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/resource-policy": keep
type: Opaque
data:
config: {{ .Files.Get "kubeconfig" | b64enc | quote }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -52,10 +63,11 @@ spec:
configMap:
name: {{ include "mint.prefix" . }}-ensemble-manager-config-map
- name: storage
hostPath:
path: {{ .Values.components.ensemble_manager.environment.data_dir }}
- name: docker-storage
emptyDir: {}
persistentVolumeClaim:
claimName: {{ include "mint.prefix" . }}-ensemble-manager
- name: kubeconfig
secret:
secretName: {{ include "mint.prefix" . }}-kubeconfig
initContainers:
- name: volume-mount-hack
image: busybox
Expand All @@ -73,11 +85,7 @@ spec:
resources:
{{- toYaml .resources | nindent 12 }}
{{- end }}
securityContext:
privileged: true
env:
- name: DOCKER_HOST
value: 127.0.0.1:2375
- name: TMPDIR
value: /home/node/app/data/temp
- name: HASURA_GRAPHQL_ADMIN_SECRET
Expand All @@ -93,6 +101,9 @@ spec:
- name: config
mountPath: /home/node/app/config.json
subPath: config.json
- name: kubeconfig
mountPath: /home/node/.kube
readOnly: true
- name: files
{{- with .Values.components.ensemble_manager }}
image: "nginx"
Expand All @@ -108,21 +119,5 @@ spec:
imagePullPolicy: IfNotPresent
command: ['redis-server', '--port', '7379']
resources:
{{- toYaml .resources | nindent 12 }}
- name: docker
image: docker:23.0.0-dind
imagePullPolicy: IfNotPresent
args: ["docker-init", "dockerd-entrypoint.sh"]
resources:
{{- toYaml .resources | nindent 12 }}
env:
- name: DOCKER_TLS_CERTDIR
value: ""
securityContext:
privileged: true
volumeMounts:
- name: docker-storage
mountPath: /var/lib/docker
- name: storage
mountPath: /home/node/app/data
{{- toYaml .Values.resources | nindent 12 }}
{{ end }}
9 changes: 4 additions & 5 deletions charts/mint/templates/hasura.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,21 @@ spec:
port: http
- name: hasura-db
#if the values.arm_support is true, then use the arm_image, otherwise use the image

{{- if .Values.arm_support }}
{{- with .Values.components.hasura_db }}
image: "{{ .arm_image.repository }}:{{ .arm_image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ .arm_image.pullPolicy }}
resources:
{{- toYaml .resources | nindent 12 }}
{{- end }}
{{- else }}
{{- with .Values.components.hasura_db }}
image: "{{ .image.repository }}:{{ .image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ .image.pullPolicy }}
{{- end }}
resources:
{{- toYaml .resources | nindent 12 }}
{{- end }}

resources: {}
{{- end }}
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: hasura-db
Expand All @@ -125,7 +124,7 @@ spec:
- pg_isready
- -U
- {{ .Values.secrets.database.hasura.username }}
initialDelaySeconds: 5
initialDelaySeconds: 100
periodSeconds: 10
volumes:
- name: hasura-db
Expand Down
11 changes: 11 additions & 0 deletions charts/mint/templates/model-catalog-endpoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ spec:
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: volume-mount-hack
image: busybox
command: ["sh", "-c", "chown -R 9008 /fuseki-base"]
volumeMounts:
- name: db
mountPath: /fuseki-base/databases
- name: config
mountPath: /fuseki-base/configuration
resources:
{{- toYaml .Values.resources | nindent 12 }}
containers:
- name: endpoint
{{- with .Values.components.model_catalog_endpoint }}
Expand Down
2 changes: 1 addition & 1 deletion charts/mint/templates/model-catalog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ spec:
image: redis:6.0.16-alpine
imagePullPolicy: IfNotPresent
resources:
{{- toYaml .resources | nindent 12 }}
{{- toYaml .Values.resources | nindent 12 }}
ports:
- name: redis
containerPort: 6379
Expand Down
7 changes: 6 additions & 1 deletion charts/mint/templates/post-install-hasura.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ spec:
{{- with .Values.components.hasura }}
image: "{{ .image.repository }}:{{ .image.tag | default $.Chart.AppVersion }}"
resources:
{{- toYaml .resources | nindent 12 }}
requests:
cpu: 1000m
memory: 1000Mi
limits:
cpu: 1100m
memory: 1100Mi
{{ end }}
env:
- name: HASURA_GRAPHQL_ENDPOINT
Expand Down
35 changes: 35 additions & 0 deletions charts/mint/templates/pvc-ensemble-manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

{{- if and .Values.components.ensemble_manager.enabled }}
{{- if and .Values.components.ensemble_manager.persistence.enabled (not .Values.components.ensemble_manager.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "mint.prefix" . }}-ensemble-manager
namespace: {{ .Release.Namespace | quote }}
{{- if or .Values.components.ensemble_manager.persistence.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.components.ensemble_manager.persistence.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.components.ensemble_manager.persistence.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
accessModes:
{{- if not (empty .Values.components.ensemble_manager.persistence.accessModes) }}
{{- range .Values.components.ensemble_manager.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
{{- else }}
- "ReadWriteOnce"
{{- end }}
resources:
requests:
storage: {{ .Values.components.ensemble_manager.persistence.size | quote }}
{{- include "common.storage.class" (dict "persistence" .Values.components.ensemble_manager.persistence "global" .Values.global) | nindent 2 }}
{{- if .Values.components.ensemble_manager.persistence.dataSource }}
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.components.ensemble_manager.persistence.dataSource "context" $) | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
Loading

0 comments on commit b33c119

Please sign in to comment.