postgres

package module
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMajor = 17
View Source
const DefaultPort = 5432
View Source
const DefaultVariant = "alpine"

The default variant of the image to use.

Note that this is may not be the same as the upstream default variant!

Variables

This section is empty.

Functions

func Configure

func Configure(opts ...option)

func Credentials added in v0.6.0

func Credentials() map[string]string

Credentials returns connection credentials (in the form of `PG...` environment variable names) for the default service configured in the addon, e.g. for setting in a PM service environment block.

func CredentialsSecretName added in v0.6.0

func CredentialsSecretName() string

CredentialsSecretName returns the k8s secret name where credentials will be stored (in the form of `PG...` environment variable names) for the default service configured in the addon.

func Service

func Service(
	opts ...svcOpt,
) service.Service

func WithInitDBs added in v0.6.0

func WithInitDBs(dbs ...string) svcOpt

WithInitDBs will cause the postgres service to ensure the named databases exist during startup.

This requires enabling WithNodePort.

func WithMajor

func WithMajor(major int) svcOpt

Set the major version of postgres to run. Different major versions will have data stored in different PVs.

If this is not set, or set to zero, DefaultMajor will be used.

func WithName

func WithName(name string) svcOpt

Set the service name, determines the stack service name, k8s deployment name, and k8s service name.

If name is not set (or set to the empty string), a default name will be chosen based on the major version.

func WithNodePort added in v0.6.0

func WithNodePort(port int) svcOpt

Enables or disables exposing the postgres instance on a k8s NodePort.

If port is 0, the NodePort will be disabled. Else the value is the exposed port number.

If port is not in [0..65535], it will panic.

func WithService

func WithService(opts ...svcOpt) option

WithService causes a postgres server instance to be added to the stack, using the given options.

func WithVariant

func WithVariant(variant string) svcOpt

Set the variant to run. Changing variants between Debian and Alpine will cause data to need to be re-indexed in most cases due to differeing libc implementations. Different variants will NOT have their data stored in different PVs.

If unset DefaultVariant will be used. If set to the empty string, the default variant at the image level will be used.

func WithWaitReady added in v0.6.0

func WithWaitReady() svcOpt

WithWaitReady will include a resource in the service that waits for postgres to be ready before continuing.

This is implied if you use WithInitDBs.

Types

This section is empty.

Source Files

  • addon.go
  • init-dbs.go
  • service.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL