Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to create groups or run SQL files using crunchy postgres operator yaml without deleting the Postgres cluster #3862

Closed
Naveen-Kamagani opened this issue Feb 28, 2024 · 1 comment

Comments

@Naveen-Kamagani
Copy link

  1. How to create groups using crunchy Postgres operator yaml? There is no documentation.
  2. How to run a SQL file after creating users using Postgres operator yaml CR(not the initdb sql file). Because initdb sql file will only executed after deleting the cluster and recreating it.
    Example - I have modified SQL config map and ran "kubectl apply -f postgres.yaml" . It did not add the changes added in sql config map. Also tried deleting the configmap and recreating it, still the same.

Request someone to help on this issue ASAP.

@andrewlecuyer
Copy link
Collaborator

Hi @Naveen-Kamagani!

Regarding your first question, we do not currently expose functionality for Postgres group creation via the PostgresCluster API. You can therefore leverage the init SQL for this.

As for your second question, the init SQL is intended to be run at cluster-bootstrap only. More specifically, the Database Initialization SQL docs recommend removing this setting post-cluster initialization:

Now that databaseInitSQL is defined in your cluster status, verify database objects have been created as expected. After verifying, we recommend removing the spec.databaseInitSQL field from your spec. Removing the field from the spec will also remove databaseInitSQL from the cluster status.

Therefore, this file is not intended to be updated or re-run post-cluster initialization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants