Postgres cluster reconciler creates Secret and ConfigMap#1749
Postgres cluster reconciler creates Secret and ConfigMap#1749DmytroPI-dev wants to merge 2 commits intofeature/database-controllersfrom
Conversation
| SuperuserSecret: cnpgv1.LocalObjectReference{ | ||
| Name: secretName, | ||
| }, | ||
| EnableSuperuserAccess: *ptr.To(true), |
There was a problem hiding this comment.
do we need * before ptr.To?
| if cnpgCluster.Status.Phase == cnpgv1.PhaseHealthy { | ||
| logger.Info("CNPG Cluster is ready, generating ConfigMap for connection details") | ||
|
|
||
| // Reconcile ConfigMap |
There was a problem hiding this comment.
lets put a comments that doesnt reflect what we do here but lets put it with the why in case we need it
| logger.Error(err, "Failed to fetch existing ConfigMap") | ||
| return err | ||
| } | ||
| existingConfigMap.Data = configMap.Data |
There was a problem hiding this comment.
shouldnt we check if they are equal and only send update API call if they do?
| "CLUSTER_R_ENDPOINT": fmt.Sprintf("%s.%s.svc", cnpgCluster.Status.ReadService, postgresCluster.Namespace), | ||
| "CLUSTER_RO_ENDPOINT": fmt.Sprintf("%so.%s.svc", cnpgCluster.Status.ReadService, postgresCluster.Namespace), | ||
| "DEFAULT_CLUSTER_PORT": defaultPort, | ||
| "DEFAULT_USER": defaultUsername, |
There was a problem hiding this comment.
its probably not a default user but superuser
| } | ||
|
|
||
| // generatePassword creates a random 16-character alphanumeric password for the default postgres user. | ||
| func generatePassword() string { |
There was a problem hiding this comment.
why not to use something already provided like: https://github.com/sethvargo/go-password?
| Owner string | ||
| StorageSize string | ||
| Resources corev1.ResourceRequirements | ||
| SuperuserSecret cnpgv1.LocalObjectReference |
There was a problem hiding this comment.
why do we need those two in here? EnableSuperuserAccess and SuperuserSecret is not part of the class? I think secrets and configmaps can be checked outside of this process?
Description
_Creates ConfigMap and Secret for PostgresCluster _
Key Changes
Highlight the updates in specific files
Testing and Verification
How did you test these changes? What automated tests are added?
Related Issues
CPI-1903 CPI-1907
PR Checklist