Skip to content

Commit

Permalink
feat: add resources config for initContainer (#298)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Jul 1, 2024
1 parent e58ae6b commit 3a10e77
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 2 deletions.
4 changes: 2 additions & 2 deletions charts/dragonfly/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: dragonfly
description: Dragonfly is an intelligent P2P based image and file distribution system
icon: https://raw.githubusercontent.com/dragonflyoss/Dragonfly2/main/docs/images/logo/dragonfly.svg
type: application
version: 1.1.68
version: 1.1.69
appVersion: 2.1.49
keywords:
- dragonfly
Expand All @@ -27,7 +27,7 @@ sources:

annotations:
artifacthub.io/changes: |
- Use master service for redis.
- Add resources for initContainer.
artifacthub.io/links: |
- name: Chart Source
Expand Down
4 changes: 4 additions & 0 deletions charts/dragonfly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ helm delete dragonfly --namespace dragonfly-system
| client.initContainer.image.registry | string | `"docker.io"` | Image registry. |
| client.initContainer.image.repository | string | `"busybox"` | Image repository. |
| client.initContainer.image.tag | string | `"latest"` | Image tag. |
| client.initContainer.resources | object | `{"limits":{"cpu":"2","memory":"4Gi"},"requests":{"cpu":"0","memory":"0"}}` | Pod resource requests and limits. |
| client.maxProcs | string | `""` | maxProcs Limits the number of operating system threads that can execute user-level. Go code simultaneously by setting GOMAXPROCS environment variable, refer to https://golang.org/pkg/runtime. |
| client.metrics.enable | bool | `false` | Enable client metrics. |
| client.metrics.prometheusRule.additionalLabels | object | `{}` | Additional labels. |
Expand Down Expand Up @@ -302,6 +303,7 @@ helm delete dragonfly --namespace dragonfly-system
| manager.initContainer.image.registry | string | `"docker.io"` | Image registry. |
| manager.initContainer.image.repository | string | `"busybox"` | Image repository. |
| manager.initContainer.image.tag | string | `"latest"` | Image tag. |
| manager.initContainer.resources | object | `{"limits":{"cpu":"2","memory":"4Gi"},"requests":{"cpu":"0","memory":"0"}}` | Pod resource requests and limits. |
| manager.maxProcs | string | `""` | maxProcs Limits the number of operating system threads that can execute user-level. Go code simultaneously by setting GOMAXPROCS environment variable, refer to https://golang.org/pkg/runtime. |
| manager.metrics.enable | bool | `false` | Enable manager metrics. |
| manager.metrics.prometheusRule.additionalLabels | object | `{}` | Additional labels. |
Expand Down Expand Up @@ -415,6 +417,7 @@ helm delete dragonfly --namespace dragonfly-system
| scheduler.initContainer.image.registry | string | `"docker.io"` | Image registry. |
| scheduler.initContainer.image.repository | string | `"busybox"` | Image repository. |
| scheduler.initContainer.image.tag | string | `"latest"` | Image tag. |
| scheduler.initContainer.resources | object | `{"limits":{"cpu":"2","memory":"4Gi"},"requests":{"cpu":"0","memory":"0"}}` | Pod resource requests and limits. |
| scheduler.maxProcs | string | `""` | maxProcs Limits the number of operating system threads that can execute user-level. Go code simultaneously by setting GOMAXPROCS environment variable, refer to https://golang.org/pkg/runtime. |
| scheduler.metrics.enable | bool | `false` | Enable scheduler metrics. |
| scheduler.metrics.enableHost | bool | `false` | Enable host metrics. |
Expand Down Expand Up @@ -497,6 +500,7 @@ helm delete dragonfly --namespace dragonfly-system
| seedClient.initContainer.image.registry | string | `"docker.io"` | Image registry. |
| seedClient.initContainer.image.repository | string | `"busybox"` | Image repository. |
| seedClient.initContainer.image.tag | string | `"latest"` | Image tag. |
| seedClient.initContainer.resources | object | `{"limits":{"cpu":"2","memory":"4Gi"},"requests":{"cpu":"0","memory":"0"}}` | Pod resource requests and limits. |
| seedClient.maxProcs | string | `""` | maxProcs Limits the number of operating system threads that can execute user-level. Go code simultaneously by setting GOMAXPROCS environment variable, refer to https://golang.org/pkg/runtime. |
| seedClient.metrics.enable | bool | `false` | Enable seed client metrics. |
| seedClient.metrics.prometheusRule.additionalLabels | object | `{}` | Additional labels. |
Expand Down
4 changes: 4 additions & 0 deletions charts/dragonfly/templates/client/client-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ spec:
{{- if .Values.client.dfinit.config.verbose }}
- --verbose
{{- end }}
resources:
{{ toYaml .Values.client.initContainer.resources | indent 12 }}
volumeMounts:
- name: dfinit-config
mountPath: "/etc/dragonfly"
Expand Down Expand Up @@ -118,6 +120,8 @@ spec:
{{- else }}
echo "no container runtime to restart"
{{- end }}
resources:
{{ toYaml .Values.client.initContainer.resources | indent 12 }}
{{- end }}
containers:
- name: client
Expand Down
4 changes: 4 additions & 0 deletions charts/dragonfly/templates/manager/manager-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,16 @@ spec:
image: {{ template "manager.initContainer.image" . }}
imagePullPolicy: {{ .Values.manager.initContainer.image.pullPolicy }}
command: ['sh', '-c', 'until nslookup {{ .Release.Name }}-{{ default "redis" .Values.redis.fullname }}-master.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }} && nc -vz {{ .Release.Name }}-{{ default "redis" .Values.redis.fullname }}-master.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }} {{ .Values.redis.master.service.ports.redis }}; do echo waiting for redis; sleep 2; done;']
resources:
{{ toYaml .Values.manager.initContainer.resources | indent 12 }}
{{- end }}
{{- if .Values.mysql.enable }}
- name: wait-for-mysql
image: {{ template "manager.initContainer.image" . }}
imagePullPolicy: {{ .Values.manager.initContainer.image.pullPolicy }}
command: ['sh', '-c', 'until nslookup {{ .Release.Name }}-{{ default "mysql" .Values.mysql.fullname }}.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }} && nc -vz {{ .Release.Name }}-{{ default "mysql" .Values.mysql.fullname }}.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }} {{ .Values.mysql.primary.service.port }}; do echo waiting for mysql; sleep 2; done;']
resources:
{{ toYaml .Values.manager.initContainer.resources | indent 12 }}
{{- end }}
{{- end }}
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ spec:
{{- else }}
command: ['sh', '-c', 'until nslookup {{ .Values.externalManager.host }} && nc -vz {{ .Values.externalManager.host }} {{ .Values.externalManager.restPort }}; do echo waiting for external manager; sleep 2; done;']
{{- end }}
resources:
{{ toYaml .Values.scheduler.initContainer.resources | indent 12 }}
containers:
- name: scheduler
image: {{ template "scheduler.image" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ spec:
{{- else }}
command: ['sh', '-c', 'until nslookup {{ .Values.externalManager.host }} && nc -vz {{ .Values.externalManager.host }} {{ .Values.externalManager.restPort }}; do echo waiting for external manager; sleep 2; done;']
{{- end }}
resources:
{{ toYaml .Values.seedClient.initContainer.resources | indent 12 }}
containers:
- name: seed-client
image: {{ template "seedClient.image" . }}
Expand Down
32 changes: 32 additions & 0 deletions charts/dragonfly/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ manager:
# -- Service annotations.
annotations: {}
initContainer:
# -- Pod resource requests and limits.
resources:
requests:
cpu: "0"
memory: "0"
limits:
cpu: "2"
memory: "4Gi"
image:
# -- Image registry.
registry: docker.io
Expand Down Expand Up @@ -375,6 +383,14 @@ scheduler:
- name: logs
mountPath: /var/log/dragonfly/scheduler
initContainer:
# -- Pod resource requests and limits.
resources:
requests:
cpu: "0"
memory: "0"
limits:
cpu: "2"
memory: "4Gi"
image:
# -- Image registry.
registry: docker.io
Expand Down Expand Up @@ -756,6 +772,14 @@ seedClient:
# -- Statefulset annotations.
statefulsetAnnotations: {}
initContainer:
# -- Pod resource requests and limits.
resources:
requests:
cpu: "0"
memory: "0"
limits:
cpu: "2"
memory: "4Gi"
image:
# -- Image registry.
registry: docker.io
Expand Down Expand Up @@ -1076,6 +1100,14 @@ client:
# -- Statefulset annotations.
statefulsetAnnotations: {}
initContainer:
# -- Pod resource requests and limits.
resources:
requests:
cpu: "0"
memory: "0"
limits:
cpu: "2"
memory: "4Gi"
image:
# -- Image registry.
registry: docker.io
Expand Down

0 comments on commit 3a10e77

Please sign in to comment.