let _presets = (import "schemas/lib/concerns_presets.ncl").presets in { listmonk | default = { name | default = "listmonk", namespace | default = "listmonk-svc", catalog_ref | default = "listmonk", image | default = "listmonk/listmonk", image_tag | default = "v4.1.0", http_port | default = 9000, domain | default = "", dns_zone | default = "", acme_email | default = "", cluster_issuer | default = "letsencrypt-prod", gateway_fip | default = "", gateway_name | default = "libre-wuji", gateway_ns | default = "kube-system", storage_class | default = "longhorn-retain", storage_size | default = "1Gi", uploads_path | default = "/listmonk/uploads", db_host | default = "postgresql.core-data.svc.libre-wuji.local", db_port | default = 5432, db_user | default = "listmonk", db_name | default = "listmonk", admin_username | default = "admin", requires | default = { storage = { size = "1Gi", persistent = true }, ports = [{ port = 9000, exposure = 'public }], credentials = ["LISTMONK_DB_PASSWORD", "LISTMONK_ADMIN_PASSWORD"], }, provides | default = { service = "listmonk", port = 9000, endpoints = [], }, operations | default = { install = true, update = true, delete = true, health = true, }, live_check | default = { strategy = 'k8s_pods, scope = 'cp_only, }, concerns | default = let _name = name in let _domain = domain in let _dns_zone = dns_zone in let _acme_email = acme_email in let _cluster_issuer = cluster_issuer in (_presets.tls_endpoint_with_acme { tls_secret = "%{_name}-tls", cluster_issuer = _cluster_issuer, hostnames = [_domain], dns_internal = [], dns_zone = _dns_zone, acme_server = "https://acme-v02.api.letsencrypt.org/directory", acme_email = _acme_email, cert_secret_ref = "", cert_provider = 'cloudflare, backup_backlog_ref = "BACKUP-LISTMONK-001", }) & { backup | force = { kind = 'pending, reason = "Uploads PVC and PostgreSQL database require coordinated backup policy", backlog_ref = "BACKUP-LISTMONK-001", }, manifest_hooks = { init = { pre = [ { file = "certificate", action = 'apply, skip_if_exists = true }, { file = "referencegrant", action = 'apply }, { action = 'patch-gateway-https }, ] }, update = { pre = [ { file = "certificate", action = 'apply, skip_if_exists = true }, { file = "referencegrant", action = 'apply }, { action = 'patch-gateway-https }, ] }, delete = { pre = [ { action = 'remove-gateway-https }, { file = "referencegrant", action = 'delete }, ] }, }, }, }, }