Skip to content

[Feature]: Helper to inject postgres socket directory #10

@ringerc

Description

@ringerc

Is there an existing issue already for this feature request/idea?

  • I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.

What problem is this feature going to solve? Why should it be added?

Since many plugins that inject sidecars into postgres pods will want to communicate with postgres, a helper for injecting the pg socket volume mount would be useful.

Describe the solution you'd like

A helper method that finds the scratch-data Volume in the target Pod and injects a VolumeMount for it into a specified Container, expected to be a sidecar managed by the plugin. It should accept the path at which the socket directory should be mounted.

The VolumeMount should specify a SubMount of run so only the postgres socket directory gets mounted.

Something like

        corev1.VolumeMount{
            {
                Name:      "scratch-data",
                ReadOnly:  false,
                MountPath: "/var/run/postgresql",
                // postgres socket dir is in /run/run on the cnp pod
                SubPath:   config.PgSocketSubVolumeName,
	   }

While this is trivial to implement in a plugin, the helper will know the correct socket volume name scratch-data which is not exposed in CNPG as a constant anywhere. It's also going to be common enough it just makes sense to add.

Describe alternatives you've considered

I just added it in my plugin code, it's trivial, but seems like something common enough to be worth doing in a helper.

Additional context

No response

Are you willing to actively contribute to this feature?

Yes

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions