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

Function PostgreSQLHBAs

internal/pgmonitor/postgres.go:26–35  ·  view source on GitHub ↗

PostgreSQLHBAs provides the Postgres HBA rules for allowing the monitoring exporter to be accessible

(ctx context.Context, inCluster *v1beta1.PostgresCluster, outHBAs *postgres.HBAs)

Source from the content-addressed store, hash-verified

24// PostgreSQLHBAs provides the Postgres HBA rules for allowing the monitoring
25// exporter to be accessible
26func PostgreSQLHBAs(ctx context.Context, inCluster *v1beta1.PostgresCluster, outHBAs *postgres.HBAs) {
27 if ExporterEnabled(ctx, inCluster) ||
28 collector.OpenTelemetryMetricsEnabled(ctx, inCluster) {
29 // Limit the monitoring user to local connections using SCRAM.
30 outHBAs.Mandatory = append(outHBAs.Mandatory,
31 postgres.NewHBA().TCP().Users(MonitoringUser).Method("scram-sha-256").Network("127.0.0.0/8"),
32 postgres.NewHBA().TCP().Users(MonitoringUser).Method("scram-sha-256").Network("::1/128"),
33 postgres.NewHBA().TCP().Users(MonitoringUser).Method("reject"))
34 }
35}
36
37// PostgreSQLParameters provides additional required configuration parameters
38// that Postgres needs to support monitoring for both pgMonitor and OTel

Callers 2

generatePostgresHBAsMethod · 0.92
TestPostgreSQLHBAFunction · 0.85

Calls 7

NewHBAFunction · 0.92
ExporterEnabledFunction · 0.85
NetworkMethod · 0.80
MethodMethod · 0.80
UsersMethod · 0.80
TCPMethod · 0.80

Tested by 1

TestPostgreSQLHBAFunction · 0.68