Skip to content
Open
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
40 changes: 40 additions & 0 deletions deploy/helm/cnpgstac/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2025 CS Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

# dependencies
.tgz
30 changes: 30 additions & 0 deletions deploy/helm/cnpgstac/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2025 CS Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v2
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
tags:
- bitnami-common
version: 2.x
description: A CS Group STAC backend based on CloudNativePG PostGIS and PgSTAC.
home: https://github.com/csgroup-oss/eo-catalogue
icon: https://github.com/csgroup-oss/eo-catalog/raw/refs/heads/main/docs/static/eo-catalogue-logo-1080.webp
name: eo-cnpgstac
sources:
- https://github.com/csgroup-oss/eo-catalogue
type: application
version: 1.0.0-alpha
appVersion: 0.9.8
110 changes: 110 additions & 0 deletions deploy/helm/cnpgstac/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{{/*
Copyright 2025 CS Group

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}

{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "cnpgstac.imagePullSecrets" -}}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.cnpgstac.image) "global" .Values.global) -}}
{{- end -}}

{{/*
Render imageCatalogRef block inside spec
*/}}
{{- define "cnpgstac.imageCatalogRef" -}}
apiGroup: postgresql.cnpg.io
kind: ClusterImageCatalog
name: {{ default "cnpgstac" .Values.cnpgstac.imageCatalog.name }}
major: {{ default 17 .Values.cnpgstac.imageCatalog.major }}
{{- end -}}

{{/*
Render only the images list for ClusterImageCatalog, with inline image values
*/}}
{{- define "cnpgstac.clusterImageCatalogList" -}}
{{- range .Values.cnpgstac.imageCatalog.images }}
- major: {{ .major }}
image: "{{- $registry := trimSuffix "/" (default "ghcr.io" .registry) -}}
{{- $repository := trimPrefix "/" (default "csgroup-oss/eo-catalog-cnpgstac" .repository) -}}
{{- $tag := default "latest" .tag -}}
{{- $digest := .digest -}}
{{- if $digest -}}
{{- printf "%s/%s@%s" $registry $repository $digest -}}
{{- else -}}
{{- printf "%s/%s:%v" $registry $repository $tag -}}
{{- end }}"
{{- end }}
{{- end }}

{{/*
Calculate the memory settings
*/}}

{{/*
Convert suffix to PostgreSQL valid memory units :
https://www.postgresql.org/docs/current/config-setting.html#CONFIG-SETTING-NAMES-VALUES
*/}}
{{- define "limit_suffix_bytes" -}}
{{- $limit_suffix := .Values.cnpgstac.resources.limits.memory | toString | regexFind "[^0-9.]+" -}}
{{- if eq "G" $limit_suffix -}}
GB
{{- else if eq "Gi" $limit_suffix -}}
GB
{{- else if eq "M" $limit_suffix -}}
MB
{{- else if eq "Mi" $limit_suffix -}}
MB
{{- else if eq "k" $limit_suffix -}}
KB
{{- else if eq "Ki" $limit_suffix -}}
KB
{{- else if eq "T" $limit_suffix -}}
TB
{{- else if eq "Ti" $limit_suffix -}}
TB
{{- else if eq "P" $limit_suffix -}}
PB
{{- else if eq "Pi" $limit_suffix -}}
PB
{{- else if eq "E" $limit_suffix -}}
EB
{{- else if eq "Ei" $limit_suffix -}}
EB
{{- else if eq "" $limit_suffix -}}
{{- /* Check for empty suffix, meaning bytes */ -}}
B
{{- else -}}
{{- /* Unknown suffix case, assume GB */ -}}
GB {{- printf " # Warning: Unknown suffix '%s' Defaulting to GB." . -}}
{{- end -}}
{{- end -}}

{{/*
Calculate shared_buffers: should be 1/4 of the total RAM
*/}}
{{- define "shared_buffers" -}}
{{- $limit_value := .Values.cnpgstac.resources.limits.memory | toString | regexFind "[0-9.]+" -}}
{{ mulf $limit_value 0.25 }}
{{- end -}}

{{/*
Calculate effective_cache_size: should be 3/4 of the total RAM
*/}}
{{- define "effective_cache_size" -}}
{{- $limit_value := .Values.cnpgstac.resources.limits.memory | toString | regexFind "[0-9.]+" -}}
{{ mulf $limit_value 0.75 }}
{{- end -}}

139 changes: 139 additions & 0 deletions deploy/helm/cnpgstac/templates/cnpgstac/Cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Copyright 2025 CS Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: {{ .Values.cnpgstac.clusterName }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: cnpgstac
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.cnpgstac.clusterLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.cnpgstac.clusterLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.cnpgstac.imageCatalog.enabled }}
imageCatalogRef:
apiGroup: postgresql.cnpg.io
kind: ClusterImageCatalog
name: {{ .Values.cnpgstac.imageCatalog.name }}
major: {{ .Values.cnpgstac.imageCatalog.major }}
{{- else if or (and .Values.cnpgstac.image.repository .Values.cnpgstac.image.registry) .Values.global.imageRegistry }}
{{- $image := include "common.images.image" (dict "imageRoot" .Values.cnpgstac.image "global" .Values.global) | trim }}
imageName: {{ $image }}
{{- else }}
imageCatalogRef:
apiGroup: postgresql.cnpg.io
kind: ClusterImageCatalog
name: postgis-standard-trixie
major: 17
{{- end }}
{{- if .Values.cnpgstac.imagePullPolicy }}
imagePullPolicy: {{ .Values.cnpgstac.image.pullPolicy }}
{{- end }}
{{- include "cnpgstac.imagePullSecrets" . | nindent 2 }}
instances: {{ .Values.cnpgstac.instances | default "3" }}
{{- if .Values.cnpgstac.startDelay }}
startDelay: {{ .Values.cnpgstac.startDelay }}
{{- end }}
{{- if .Values.cnpgstac.stopDelay }}
stopDelay: {{ .Values.cnpgstac.stopDelay }}
{{- end }}
{{- if .Values.cnpgstac.primaryUpdateStrategy }}
primaryUpdateStrategy: {{ .Values.cnpgstac.primaryUpdateStrategy }}
{{- end }}
{{- with .Values.cnpgstac.bootstrap }}
bootstrap:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.cnpgstac.superUserAccess.enabled }}
enableSuperuserAccess: true
{{- end }}
{{- if .Values.cnpgstac.backup.barman.enabled }}
plugins:
- name: barman-cloud.cloudnative-pg.io
isWALArchiver: {{ .Values.cnpgstac.backup.barman.isWALArchiver }}
parameters:
barmanObjectName: {{ .Values.cnpgstac.backup.barman.barmanObjectStore.name }}
{{- end }}
{{- if .Values.cnpgstac.superUserAccess.existingSecret }}
superuserSecret:
name: {{- .Values.cnpgstac.superUserAccess.existingSecret }}
{{- end }}
postgresql:
parameters:
{{- with .Values.cnpgstac.postgresql.parameters }}
{{- toYaml . | nindent 6 }}
{{- end }}
# shared_buffers: should be 1/4 of the total RAM
shared_buffers: {{ include "shared_buffers" . }}{{ include "limit_suffix_bytes" . }}
# effective_cache_size: should be 3/4 of the total RAM
effective_cache_size: {{ include "effective_cache_size" . }}{{ include "limit_suffix_bytes" . }}
{{- with .Values.cnpgstac.postgresql.shared_preload_libraries }}
shared_preload_libraries:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.cnpgstac.postgresql.pg_hba }}
pg_hba:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.cnpgstac.postgresql.pg_ident }}
pg_ident:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.cnpgstac.postgresql.synchronous }}
synchronous:
{{- toYaml . | nindent 6 }}
{{ end }}
{{- if .Values.cnpgstac.resources }}
resources: {{- toYaml .Values.cnpgstac.resources | nindent 4 }}
{{- end }}
{{- if .Values.cnpgstac.persistence.enabled }}
storage:
pvcTemplate:
accessModes:
{{- range .Values.cnpgstac.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.cnpgstac.persistence.size | quote }}
volumeMode: Filesystem
{{- include "common.storage.class" (dict "persistence" .Values.cnpgstac.persistence "global" .Values.global) | nindent 6 }}
{{- end }}
{{- if .Values.cnpgstac.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.cnpgstac.affinity "context" $) | nindent 4 }}
{{- else if or .Values.cnpgstac.podAffinityPreset .Values.cnpgstac.podAntiAffinityPreset .Values.cnpgstac.nodeAffinityPreset }}
affinity:
# https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-AffinityConfiguration
enablePodAntiAffinity: false
topologyKey: ''
podAntiAffinityType: ''
# tolerations: ''
additionalPodAffinity: {{- include "common.affinities.pods" (dict "type" .Values.cnpgstac.podAffinityPreset "instance" .Chart.Name "context" $) | nindent 6}}
additionalPodAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.cnpgstac.podAntiAffinityPreset "instance" .Chart.Name "context" $) | nindent 8 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.cnpgstac.nodeAffinityPreset.type "key" .Values.cnpgstac.nodeAffinityPreset.key "values" .Values.cnpgstac.nodeAffinityPreset.values) | nindent 6 }}
{{- end }}
{{- if .Values.cnpgstac.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.cnpgstac.nodeSelector "context" $) | nindent 6 }}
{{- end }}
{{- if .Values.cnpgstac.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.cnpgstac.tolerations "context" .) | nindent 6 }}
{{- end }}
32 changes: 32 additions & 0 deletions deploy/helm/cnpgstac/templates/cnpgstac/ClusterImageCatalog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2025 CS Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if .Values.cnpgstac.imageCatalog.enabled }}
apiVersion: postgresql.cnpg.io/v1
kind: ClusterImageCatalog
metadata:
name: {{ .Values.cnpgstac.imageCatalog.name }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: cnpgstac
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
images:
{{- include "cnpgstac.clusterImageCatalogList" . | indent 4 }}
{{- end }}
Loading
Loading