diff --git a/VERSION b/VERSION index 44517d5..fe04e7f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.19 +0.0.20 diff --git a/bundle/manifests/susql-operator.clusterserviceversion.yaml b/bundle/manifests/susql-operator.clusterserviceversion.yaml index 7a02ae2..076fbe7 100644 --- a/bundle/manifests/susql-operator.clusterserviceversion.yaml +++ b/bundle/manifests/susql-operator.clusterserviceversion.yaml @@ -22,14 +22,14 @@ metadata: ] capabilities: Basic Install categories: Monitoring - containerImage: quay.io/sustainable_computing_io/susql_operator:0.0.19 - createdAt: "2024-06-21T06:11:03Z" + containerImage: quay.io/sustainable_computing_io/susql_operator:0.0.20 + createdAt: "2024-06-24T04:37:59Z" description: 'Aggregates energy data from pods tagged with SusQL labels ' operators.operatorframework.io/builder: operator-sdk-v1.34.1 operators.operatorframework.io/project_layout: go.kubebuilder.io/v4 repository: https://github.com/sustainable-computing-io/susql-operator support: https://github.com/sustainable-computing-io/susql-operator/issues - name: susql-operator.v0.0.19 + name: susql-operator.v0.0.20 namespace: placeholder spec: apiservicedefinitions: {} @@ -224,7 +224,7 @@ spec: value: :8081 - name: METRICS-BIND-ADDRESS value: 127.0.0.1:9999 - image: quay.io/sustainable_computing_io/susql_operator:0.0.19 + image: quay.io/sustainable_computing_io/susql_operator:0.0.20 imagePullPolicy: IfNotPresent livenessProbe: httpGet: @@ -328,4 +328,4 @@ spec: provider: name: SusQL Operator Contributors url: https://github.com/sustainable-computing-io/susql-operator - version: 0.0.19 + version: 0.0.20 diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 8ccdf46..f3eb4fb 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -5,4 +5,4 @@ kind: Kustomization images: - name: controller newName: quay.io/sustainable_computing_io/susql_operator - newTag: 0.0.19 + newTag: 0.0.20 diff --git a/internal/controller/labelgroup_controller.go b/internal/controller/labelgroup_controller.go index 81e9fbb..c243105 100644 --- a/internal/controller/labelgroup_controller.go +++ b/internal/controller/labelgroup_controller.go @@ -98,9 +98,9 @@ func (r *LabelGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) // Decide what action to take based on the state of the labelGroup switch labelGroup.Status.Phase { case susqlv1.Initializing: - r.Logger.V(5).Info("[Reconcile] Entered initializing case.") + r.Logger.V(5).Info("[Reconcile-Initializing] Entered initializing case.") if len(labelGroup.Spec.Labels) > len(susqlPrometheusLabelNames) { - r.Logger.V(0).Error(fmt.Errorf("[Reconcile] The number of provided labels is greater than the maximum number of supported labels (e.g., up to %d labels).", len(susqlPrometheusLabelNames)), "") + r.Logger.V(0).Error(fmt.Errorf("[Reconcile-Initializing] The number of provided labels is greater than the maximum number of supported labels (e.g., up to %d labels).", len(susqlPrometheusLabelNames)), "") return ctrl.Result{RequeueAfter: fixingDelay}, nil } @@ -141,7 +141,7 @@ func (r *LabelGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) labelGroup.Status.Phase = susqlv1.Reloading if err := r.Status().Update(ctx, labelGroup); err != nil { - r.Logger.V(0).Error(err, "[Reconcile] Couldn't update status of the LabelGroup.") + r.Logger.V(0).Error(err, "[Reconcile-Initializing] Couldn't update status of the LabelGroup.") return ctrl.Result{RequeueAfter: fixingDelay}, nil } @@ -149,13 +149,13 @@ func (r *LabelGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) return ctrl.Result{}, nil case susqlv1.Reloading: - r.Logger.V(5).Info("[Reconcile] Entered reloading case.") + r.Logger.V(5).Info("[Reconcile-Reloading] Entered reloading case.") // Reload data from existing database if !labelGroup.Spec.DisableUsingMostRecentValue { totalEnergy, err := r.GetMostRecentValue(labelGroup.Status.SusQLPrometheusQuery) if err != nil { - r.Logger.V(0).Error(err, "[Reconcile] Couldn't retrieve most recent value.") + r.Logger.V(0).Error(err, "[Reconcile-Reloading] Couldn't retrieve most recent value.") return ctrl.Result{RequeueAfter: fixingDelay}, nil } @@ -165,7 +165,7 @@ func (r *LabelGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) labelGroup.Status.Phase = susqlv1.Aggregating if err := r.Status().Update(ctx, labelGroup); err != nil { - r.Logger.V(0).Error(err, "[Reconcile] Couldn't update status of the LabelGroup.") + r.Logger.V(0).Error(err, "[Reconcile-Reloading] Couldn't update status of the LabelGroup.") return ctrl.Result{RequeueAfter: fixingDelay}, nil } @@ -173,20 +173,20 @@ func (r *LabelGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) return ctrl.Result{}, nil case susqlv1.Aggregating: - r.Logger.V(5).Info("[Reconcile] Entered aggregating case.") // trace + r.Logger.V(5).Info("[Reconcile-Aggregating] Entered aggregating case.") // trace // Get list of pods matching the label group and namespace podsInNamespace, err := r.filterPodsInNamespace(ctx, labelGroup.Namespace, labelGroup.Status.KubernetesLabels) if err != nil || len(podsInNamespace) == 0 { - r.Logger.V(5).Info("[Reconcile] Unable to get podlist.") // trace - 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] KubernetesLabels: %#v", labelGroup.Status.KubernetesLabels)) // trace - r.Logger.V(5).Info(fmt.Sprintf("[Reconcile] podNamesinNamespace: %s", podsInNamespace)) // trace - r.Logger.V(5).Info(fmt.Sprintf("[Reconcile] ctx: %#v", ctx)) // trace + r.Logger.V(5).Info("[Reconcile-Aggregating] Unable to get podlist.") // trace + r.Logger.V(5).Info(fmt.Sprintf("[Reconcile-Aggregating] LabelName: %s", labelGroup.Name)) // trace + r.Logger.V(5).Info(fmt.Sprintf("[Reconcile-Aggregating] Namespace: %s", labelGroup.Namespace)) // trace + r.Logger.V(5).Info(fmt.Sprintf("[Reconcile-Aggregating] KubernetesLabels: %#v", labelGroup.Status.KubernetesLabels)) // trace + r.Logger.V(5).Info(fmt.Sprintf("[Reconcile-Aggregating] podNamesinNamespace: %s", podsInNamespace)) // trace + r.Logger.V(5).Info(fmt.Sprintf("[Reconcile] ctx: %#v", ctx)) // trace if err != nil { - r.Logger.V(0).Error(err, "[Reconcile] ERROR: Couldn't get pods for the labels provided.") + r.Logger.V(0).Error(err, "[Reconcile-Aggregating] ERROR: Couldn't get pods for the labels provided.") } return ctrl.Result{}, err @@ -196,7 +196,7 @@ func (r *LabelGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) metricValues, err := r.GetMetricValuesForPodNames(r.KeplerMetricName, podsInNamespace, labelGroup.Namespace) if err != nil { - r.Logger.V(0).Error(err, "[Reconcile] Querying Prometheus didn't work.") + r.Logger.V(0).Error(err, "[Reconcile-Aggregating] Querying Prometheus didn't work.") return ctrl.Result{RequeueAfter: errorDelay}, nil } @@ -248,12 +248,12 @@ func (r *LabelGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) return ctrl.Result{RequeueAfter: r.SamplingRate}, nil default: - r.Logger.V(5).Info("[Reconcile] Entered default case.") + r.Logger.V(5).Info("[Reconcile-default] Entered default case.") // First time seeing this object labelGroup.Status.Phase = susqlv1.Initializing if err := r.Status().Update(ctx, labelGroup); err != nil { - r.Logger.V(0).Error(err, "[Reconcile] Couldn't set object to 'Initializing'.") + r.Logger.V(0).Error(err, "[Reconcile-default] Couldn't set object to 'Initializing'.") } return ctrl.Result{}, nil diff --git a/internal/controller/resource_manager.go b/internal/controller/resource_manager.go index c51baa9..6987b3b 100644 --- a/internal/controller/resource_manager.go +++ b/internal/controller/resource_manager.go @@ -61,6 +61,7 @@ func (r *LabelGroupReconciler) GetPodNamesMatchingLabels(ctx context.Context, la if err := r.List(ctx, pods, client.UnsafeDisableDeepCopy, (client.MatchingLabels)(labelGroup.Status.KubernetesLabels)); err != nil { r.Logger.V(5).Info(fmt.Sprintf("[GetPodNamesMatchingLabels] pods: %#v", pods)) r.Logger.V(5).Info(fmt.Sprintf("[GetPodNamesMatchingLabels] labelgroup: %#v", labelGroup)) + r.Logger.V(5).Info(fmt.Sprintf("[GetPodNamesMatchingLabels] KubernetesLabels: %#v", labelGroup.Status.KubernetesLabels)) r.Logger.V(0).Error(err, "[GetPodNamesMatchingLabels] List Error:") return nil, nil, err }