-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow configuring the operator via the YAML manifest. (#326)
* Up until now, the operator read its own configuration from the configmap. That has a number of limitations, i.e. when the configuration value is not a scalar, but a map or a list. We use a custom code based on github.com/kelseyhightower/envconfig to decode non-scalar values out of plain text keys, but that breaks when the data inside the keys contains both YAML-special elememtns (i.e. commas) and complex quotes, one good example for that is search_path inside `team_api_role_configuration`. In addition, reliance on the configmap forced a flag structure on the configuration, making it hard to write and to read (see zalando/postgres-operator#308 (comment)). The changes allow to supply the operator configuration in a proper YAML file. That required registering a custom CRD to support the operator configuration and provide an example at manifests/postgresql-operator-default-configuration.yaml. At the moment, both old configmap and the new CRD configuration is supported, so no compatibility issues, however, in the future I'd like to deprecate the configmap-based configuration altogether. Contrary to the configmap-based configuration, the CRD one doesn't embed defaults into the operator code, however, one can use the manifests/postgresql-operator-default-configuration.yaml as a starting point in order to build a custom configuration. Since previously `ReadyWaitInterval` and `ReadyWaitTimeout` parameters used to create the CRD were taken from the operator configuration, which is not possible if the configuration itself is stored in the CRD object, I've added the ability to specify them as environment variables `CRD_READY_WAIT_INTERVAL` and `CRD_READY_WAIT_TIMEOUT` respectively. Per review by @zerg-junior and @Jan-M.
- Loading branch information
1 parent
aa59276
commit 27a95e3
Showing
14 changed files
with
583 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
apiVersion: "acid.zalan.do/v1" | ||
kind: postgresql-operator-configuration | ||
metadata: | ||
name: postgresql-operator-default-configuration | ||
configuration: | ||
etcd_host: "" | ||
docker_image: registry.opensource.zalan.do/acid/spilo-cdp-10:1.4-p8 | ||
workers: 4 | ||
min_instances: -1 | ||
max_instances: -1 | ||
resync_period: 5m | ||
#sidecar_docker_images: | ||
# example: "exampleimage:exampletag" | ||
users: | ||
super_username: postgres | ||
replication_username: standby | ||
kubernetes: | ||
pod_service_account_name: operator | ||
pod_terminate_grace_period: 5m | ||
pdb_name_format: "postgres-{cluster}-pdb" | ||
secret_name_template: "{username}.{cluster}.credentials.{tprkind}.{tprgroup}" | ||
oauth_token_secret_name: postgresql-operator | ||
pod_role_label: spilo-role | ||
cluster_labels: | ||
application: spilo | ||
cluster_name_label: cluster-name | ||
# watched_namespace:"" | ||
# node_readiness_label: "" | ||
# toleration: {} | ||
# infrastructure_roles_secret_name: "" | ||
# pod_environment_configmap: "" | ||
postgres_pod_resources: | ||
default_cpu_request: 100m | ||
default_memory_request: 100Mi | ||
default_cpu_limit: "3" | ||
default_memory_limit: 1Gi | ||
timeouts: | ||
resource_check_interval: 3s | ||
resource_check_timeout: 10m | ||
pod_label_wait_timeout: 10m | ||
pod_deletion_wait_timeout: 10m | ||
ready_wait_interval: 4s | ||
ready_wait_timeout: 30s | ||
load_balancer: | ||
enable_master_load_balancer: false | ||
enable_replica_load_balancer: false | ||
master_dns_name_format: "{cluster}.{team}.{hostedzone}" | ||
replica_dns_name_format: "{cluster}-repl.{team}.{hostedzone}" | ||
aws_or_gcp: | ||
# db_hosted_zone: "" | ||
# wal_s3_bucket: "" | ||
# log_s3_bucket: "" | ||
# kube_iam_role: "" | ||
aws_region: eu-central-1 | ||
debug: | ||
debug_logging: true | ||
enable_database_access: true | ||
teams_api: | ||
enable_teams_api: false | ||
team_api_role_configuration: | ||
log_statement: all | ||
enable_team_superuser: false | ||
team_admin_role: admin | ||
pam_role_name: zalandos | ||
# pam_configuration: "" | ||
protected_role_names: | ||
- admin | ||
# teams_api_url: "" | ||
logging_rest_api: | ||
api_port: 8008 | ||
ring_log_lines: 100 | ||
cluster_history_entries: 1000 | ||
scalyr: | ||
scalyr_cpu_request: 100m | ||
scalyr_memory_request: 50Mi | ||
scalyr_cpu_limit: "1" | ||
scalyr_memory_limit: 1Gi | ||
# scalyr_api_key: "" | ||
# scalyr_image: "" | ||
# scalyr_server_url: "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.