Skip to content

Commit 3ff214c

Browse files
authored
Merge pull request #1753 from splunk/feature/postgres-db-controller-secrets-management
Add secrets management for roles and its use in cluster
2 parents ff47024 + b74f281 commit 3ff214c

8 files changed

Lines changed: 263 additions & 115 deletions

api/v4/postgrescluster_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ type ManagedRole struct {
4545
// Validation rules ensure immutability of Class, and that Storage and PostgresVersion can only be set once and cannot be removed or downgraded.
4646
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.postgresVersion) || (has(self.postgresVersion) && int(self.postgresVersion.split('.')[0]) >= int(oldSelf.postgresVersion.split('.')[0]))",messageExpression="!has(self.postgresVersion) ? 'postgresVersion cannot be removed once set (was: ' + oldSelf.postgresVersion + ')' : 'postgresVersion major version cannot be downgraded (from: ' + oldSelf.postgresVersion + ', to: ' + self.postgresVersion + ')'"
4747
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.storage) || (has(self.storage) && quantity(self.storage).compareTo(quantity(oldSelf.storage)) >= 0)",messageExpression="!has(self.storage) ? 'storage cannot be removed once set (was: ' + string(oldSelf.storage) + ')' : 'storage size cannot be decreased (from: ' + string(oldSelf.storage) + ', to: ' + string(self.storage) + ')'"
48-
// +kubebuilder:validation:XValidation:rule="!self.connectionPoolerEnabled || self.connectionPoolerConfig != null || (self.cnpg != null && self.cnpg.connectionPooler != null)",message="connectionPoolerConfig must be set in cluster spec or class when connectionPoolerEnabled is true"
4948
type PostgresClusterSpec struct {
5049
// This field is IMMUTABLE after creation.
5150
// +kubebuilder:validation:Required

api/v4/postgresclusterclass_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ const (
114114

115115
// ConnectionPoolerConfig defines PgBouncer connection pooler configuration.
116116
// When enabled, creates RW and RO pooler deployments for clusters using this class.
117-
// +kubebuilder:validation:XValidation:rule="!self.connectionPoolerEnabled || self.connectionPoolerConfig != null || (self.cnpg != null && self.cnpg.connectionPooler != null)",message="connectionPoolerConfig must be set in cluster spec or class when connectionPoolerEnabled is true"
118117
type ConnectionPoolerConfig struct {
119118
// Instances is the number of PgBouncer pod replicas.
120119
// Higher values provide better availability and load distribution.

api/v4/postgresdatabase_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type DatabaseInfo struct {
4949
Ready bool `json:"ready"`
5050
DatabaseRef *corev1.LocalObjectReference `json:"databaseRef,omitempty"`
5151
AdminUserSecretRef *corev1.LocalObjectReference `json:"adminUserSecretRef,omitempty"`
52-
RWSecretRef *corev1.LocalObjectReference `json:"rwSecretRef,omitempty"`
52+
RWUserSecretRef *corev1.LocalObjectReference `json:"rwUserSecretRef,omitempty"`
5353
ConfigMapRef *corev1.LocalObjectReference `json:"configMap,omitempty"`
5454
}
5555

api/v4/zz_generated.deepcopy.go

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ require (
136136
github.com/prometheus/common v0.66.1 // indirect
137137
github.com/prometheus/procfs v0.16.1 // indirect
138138
github.com/rs/xid v1.2.1 // indirect
139+
github.com/sethvargo/go-password v0.3.1 // indirect
139140
github.com/sirupsen/logrus v1.9.3 // indirect
140141
github.com/spf13/cobra v1.10.1 // indirect
141142
github.com/spf13/pflag v1.0.10 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7
305305
github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc=
306306
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
307307
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
308+
github.com/sethvargo/go-password v0.3.1 h1:WqrLTjo7X6AcVYfC6R7GtSyuUQR9hGyAj/f1PYQZCJU=
309+
github.com/sethvargo/go-password v0.3.1/go.mod h1:rXofC1zT54N7R8K/h1WDUdkf9BOx5OptoxrMBcrXzvs=
308310
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
309311
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
310312
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=

0 commit comments

Comments
 (0)