Skip to content

Commit

Permalink
Add service account name in connection pooler (#2352)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmikechen authored Sep 4, 2023
1 parent eb0d55e commit 781d17b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/cluster/connection_pooler.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ func (c *Cluster) generateConnectionPoolerPodTemplate(role PostgresRole) (
Tolerations: tolerationsSpec,
Volumes: poolerVolumes,
SecurityContext: &securityContext,
ServiceAccountName: c.OpConfig.PodServiceAccountName,
},
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/cluster/connection_pooler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ func TestPoolerTLS(t *testing.T) {
ConnectionPoolerDefaultMemoryRequest: "100Mi",
ConnectionPoolerDefaultMemoryLimit: "100Mi",
},
PodServiceAccountName: "postgres-pod",
},
}, client, pg, logger, eventRecorder)

Expand Down Expand Up @@ -1028,6 +1029,8 @@ func TestPoolerTLS(t *testing.T) {
fsGroup := int64(103)
assert.Equal(t, &fsGroup, deploy.Spec.Template.Spec.SecurityContext.FSGroup, "has a default FSGroup assigned")

assert.Equal(t, "postgres-pod", deploy.Spec.Template.Spec.ServiceAccountName, "need to add a service account name")

volume := v1.Volume{
Name: "my-secret",
VolumeSource: v1.VolumeSource{
Expand Down

0 comments on commit 781d17b

Please sign in to comment.