Skip to content

Commit

Permalink
add co
Browse files Browse the repository at this point in the history
Signed-off-by: MohammedAbdi <[email protected]>
  • Loading branch information
mamy-CS committed Jun 14, 2024
1 parent 38012a2 commit 7f6b73b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
15 changes: 3 additions & 12 deletions internal/controller/labelgroup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,13 @@ func (r *LabelGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request)

case susqlv1.Aggregating:
r.Logger.V(5).Info("[Reconcile] Entered aggregating case.") // trace
// Get list of pods matching the label group
// podNames, namespaceNames, err := r.GetPodNamesMatchingLabels(ctx, labelGroup)
// r.Logger.V(5).Info(fmt.Sprintf("[Reconcile] podNames: %s", podNames)) // trace
// r.Logger.V(5).Info(fmt.Sprintf("[Reconcile] namespaceNames: %s", namespaceNames)) // trace

// Get list of pods matching the label group and namespace
podsInNamespace, err := r.filterPodsInNamespace(ctx, labelGroup.Namespace, labelGroup.Status.KubernetesLabels)

// var printPodNames []string
// for _, pod := range podsInNamespace {
// printPodNames = append(printPodNames, pod.Name)
// }

r.Logger.V(5).Info(fmt.Sprintf("[Reconcile] LabelName: %s", labelGroup.Name))
r.Logger.V(5).Info(fmt.Sprintf("[Reconcile] Namespace: %s", labelGroup.Namespace))
r.Logger.V(5).Info(fmt.Sprintf("[Reconcile] podNamesinNamespace: [%s]", podsInNamespace))
r.Logger.V(5).Info(fmt.Sprintf("[Reconcile] LabelName: %s", labelGroup.Name)) // trace
r.Logger.V(5).Info(fmt.Sprintf("[Reconcile] Namespace: %s", labelGroup.Namespace)) // trace
r.Logger.V(5).Info(fmt.Sprintf("[Reconcile] podNamesinNamespace: %s", podsInNamespace)) // trace

if err != nil || len(podsInNamespace) == 0 {
r.Logger.V(0).Error(err, "[Reconcile] Couldn't get pods for the labels provided.")
Expand Down
1 change: 1 addition & 0 deletions internal/controller/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"k8s.io/apimachinery/pkg/labels"
)

// Function to filter pods with matching labels from namespace label is defined
func (r *LabelGroupReconciler) filterPodsInNamespace(ctx context.Context, namespace string, labelSelector map[string]string) ([]string, error) {
// Initialize list options with label selector
listOptions := &client.ListOptions{
Expand Down

0 comments on commit 7f6b73b

Please sign in to comment.