Documentation
¶
Index ¶
- Constants
- func Configure(opts ...option)
- func Credentials() map[string]string
- func CredentialsSecretName() string
- func Service(opts ...svcOpt) service.Service
- func WithInitDBs(dbs ...string) svcOpt
- func WithMajor(major int) svcOpt
- func WithName(name string) svcOpt
- func WithNodePort(port int) svcOpt
- func WithService(opts ...svcOpt) option
- func WithVariant(variant string) svcOpt
- func WithWaitReady() svcOpt
Constants ¶
const DefaultMajor = 17
const DefaultPort = 5432
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
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 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