From 4bbb123edf90b3fdf7326d9c251777092bb684c1 Mon Sep 17 00:00:00 2001 From: Patrick Lee Scott Date: Sun, 24 May 2026 21:02:46 -0500 Subject: [PATCH] fix: add operator resource defaults --- functions/stack/200-cnpg-operator.yaml.gotmpl | 7 ++++++- functions/stack/210-cnpg-scale-to-zero.yaml.gotmpl | 8 ++++---- functions/stack/220-atlas-operator.yaml.gotmpl | 4 ++++ tests/test-stack/main.k | 11 +++++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/functions/stack/200-cnpg-operator.yaml.gotmpl b/functions/stack/200-cnpg-operator.yaml.gotmpl index e1a442c..a1e42c7 100644 --- a/functions/stack/200-cnpg-operator.yaml.gotmpl +++ b/functions/stack/200-cnpg-operator.yaml.gotmpl @@ -35,7 +35,12 @@ spec: {{- else }} {{- /* Chart defaults — Auto Mode handles scheduling, no nodeSelector/ tolerations injected. */}} - {{- $chartDefaults := dict }} + {{- $chartDefaults := dict + "resources" (dict + "requests" (dict "cpu" "23m" "memory" "138Mi") + "limits" (dict "cpu" "200m" "memory" "512Mi") + ) + }} {{- if $state.ha.enabled }} {{- $_ := set $chartDefaults "replicaCount" $state.ha.replicas }} {{- if $state.ha.topologySpreadByZone }} diff --git a/functions/stack/210-cnpg-scale-to-zero.yaml.gotmpl b/functions/stack/210-cnpg-scale-to-zero.yaml.gotmpl index 969016d..736cd98 100644 --- a/functions/stack/210-cnpg-scale-to-zero.yaml.gotmpl +++ b/functions/stack/210-cnpg-scale-to-zero.yaml.gotmpl @@ -361,11 +361,11 @@ spec: failureThreshold: 3 resources: requests: - cpu: 100m - memory: 128Mi + cpu: 15m + memory: 100Mi limits: - cpu: 500m - memory: 128Mi + cpu: 100m + memory: 256Mi volumeMounts: - name: server mountPath: /server diff --git a/functions/stack/220-atlas-operator.yaml.gotmpl b/functions/stack/220-atlas-operator.yaml.gotmpl index ab8f902..578b264 100644 --- a/functions/stack/220-atlas-operator.yaml.gotmpl +++ b/functions/stack/220-atlas-operator.yaml.gotmpl @@ -30,6 +30,10 @@ spec: {{- else }} {{- $chartDefaults := dict "prewarmDevDB" true + "resources" (dict + "requests" (dict "cpu" "15m" "memory" "100Mi") + "limits" (dict "cpu" "100m" "memory" "256Mi") + ) }} {{- if $state.ha.enabled }} {{- $_ := set $chartDefaults "replicaCount" $state.ha.replicas }} diff --git a/tests/test-stack/main.k b/tests/test-stack/main.k index c7e8815..6f97086 100644 --- a/tests/test-stack/main.k +++ b/tests/test-stack/main.k @@ -31,11 +31,13 @@ _items = [ apiVersion = "helm.m.crossplane.io/v1beta1" kind = "Release" metadata.name = "cloudnative-pg" + spec.forProvider.values.resources.requests = {cpu = "23m", memory = "138Mi"} } { apiVersion = "helm.m.crossplane.io/v1beta1" kind = "Release" metadata.name = "atlas-operator" + spec.forProvider.values.resources.requests = {cpu = "15m", memory = "100Mi"} } { apiVersion = "kubernetes.m.crossplane.io/v1alpha1" @@ -51,6 +53,15 @@ _items = [ apiVersion = "kubernetes.m.crossplane.io/v1alpha1" kind = "Object" metadata.name = "test-psql-s2z-deployment" + spec.forProvider.manifest.spec.template.spec.containers = [ + { + name = "cnpg-i-scale-to-zero" + resources = { + requests = {cpu = "15m", memory = "100Mi"} + limits = {cpu = "100m", memory = "256Mi"} + } + } + ] } ] }