Skip to content

Commit

Permalink
feat: expose resources and additionalVolumes for HugePages
Browse files Browse the repository at this point in the history
  • Loading branch information
Racer159 committed Sep 18, 2024
1 parent a69155c commit 31b7260
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
8 changes: 8 additions & 0 deletions chart/templates/postgres-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ spec:
{{- toYaml .Values.postgresql.databases | nindent 4 }}
postgresql:
version: {{ .Values.postgresql.version | quote }}
resources:
{{- toYaml .Values.postgresql.resources | nindent 4 }}
{{- if ne (len .Values.postgresql.additionalVolumes) 0 }}
additionalVolumes:
{{- range .Values.postgresql.additionalVolumes }}
- {{ . | toYaml | nindent 6 }}
{{- end }}
{{- end }}
sidecars:
- name: "exporter"
image: {{ .Values.metrics.image | quote }}
Expand Down
8 changes: 8 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
postgresql:
enabled: false
ingress: []
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 100m
memory: 100Mi
additionalVolumes: []

# teamId: "uds"
# volume:
Expand Down
17 changes: 17 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,20 @@ Postgres Operator is configured through [`acid.zalan.do/v1` `Postgresql` custom
- `postgresql.databases`: The database names to create and the users they map to (i.e. `gitlabdb: gitlab.gitlab`)
- `postgresql.version`: The version of Postgres to run (i.e. `14`)
- `postgresql.ingress`: A list of ingress entries to create for this cluster (follows the [custom networking definition](https://github.com/defenseunicorns/uds-software-factory/blob/main/docs/networking.md) except for `direction` which is always `Ingress` and `selector` which is always `cluster-name: pg-cluster`)
- `postgresql.resources`: A Kubernetes Pod resource specification to define requests and limits
- `postgresql.additionalVolumes`: A list of additional volumes to map into the Postgres container if needed (see below)

## Postgres HugePages

Postgres Operator can also support HugePages by setting the following keys appropriately for your environment. You can learn more about HugePages in Kubernetes in their [Manage HugePages documentation](https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/#api) and learn more about these fields in the [`Postgresql` custom resource reference documentation](https://github.com/zalando/postgres-operator/blob/master/docs/reference/cluster_manifest.md#cluster-manifest-reference).

- `postgresql.resources`: This allows you to set the desired hugepages `limits` and `requests`
- `postgresql.additionalVolumes`: This allows you to map the correct hugepages volumes into the container, e.g.:

```yaml
- name: hugepage-2mi
mountPath: /hugepages-2Mi
volumeSource:
emptyDir:
medium: HugePages-2Mi
```

0 comments on commit 31b7260

Please sign in to comment.