merge: bp-powerdns 1.0.5 (postInitSQL syntax fix, openova#167)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hatiyildiz 2026-04-29 08:17:34 +02:00
commit 22d430eaa8
2 changed files with 12 additions and 18 deletions

View File

@ -1,6 +1,6 @@
apiVersion: v2
name: bp-powerdns
version: 1.0.4
version: 1.0.5
description: |
Catalyst-curated Blueprint wrapper for PowerDNS Authoritative.
Carries Catalyst-specific values.yaml + templates (CNPG cluster, dnsdist

View File

@ -128,23 +128,17 @@ spec:
-- postInitApplicationSQL runs as the postgres superuser (not the
-- database owner) so newly-created tables are owned by postgres
-- by default. PowerDNS connects as `pdns` and needs full DML
-- access — reassign every table + sequence to the owner.
DO $$
DECLARE
obj record;
BEGIN
FOR obj IN
SELECT n.nspname, c.relname, c.relkind
FROM pg_class c
JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE n.nspname = 'public'
AND c.relkind IN ('r','S')
LOOP
EXECUTE format('ALTER %s %I.%I OWNER TO %I',
CASE obj.relkind WHEN 'r' THEN 'TABLE' WHEN 'S' THEN 'SEQUENCE' END,
obj.nspname, obj.relname, '{{ .Values.postgres.cluster.owner | default "pdns" }}');
END LOOP;
END $$;
-- access — reassign every PowerDNS gpgsql table to the owner.
-- Plain ALTER TABLE statements (no DO block) so Helm templating
-- doesn't have to wrestle with PL/pgSQL `$$` quoting.
ALTER TABLE domains OWNER TO {{ .Values.postgres.cluster.owner | default "pdns" }};
ALTER TABLE records OWNER TO {{ .Values.postgres.cluster.owner | default "pdns" }};
ALTER TABLE supermasters OWNER TO {{ .Values.postgres.cluster.owner | default "pdns" }};
ALTER TABLE comments OWNER TO {{ .Values.postgres.cluster.owner | default "pdns" }};
ALTER TABLE domainmetadata OWNER TO {{ .Values.postgres.cluster.owner | default "pdns" }};
ALTER TABLE cryptokeys OWNER TO {{ .Values.postgres.cluster.owner | default "pdns" }};
ALTER TABLE tsigkeys OWNER TO {{ .Values.postgres.cluster.owner | default "pdns" }};
GRANT ALL PRIVILEGES ON SCHEMA public TO {{ .Values.postgres.cluster.owner | default "pdns" }};
postgresql:
parameters: