Skip to content

Commit c1f0902

Browse files
Update Label & Selector for 'pgo show cluster'
This commit updates the label selector utilized to identify the PostgreSQL pods within a cluster when running the 'pgo show cluster' command. Specifically, the 'pgo-pg-database' and 'pg-cluster' labels are now utilized to ensure only database Pods (i.e. PostgreSQL primary and replica Pods) are displayed when running this command. Additionally, the 'pgo-pg-database' label has been removed from the cluster bootstrap Job template to prevent bootstrap Pods from appearing in the output of the 'pgo show cluster' command.
1 parent 953e770 commit c1f0902

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

conf/postgres-operator/cluster-bootstrap-job.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"name": "{{.Name}}-bootstrap",
66
"labels": {
77
"vendor": "crunchydata",
8-
"pgo-pg-database": "true",
98
"pgo-backrest-job": "true",
109
"pgha-bootstrap": "{{.Name}}",
1110
{{.DeploymentLabels}}
@@ -17,7 +16,7 @@
1716
"labels": {
1817
"name": "{{.Name}}",
1918
"vendor": "crunchydata",
20-
"pgo-pg-database": "true",
19+
"pgha-bootstrap": "{{.Name}}",
2120
{{.PodLabels}}
2221
}
2322
},

installers/ansible/roles/pgo-operator/files/pgo-configs/cluster-bootstrap-job.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"name": "{{.Name}}-bootstrap",
66
"labels": {
77
"vendor": "crunchydata",
8-
"pgo-pg-database": "true",
98
"pgo-backrest-job": "true",
109
"pgha-bootstrap": "{{.Name}}",
1110
{{.DeploymentLabels}}
@@ -17,7 +16,7 @@
1716
"labels": {
1817
"name": "{{.Name}}",
1918
"vendor": "crunchydata",
20-
"pgo-pg-database": "true",
19+
"pgha-bootstrap": "{{.Name}}",
2120
{{.PodLabels}}
2221
}
2322
},

internal/apiserver/clusterservice/clusterimpl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ func GetPods(clientset kubernetes.Interface, cluster *crv1.Pgcluster) ([]msgs.Sh
229229
output := []msgs.ShowClusterPod{}
230230

231231
//get pods, but exclude backup pods and backrest repo
232-
selector := config.LABEL_BACKREST_JOB + "!=true," + config.LABEL_BACKREST_RESTORE + "!=true," + config.LABEL_PGO_BACKREST_REPO + "!=true," + config.LABEL_PG_CLUSTER + "=" + cluster.Spec.Name
232+
selector := fmt.Sprintf("%s=%s,%s", config.LABEL_PG_CLUSTER, cluster.GetName(), config.LABEL_PG_DATABASE)
233233
log.Debugf("selector for GetPods is %s", selector)
234234

235235
pods, err := clientset.CoreV1().Pods(cluster.Namespace).List(metav1.ListOptions{LabelSelector: selector})

0 commit comments

Comments
 (0)