Skip to content

Commit 50f129a

Browse files
author
jmccormick2001
committed
fix pgbouncer svc deletion when pgo delete cluster is called
1 parent 7e6478b commit 50f129a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

operator/cluster/cluster_strategy_1.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,19 @@ func (r Strategy1) DeleteCluster(clientset *kubernetes.Clientset, restclient *re
194194
log.Error("error deleting primary Deployment " + err.Error())
195195
}
196196

197+
//delete the pgbouncer service if exists
198+
if cl.Spec.UserLabels[util.LABEL_PGBOUNCER] == "true" {
199+
DeletePgbouncer(clientset, cl.Spec.Name, namespace)
200+
}
201+
197202
//delete the primary service
198203
kubeapi.DeleteService(clientset, cl.Spec.Name, namespace)
199204

200205
//delete the replica service
201206
kubeapi.DeleteService(clientset, cl.Spec.Name+ReplicaSuffix, namespace)
202207

203208
//delete the pgpool deployment if necessary
204-
if cl.Spec.UserLabels["crunchy-pgpool"] == "true" {
209+
if cl.Spec.UserLabels[util.LABEL_PGPOOL] == "true" {
205210
DeletePgpool(clientset, cl.Spec.Name, namespace)
206211
}
207212

pgo/cmd/create.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ func init() {
226226
createClusterCmd.Flags().BoolVarP(&BackrestFlag, "pgbackrest", "", false, "Enables a pgBackRest volume for the database pod.")
227227
createClusterCmd.Flags().BoolVarP(&BadgerFlag, "pgbadger", "", false, "Adds the crunchy-pgbadger container to the database pod.")
228228
createClusterCmd.Flags().BoolVarP(&PgpoolFlag, "pgpool", "", false, "Adds the crunchy-pgpool container to the database pod.")
229+
createClusterCmd.Flags().BoolVarP(&PgbouncerFlag, "pgbouncer", "", false, "Adds a crunchy-pgbouncer deployment to the cluster.")
229230
createClusterCmd.Flags().BoolVarP(&ArchiveFlag, "archive", "", false, "Enables archive logging for the database cluster.")
230231
createClusterCmd.Flags().StringVarP(&PgpoolSecret, "pgpool-secret", "", "", "The name of a pgpool secret to use for the pgpool configuration.")
231232
createClusterCmd.Flags().BoolVarP(&MetricsFlag, "metrics", "", false, "Adds the crunchy-collect container to the database pod.")

0 commit comments

Comments
 (0)