Skip to content

Commit

Permalink
Add node selector support to Helm chart (#3574)
Browse files Browse the repository at this point in the history
* feat: add support for nodeSelector to workloads
* chore: update values schema
* chore: bump chart version

Signed-off-by: Jared King <jared.king@subsplash.com>
  • Loading branch information
jking916 authored Jan 8, 2024
1 parent c535f02 commit e7c3de9
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/artifact-hub/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: artifact-hub
description: Artifact Hub is a web-based application that enables finding, installing, and publishing Kubernetes packages.
type: application
version: 1.16.1-3
version: 1.16.1-4
appVersion: 1.16.0
kubeVersion: ">= 1.19.0-0"
home: https://artifacthub.io
Expand Down
4 changes: 4 additions & 0 deletions charts/artifact-hub/templates/db_migrator_job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ spec:
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default .Values.nodeSelector .Values.dbMigrator.job.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
restartPolicy: Never
initContainers:
- {{- include "chart.checkDbIsReadyInitContainer" . | nindent 10 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/artifact-hub/templates/hub_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ spec:
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default .Values.nodeSelector .Values.hub.deploy.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Release.IsInstall }}
serviceAccountName: {{ include "chart.serviceAccountName" . }}
{{- end }}
Expand Down
4 changes: 4 additions & 0 deletions charts/artifact-hub/templates/scanner_cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ spec:
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with (default .Values.nodeSelector .Values.scanner.cronjob.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
restartPolicy: Never
initContainers:
- {{- include "chart.checkDbIsReadyInitContainer" . | nindent 14 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/artifact-hub/templates/tracker_cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ spec:
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with (default .Values.nodeSelector .Values.tracker.cronjob.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
restartPolicy: Never
initContainers:
- {{- include "chart.checkDbIsReadyInitContainer" . | nindent 14 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/artifact-hub/templates/trivy_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ spec:
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default .Values.nodeSelector .Values.trivy.deploy.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: trivy
image: {{ .Values.trivy.deploy.image }}
Expand Down
30 changes: 30 additions & 0 deletions charts/artifact-hub/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@
"repository"
]
},
"nodeSelector": {
"title": "DB migrator pod node selector",
"type": "object",
"default": {}
},
"resources": {
"title": "DB migrator pod resource requirements",
"type": "object",
Expand Down Expand Up @@ -346,6 +351,11 @@
"type": "object",
"$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.19.0/_definitions.json#/definitions/io.k8s.api.core.v1.Probe"
},
"nodeSelector": {
"title": "Hub pod node selector",
"type": "object",
"default": {}
},
"readinessGates": {
"title": "Hub pod readiness gates",
"type": "array",
Expand Down Expand Up @@ -929,6 +939,11 @@
"type": "string",
"default": ""
},
"nodeSelector": {
"title": "Default node selector used by pods",
"type": "object",
"default": {}
},
"pullPolicy": {
"type": "string",
"default": "IfNotPresent"
Expand Down Expand Up @@ -1005,6 +1020,11 @@
"repository"
]
},
"nodeSelector": {
"title": "Scanner pod node selector",
"type": "object",
"default": {}
},
"resources": {
"title": "Scanner pod resource requirements",
"type": "object",
Expand Down Expand Up @@ -1113,6 +1133,11 @@
"repository"
]
},
"nodeSelector": {
"title": "Tracker pod node selector",
"type": "object",
"default": {}
},
"resources": {
"title": "Tracker pod resource requirements",
"type": "object",
Expand Down Expand Up @@ -1207,6 +1232,11 @@
"type": "string",
"default": "aquasec/trivy:0.44.1"
},
"nodeSelector": {
"title": "Trivy pod node selector",
"type": "object",
"default": {}
},
"resources": {
"title": "Trivy pod resource requirements",
"type": "object",
Expand Down
11 changes: 11 additions & 0 deletions charts/artifact-hub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ imagePullSecrets: []
imageTag: ""
nameOverride: ""
pullPolicy: IfNotPresent
nodeSelector: {}

# Enable dynamic resource name prefix
#
Expand Down Expand Up @@ -101,6 +102,8 @@ dbMigrator:
# requests:
# cpu: 100m
# memory: 128Mi
# Optionally specify a node selector for the dbMigrator pod
nodeSelector: {}
# Load demo user and sample repositories
loadSampleData: true
# Directory path where the configuration files should be mounted
Expand Down Expand Up @@ -179,6 +182,8 @@ hub:
extraVolumes: []
# Optionally specify extra list of additional volume mounts for the hub deployment
extraVolumeMounts: []
# Optionally specify a node selector for the hub deployment
nodeSelector: {}
server:
# Allow adding private repositories to the Hub
allowPrivateRepositories: false
Expand Down Expand Up @@ -323,6 +328,8 @@ scanner:
extraVolumes: []
# Optionally specify extra list of additional volume mounts for the scanner cronjob
extraVolumeMounts: []
# Optionally specify a node selector for the scanner cronjob
nodeSelector: {}
# Number of snapshots to process concurrently
concurrency: 3
# Trivy server url. Defaults to the Trivy service's internal URL
Expand Down Expand Up @@ -357,6 +364,8 @@ tracker:
extraVolumes: []
# Optionally specify extra list of additional volume mounts for the tracker cronjob
extraVolumeMounts: []
# Optionally specify a node selector for the tracker cronjob
nodeSelector: {}
# Cache directory path. If set, the cache directory for the Helm client will be explicitly set (otherwise defaults
# to $HOME/.cache), and the directory will be mounted as ephemeral volume (emptyDir)
cacheDir: ""
Expand Down Expand Up @@ -396,6 +405,8 @@ trivy:
extraVolumes: []
# Optionally specify extra list of additional volume mounts for the trivy deployment
extraVolumeMounts: []
# Optionally specify a node selector for the trivy deployment
nodeSelector: {}
persistence:
enabled: false
size: 10Gi
Expand Down

0 comments on commit e7c3de9

Please sign in to comment.