Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pg): add default memory requests/limits #428

Merged
merged 6 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions packages/kontinuous/tests/__snapshots__/extends-ovh.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ kind: Cluster
metadata:
name: pg-hasura
labels:
helm.sh/chart: cnpg-cluster-1.9.12
helm.sh/chart: cnpg-cluster-1.15.0
app.kubernetes.io/name: pg-hasura
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
Expand Down Expand Up @@ -591,6 +591,11 @@ spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgis:14
imagePullPolicy: IfNotPresent
resources:
limits:
memory: 1Gb
requests:
memory: 128Mb
storage:
size: 8Gi
storageClass: csi-cinder-high-speed
Expand All @@ -603,6 +608,7 @@ spec:
pg_stat_statements.track: all
monitoring:
enablePodMonitor: false
priorityClassName: cnpg-high-priority
bootstrap:
initdb:
database: autodevops_feature-branch-1
Expand All @@ -624,7 +630,7 @@ kind: Cluster
metadata:
name: pg-keycloak
labels:
helm.sh/chart: cnpg-cluster-1.9.12
helm.sh/chart: cnpg-cluster-1.15.0
app.kubernetes.io/name: pg-keycloak
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
Expand Down Expand Up @@ -658,6 +664,11 @@ spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgis:14
imagePullPolicy: IfNotPresent
resources:
limits:
memory: 1Gb
requests:
memory: 128Mb
storage:
size: 8Gi
storageClass: csi-cinder-high-speed
Expand All @@ -670,6 +681,7 @@ spec:
pg_stat_statements.track: all
monitoring:
enablePodMonitor: false
priorityClassName: cnpg-high-priority
bootstrap:
initdb:
database: autodevops_feature-branch-1
Expand Down
34 changes: 26 additions & 8 deletions packages/kontinuous/tests/__snapshots__/extends-ovh.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ metadata:
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
namespace: test-extends-ovh
spec:
schedule: 0 0 * * 0
schedule: 0 0 * * *
concurrencyPolicy: Forbid
jobTemplate:
spec:
Expand All @@ -118,7 +118,7 @@ spec:
restartPolicy: Never
containers:
- name: s3-client
image: ghcr.io/socialgouv/docker/s3-client:1
image: ghcr.io/socialgouv/docker/s3-client:1.2.0
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
Expand Down Expand Up @@ -156,6 +156,8 @@ spec:
value: test-extends-ovh
- name: PGHOST
value: pg-hasura-r
- name: RETENTION_DAYS
value: 30
---
apiVersion: batch/v1
kind: CronJob
Expand All @@ -179,7 +181,7 @@ metadata:
kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv
namespace: test-extends-ovh
spec:
schedule: 0 0 * * 0
schedule: 0 0 * * *
concurrencyPolicy: Forbid
jobTemplate:
spec:
Expand All @@ -197,7 +199,7 @@ spec:
restartPolicy: Never
containers:
- name: s3-client
image: ghcr.io/socialgouv/docker/s3-client:1
image: ghcr.io/socialgouv/docker/s3-client:1.2.0
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
Expand Down Expand Up @@ -235,6 +237,8 @@ spec:
value: test-extends-ovh
- name: PGHOST
value: pg-keycloak-r
- name: RETENTION_DAYS
value: 30
---
apiVersion: batch/v1
kind: Job
Expand Down Expand Up @@ -716,7 +720,7 @@ kind: Cluster
metadata:
name: pg-hasura
labels:
helm.sh/chart: cnpg-cluster-1.9.12
helm.sh/chart: cnpg-cluster-1.15.0
app.kubernetes.io/name: pg-hasura
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
Expand Down Expand Up @@ -750,6 +754,11 @@ spec:
instances: 3
imageName: ghcr.io/cloudnative-pg/postgis:14
imagePullPolicy: IfNotPresent
resources:
limits:
memory: 1Gb
requests:
memory: 128Mb
storage:
size: 8Gi
storageClass: managed-csi
Expand Down Expand Up @@ -781,6 +790,7 @@ spec:
pg_stat_statements.track: all
monitoring:
enablePodMonitor: true
priorityClassName: cnpg-high-priority
bootstrap:
initdb:
database: test-extends-ovh
Expand All @@ -802,7 +812,7 @@ kind: Cluster
metadata:
name: pg-keycloak
labels:
helm.sh/chart: cnpg-cluster-1.9.12
helm.sh/chart: cnpg-cluster-1.15.0
app.kubernetes.io/name: pg-keycloak
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
Expand Down Expand Up @@ -836,6 +846,11 @@ spec:
instances: 3
imageName: ghcr.io/cloudnative-pg/postgis:14
imagePullPolicy: IfNotPresent
resources:
limits:
memory: 1Gb
requests:
memory: 128Mb
storage:
size: 8Gi
storageClass: managed-csi
Expand Down Expand Up @@ -867,6 +882,7 @@ spec:
pg_stat_statements.track: all
monitoring:
enablePodMonitor: true
priorityClassName: cnpg-high-priority
bootstrap:
initdb:
database: test-extends-ovh
Expand All @@ -888,7 +904,7 @@ kind: ScheduledBackup
metadata:
name: pg-hasura-scheduledbackup
labels:
helm.sh/chart: cnpg-cluster-1.9.12
helm.sh/chart: cnpg-cluster-1.15.0
app.kubernetes.io/name: pg-hasura
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
Expand All @@ -913,13 +929,14 @@ spec:
cluster:
name: pg-hasura
schedule: 0 0 0 * * *
immediate: true
---
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: pg-keycloak-scheduledbackup
labels:
helm.sh/chart: cnpg-cluster-1.9.12
helm.sh/chart: cnpg-cluster-1.15.0
app.kubernetes.io/name: pg-keycloak
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
Expand All @@ -944,5 +961,6 @@ spec:
cluster:
name: pg-keycloak
schedule: 0 0 0 * * *
immediate: true
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ metadata:
kontinuous/deployment: test-override-env-default-feature-branch-1-ffac537e6c-tw0tuagy
namespace: test-override-env-default-feature-branch-1
spec:
schedule: 0 0 * * 0
schedule: 0 0 * * *
concurrencyPolicy: Forbid
jobTemplate:
spec:
Expand All @@ -119,7 +119,7 @@ spec:
restartPolicy: Never
containers:
- name: s3-client
image: ghcr.io/socialgouv/docker/s3-client:1
image: ghcr.io/socialgouv/docker/s3-client:1.2.0
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
Expand Down Expand Up @@ -157,6 +157,8 @@ spec:
value: autodevops_feature-branch-1
- name: PGHOST
value: pg-r
- name: RETENTION_DAYS
value: 30
---
apiVersion: batch/v1
kind: Job
Expand Down Expand Up @@ -312,7 +314,7 @@ kind: Cluster
metadata:
name: pg
labels:
helm.sh/chart: cnpg-cluster-1.9.12
helm.sh/chart: cnpg-cluster-1.15.0
app.kubernetes.io/name: pg
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
Expand Down Expand Up @@ -346,6 +348,11 @@ spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgis:14
imagePullPolicy: IfNotPresent
resources:
limits:
memory: 1Gb
requests:
memory: 128Mb
storage:
size: 8Gi
storageClass: csi-cinder-high-speed
Expand Down Expand Up @@ -377,6 +384,7 @@ spec:
pg_stat_statements.track: all
monitoring:
enablePodMonitor: false
priorityClassName: cnpg-high-priority
bootstrap:
initdb:
database: autodevops_feature-branch-1
Expand All @@ -398,7 +406,7 @@ kind: ScheduledBackup
metadata:
name: pg-scheduledbackup
labels:
helm.sh/chart: cnpg-cluster-1.9.12
helm.sh/chart: cnpg-cluster-1.15.0
app.kubernetes.io/name: pg
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
Expand All @@ -423,5 +431,6 @@ spec:
cluster:
name: pg
schedule: 0 0 0 * * *
immediate: true
"
`;
17 changes: 13 additions & 4 deletions packages/kontinuous/tests/__snapshots__/pg.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ metadata:
kontinuous/deployment: test-pg-feature-branch-1-ffac537e6cbbf934b08745a37893-4f12g0z3
namespace: test-pg
spec:
schedule: 0 0 * * 0
schedule: 0 0 * * *
concurrencyPolicy: Forbid
jobTemplate:
spec:
Expand All @@ -118,7 +118,7 @@ spec:
restartPolicy: Never
containers:
- name: s3-client
image: ghcr.io/socialgouv/docker/s3-client:1
image: ghcr.io/socialgouv/docker/s3-client:1.2.0
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
Expand Down Expand Up @@ -156,6 +156,8 @@ spec:
value: test-pg
- name: PGHOST
value: cnpg-r
- name: RETENTION_DAYS
value: 30
---
apiVersion: batch/v1
kind: Job
Expand Down Expand Up @@ -476,7 +478,7 @@ kind: Cluster
metadata:
name: cnpg
labels:
helm.sh/chart: cnpg-cluster-1.9.12
helm.sh/chart: cnpg-cluster-1.15.0
app.kubernetes.io/name: cnpg
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
Expand Down Expand Up @@ -510,6 +512,11 @@ spec:
instances: 3
imageName: ghcr.io/cloudnative-pg/postgis:14
imagePullPolicy: IfNotPresent
resources:
limits:
memory: 1Gb
requests:
memory: 42Mb
storage:
size: 8Gi
storageClass: managed-csi
Expand Down Expand Up @@ -541,6 +548,7 @@ spec:
pg_stat_statements.track: all
monitoring:
enablePodMonitor: true
priorityClassName: cnpg-high-priority
bootstrap:
initdb:
database: test-pg
Expand All @@ -562,7 +570,7 @@ kind: ScheduledBackup
metadata:
name: cnpg-scheduledbackup
labels:
helm.sh/chart: cnpg-cluster-1.9.12
helm.sh/chart: cnpg-cluster-1.15.0
app.kubernetes.io/name: cnpg
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: \\"15\\"
Expand All @@ -587,5 +595,6 @@ spec:
cluster:
name: cnpg
schedule: 0 0 0 * * *
immediate: true
"
`;
2 changes: 1 addition & 1 deletion packages/kontinuous/tests/samples/extends-ovh/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ dependencies:
# links:
# socialgouv/helm-charts/charts/cnpg-cluster@v1: ./charts-overrides/cnpg-cluster
remoteLinks:
socialgouv/helm-charts/charts/cnpg-cluster@v1: socialgouv/helm-charts/charts/cnpg-cluster@v1.9.12
socialgouv/helm-charts/charts/cnpg-cluster@v1: socialgouv/helm-charts/charts/cnpg-cluster@v1.15.0
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dependencies:
ifEnv: [dev]

remoteLinks:
socialgouv/helm-charts/charts/cnpg-cluster@v1: socialgouv/helm-charts/charts/cnpg-cluster@v1.9.12
socialgouv/helm-charts/charts/cnpg-cluster@v1: socialgouv/helm-charts/charts/cnpg-cluster@v1.15.0
2 changes: 1 addition & 1 deletion packages/kontinuous/tests/samples/pg/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ dependencies:
import: socialgouv/kontinuous/plugins/fabrique

remoteLinks:
socialgouv/helm-charts/charts/cnpg-cluster@v1: socialgouv/helm-charts/charts/cnpg-cluster@v1.9.12
socialgouv/helm-charts/charts/cnpg-cluster@v1: socialgouv/helm-charts/charts/cnpg-cluster@v1.15.0
4 changes: 4 additions & 0 deletions packages/kontinuous/tests/samples/pg/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ hasura:

cnpg:
~chart: pg
cnpg-cluster:
resources:
requests:
memory: 42Mb
7 changes: 7 additions & 0 deletions plugins/fabrique/charts/pg/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ cnpg-cluster:
image:
repository: "ghcr.io/cloudnative-pg/postgis"
tag: "14"

resources:
requests:
~tpl~memory: "{{ or (and .Values.Parent._ProjectValues (index .Values.Parent._ProjectValues `cnpg-cluster`).resources (index .Values.Parent._ProjectValues `cnpg-cluster`).resources.requests (index .Values.Parent._ProjectValues `cnpg-cluster`).resources.requests.memory) `128Mb` }}"
limits:
~tpl~memory: "{{ or (and .Values.Parent._ProjectValues (index .Values.Parent._ProjectValues `cnpg-cluster`).resources (index .Values.Parent._ProjectValues `cnpg-cluster`).resources.limits (index .Values.Parent._ProjectValues `cnpg-cluster`).resources.limits.memory) `1Gb` }}"

backup:
~tpl~enabled: "{{ (or .Values.Parent.backup.enabled .Values.global.isProd .Values.global.isPreProd) | ternary `true` `false` }}"
schedule: "0 0 0 * * *" # daily
Expand Down