Skip to content

Commit

Permalink
feat(nodeselector): per-Deployment node selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Nov 29, 2024
1 parent b91e9bd commit 383d62a
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 10 deletions.
8 changes: 7 additions & 1 deletion charts/cryostat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ helm install cryostat ./charts/cryostat
| `core.discovery.kubernetes.portNames` | List of port names that the Cryostat application should look for in order to consider a target as JMX connectable | `[]` |
| `core.discovery.kubernetes.builtInPortNumbersDisabled` | When false and `portNumbers` is empty, the Cryostat application will use the default port number `9091` to look for JMX connectable targets. | `false` |
| `core.discovery.kubernetes.portNumbers` | List of port numbers that the Cryostat application should look for in order to consider a target as JMX connectable | `[]` |
| `core.nodeSelector` | Node Selector for the Cryostat Pod. See: [NodeSelector](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling) | `{}` |

### Report Generator Deployment

Expand All @@ -101,6 +102,7 @@ helm install cryostat ./charts/cryostat
| `reports.resources.requests.cpu` | CPU resource request for each Pod in the Report Generator Deployment. | `500m` |
| `reports.resources.requests.memory` | Memory resource request for each Pod in the Report Generator Deployment. | `512Mi` |
| `reports.securityContext` | Security Context for the Report Generator containers. Defaults to meet "restricted" [Pod Security Standard](https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted). See: [SecurityContext](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context-1) | `{}` |
| `reports.nodeSelector` | Node Selector for the Report Generator Pods. See: [NodeSelector](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling) | `{}` |

### Database Container

Expand All @@ -115,6 +117,7 @@ helm install cryostat ./charts/cryostat
| `db.resources.requests.cpu` | CPU resource request for the database container. See: [ResourceRequirements](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#resources) | `25m` |
| `db.resources.requests.memory` | Memory resource request for the database container. | `64Mi` |
| `db.securityContext` | Security Context for the database container. Defaults to meet "restricted" [Pod Security Standard](https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted). See: [SecurityContext](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context-1) | `{}` |
| `db.nodeSelector` | Node Selector for the Database Pod. See: [NodeSelector](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling) | `{}` |

### Storage Container

Expand All @@ -131,6 +134,7 @@ helm install cryostat ./charts/cryostat
| `storage.resources.requests.cpu` | CPU resource request for the object storage container. See: [ResourceRequirements](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#resources) | `50m` |
| `storage.resources.requests.memory` | Memory resource request for the object storage container. | `256Mi` |
| `storage.securityContext` | Security Context for the storage container. Defaults to meet "restricted" [Pod Security Standard](https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted). See: [SecurityContext](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context-1) | `{}` |
| `storage.nodeSelector` | Node Selector for the Storage Pod. See: [NodeSelector](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling) | `{}` |

### Grafana Container

Expand All @@ -145,6 +149,7 @@ helm install cryostat ./charts/cryostat
| `grafana.resources.requests.cpu` | CPU resource request for the Grafana container. See: [ResourceRequirements](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#resources) | `25m` |
| `grafana.resources.requests.memory` | Memory resource request for the Grafana container. | `80Mi` |
| `grafana.securityContext` | Security Context for the Grafana container. Defaults to meet "restricted" [Pod Security Standard](https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted). See: [SecurityContext](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context-1) | `{}` |
| `grafana.nodeSelector` | Node Selector for the Grafana Pod. See: [NodeSelector](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling) | `{}` |

### JFR Data Source Container

Expand All @@ -157,6 +162,7 @@ helm install cryostat ./charts/cryostat
| `datasource.resources.requests.cpu` | CPU resource request for the JFR Data Source container. See: [ResourceRequirements](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#resources) | `200m` |
| `datasource.resources.requests.memory` | Memory resource request for the JFR Data Source container. | `200Mi` |
| `datasource.securityContext` | Security Context for the JFR Data Source container. Defaults to meet "restricted" [Pod Security Standard](https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted). See: [SecurityContext](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context-1) | `{}` |
| `datasource.nodeSelector` | Node Selector for the JFR Datasource Pod. See: [NodeSelector](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling) | `{}` |

### Authentication

Expand Down Expand Up @@ -212,7 +218,7 @@ helm install cryostat ./charts/cryostat
| `serviceAccount.name` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | `""` |
| `podAnnotations` | Annotations to be applied to the Cryostat Pod | `{}` |
| `podSecurityContext` | Security Context for the Cryostat Pod. Defaults to meet "restricted" [Pod Security Standard](https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted). See: [PodSecurityContext](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context) | `{}` |
| `nodeSelector` | Node Selector for the Cryostat Pod. See: [NodeSelector](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling) | `{}` |
| `nodeSelector` | default Node Selector for the various Pods. Any Pod which does not have an individual nodeSelector setting will default to this. See: [NodeSelector](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling) | `{}` |
| `tolerations` | Tolerations for the Cryostat Pod. See: [Tolerations](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling) | `[]` |
| `affinity` | Affinity for the Cryostat Pod. See: [Affinity](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling) | `{}` |
| `pvc.enabled` | Specify whether to use persistentVolumeClaim or EmptyDir storage | `false` |
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/templates/cryostat_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ spec:
- http://localhost:8800
resources:
{{- toYaml .Values.datasource.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
{{- with (default .Values.nodeSelector .Values.core.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/templates/db_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ spec:
- cryostat
resources:
{{- toYaml (.Values.db).resources | nindent 12 }}
{{- with .Values.nodeSelector }}
{{- with (default .Values.nodeSelector .Values.db.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/templates/reports_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ spec:
failureThreshold: 2
resources:
{{- toYaml (.Values.reports).resources | nindent 12 }}
{{- with .Values.nodeSelector }}
{{- with (default .Values.nodeSelector .Values.reports.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/templates/storage_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ spec:
timeoutSeconds: 5
resources:
{{- toYaml (.Values.storage).resources | nindent 12 }}
{{- with .Values.nodeSelector }}
{{- with (default .Values.nodeSelector .Values.storage.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
24 changes: 23 additions & 1 deletion charts/cryostat/tests/cryostat_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,29 @@ tests:
path: spec.template.spec.affinity
- exists:
path: spec.template.spec.tolerations


- it: should accept specific nodeSelector setting
set:
core.nodeSelector:
diskType: ssd
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
diskType: ssd

- it: should prefer specific nodeSelector over general
set:
nodeSelector:
disktype: hdd
core.nodeSelector:
diskType: ssd
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
diskType: ssd

- it: should verify image pull policies for development snapshots
set:
core.image.tag: "4.0.0-snapshot"
Expand Down
24 changes: 23 additions & 1 deletion charts/cryostat/tests/db_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,29 @@ tests:
path: spec.template.spec.affinity
- exists:
path: spec.template.spec.tolerations


- it: should accept specific nodeSelector setting
set:
db.nodeSelector:
diskType: ssd
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
diskType: ssd

- it: should prefer specific nodeSelector over general
set:
nodeSelector:
disktype: hdd
db.nodeSelector:
diskType: ssd
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
diskType: ssd

- it: should verify image pull policies for development snapshots
set:
core.image.tag: "4.0.0-snapshot"
Expand Down
26 changes: 25 additions & 1 deletion charts/cryostat/tests/reports_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,31 @@ tests:
path: spec.template.spec.affinity
- exists:
path: spec.template.spec.tolerations


- it: should accept specific nodeSelector setting
set:
reports.replicas: 1
reports.nodeSelector:
diskType: ssd
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
diskType: ssd

- it: should prefer specific nodeSelector over general
set:
reports.replicas: 1
nodeSelector:
disktype: hdd
reports.nodeSelector:
diskType: ssd
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
diskType: ssd

- it: should verify image pull policies for development snapshots
set:
reports:
Expand Down
24 changes: 23 additions & 1 deletion charts/cryostat/tests/storage_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,29 @@ tests:
path: spec.template.spec.affinity
- exists:
path: spec.template.spec.tolerations


- it: should accept specific nodeSelector setting
set:
storage.nodeSelector:
diskType: ssd
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
diskType: ssd

- it: should prefer specific nodeSelector over general
set:
nodeSelector:
disktype: hdd
storage.nodeSelector:
diskType: ssd
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
diskType: ssd

- it: should verify image pull policies for development snapshots
set:
core.image.tag: "4.0.0-snapshot"
Expand Down
Loading

0 comments on commit 383d62a

Please sign in to comment.