mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-05 11:52:15 +02:00
Create cross namespace secrets (#1490)
* Create cross namespace secrets * add test cases * fixes * Fixes - include namespace in secret name only when namespace is provided - use username.namespace as key to pgUsers only when namespace is provided - avoid conflict in the role creation in db by checking namespace alongwith the username * Update unit tests * Fix test case * Fixes - update regular expression for usernames - add test to allow check for valid usernames - create pg roles with namespace (if any) appended in rolename * add more test cases for valid usernames * update docs * fixes as per review comments * update e2e * fixes * Add toggle to allow namespaced secrets * update docs * comment update * Update e2e/tests/test_e2e.py * few minor fixes * fix unit tests * fix e2e * fix e2e attempt 2 * fix e2e Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de> Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
This commit is contained in:
co-authored by
Rafia Sabih
Felix Kunde
parent
9668ac21a3
commit
75a9e2be38
@@ -172,11 +172,11 @@ under the `users` key.
|
||||
|
||||
## Major version upgrades
|
||||
|
||||
Parameters configuring automatic major version upgrades. In a
|
||||
Parameters configuring automatic major version upgrades. In a
|
||||
CRD-configuration, they are grouped under the `major_version_upgrade` key.
|
||||
|
||||
* **major_version_upgrade_mode**
|
||||
Postgres Operator supports [in-place major version upgrade](../administrator.md#in-place-major-version-upgrade)
|
||||
Postgres Operator supports [in-place major version upgrade](../administrator.md#in-place-major-version-upgrade)
|
||||
with three different modes:
|
||||
`"off"` = no upgrade by the operator,
|
||||
`"manual"` = manifest triggers action,
|
||||
@@ -275,11 +275,14 @@ configuration they are grouped under the `kubernetes` key.
|
||||
|
||||
* **secret_name_template**
|
||||
a template for the name of the database user secrets generated by the
|
||||
operator. `{username}` is replaced with name of the secret, `{cluster}` with
|
||||
the name of the cluster, `{tprkind}` with the kind of CRD (formerly known as
|
||||
TPR) and `{tprgroup}` with the group of the CRD. No other placeholders are
|
||||
allowed. The default is
|
||||
`{username}.{cluster}.credentials.{tprkind}.{tprgroup}`.
|
||||
operator. `{namespace}` is replaced with name of the namespace (if cross
|
||||
namespace secrets are enabled via EnableNamespacedSecret flag, otherwise the
|
||||
secret is in cluster's namespace and in that case it is not present in secret
|
||||
name), `{username}` is replaced with name of the secret, `{cluster}` with the
|
||||
name of the cluster, `{tprkind}` with the kind of CRD (formerly known as TPR)
|
||||
and `{tprgroup}` with the group of the CRD. No other placeholders are allowed.
|
||||
The default is
|
||||
`{namespace}.{username}.{cluster}.credentials.{tprkind}.{tprgroup}`.
|
||||
|
||||
* **cluster_domain**
|
||||
defines the default DNS domain for the kubernetes cluster the operator is
|
||||
|
||||
+20
-1
@@ -139,6 +139,25 @@ secret, without ever sharing it outside of the cluster.
|
||||
At the moment it is not possible to define membership of the manifest role in
|
||||
other roles.
|
||||
|
||||
To define the secrets for the users in a different namespace than that of the cluster,
|
||||
one can use the flag `EnableNamespacedSecret` and declare the namespace for the
|
||||
secrets in the manifest in the following manner,
|
||||
|
||||
```yaml
|
||||
spec:
|
||||
users:
|
||||
#users with secret in dfferent namespace
|
||||
appspace.db_user:
|
||||
- createdb
|
||||
```
|
||||
Here, anything before the first dot is taken as the namespace and the text after
|
||||
the first dot is the username. Also, the postgres roles of these usernames would
|
||||
be in the form of `namespace.username`.
|
||||
|
||||
For such usernames, the secret is created in the given namespace and its name is
|
||||
of the following form,
|
||||
`{namespace}.{username}.{team}-{clustername}.credentials.postgresql.acid.zalan.do`
|
||||
|
||||
### Infrastructure roles
|
||||
|
||||
An infrastructure role is a role that should be present on every PostgreSQL
|
||||
@@ -330,7 +349,7 @@ spec:
|
||||
|
||||
This creates roles for members of the `c-team` team not only in all clusters
|
||||
owned by `a-team`, but as well in cluster owned by `b-team`, as `a-team` is
|
||||
an `additionalTeam` to `b-team`
|
||||
an `additionalTeam` to `b-team`
|
||||
|
||||
Not, you can also define `additionalSuperuserTeams` in the `PostgresTeam`
|
||||
manifest. By default, this option is disabled and must be configured with
|
||||
|
||||
Reference in New Issue
Block a user