@reyemtech/nimbus 2.12.6 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/cjs/aws/cloudfront.d.ts +17 -0
- package/dist/cjs/aws/cloudfront.d.ts.map +1 -0
- package/dist/cjs/aws/cloudfront.js +147 -0
- package/dist/cjs/aws/cloudfront.js.map +1 -0
- package/dist/cjs/aws/index.d.ts +1 -0
- package/dist/cjs/aws/index.d.ts.map +1 -1
- package/dist/cjs/aws/index.js +3 -1
- package/dist/cjs/aws/index.js.map +1 -1
- package/dist/cjs/cdn/index.d.ts +7 -0
- package/dist/cjs/cdn/index.d.ts.map +1 -0
- package/dist/cjs/cdn/index.js +8 -0
- package/dist/cjs/cdn/index.js.map +1 -0
- package/dist/cjs/cdn/interfaces.d.ts +43 -0
- package/dist/cjs/cdn/interfaces.d.ts.map +1 -0
- package/dist/cjs/cdn/interfaces.js +8 -0
- package/dist/cjs/cdn/interfaces.js.map +1 -0
- package/dist/cjs/cli/migrate-cnpg-ownership.d.ts +43 -0
- package/dist/cjs/cli/migrate-cnpg-ownership.d.ts.map +1 -0
- package/dist/cjs/cli/migrate-cnpg-ownership.js +67 -0
- package/dist/cjs/cli/migrate-cnpg-ownership.js.map +1 -0
- package/dist/cjs/cli/migrate-cnpg-roles.d.ts +92 -0
- package/dist/cjs/cli/migrate-cnpg-roles.d.ts.map +1 -0
- package/dist/cjs/cli/migrate-cnpg-roles.js +337 -0
- package/dist/cjs/cli/migrate-cnpg-roles.js.map +1 -0
- package/dist/cjs/cli/migrate-cnpg.d.ts +38 -0
- package/dist/cjs/cli/migrate-cnpg.d.ts.map +1 -0
- package/dist/cjs/cli/migrate-cnpg.js +258 -0
- package/dist/cjs/cli/migrate-cnpg.js.map +1 -0
- package/dist/cjs/cli/migrate-exec.d.ts +45 -0
- package/dist/cjs/cli/migrate-exec.d.ts.map +1 -0
- package/dist/cjs/cli/migrate-exec.js +104 -0
- package/dist/cjs/cli/migrate-exec.js.map +1 -0
- package/dist/cjs/cli/migrate-psql.d.ts +125 -0
- package/dist/cjs/cli/migrate-psql.d.ts.map +1 -0
- package/dist/cjs/cli/migrate-psql.js +213 -0
- package/dist/cjs/cli/migrate-psql.js.map +1 -0
- package/dist/cjs/cli/migrate-report.d.ts +27 -0
- package/dist/cjs/cli/migrate-report.d.ts.map +1 -0
- package/dist/cjs/cli/migrate-report.js +29 -0
- package/dist/cjs/cli/migrate-report.js.map +1 -0
- package/dist/cjs/cli/migrate-superuser.d.ts +22 -0
- package/dist/cjs/cli/migrate-superuser.d.ts.map +1 -0
- package/dist/cjs/cli/migrate-superuser.js +73 -0
- package/dist/cjs/cli/migrate-superuser.js.map +1 -0
- package/dist/cjs/cli/migrate.d.ts +37 -0
- package/dist/cjs/cli/migrate.d.ts.map +1 -0
- package/dist/cjs/cli/migrate.js +67 -0
- package/dist/cjs/cli/migrate.js.map +1 -0
- package/dist/cjs/cli.d.ts +1 -0
- package/dist/cjs/cli.d.ts.map +1 -1
- package/dist/cjs/cli.js +6 -0
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/edge/index.d.ts +8 -0
- package/dist/cjs/edge/index.d.ts.map +1 -0
- package/dist/cjs/edge/index.js +13 -0
- package/dist/cjs/edge/index.js.map +1 -0
- package/dist/cjs/edge/interfaces.d.ts +35 -0
- package/dist/cjs/edge/interfaces.d.ts.map +1 -0
- package/dist/cjs/edge/interfaces.js +8 -0
- package/dist/cjs/edge/interfaces.js.map +1 -0
- package/dist/cjs/edge/verify.d.ts +22 -0
- package/dist/cjs/edge/verify.d.ts.map +1 -0
- package/dist/cjs/edge/verify.js +105 -0
- package/dist/cjs/edge/verify.js.map +1 -0
- package/dist/cjs/factories/cdn.d.ts +15 -0
- package/dist/cjs/factories/cdn.d.ts.map +1 -0
- package/dist/cjs/factories/cdn.js +28 -0
- package/dist/cjs/factories/cdn.js.map +1 -0
- package/dist/cjs/factories/index.d.ts +1 -0
- package/dist/cjs/factories/index.d.ts.map +1 -1
- package/dist/cjs/factories/index.js +3 -1
- package/dist/cjs/factories/index.js.map +1 -1
- package/dist/cjs/index.d.ts +5 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +7 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/operator/cnpg-common.d.ts +56 -0
- package/dist/cjs/operator/cnpg-common.d.ts.map +1 -0
- package/dist/cjs/operator/cnpg-common.js +82 -0
- package/dist/cjs/operator/cnpg-common.js.map +1 -0
- package/dist/cjs/operator/cnpg-database.d.ts +66 -0
- package/dist/cjs/operator/cnpg-database.d.ts.map +1 -0
- package/dist/cjs/operator/cnpg-database.js +296 -0
- package/dist/cjs/operator/cnpg-database.js.map +1 -0
- package/dist/cjs/operator/cnpg-roles.d.ts +173 -0
- package/dist/cjs/operator/cnpg-roles.d.ts.map +1 -0
- package/dist/cjs/operator/cnpg-roles.js +225 -0
- package/dist/cjs/operator/cnpg-roles.js.map +1 -0
- package/dist/cjs/operator/cnpg.d.ts.map +1 -1
- package/dist/cjs/operator/cnpg.js +50 -162
- package/dist/cjs/operator/cnpg.js.map +1 -1
- package/dist/cjs/operator/connection-uri.d.ts +44 -0
- package/dist/cjs/operator/connection-uri.d.ts.map +1 -0
- package/dist/cjs/operator/connection-uri.js +49 -0
- package/dist/cjs/operator/connection-uri.js.map +1 -0
- package/dist/cjs/operator/credentials.d.ts +76 -0
- package/dist/cjs/operator/credentials.d.ts.map +1 -0
- package/dist/cjs/operator/credentials.js +106 -0
- package/dist/cjs/operator/credentials.js.map +1 -0
- package/dist/cjs/operator/database-options.d.ts +121 -0
- package/dist/cjs/operator/database-options.d.ts.map +1 -0
- package/dist/cjs/operator/database-options.js +131 -0
- package/dist/cjs/operator/database-options.js.map +1 -0
- package/dist/cjs/operator/grants/postgres-job.d.ts +109 -0
- package/dist/cjs/operator/grants/postgres-job.d.ts.map +1 -0
- package/dist/cjs/operator/grants/postgres-job.js +232 -0
- package/dist/cjs/operator/grants/postgres-job.js.map +1 -0
- package/dist/cjs/operator/grants/postgres-sql.d.ts +130 -0
- package/dist/cjs/operator/grants/postgres-sql.d.ts.map +1 -0
- package/dist/cjs/operator/grants/postgres-sql.js +305 -0
- package/dist/cjs/operator/grants/postgres-sql.js.map +1 -0
- package/dist/cjs/operator/grants/privileges.d.ts +24 -0
- package/dist/cjs/operator/grants/privileges.d.ts.map +1 -0
- package/dist/cjs/operator/grants/privileges.js +35 -0
- package/dist/cjs/operator/grants/privileges.js.map +1 -0
- package/dist/cjs/operator/grants/role-config.d.ts +80 -0
- package/dist/cjs/operator/grants/role-config.d.ts.map +1 -0
- package/dist/cjs/operator/grants/role-config.js +134 -0
- package/dist/cjs/operator/grants/role-config.js.map +1 -0
- package/dist/cjs/operator/index.d.ts +1 -1
- package/dist/cjs/operator/index.d.ts.map +1 -1
- package/dist/cjs/operator/index.js.map +1 -1
- package/dist/cjs/operator/interfaces.d.ts +223 -1
- package/dist/cjs/operator/interfaces.d.ts.map +1 -1
- package/dist/cjs/operator/interfaces.js.map +1 -1
- package/dist/cjs/operator/mariadb-common.d.ts +99 -0
- package/dist/cjs/operator/mariadb-common.d.ts.map +1 -0
- package/dist/cjs/operator/mariadb-common.js +141 -0
- package/dist/cjs/operator/mariadb-common.js.map +1 -0
- package/dist/cjs/operator/mariadb-database.d.ts +65 -0
- package/dist/cjs/operator/mariadb-database.d.ts.map +1 -0
- package/dist/cjs/operator/mariadb-database.js +285 -0
- package/dist/cjs/operator/mariadb-database.js.map +1 -0
- package/dist/cjs/operator/mariadb-roles.d.ts +264 -0
- package/dist/cjs/operator/mariadb-roles.d.ts.map +1 -0
- package/dist/cjs/operator/mariadb-roles.js +366 -0
- package/dist/cjs/operator/mariadb-roles.js.map +1 -0
- package/dist/cjs/operator/mariadb.d.ts.map +1 -1
- package/dist/cjs/operator/mariadb.js +35 -147
- package/dist/cjs/operator/mariadb.js.map +1 -1
- package/dist/cjs/operator/neo4j-common.d.ts +62 -0
- package/dist/cjs/operator/neo4j-common.d.ts.map +1 -0
- package/dist/cjs/operator/neo4j-common.js +89 -0
- package/dist/cjs/operator/neo4j-common.js.map +1 -0
- package/dist/cjs/operator/neo4j-database.d.ts +88 -0
- package/dist/cjs/operator/neo4j-database.d.ts.map +1 -0
- package/dist/cjs/operator/neo4j-database.js +274 -0
- package/dist/cjs/operator/neo4j-database.js.map +1 -0
- package/dist/cjs/operator/neo4j-roles.d.ts +203 -0
- package/dist/cjs/operator/neo4j-roles.d.ts.map +1 -0
- package/dist/cjs/operator/neo4j-roles.js +298 -0
- package/dist/cjs/operator/neo4j-roles.js.map +1 -0
- package/dist/cjs/operator/neo4j.d.ts.map +1 -1
- package/dist/cjs/operator/neo4j.js +32 -132
- package/dist/cjs/operator/neo4j.js.map +1 -1
- package/dist/cjs/operator/resource-identity.d.ts +170 -0
- package/dist/cjs/operator/resource-identity.d.ts.map +1 -0
- package/dist/cjs/operator/resource-identity.js +231 -0
- package/dist/cjs/operator/resource-identity.js.map +1 -0
- package/dist/cjs/operator/role-registry.d.ts +85 -0
- package/dist/cjs/operator/role-registry.d.ts.map +1 -0
- package/dist/cjs/operator/role-registry.js +72 -0
- package/dist/cjs/operator/role-registry.js.map +1 -0
- package/dist/cjs/types/errors.d.ts +3 -0
- package/dist/cjs/types/errors.d.ts.map +1 -1
- package/dist/cjs/types/errors.js +3 -0
- package/dist/cjs/types/errors.js.map +1 -1
- package/dist/esm/aws/cloudfront.d.ts +17 -0
- package/dist/esm/aws/cloudfront.d.ts.map +1 -0
- package/dist/esm/aws/cloudfront.js +147 -0
- package/dist/esm/aws/cloudfront.js.map +1 -0
- package/dist/esm/aws/index.d.ts +1 -0
- package/dist/esm/aws/index.d.ts.map +1 -1
- package/dist/esm/aws/index.js +3 -1
- package/dist/esm/aws/index.js.map +1 -1
- package/dist/esm/cdn/index.d.ts +7 -0
- package/dist/esm/cdn/index.d.ts.map +1 -0
- package/dist/esm/cdn/index.js +8 -0
- package/dist/esm/cdn/index.js.map +1 -0
- package/dist/esm/cdn/interfaces.d.ts +43 -0
- package/dist/esm/cdn/interfaces.d.ts.map +1 -0
- package/dist/esm/cdn/interfaces.js +8 -0
- package/dist/esm/cdn/interfaces.js.map +1 -0
- package/dist/esm/cli/migrate-cnpg-ownership.d.ts +43 -0
- package/dist/esm/cli/migrate-cnpg-ownership.d.ts.map +1 -0
- package/dist/esm/cli/migrate-cnpg-ownership.js +67 -0
- package/dist/esm/cli/migrate-cnpg-ownership.js.map +1 -0
- package/dist/esm/cli/migrate-cnpg-roles.d.ts +92 -0
- package/dist/esm/cli/migrate-cnpg-roles.d.ts.map +1 -0
- package/dist/esm/cli/migrate-cnpg-roles.js +337 -0
- package/dist/esm/cli/migrate-cnpg-roles.js.map +1 -0
- package/dist/esm/cli/migrate-cnpg.d.ts +38 -0
- package/dist/esm/cli/migrate-cnpg.d.ts.map +1 -0
- package/dist/esm/cli/migrate-cnpg.js +258 -0
- package/dist/esm/cli/migrate-cnpg.js.map +1 -0
- package/dist/esm/cli/migrate-exec.d.ts +45 -0
- package/dist/esm/cli/migrate-exec.d.ts.map +1 -0
- package/dist/esm/cli/migrate-exec.js +104 -0
- package/dist/esm/cli/migrate-exec.js.map +1 -0
- package/dist/esm/cli/migrate-psql.d.ts +125 -0
- package/dist/esm/cli/migrate-psql.d.ts.map +1 -0
- package/dist/esm/cli/migrate-psql.js +213 -0
- package/dist/esm/cli/migrate-psql.js.map +1 -0
- package/dist/esm/cli/migrate-report.d.ts +27 -0
- package/dist/esm/cli/migrate-report.d.ts.map +1 -0
- package/dist/esm/cli/migrate-report.js +29 -0
- package/dist/esm/cli/migrate-report.js.map +1 -0
- package/dist/esm/cli/migrate-superuser.d.ts +22 -0
- package/dist/esm/cli/migrate-superuser.d.ts.map +1 -0
- package/dist/esm/cli/migrate-superuser.js +73 -0
- package/dist/esm/cli/migrate-superuser.js.map +1 -0
- package/dist/esm/cli/migrate.d.ts +37 -0
- package/dist/esm/cli/migrate.d.ts.map +1 -0
- package/dist/esm/cli/migrate.js +67 -0
- package/dist/esm/cli/migrate.js.map +1 -0
- package/dist/esm/cli.d.ts +1 -0
- package/dist/esm/cli.d.ts.map +1 -1
- package/dist/esm/cli.js +6 -0
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/edge/index.d.ts +8 -0
- package/dist/esm/edge/index.d.ts.map +1 -0
- package/dist/esm/edge/index.js +13 -0
- package/dist/esm/edge/index.js.map +1 -0
- package/dist/esm/edge/interfaces.d.ts +35 -0
- package/dist/esm/edge/interfaces.d.ts.map +1 -0
- package/dist/esm/edge/interfaces.js +8 -0
- package/dist/esm/edge/interfaces.js.map +1 -0
- package/dist/esm/edge/verify.d.ts +22 -0
- package/dist/esm/edge/verify.d.ts.map +1 -0
- package/dist/esm/edge/verify.js +105 -0
- package/dist/esm/edge/verify.js.map +1 -0
- package/dist/esm/factories/cdn.d.ts +15 -0
- package/dist/esm/factories/cdn.d.ts.map +1 -0
- package/dist/esm/factories/cdn.js +28 -0
- package/dist/esm/factories/cdn.js.map +1 -0
- package/dist/esm/factories/index.d.ts +1 -0
- package/dist/esm/factories/index.d.ts.map +1 -1
- package/dist/esm/factories/index.js +3 -1
- package/dist/esm/factories/index.js.map +1 -1
- package/dist/esm/index.d.ts +5 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +7 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/operator/cnpg-common.d.ts +56 -0
- package/dist/esm/operator/cnpg-common.d.ts.map +1 -0
- package/dist/esm/operator/cnpg-common.js +82 -0
- package/dist/esm/operator/cnpg-common.js.map +1 -0
- package/dist/esm/operator/cnpg-database.d.ts +66 -0
- package/dist/esm/operator/cnpg-database.d.ts.map +1 -0
- package/dist/esm/operator/cnpg-database.js +296 -0
- package/dist/esm/operator/cnpg-database.js.map +1 -0
- package/dist/esm/operator/cnpg-roles.d.ts +173 -0
- package/dist/esm/operator/cnpg-roles.d.ts.map +1 -0
- package/dist/esm/operator/cnpg-roles.js +225 -0
- package/dist/esm/operator/cnpg-roles.js.map +1 -0
- package/dist/esm/operator/cnpg.d.ts.map +1 -1
- package/dist/esm/operator/cnpg.js +50 -162
- package/dist/esm/operator/cnpg.js.map +1 -1
- package/dist/esm/operator/connection-uri.d.ts +44 -0
- package/dist/esm/operator/connection-uri.d.ts.map +1 -0
- package/dist/esm/operator/connection-uri.js +49 -0
- package/dist/esm/operator/connection-uri.js.map +1 -0
- package/dist/esm/operator/credentials.d.ts +76 -0
- package/dist/esm/operator/credentials.d.ts.map +1 -0
- package/dist/esm/operator/credentials.js +106 -0
- package/dist/esm/operator/credentials.js.map +1 -0
- package/dist/esm/operator/database-options.d.ts +121 -0
- package/dist/esm/operator/database-options.d.ts.map +1 -0
- package/dist/esm/operator/database-options.js +131 -0
- package/dist/esm/operator/database-options.js.map +1 -0
- package/dist/esm/operator/grants/postgres-job.d.ts +109 -0
- package/dist/esm/operator/grants/postgres-job.d.ts.map +1 -0
- package/dist/esm/operator/grants/postgres-job.js +232 -0
- package/dist/esm/operator/grants/postgres-job.js.map +1 -0
- package/dist/esm/operator/grants/postgres-sql.d.ts +130 -0
- package/dist/esm/operator/grants/postgres-sql.d.ts.map +1 -0
- package/dist/esm/operator/grants/postgres-sql.js +305 -0
- package/dist/esm/operator/grants/postgres-sql.js.map +1 -0
- package/dist/esm/operator/grants/privileges.d.ts +24 -0
- package/dist/esm/operator/grants/privileges.d.ts.map +1 -0
- package/dist/esm/operator/grants/privileges.js +35 -0
- package/dist/esm/operator/grants/privileges.js.map +1 -0
- package/dist/esm/operator/grants/role-config.d.ts +80 -0
- package/dist/esm/operator/grants/role-config.d.ts.map +1 -0
- package/dist/esm/operator/grants/role-config.js +134 -0
- package/dist/esm/operator/grants/role-config.js.map +1 -0
- package/dist/esm/operator/index.d.ts +1 -1
- package/dist/esm/operator/index.d.ts.map +1 -1
- package/dist/esm/operator/index.js.map +1 -1
- package/dist/esm/operator/interfaces.d.ts +223 -1
- package/dist/esm/operator/interfaces.d.ts.map +1 -1
- package/dist/esm/operator/interfaces.js.map +1 -1
- package/dist/esm/operator/mariadb-common.d.ts +99 -0
- package/dist/esm/operator/mariadb-common.d.ts.map +1 -0
- package/dist/esm/operator/mariadb-common.js +141 -0
- package/dist/esm/operator/mariadb-common.js.map +1 -0
- package/dist/esm/operator/mariadb-database.d.ts +65 -0
- package/dist/esm/operator/mariadb-database.d.ts.map +1 -0
- package/dist/esm/operator/mariadb-database.js +285 -0
- package/dist/esm/operator/mariadb-database.js.map +1 -0
- package/dist/esm/operator/mariadb-roles.d.ts +264 -0
- package/dist/esm/operator/mariadb-roles.d.ts.map +1 -0
- package/dist/esm/operator/mariadb-roles.js +366 -0
- package/dist/esm/operator/mariadb-roles.js.map +1 -0
- package/dist/esm/operator/mariadb.d.ts.map +1 -1
- package/dist/esm/operator/mariadb.js +35 -147
- package/dist/esm/operator/mariadb.js.map +1 -1
- package/dist/esm/operator/neo4j-common.d.ts +62 -0
- package/dist/esm/operator/neo4j-common.d.ts.map +1 -0
- package/dist/esm/operator/neo4j-common.js +89 -0
- package/dist/esm/operator/neo4j-common.js.map +1 -0
- package/dist/esm/operator/neo4j-database.d.ts +88 -0
- package/dist/esm/operator/neo4j-database.d.ts.map +1 -0
- package/dist/esm/operator/neo4j-database.js +274 -0
- package/dist/esm/operator/neo4j-database.js.map +1 -0
- package/dist/esm/operator/neo4j-roles.d.ts +203 -0
- package/dist/esm/operator/neo4j-roles.d.ts.map +1 -0
- package/dist/esm/operator/neo4j-roles.js +298 -0
- package/dist/esm/operator/neo4j-roles.js.map +1 -0
- package/dist/esm/operator/neo4j.d.ts.map +1 -1
- package/dist/esm/operator/neo4j.js +32 -132
- package/dist/esm/operator/neo4j.js.map +1 -1
- package/dist/esm/operator/resource-identity.d.ts +170 -0
- package/dist/esm/operator/resource-identity.d.ts.map +1 -0
- package/dist/esm/operator/resource-identity.js +231 -0
- package/dist/esm/operator/resource-identity.js.map +1 -0
- package/dist/esm/operator/role-registry.d.ts +85 -0
- package/dist/esm/operator/role-registry.d.ts.map +1 -0
- package/dist/esm/operator/role-registry.js +72 -0
- package/dist/esm/operator/role-registry.js.map +1 -0
- package/dist/esm/types/errors.d.ts +3 -0
- package/dist/esm/types/errors.d.ts.map +1 -1
- package/dist/esm/types/errors.js +3 -0
- package/dist/esm/types/errors.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pure defaults resolution and validation for database role configuration, and
|
|
4
|
+
* the shared validators every backend runs over caller-supplied identifiers.
|
|
5
|
+
*
|
|
6
|
+
* @module operator/grants/role-config
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.assertValidRoleName = assertValidRoleName;
|
|
10
|
+
exports.assertValidDatabaseName = assertValidDatabaseName;
|
|
11
|
+
exports.resolveRoleConfig = resolveRoleConfig;
|
|
12
|
+
const errors_js_1 = require("../../types/errors.js");
|
|
13
|
+
const DEFAULT_LOGIN = true;
|
|
14
|
+
const DEFAULT_RECLAIM_POLICY = "retain";
|
|
15
|
+
/**
|
|
16
|
+
* Characters no role name may contain, with a human-readable name for each.
|
|
17
|
+
*
|
|
18
|
+
* Every engine nimbus supports quotes identifiers somehow — PostgreSQL with
|
|
19
|
+
* `"`, MariaDB with `` ` ``, Neo4j Cypher with `` ` `` — and each of these
|
|
20
|
+
* characters terminates or escapes at least one of those quotings. A role name
|
|
21
|
+
* is caller-controlled and flows into generated SQL, into Cypher, and into CR
|
|
22
|
+
* `spec` fields, so it is validated once here rather than argued about three
|
|
23
|
+
* times. NUL is included because it truncates the identifier in C-string
|
|
24
|
+
* consumers rather than being rejected by them.
|
|
25
|
+
*/
|
|
26
|
+
const FORBIDDEN_ROLE_NAME_CHARS = [
|
|
27
|
+
["`", "a backtick"],
|
|
28
|
+
["'", "a single quote"],
|
|
29
|
+
['"', "a double quote"],
|
|
30
|
+
["\\", "a backslash"],
|
|
31
|
+
["\0", "a NUL byte"],
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Matches a value holding nothing but whitespace, the empty string included.
|
|
35
|
+
*
|
|
36
|
+
* The empty string is not a valid account or database name in PostgreSQL,
|
|
37
|
+
* MariaDB or Neo4j. Whitespace-only strings technically are — every engine
|
|
38
|
+
* quotes identifiers, so `" "` is creatable — but they are refused alongside
|
|
39
|
+
* the empty string because nothing readable derives from them: narrowing one
|
|
40
|
+
* into a Kubernetes name leaves nothing behind, so every resource would be
|
|
41
|
+
* named after a bare hash. A name that renders as nothing is a config typo far
|
|
42
|
+
* more often than it is a deliberate account.
|
|
43
|
+
*/
|
|
44
|
+
const BLANK_IDENTIFIER = /^\s*$/;
|
|
45
|
+
/**
|
|
46
|
+
* Reject a role name that cannot be safely embedded in a database identifier.
|
|
47
|
+
*
|
|
48
|
+
* This is a choke point, not a per-engine concern. CloudNativePG's grants go
|
|
49
|
+
* through an identifier quoter and MariaDB's go through `Grant` CRs rather than
|
|
50
|
+
* SQL, so neither is exploitable today — but Neo4j interpolates the name
|
|
51
|
+
* directly into a Cypher `CREATE USER` statement between escaped backticks, and
|
|
52
|
+
* one validator all three call is easier to reason about than three separate
|
|
53
|
+
* arguments for why each backend happens to be fine.
|
|
54
|
+
*
|
|
55
|
+
* A blank name is refused here for the same reason: accepted, all three backends
|
|
56
|
+
* would register a full set of resources — the CR or Job, the credential Secret,
|
|
57
|
+
* the replicated connection Secrets — and the failure would surface only once
|
|
58
|
+
* the controller or provisioning Job tried to create an account with no name,
|
|
59
|
+
* long after `pulumi up` reported success.
|
|
60
|
+
*
|
|
61
|
+
* @param roleName - Role name as it would be created in the engine
|
|
62
|
+
* @param databaseName - Database the role belongs to, for the error message
|
|
63
|
+
* @throws {AnyCloudError} code `UNSUPPORTED_ROLE_OPTION` when the name is blank,
|
|
64
|
+
* or contains a backtick, single quote, double quote, backslash, or NUL byte
|
|
65
|
+
*/
|
|
66
|
+
function assertValidRoleName(roleName, databaseName) {
|
|
67
|
+
if (BLANK_IDENTIFIER.test(roleName)) {
|
|
68
|
+
throw new errors_js_1.AnyCloudError(`Role name ${JSON.stringify(roleName)} on database "${databaseName}" is empty. ` +
|
|
69
|
+
"PostgreSQL, MariaDB and Neo4j all require an account to have a name, so nothing " +
|
|
70
|
+
"would be provisioned for this role — the failure would surface inside the " +
|
|
71
|
+
"controller or provisioning Job, after the deploy reported success. Pass a " +
|
|
72
|
+
"non-empty role name.", errors_js_1.ERROR_CODES.UNSUPPORTED_ROLE_OPTION);
|
|
73
|
+
}
|
|
74
|
+
for (const [char, label] of FORBIDDEN_ROLE_NAME_CHARS) {
|
|
75
|
+
if (roleName.includes(char)) {
|
|
76
|
+
throw new errors_js_1.AnyCloudError(`Role name ${JSON.stringify(roleName)} on database "${databaseName}" contains ` +
|
|
77
|
+
`${label}, which cannot be safely embedded in a database identifier. Role names ` +
|
|
78
|
+
"must not contain backticks, quotes, backslashes, or NUL bytes.", errors_js_1.ERROR_CODES.UNSUPPORTED_ROLE_OPTION);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Reject a database name no engine could create a database under.
|
|
84
|
+
*
|
|
85
|
+
* The same hole as a blank role name, one level up: `createDatabase("")` — or a
|
|
86
|
+
* name resolved from a config value that turned out to be empty — reaches the
|
|
87
|
+
* backends as a database with no name, and every CR, Job and Secret is
|
|
88
|
+
* registered before anything notices. On CloudNativePG and Neo4j the owner
|
|
89
|
+
* defaults to the database name and would be caught by
|
|
90
|
+
* {@link assertValidRoleName}, but only while no explicit `owner` is set, which
|
|
91
|
+
* is exactly the case a caller is most likely to have configured.
|
|
92
|
+
*
|
|
93
|
+
* Only blankness is checked. The character set is not narrowed here: a database
|
|
94
|
+
* name reaches the engine through CR `spec` fields rather than through SQL this
|
|
95
|
+
* library composes, and on every backend it is additionally run through
|
|
96
|
+
* {@link assertValidRoleName} whenever it is also the owner's name.
|
|
97
|
+
*
|
|
98
|
+
* @param databaseName - Database name as it would be created in the engine
|
|
99
|
+
* @throws {AnyCloudError} code `UNSUPPORTED_ROLE_OPTION` when the name is blank
|
|
100
|
+
*/
|
|
101
|
+
function assertValidDatabaseName(databaseName) {
|
|
102
|
+
if (BLANK_IDENTIFIER.test(databaseName)) {
|
|
103
|
+
throw new errors_js_1.AnyCloudError(`Database name ${JSON.stringify(databaseName)} is empty. A database must have a ` +
|
|
104
|
+
"name on every engine nimbus supports, so nothing would be provisioned for it — " +
|
|
105
|
+
"the failure would surface inside the controller or provisioning Job, after the " +
|
|
106
|
+
"deploy reported success. Pass a non-empty database name.", errors_js_1.ERROR_CODES.UNSUPPORTED_ROLE_OPTION);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Apply defaults to a role config and validate its grants.
|
|
111
|
+
*
|
|
112
|
+
* `grants` is deliberately **not** defaulted: see
|
|
113
|
+
* {@link IResolvedRoleConfig.grants} for why `undefined` and `[]` must stay
|
|
114
|
+
* distinguishable.
|
|
115
|
+
*
|
|
116
|
+
* @param config - Raw user-supplied configuration
|
|
117
|
+
* @returns Configuration with every optional field resolved
|
|
118
|
+
* @throws {AnyCloudError} code `INVALID_GRANT` when a grant lists no privileges
|
|
119
|
+
*/
|
|
120
|
+
function resolveRoleConfig(config) {
|
|
121
|
+
const grants = config?.grants;
|
|
122
|
+
for (const grant of grants ?? []) {
|
|
123
|
+
if (grant.privileges.length === 0) {
|
|
124
|
+
throw new errors_js_1.AnyCloudError("Each grant must list at least one privilege.", errors_js_1.ERROR_CODES.INVALID_GRANT);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
login: config?.login ?? DEFAULT_LOGIN,
|
|
129
|
+
grants,
|
|
130
|
+
reclaimPolicy: config?.reclaimPolicy ?? DEFAULT_RECLAIM_POLICY,
|
|
131
|
+
namespaces: config?.namespaces ?? [],
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=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CAAC,uBAAuB,CACpC,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,uBAAuB,CAAC,YAAoB;IAC1D,IAAI,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,yBAAa,CACrB,iBAAiB,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,oCAAoC;YAC/E,iFAAiF;YACjF,iFAAiF;YACjF,0DAA0D,EAC5D,uBAAW,CAAC,uBAAuB,CACpC,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,iBAAiB,CAAC,MAA4B;IAC5D,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC;IAE9B,KAAK,MAAM,KAAK,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;QACjC,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,yBAAa,CACrB,8CAA8C,EAC9C,uBAAW,CAAC,aAAa,CAC1B,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,aAAa;QACrC,MAAM;QACN,aAAa,EAAE,MAAM,EAAE,aAAa,IAAI,sBAAsB;QAC9D,UAAU,EAAE,MAAM,EAAE,UAAU,IAAI,EAAE;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @module operator
|
|
9
9
|
*/
|
|
10
10
|
import type { IOperator, IMinIOOperator, IOperatorConfig, OperatorType } from "./interfaces";
|
|
11
|
-
export type { OperatorType, EnvironmentOverrides, IBackupDefaults, IOperatorConfig, IOperatorClusterConfig, IOperatorDatabaseConfig, IDatabaseInstance, IClusterInstance, IOperator, IMinIOOperator, IMinIOBucket, IMinIOBucketConfig, IMinIOIngressConfig, } from "./interfaces";
|
|
11
|
+
export type { OperatorType, EnvironmentOverrides, IBackupDefaults, IOperatorConfig, IOperatorClusterConfig, IOperatorDatabaseConfig, IDatabaseInstance, IDatabaseGrant, IDatabaseRole, IDatabaseRoleConfig, ReclaimPolicy, IClusterInstance, IOperator, IMinIOOperator, IMinIOBucket, IMinIOBucketConfig, IMinIOIngressConfig, } from "./interfaces";
|
|
12
12
|
export { OPERATOR_TYPES } from "./interfaces";
|
|
13
13
|
export { createMinioIngress } from "./minio";
|
|
14
14
|
export type { INeo4jClusterConfig } from "./neo4j";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/operator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,eAAe,EAGf,YAAY,EACb,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AA8CnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,GAAG,cAAc,CAAC;AACvF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,OAAO,EACrD,MAAM,EAAE,eAAe,GACtB,SAAS,CAAC;AACb,wBAAgB,cAAc,CAC5B,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,eAAe,GACtB,SAAS,GAAG,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/operator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,eAAe,EAGf,YAAY,EACb,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AA8CnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,GAAG,cAAc,CAAC;AACvF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,OAAO,EACrD,MAAM,EAAE,eAAe,GACtB,SAAS,CAAC;AACb,wBAAgB,cAAc,CAC5B,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,eAAe,GACtB,SAAS,GAAG,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/operator/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/operator/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACJ,WAAW;QACX,aAAa,CAAC,IAAY,EAAE,aAAsC;YAChE,IAAI,MAA2D,CAAC;YAChE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;YAC5C,QAAQ,IAAI,EAAE,CAAC;gBACb,KAAK,gBAAgB;oBACnB,MAAM,GAAG,IAAA,yBAAkB,EACzB,IAAI,EACJ,aAAa,EACb,MAAM,CAAC,MAAM,EACb,QAAQ,EACR,WAAW,EACX,OAAO,CACR,CAAC;oBACF,MAAM;gBACR,KAAK,kBAAkB;oBACrB,MAAM,GAAG,IAAA,+BAAqB,EAC5B,IAAI,EACJ,aAAa,EACb,MAAM,CAAC,MAAM,EACb,QAAQ,EACR,WAAW,EACX,OAAO,CACR,CAAC;oBACF,MAAM;gBACR,KAAK,OAAO;oBACV,oEAAoE;oBACpE,mEAAmE;oBACnE,MAAM,GAAG,IAAA,0BAAkB,EACzB,IAAI;oBACJ,gHAAgH;oBAChH,aAAoB,EACpB,MAAM,CAAC,MAAM,EACb,QAAQ,EACR,WAAW,EACX,OAAO,CACR,CAAC;oBACF,MAAM;gBACR;oBACE,OAAO,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;YACD,gEAAgE;YAChE,gEAAgE;YAChE,OAAO,MAA6D,CAAC;QACvE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -15,6 +15,135 @@ import type { StorageTier } from "../types/storage-tiers";
|
|
|
15
15
|
import type { IExposedService } from "../types";
|
|
16
16
|
/** Per-environment config overrides. Keys are environment names (e.g. "dev", "prod"). */
|
|
17
17
|
export type EnvironmentOverrides<T> = Record<string, Partial<T>>;
|
|
18
|
+
/**
|
|
19
|
+
* End-of-life policy for a declaratively managed database or role.
|
|
20
|
+
*
|
|
21
|
+
* - `"retain"` — the database/role survives deletion of the Kubernetes resource.
|
|
22
|
+
* - `"delete"` — the operator issues `DROP DATABASE` / `DROP ROLE` on deletion.
|
|
23
|
+
*/
|
|
24
|
+
export type ReclaimPolicy = "retain" | "delete";
|
|
25
|
+
/**
|
|
26
|
+
* A privilege grant on a database, portable across engines that model privileges.
|
|
27
|
+
*
|
|
28
|
+
* @example Read-only access to every current and future table in a schema
|
|
29
|
+
* ```typescript
|
|
30
|
+
* { privileges: ["SELECT"], schema: "marts", objects: "all" }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export interface IDatabaseGrant {
|
|
34
|
+
/**
|
|
35
|
+
* Privileges to grant (e.g. ["SELECT"], ["SELECT", "INSERT"]).
|
|
36
|
+
*
|
|
37
|
+
* On PostgreSQL a grant that includes `INSERT`, `UPDATE`, or
|
|
38
|
+
* `ALL PRIVILEGES` additionally grants `USAGE, SELECT` on **every current
|
|
39
|
+
* and future sequence in the grant's schema**, because inserting into a
|
|
40
|
+
* `serial`/`identity` column calls `nextval()` on a separate object with its
|
|
41
|
+
* own ACL — without it every such `INSERT` fails with
|
|
42
|
+
* `permission denied for sequence`. The sequence grant is schema-wide even
|
|
43
|
+
* when `objects` names a single table: a sequence's link to its table lives
|
|
44
|
+
* in the catalog, and the compiler emits static SQL. Sequence `UPDATE`
|
|
45
|
+
* (`setval()`) is never granted, and correspondingly never revoked.
|
|
46
|
+
*
|
|
47
|
+
* A read-only grant (`SELECT` alone, `DELETE`, `TRUNCATE`, `REFERENCES`,
|
|
48
|
+
* `TRIGGER`) gets no sequence privileges.
|
|
49
|
+
*/
|
|
50
|
+
readonly privileges: string[];
|
|
51
|
+
/**
|
|
52
|
+
* Schema to scope the grant to. PostgreSQL only; ignored by engines without
|
|
53
|
+
* schemas. MariaDB in particular has no schema concept distinct from the
|
|
54
|
+
* database, so this field is dropped there and the grant applies to the
|
|
55
|
+
* database named by the {@link IDatabaseInstance} it was added to.
|
|
56
|
+
*/
|
|
57
|
+
readonly schema?: string;
|
|
58
|
+
/** A specific object name, or every current and future object when "all". Default: "all". */
|
|
59
|
+
readonly objects?: string;
|
|
60
|
+
}
|
|
61
|
+
/** Configuration for a role created via {@link IDatabaseInstance.addRole}. */
|
|
62
|
+
export interface IDatabaseRoleConfig {
|
|
63
|
+
/** Namespaces to replicate the credential Secret into. */
|
|
64
|
+
readonly namespaces?: string[];
|
|
65
|
+
/** Whether the role can log in. Default: true. */
|
|
66
|
+
readonly login?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Privileges this role holds on the owning database.
|
|
69
|
+
*
|
|
70
|
+
* The field has three states, and the difference between the last two
|
|
71
|
+
* matters:
|
|
72
|
+
*
|
|
73
|
+
* - **omitted** — nimbus does not manage this role's privileges. Nothing is
|
|
74
|
+
* granted and, on CloudNativePG, nothing is revoked: whatever the role
|
|
75
|
+
* holds is left exactly as it is.
|
|
76
|
+
* - **`[]`** — this role should hold *no* privileges. This is a real desired
|
|
77
|
+
* state, not an absence of one: on CloudNativePG the reconciling Job still
|
|
78
|
+
* runs and revokes everything the role holds. Removing the last entry from
|
|
79
|
+
* a role's grants therefore actually takes its access away, rather than
|
|
80
|
+
* freezing it at whatever was granted last.
|
|
81
|
+
* - **a non-empty list** — the role holds exactly these privileges; anything
|
|
82
|
+
* else it held is revoked.
|
|
83
|
+
*
|
|
84
|
+
* On MariaDB the first two states coincide, since privileges live in `Grant`
|
|
85
|
+
* CRs the operator deletes (and revokes) when they leave the config. Neo4j
|
|
86
|
+
* Community has no RBAC at all, so any value — including `[]` — throws.
|
|
87
|
+
*/
|
|
88
|
+
readonly grants?: IDatabaseGrant[];
|
|
89
|
+
/**
|
|
90
|
+
* End-of-life policy for the role. Default: `"retain"`.
|
|
91
|
+
*
|
|
92
|
+
* **CloudNativePG only, and — uniquely among this module's engine-specific
|
|
93
|
+
* options — accepted and ignored elsewhere rather than rejected.** On CNPG it
|
|
94
|
+
* becomes `DatabaseRole.spec.databaseRoleReclaimPolicy`. MariaDB and Neo4j
|
|
95
|
+
* drop it: their role lifecycle is governed by the operator's own default
|
|
96
|
+
* (mariadb-operator's `spec.cleanupPolicy`, left unset) instead.
|
|
97
|
+
*
|
|
98
|
+
* Every other unhonourable option throws `UNSUPPORTED_ROLE_OPTION` at preview.
|
|
99
|
+
* This one cannot, because it is defaulted: `resolveRoleConfig` fills in
|
|
100
|
+
* `"retain"`, so it is always "set" and a guard could not distinguish an
|
|
101
|
+
* explicit value from an omitted one without rejecting every MariaDB and
|
|
102
|
+
* Neo4j role that exists. Adopting `cleanupPolicy` instead would change the
|
|
103
|
+
* deletion semantics of already-running CRs on the next apply. The exemption
|
|
104
|
+
* and its reasoning are recorded at the rule's definition site — see the
|
|
105
|
+
* `operator/database-options` module docblock.
|
|
106
|
+
*/
|
|
107
|
+
readonly reclaimPolicy?: ReclaimPolicy;
|
|
108
|
+
/** Engine-specific options that do not port across engines. */
|
|
109
|
+
readonly engineOptions?: {
|
|
110
|
+
readonly postgresql?: {
|
|
111
|
+
/** Existing roles this role becomes a member of (e.g. ["pg_read_all_data"]). */
|
|
112
|
+
readonly inRoles?: string[];
|
|
113
|
+
/** Maximum concurrent connections. Default: unlimited. */
|
|
114
|
+
readonly connectionLimit?: number;
|
|
115
|
+
/** Timestamp after which the password expires. */
|
|
116
|
+
readonly validUntil?: string;
|
|
117
|
+
};
|
|
118
|
+
readonly mariadb?: {
|
|
119
|
+
/**
|
|
120
|
+
* Host pattern the user may connect from. Default: `"%"`.
|
|
121
|
+
*
|
|
122
|
+
* A blank or whitespace-only pattern resolves to the same `"%"` an
|
|
123
|
+
* omitted one does — that is what the account ends up with either way, so
|
|
124
|
+
* it is also the identity nimbus refuses to hand out twice. Two databases
|
|
125
|
+
* asking for `reader` with and without `host: ""` are asking for one
|
|
126
|
+
* MariaDB account, and the second is rejected at preview.
|
|
127
|
+
*/
|
|
128
|
+
readonly host?: string;
|
|
129
|
+
/** Maximum concurrent connections. Default: 100. */
|
|
130
|
+
readonly maxUserConnections?: number;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/** A role provisioned within a database. */
|
|
135
|
+
export interface IDatabaseRole {
|
|
136
|
+
/** Role name as it exists in the database engine. */
|
|
137
|
+
readonly name: string;
|
|
138
|
+
/** Database this role was created for. */
|
|
139
|
+
readonly databaseName: string;
|
|
140
|
+
/** Cluster the database belongs to. */
|
|
141
|
+
readonly clusterName: string;
|
|
142
|
+
/** Secrets created in target namespaces (namespace → secret name). */
|
|
143
|
+
readonly secrets: Record<string, pulumi.Output<string>>;
|
|
144
|
+
/** Underlying Pulumi resource for dependency wiring. */
|
|
145
|
+
readonly nativeResource: pulumi.Resource;
|
|
146
|
+
}
|
|
18
147
|
/** Supported Kubernetes database operators. */
|
|
19
148
|
export type OperatorType = "cloudnative-pg" | "mariadb-operator" | "minio" | "neo4j";
|
|
20
149
|
/** Typed constant map for OperatorType string literals. */
|
|
@@ -77,6 +206,17 @@ export interface IOperatorClusterConfig {
|
|
|
77
206
|
readonly parameters?: Record<string, string>;
|
|
78
207
|
/** Resource tags (applied as labels). */
|
|
79
208
|
readonly tags?: Record<string, string>;
|
|
209
|
+
/**
|
|
210
|
+
* Expose a network-reachable superuser and publish its credentials Secret
|
|
211
|
+
* (CloudNativePG only). Default: false.
|
|
212
|
+
*
|
|
213
|
+
* Databases and roles are provisioned through the operator's own `Database`
|
|
214
|
+
* and `DatabaseRole` CRDs, which run inside the instance manager and do not
|
|
215
|
+
* need this. Enable it only when something outside nimbus must connect as
|
|
216
|
+
* `postgres` — turning it off makes CNPG set the superuser password to NULL
|
|
217
|
+
* and delete the `{cluster}-superuser` Secret.
|
|
218
|
+
*/
|
|
219
|
+
readonly superuserAccess?: boolean;
|
|
80
220
|
/** When set, creates separate clusters per environment with {name}-{env} naming. Per-env values override base config. */
|
|
81
221
|
readonly environments?: EnvironmentOverrides<Omit<IOperatorClusterConfig, "environments">>;
|
|
82
222
|
}
|
|
@@ -84,8 +224,62 @@ export interface IOperatorClusterConfig {
|
|
|
84
224
|
export interface IOperatorDatabaseConfig {
|
|
85
225
|
/** Namespaces to replicate the connection secret into. */
|
|
86
226
|
readonly namespaces: string[];
|
|
87
|
-
/**
|
|
227
|
+
/**
|
|
228
|
+
* Database owner/username. Default: same as database name.
|
|
229
|
+
*
|
|
230
|
+
* Honoured by CloudNativePG and Neo4j. **Rejected by MariaDB** unless it
|
|
231
|
+
* equals the database name: mariadb-operator treats `User.spec.name` and
|
|
232
|
+
* `Grant.spec.username` as immutable, so on an existing database honouring it
|
|
233
|
+
* would rename only the replicated connection Secrets and leave applications
|
|
234
|
+
* authenticating as an account that was never created. Use `addRole()` to
|
|
235
|
+
* create additional MariaDB accounts.
|
|
236
|
+
*/
|
|
88
237
|
readonly owner?: string;
|
|
238
|
+
/**
|
|
239
|
+
* What happens to the PostgreSQL database and its owning role when the
|
|
240
|
+
* Kubernetes resources are deleted (CloudNativePG only). Default: `"retain"`.
|
|
241
|
+
*
|
|
242
|
+
* `"retain"` keeps the data, so removing a database from config — or renaming
|
|
243
|
+
* the Pulumi resource — is never destructive. Set `"delete"` only for
|
|
244
|
+
* databases whose lifecycle should genuinely track the config.
|
|
245
|
+
*
|
|
246
|
+
* **On MariaDB and Neo4j this is accepted and ignored, not rejected** — the
|
|
247
|
+
* single deliberate exception to the rule that an option which cannot be
|
|
248
|
+
* honoured throws `UNSUPPORTED_ROLE_OPTION` at preview. It is exempt because
|
|
249
|
+
* it is defaulted (so it is always "set" and no guard could tell an explicit
|
|
250
|
+
* value from an omitted one), because only CloudNativePG consumes it, and
|
|
251
|
+
* because adopting mariadb-operator's `spec.cleanupPolicy` would silently
|
|
252
|
+
* change the deletion semantics of CRs that already exist. There, the
|
|
253
|
+
* database's lifecycle follows the operator's own default instead. See the
|
|
254
|
+
* `operator/database-options` module docblock for the full reasoning.
|
|
255
|
+
*/
|
|
256
|
+
readonly reclaimPolicy?: ReclaimPolicy;
|
|
257
|
+
/**
|
|
258
|
+
* Raw SQL applied to the database as its owner, after the database and owner
|
|
259
|
+
* role exist. Intended for one-off setup a CRD cannot express, such as
|
|
260
|
+
* `CREATE EXTENSION IF NOT EXISTS ...` or seeding a schema.
|
|
261
|
+
*
|
|
262
|
+
* **CloudNativePG only.** It rides along in the same owner-authenticated
|
|
263
|
+
* `psql` Job that reconciles grants; MariaDB (CRs only) and Neo4j (Cypher)
|
|
264
|
+
* have no equivalent path, so both **throw** `UNSUPPORTED_ROLE_OPTION` when
|
|
265
|
+
* this is set rather than accepting statements that would never run.
|
|
266
|
+
*
|
|
267
|
+
* Statements MUST be idempotent — the Job re-runs whenever the content
|
|
268
|
+
* checksum changes, and may be re-applied to a database that already has the
|
|
269
|
+
* result of a previous run.
|
|
270
|
+
*
|
|
271
|
+
* They also run inside the surrounding transaction the applying script opens,
|
|
272
|
+
* not in one of their own, so they must be transaction-safe: statements
|
|
273
|
+
* PostgreSQL refuses inside a transaction block (`CREATE INDEX CONCURRENTLY`,
|
|
274
|
+
* `VACUUM`) will error, and a stray `COMMIT;` closes the transaction early and
|
|
275
|
+
* leaves the script's own trailing `COMMIT;` failing outside any transaction.
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```typescript
|
|
279
|
+
* sql: ["CREATE EXTENSION IF NOT EXISTS pgcrypto;"]
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
readonly sql?: string[];
|
|
89
283
|
/** When set, creates separate databases per environment with {dbName}-{env} naming. Per-env values override base config. */
|
|
90
284
|
readonly environments?: EnvironmentOverrides<Omit<IOperatorDatabaseConfig, "environments">>;
|
|
91
285
|
}
|
|
@@ -105,6 +299,34 @@ export interface IDatabaseInstance {
|
|
|
105
299
|
readonly secrets: Record<string, pulumi.Output<string>>;
|
|
106
300
|
/** Underlying Pulumi resource for dependency wiring. */
|
|
107
301
|
readonly nativeResource: pulumi.Resource;
|
|
302
|
+
/**
|
|
303
|
+
* Create an additional role/user on this database with a generated password,
|
|
304
|
+
* replicating a connection Secret into the given namespaces.
|
|
305
|
+
*
|
|
306
|
+
* Implemented by every backend — CloudNativePG, MariaDB, and Neo4j — though
|
|
307
|
+
* not by the same mechanism: CNPG and MariaDB reconcile the account through a
|
|
308
|
+
* CRD, while Neo4j (which has no operator) creates it with a one-shot
|
|
309
|
+
* `cypher-shell` Job. The API is uniform; the guarantees behind it are not.
|
|
310
|
+
*
|
|
311
|
+
* `grants` are reconciled, not merely applied: every privilege the role holds
|
|
312
|
+
* is revoked before the requested grants are re-applied, so removing a grant
|
|
313
|
+
* from config actually removes it — including the last one, since
|
|
314
|
+
* `grants: []` means "hold nothing" rather than "manage nothing" (see
|
|
315
|
+
* {@link IDatabaseRoleConfig.grants}). The database owner is exempt and
|
|
316
|
+
* cannot be passed here at all — an owner's rights over its own objects are
|
|
317
|
+
* ordinary ACL entries, so revoking them would strip the owner's access to
|
|
318
|
+
* the very tables it owns. The owner's role is created by `createDatabase()`.
|
|
319
|
+
*
|
|
320
|
+
* @param name - Role name as it will exist in the database engine
|
|
321
|
+
* @param config - Namespaces, login flag, grants, and engine-specific options
|
|
322
|
+
* @returns The provisioned role with its replicated Secret references
|
|
323
|
+
* @throws {AnyCloudError} with code `UNSUPPORTED_ROLE_OPTION` when `grants` is
|
|
324
|
+
* passed to an engine that cannot express privileges (Neo4j Community),
|
|
325
|
+
* when `login: false` is passed to an engine whose every account is a login
|
|
326
|
+
* account (MariaDB, Neo4j), or when `name` is the database owner's own role
|
|
327
|
+
* name.
|
|
328
|
+
*/
|
|
329
|
+
addRole(name: string, config?: IDatabaseRoleConfig): IDatabaseRole;
|
|
108
330
|
}
|
|
109
331
|
/** A database cluster instance created by an operator. */
|
|
110
332
|
export interface IClusterInstance {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/operator/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,aAA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CAA2C;AAC3C,MAAM,WAAW,SAAS;IACxB,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;IAC1C;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,sBAAsB,GAAG,gBAAgB,CAAC;IAC/E,2FAA2F;IAC3F,aAAa,CACX,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,sBAAsB,GAAG,QAAQ,CAAC,IAAI,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC,GACtF,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/operator/interfaces.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/operator/interfaces.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAoJH,2DAA2D;AAC9C,QAAA,cAAc,GAAG;IAC5B,cAAc,EAAE,gBAAyB;IACzC,gBAAgB,EAAE,kBAA2B;IAC7C,KAAK,EAAE,OAAgB;IACvB,KAAK,EAAE,OAAgB;CACe,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants and naming helpers shared by the MariaDB Operator modules.
|
|
3
|
+
*
|
|
4
|
+
* They live here rather than in any one module because `mariadb.ts` (the
|
|
5
|
+
* MariaDB instance), `mariadb-roles.ts` (users, grants, and credentials), and
|
|
6
|
+
* `mariadb-database.ts` (databases) all need them and none of them owns them.
|
|
7
|
+
*
|
|
8
|
+
* @module operator/mariadb-common
|
|
9
|
+
*/
|
|
10
|
+
import { type IRoleRegistry } from "./role-registry.js";
|
|
11
|
+
/** Namespace every MariaDB instance, database, and credential Secret is created in. */
|
|
12
|
+
export declare const DATA_NAMESPACE = "data";
|
|
13
|
+
/** API group and version of every mariadb-operator custom resource. */
|
|
14
|
+
export declare const MARIADB_API_VERSION = "k8s.mariadb.com/v1alpha1";
|
|
15
|
+
/** Kind of the custom resource that owns a MariaDB instance. */
|
|
16
|
+
export declare const MARIADB_KIND = "MariaDB";
|
|
17
|
+
/** Kind of the custom resource that owns a database. */
|
|
18
|
+
export declare const DATABASE_KIND = "Database";
|
|
19
|
+
/** Kind of the custom resource that owns a login account. */
|
|
20
|
+
export declare const USER_KIND = "User";
|
|
21
|
+
/** Kind of the custom resource that owns a privilege grant. */
|
|
22
|
+
export declare const GRANT_KIND = "Grant";
|
|
23
|
+
/** Kind of the custom resource that owns a scheduled backup. */
|
|
24
|
+
export declare const BACKUP_KIND = "Backup";
|
|
25
|
+
/** Host pattern a user may connect from when none is configured. */
|
|
26
|
+
export declare const DEFAULT_GRANT_HOST = "%";
|
|
27
|
+
/** Concurrent connection cap applied to every provisioned user. */
|
|
28
|
+
export declare const DEFAULT_MAX_USER_CONNECTIONS = 100;
|
|
29
|
+
/** `spec.table` value covering every table in the database. */
|
|
30
|
+
export declare const ALL_TABLES = "*";
|
|
31
|
+
/** `IDatabaseGrant.objects` value meaning "every object", not a literal name. */
|
|
32
|
+
export declare const ALL_OBJECTS = "all";
|
|
33
|
+
/** Privilege set granted to a database's owner. */
|
|
34
|
+
export declare const ALL_PRIVILEGES = "ALL PRIVILEGES";
|
|
35
|
+
/**
|
|
36
|
+
* Create the role-identity registry for one MariaDB instance.
|
|
37
|
+
*
|
|
38
|
+
* @param clusterName - MariaDB instance the registry covers
|
|
39
|
+
* @returns A registry that rejects a `user`@`host` pair claimed twice on this instance
|
|
40
|
+
*/
|
|
41
|
+
export declare function createMariadbRoleRegistry(clusterName: string): IRoleRegistry;
|
|
42
|
+
/**
|
|
43
|
+
* Resolve a configured host pattern to the value the account will actually have.
|
|
44
|
+
*
|
|
45
|
+
* There is exactly one effective host for any configuration, and everything that
|
|
46
|
+
* identifies the account has to agree on it: the registry key that refuses a
|
|
47
|
+
* duplicate `user`@`host`, the Pulumi logical names derived from that pair, and
|
|
48
|
+
* the `spec.host` written into the `User` and `Grant` CRs. A configured `""`
|
|
49
|
+
* used to survive `?? DEFAULT_GRANT_HOST` — the empty string is not nullish — so
|
|
50
|
+
* it was registered and named as the distinct identity `reader`@`""` while the
|
|
51
|
+
* CRs omitted the field and inherited the operator's own `%` default. Two
|
|
52
|
+
* databases could then claim what MariaDB sees as one account, each pointing it
|
|
53
|
+
* at a different generated password Secret, which is the exact collision the
|
|
54
|
+
* registry exists to prevent.
|
|
55
|
+
*
|
|
56
|
+
* Whitespace-only patterns resolve the same way, and a surrounding-whitespace
|
|
57
|
+
* pattern is trimmed, so `" 10.0.0.1 "` and `"10.0.0.1"` cannot be claimed as
|
|
58
|
+
* two accounts either.
|
|
59
|
+
*
|
|
60
|
+
* @param host - Host pattern as configured, if any
|
|
61
|
+
* @returns The host the account is effectively reachable from, never blank
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* resolveMariadbHost(undefined); // "%"
|
|
66
|
+
* resolveMariadbHost(""); // "%"
|
|
67
|
+
* resolveMariadbHost(" 10.0.0.1 "); // "10.0.0.1"
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function resolveMariadbHost(host: string | undefined): string;
|
|
71
|
+
/**
|
|
72
|
+
* Claim a MariaDB account on an instance.
|
|
73
|
+
*
|
|
74
|
+
* The claim is keyed on the username **and** the host, because that pair is what
|
|
75
|
+
* MariaDB treats as one account: `reader`@`%` and `reader`@`10.0.0.1` are two
|
|
76
|
+
* separate accounts with separate passwords, so both must be allowed.
|
|
77
|
+
*
|
|
78
|
+
* @param registry - The instance's registry
|
|
79
|
+
* @param roleName - Username as it will exist in MariaDB
|
|
80
|
+
* @param host - Effective host pattern, as returned by {@link resolveMariadbHost}
|
|
81
|
+
* @param dbName - Database whose configuration is claiming it
|
|
82
|
+
* @throws {AnyCloudError} code `UNSUPPORTED_ROLE_OPTION` when the pair is taken
|
|
83
|
+
*/
|
|
84
|
+
export declare function claimMariadbRoleName(registry: IRoleRegistry, roleName: string, host: string, dbName: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Normalize a string into a DNS-1123 subdomain usable as `metadata.name`.
|
|
87
|
+
*
|
|
88
|
+
* Only the Kubernetes object name is sanitized — the MariaDB identifiers in
|
|
89
|
+
* `spec.name` / `spec.username` are passed through verbatim so that CRs adopt
|
|
90
|
+
* databases and users that already exist under their original names.
|
|
91
|
+
*
|
|
92
|
+
* Sanitizing is lossy, so this is not safe for anything that has to identify a
|
|
93
|
+
* resource: see {@link toIdentitySegment}.
|
|
94
|
+
*
|
|
95
|
+
* @param value - Raw name
|
|
96
|
+
* @returns A lowercase, `-`-separated name safe for `metadata.name`
|
|
97
|
+
*/
|
|
98
|
+
export declare function toResourceName(value: string): string;
|
|
99
|
+
//# sourceMappingURL=mariadb-common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mariadb-common.d.ts","sourceRoot":"","sources":["../../../src/operator/mariadb-common.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAG5E,uFAAuF;AACvF,eAAO,MAAM,cAAc,SAAS,CAAC;AAErC,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,6BAA6B,CAAC;AAE9D,gEAAgE;AAChE,eAAO,MAAM,YAAY,YAAY,CAAC;AAEtC,wDAAwD;AACxD,eAAO,MAAM,aAAa,aAAa,CAAC;AAExC,6DAA6D;AAC7D,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,+DAA+D;AAC/D,eAAO,MAAM,UAAU,UAAU,CAAC;AA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