Skip to content

Commit

Permalink
Add cluster label to Medusa controllers selectors when listing pods
Browse files Browse the repository at this point in the history
  • Loading branch information
adejanovski committed Dec 8, 2023
1 parent 2039871 commit 19a4cbd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/medusa/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"

cassdcapi "github.com/k8ssandra/cass-operator/apis/cassandra/v1beta1"
k8ssandraapi "github.com/k8ssandra/k8ssandra-operator/apis/k8ssandra/v1alpha1"
)

func GetCassandraDatacenterPods(ctx context.Context, cassdc *cassdcapi.CassandraDatacenter, r client.Reader, logger logr.Logger) ([]corev1.Pod, error) {
podList := &corev1.PodList{}
labels := client.MatchingLabels{cassdcapi.DatacenterLabel: cassdc.DatacenterName()}
labels := client.MatchingLabels{
k8ssandraapi.K8ssandraClusterNameLabel: cassdc.Spec.ClusterName,
cassdcapi.DatacenterLabel: cassdc.DatacenterName(),
}
if err := r.List(ctx, podList, labels, client.InNamespace(cassdc.Namespace)); err != nil {
logger.Error(err, "failed to get pods for cassandradatacenter", "CassandraDatacenter", cassdc.DatacenterName())
return nil, err
Expand Down

0 comments on commit 19a4cbd

Please sign in to comment.