postgres-operator/pkg/util
Dmitrii Dolgov d5b7c94ba3 Extend infrastructure roles handling
Postgres Operator uses infrastructure roles to provide access to a
database for external users e.g. for monitoring purposes. Such
infrastructure roles are expected to be present in the form of k8s
secrets with the following content:

    inrole1: some_encrypted_role
    password1: some_encrypted_password
    user1: some_entrypted_name

    inrole2: some_encrypted_role
    password2: some_encrypted_password
    user2: some_entrypted_name

The format of this content is implied implicitely and not flexible
enough. In case if we do not have possibility to change the format of a
secret we want to use in the Operator, we need to recreate it in this
format.

To address this lets make the format of secret content explicitely. The
idea is to introduce a new configuration option for the Operator.

    infrastructure_roles_secrets:
    - secret: k8s_secret_name
      name: some_encrypted_name
      password: some_encrypted_password
      role: some_encrypted_role

    - secret: k8s_secret_name
      name: some_encrypted_name
      password: some_encrypted_password
      role: some_encrypted_role

This would allow Operator to use any avalable secrets to prepare
infrastructure roles. To make it backward compatible simulate the old
behaviour if the new option is not present.

The new configuration option is intended be used mainly from CRD, but
it's also available via Operator ConfigMap in a limited fashion. For
ConfigMap one can put there only a string with one secret definition in
the following format (as a string):

    infrastructure_roles_secret_name: |
        secret: k8s_secret_name,
        name: some_encrypted_name,
        password: some_encrypted_password,
        role: some_encrypted_role
2020-07-27 10:38:02 +02:00
..
config Extend infrastructure roles handling 2020-07-27 10:38:02 +02:00
constants Bootstrapped databases with best practice role setup (#843) 2020-04-29 10:56:06 +02:00
filesystems Fix golint warnings 2017-08-01 16:08:56 +02:00
k8sutil Extend infrastructure roles handling 2020-07-27 10:38:02 +02:00
patroni Re-create pods only if all replicas are running (#903) 2020-04-20 15:14:11 +02:00
retryutil Fix typo (#965) 2020-05-12 09:20:09 +02:00
ringlog fix comments for ringlogger 2017-09-26 13:12:38 +02:00
teams Move operator to go 1.14 (#882) 2020-03-30 15:50:17 +02:00
users Bootstrapped databases with best practice role setup (#843) 2020-04-29 10:56:06 +02:00
volumes reflect change in github url (#496) 2019-02-25 11:26:55 +01:00
util.go bump pooler image and more coalescing for CRD config (#1004) 2020-06-05 11:14:17 +02:00
util_test.go Enforce minimum cpu and memory limits (#731) 2019-12-12 16:43:55 +01:00