mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-04 05:44:44 +02:00
@@ -676,6 +676,7 @@ func TestConnectionPoolerPodSpec(t *testing.T) {
|
||||
SuperUsername: superUserName,
|
||||
ReplicationUsername: replicationUserName,
|
||||
},
|
||||
PodServiceAccountName: "postgres-pod",
|
||||
ConnectionPooler: config.ConnectionPooler{
|
||||
MaxDBConnections: k8sutil.Int32ToPointer(60),
|
||||
ConnectionPoolerDefaultCPURequest: "100m",
|
||||
@@ -725,6 +726,15 @@ func TestConnectionPoolerPodSpec(t *testing.T) {
|
||||
cluster: cluster,
|
||||
check: noCheck,
|
||||
},
|
||||
{
|
||||
subTest: "pooler uses pod service account",
|
||||
spec: &acidv1.PostgresSpec{
|
||||
ConnectionPooler: &acidv1.ConnectionPooler{},
|
||||
},
|
||||
expected: nil,
|
||||
cluster: cluster,
|
||||
check: testServiceAccount,
|
||||
},
|
||||
{
|
||||
subTest: "no default resources",
|
||||
spec: &acidv1.PostgresSpec{
|
||||
@@ -872,6 +882,17 @@ func TestConnectionPoolerDeploymentSpec(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func testServiceAccount(cluster *Cluster, podSpec *v1.PodTemplateSpec, role PostgresRole) error {
|
||||
poolerServiceAccount := podSpec.Spec.ServiceAccountName
|
||||
|
||||
if poolerServiceAccount != cluster.OpConfig.PodServiceAccountName {
|
||||
return fmt.Errorf("Pooler service account does not match, got %+v, expected %+v",
|
||||
poolerServiceAccount, cluster.OpConfig.PodServiceAccountName)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testResources(cluster *Cluster, podSpec *v1.PodTemplateSpec, role PostgresRole) error {
|
||||
cpuReq := podSpec.Spec.Containers[0].Resources.Requests["cpu"]
|
||||
if cpuReq.String() != cluster.OpConfig.ConnectionPooler.ConnectionPoolerDefaultCPURequest {
|
||||
|
||||
Reference in New Issue
Block a user