azure-service-operator icon indicating copy to clipboard operation
azure-service-operator copied to clipboard

DatabaseAccount CRD: Add support to store the account Id in a config map

Open old-guy-coder opened this issue 1 year ago • 3 comments

Describe the current behavior A description of how things are today.

It is currently possible using the operatorSpec to store secrets only such as the AccountEndpoint, etc. But there is no way to output the Database Account Id to a configmap using a similar method.

To obtain the Database Account Id one needs to know the Subscription Id in order to construct the Id value /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.DocumentDB/databaseAccounts/<databaseAccountName>

While it is possible to ingest the Subscription Id from ConfigMaps or Values, that still relies on manually constructing the Id which would be available to export to a Secret or ConfigMap when reconciling the resource.

Describe the improvement How should things be changed or improved?

Propose adding ConfigMap to the DatabaseAccountOperatorSpec and allowing the Id to be exported to a ConfigMap for use later down the line, such as referencing as an environment variable in a deployment/container

Example:

apiVersion: documentdb.azure.com/v1api20210515
kind: DatabaseAccount
...
spec:
  ...
  operatorSpec:
    secrets:
      documentEndpoint:
        name: account-endpoint
        key: account-endpoint
    configMaps:
      id:
        name: account-id
        key: account-id

I do not believe that the Account Id is a secret, but alternatively this could be added to the DatabaseAccountOperatorSecrets and included in the existing Secrets operator spec

Additional context Add any other context about the suggested improvement.

### Tasks

old-guy-coder avatar Dec 20 '23 14:12 old-guy-coder