MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / NewParameters

Function NewParameters

internal/postgres/parameters.go:16–71  ·  view source on GitHub ↗

NewParameters returns ParameterSets required by this package.

()

Source from the content-addressed store, hash-verified

14
15// NewParameters returns ParameterSets required by this package.
16func NewParameters() Parameters {
17 parameters := Parameters{
18 Mandatory: NewParameterSet(),
19 Default: NewParameterSet(),
20 }
21
22 // Use UNIX domain sockets for local connections.
23 // PostgreSQL must be restarted when changing this value.
24 parameters.Mandatory.Add("unix_socket_directories", SocketDirectory)
25
26 // Enable logical replication in addition to streaming and WAL archiving.
27 // PostgreSQL must be restarted when changing this value.
28 // - https://www.postgresql.org/docs/current/runtime-config-wal.html#GUC-WAL-LEVEL
29 // - https://www.postgresql.org/docs/current/runtime-config-replication.html
30 // - https://www.postgresql.org/docs/current/logical-replication.html
31 parameters.Mandatory.Add("wal_level", "logical")
32
33 // Always enable SSL/TLS.
34 // PostgreSQL must be reloaded when changing this value.
35 // - https://www.postgresql.org/docs/current/ssl-tcp.html
36 parameters.Mandatory.Add("ssl", "on")
37 parameters.Mandatory.Add("ssl_cert_file", "/pgconf/tls/tls.crt")
38 parameters.Mandatory.Add("ssl_key_file", "/pgconf/tls/tls.key")
39 parameters.Mandatory.Add("ssl_ca_file", "/pgconf/tls/ca.crt")
40
41 // Just-in-Time compilation can degrade performance unexpectedly. Allow
42 // users to enable it for appropriate workloads.
43 // - https://www.postgresql.org/docs/current/jit.html
44 parameters.Default.Add("jit", "off")
45
46 // SCRAM-SHA-256 is preferred over MD5, but allow users to disable it when
47 // necessary. PostgreSQL 10 is the first to support SCRAM-SHA-256, and
48 // PostgreSQL 14 makes it the default.
49 // - https://www.postgresql.org/docs/current/auth-password.html
50 parameters.Default.Add("password_encryption", "scram-sha-256")
51
52 // Log outside of the Postgres data directory by default.
53 //
54 // When log files are inside the data directory, they are destroyed along with the data directory
55 // during replica creation and major upgrades. Being outside also reduces the size of backups.
56 //
57 // PostgreSQL must be reloaded when changing this parameter.
58 parameters.Default.Add("log_directory", path.Join(dataMountPath, "logs/postgres"))
59
60 // Pod "securityContext.fsGroup" ensures processes and filesystems agree on a GID;
61 // use the same permissions for group and owner.
62 // This allows every process in the pod to read Postgres log files.
63 //
64 // S_IRUSR, S_IWUSR: (0600) enable owner read and write permissions
65 // S_IRGRP, S_IWGRP: (0060) enable group read and write permissions.
66 //
67 // PostgreSQL must be reloaded when changing this value.
68 parameters.Mandatory.Add("log_file_mode", "0660")
69
70 return parameters
71}
72
73// Parameters is a pairing of ParameterSets.

Callers 7

TestPostgreSQLParametersFunction · 0.92
TestPostgresParametersFunction · 0.92
TestStartupCommandFunction · 0.85
TestNewParametersFunction · 0.85
TestInstancePodFunction · 0.85

Calls 2

NewParameterSetFunction · 0.85
AddMethod · 0.45

Tested by 6

TestPostgreSQLParametersFunction · 0.74
TestPostgresParametersFunction · 0.74
TestStartupCommandFunction · 0.68
TestNewParametersFunction · 0.68
TestInstancePodFunction · 0.68