Improve infrastructure role definitions (#208)

Enhance definitions of infrastructure roles by allowing membership in multiple roles, role options and per-role configuration to be specified in the infrastructure role configmap, which must have the same name as the infrastructure role secret. See manifests/infrastructure-roles-configmap.yaml for the examples and updated README for the description of different types of database roles supposed by the operator and their purposes.

Change the logic of merging infrastructure roles with the manifest roles when they have the same name, to return the infrastructure role unchanged instead of merging. Previously, we used to propagate flags from the manifest role to the resulting infrastructure one, as there were no way to define flags for the infrastructure role; however, this is not the case anymore.

Code review and tests by @erthalion
This commit is contained in:
Oleksii Kliukin
2018-04-04 17:21:36 +02:00
committed by GitHub
parent d264be9faa
commit 26db91c53e
10 changed files with 261 additions and 51 deletions
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: postgresql-infrastructure-roles
data:
batman: |
inrole: [admin] # following roles will be assigned to the new user
user_flags:
- createdb
db_parameters: # db parameters, applyed for this particular user
log_statement: all
+5 -1
View File
@@ -3,7 +3,8 @@ data:
# required format (w/o quotes): 'propertyNumber: value'
# allowed properties: 'user', 'password', 'inrole'
# numbers >= 1 are mandatory
# alternatively, supply the user: password pairs and
# provide other options in the configmap.
# robot_zmon_acid_monitoring
user1: cm9ib3Rfem1vbl9hY2lkX21vbml0b3Jpbmc=
# robot_zmon
@@ -12,6 +13,9 @@ data:
user2: dGVzdHVzZXI=
# foobar
password2: Zm9vYmFy
# user batman with the password justice
# look for other fields in the infrastructure roles configmap
batman: anVzdGljZQ==
kind: Secret
metadata:
name: postgresql-infrastructure-roles