Skip to content

Duplicated database in config-file should produce a message, warning or error #321

@aberinnj

Description

@aberinnj

Defining the same database (database connection string = same user,pwd and service name) in the config file for the observer is not handle when the name tags for the db are different.

Steps to Reproduce:

  1. Create databaseobserver_neg.yaml with 3 databases and a config file
  2. In the config file use different names for the databases definitions but specify the username, password and url for database 1 in all 3 databases
  3. Create config file configMap
  4. Apply databaseobserver_neg.yaml
  5. Monitor logs of the observer pod

Suggested Approach: add a WARN log. We can add a validation step to the configuration loader, which in general is a good idea, and this would be part of it

Example:

WARN duplicated database url: databases 'x', 'y', and 'z' reference the same database URL.

In the config file..

config-neg.yaml

databases:
  adw:
    username: ${ADW_USER}
    password: ${ADW_PWD}
    url: k8sadw_high

  atp:
    username: ${ADW_USER}
    password: ${ADW_PWD}
    url: k8sadw_high

  adw2:
    username: ${ADW_USER}
    password: ${ADW_PWD}
    url: k8sadw_high

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions