refactor(pooler): extract connectionPoolerConfigMapName helper
This commit is contained in:
parent
8641fbd9de
commit
c5e0b43a36
|
|
@ -471,7 +471,7 @@ func (c *Cluster) generateConnectionPoolerPodTemplate(role PostgresRole) (
|
|||
// container command/args (e.g. for images like the Chainguard FIPS pgbouncer
|
||||
// whose entrypoint is the bare binary with no config-rendering wrapper).
|
||||
if c.OpConfig.ConnectionPooler.GenerateConfig {
|
||||
configVolumeName := fmt.Sprintf("%s-config", c.connectionPoolerName(role))
|
||||
configVolumeName := c.connectionPoolerConfigMapName(role)
|
||||
poolerVolumes = append(poolerVolumes, v1.Volume{
|
||||
Name: configVolumeName,
|
||||
VolumeSource: v1.VolumeSource{
|
||||
|
|
@ -511,9 +511,9 @@ func (c *Cluster) generateConnectionPoolerPodTemplate(role PostgresRole) (
|
|||
securityContext.FSGroup = effectiveFSGroup
|
||||
}
|
||||
|
||||
podAnnotations, annErr := c.connectionPoolerPodAnnotations(role)
|
||||
if annErr != nil {
|
||||
return nil, annErr
|
||||
podAnnotations, err := c.connectionPoolerPodAnnotations(role)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
podTemplate := &v1.PodTemplateSpec{
|
||||
|
|
|
|||
|
|
@ -147,6 +147,12 @@ func (c *Cluster) connectionPoolerConfigChecksum(role PostgresRole) (string, err
|
|||
return fmt.Sprintf("%x", sum), nil
|
||||
}
|
||||
|
||||
// connectionPoolerConfigMapName returns the name of the operator-generated
|
||||
// pgbouncer config map for the given role.
|
||||
func (c *Cluster) connectionPoolerConfigMapName(role PostgresRole) string {
|
||||
return fmt.Sprintf("%s-config", c.connectionPoolerName(role))
|
||||
}
|
||||
|
||||
// generateConnectionPoolerConfigMap builds the operator-owned ConfigMap holding
|
||||
// the rendered pgbouncer.ini for the given role.
|
||||
func (c *Cluster) generateConnectionPoolerConfigMap(role PostgresRole) (*v1.ConfigMap, error) {
|
||||
|
|
@ -156,7 +162,7 @@ func (c *Cluster) generateConnectionPoolerConfigMap(role PostgresRole) (*v1.Conf
|
|||
}
|
||||
return &v1.ConfigMap{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: fmt.Sprintf("%s-config", c.connectionPoolerName(role)),
|
||||
Name: c.connectionPoolerConfigMapName(role),
|
||||
Namespace: c.Namespace,
|
||||
Labels: c.connectionPoolerLabels(role, true).MatchLabels,
|
||||
Annotations: c.annotationsSet(nil),
|
||||
|
|
|
|||
Loading…
Reference in New Issue