diff --git a/README.md b/README.md index 6544c3f..b2dbc00 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,11 @@ SusQL is an operator that can be deployed in a Kubernetes/OpenShift cluster. You There are two currently CO2 emission calculation methods available, and an additional method is under development. - The default CO2 emission calculation method is called "static", and simply uses a grams of CO2 per Joule of electricity consumed coefficient to calculate grams of CO2 emitted. This value is user tunable by -modifying the `CARBON-INTENSITY` configmap value. The default value is based on +modifying the `CARBON-INTENSITY` ConfigMap value. The default value is based on [US EPA](https://www.epa.gov/energy/greenhouse-gases-equivalencies-calculator-calculations-and-references) data. - The "simpledynamic" method periodically queries the carbon intensity value for a user specified location to provide a more accurate estimation of CO2 emission. -The configmap user configurable items are: +The ConfigMap user configurable items are: - `CARBON-METHOD` - The "simpledynamic" method is enabled when set to `simpledynamic`. - `CARBON-INTENSITY` - This value is set automatically. User specified values will be overwritten. - `CARBON-INTENSITY-URL` - Specifies a web API that returns carbon intensity. The default value works as of the date of this writing. diff --git a/api/v1/labelgroup_types.go b/api/v1/labelgroup_types.go index 589da94..2e2214c 100644 --- a/api/v1/labelgroup_types.go +++ b/api/v1/labelgroup_types.go @@ -40,7 +40,7 @@ type LabelGroupStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // Important: Run "make" to regenerate code after modifying this file - // Transition phase of the label group + // Transition phase of the LabelGroup Phase LabelGroupPhase `json:"phase,omitempty"` // SusQL Kubernetes labels constructed from the spec @@ -55,7 +55,7 @@ type LabelGroupStatus struct { // TotalCarbon keeps track of the accumulated grams of carbon dioxide emission over time TotalCarbon string `json:"totalCarbon,omitempty"` - // Prometheus query to get the total energy for this label group + // Prometheus query to get the total energy for this LabelGroup SusQLPrometheusQuery string `json:"susqlPrometheusQuery,omitempty"` // Active containers associated with these set of labels @@ -66,13 +66,13 @@ type LabelGroupStatus struct { type LabelGroupPhase string const ( - // Initializing: The label group is picked up for the first time and setup + // Initializing: The LabelGroup is picked up for the first time and setup Initializing LabelGroupPhase = "Initializing" // Reloading: Use most recent value in the database if requested Reloading LabelGroupPhase = "Reloading" - // Aggregating: The label group is aggregating the energy for the registered labels + // Aggregating: The LabelGroup is aggregating the energy for the registered labels Aggregating LabelGroupPhase = "Aggregating" ) diff --git a/config/crd/bases/susql.ibm.com_labelgroups.yaml b/config/crd/bases/susql.ibm.com_labelgroups.yaml index f5afa6e..b21c78f 100644 --- a/config/crd/bases/susql.ibm.com_labelgroups.yaml +++ b/config/crd/bases/susql.ibm.com_labelgroups.yaml @@ -17,7 +17,7 @@ spec: - name: v1 schema: openAPIV3Schema: - description: LabelGroup is the Schema for the labelgroups API + description: LabelGroup is the Schema for the LabelGroups API properties: apiVersion: description: |- @@ -63,7 +63,7 @@ spec: description: SusQL Kubernetes labels constructed from the spec type: object phase: - description: Transition phase of the label group + description: Transition phase of the LabelGroup type: string prometheusLabels: additionalProperties: @@ -71,8 +71,7 @@ spec: description: SusQL Prometheus labels constructed from the spec type: object susqlPrometheusQuery: - description: Prometheus query to get the total energy for this label - group + description: Prometheus query to get the total energy for this LabelGroup type: string totalCarbon: description: TotalCarbon keeps track of the accumulated grams of carbon diff --git a/config/manifests/bases/susql-operator.clusterserviceversion.yaml b/config/manifests/bases/susql-operator.clusterserviceversion.yaml index c1c54a9..17d4b73 100644 --- a/config/manifests/bases/susql-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/susql-operator.clusterserviceversion.yaml @@ -16,7 +16,7 @@ spec: apiservicedefinitions: {} customresourcedefinitions: owned: - - description: LabelGroup is the Schema for the labelgroups API + - description: LabelGroup is the Schema for the LabelGroups API displayName: Label Group kind: LabelGroup name: labelgroups.susql.ibm.com diff --git a/doc/operatorhub-installation.md b/doc/operatorhub-installation.md index 4ad2f21..38e0c39 100644 --- a/doc/operatorhub-installation.md +++ b/doc/operatorhub-installation.md @@ -42,11 +42,11 @@ Next, use the OpenShift web console to install the SusQL Operator: # Customization -Before deploying the SusQL Operator create a `configMap` called `susql-config` in +Before deploying the SusQL Operator create a `ConfigMap` called `susql-config` in the same namespace that the operator will run in. [susql-config.yaml](susql-config.yaml) is a good starting point. If you download it first, you -could create the configMap with `oc apply -n YOURNAMESPACE -f susql-config.yaml`. -If you update (or create) the configMap after the SusQL Operator has been installed, then restarting the SusQL Operator controller pod will +could create the ConfigMap with `oc apply -n YOURNAMESPACE -f susql-config.yaml`. +If you update (or create) the ConfigMap after the SusQL Operator has been installed, then restarting the SusQL Operator controller pod will enable the changes. (e.g., Delete the pod, and allow it to be recreated automatically.) # Post Installation Steps diff --git a/internal/controller/labelgroup_controller.go b/internal/controller/labelgroup_controller.go index bdc0f03..3358441 100644 --- a/internal/controller/labelgroup_controller.go +++ b/internal/controller/labelgroup_controller.go @@ -41,7 +41,7 @@ type LabelGroupReconciler struct { KeplerMetricName string SusQLPrometheusDatabaseUrl string SusQLPrometheusMetricsUrl string - SamplingRate time.Duration // Sampling rate for all label groups + SamplingRate time.Duration // Sampling rate for all LabelGroups CarbonMethod string CarbonIntensity float64 CarbonIntensityUrl string @@ -55,7 +55,7 @@ type LabelGroupReconciler struct { const ( susqlMetricName = "susql_total_energy_joules" // SusQL metric to query - fixingDelay = 15 * time.Second // Time to wait in the event the label group was badly constructed + fixingDelay = 15 * time.Second // Time to wait in the event the LabelGroup was badly constructed nopodDelay = 15 * time.Second // Time to wait in the event no pods are found errorDelay = 1 * time.Second // Time to wait when an error happens due to network connectivity issues ) @@ -87,7 +87,7 @@ func (r *LabelGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) coreruntime.ReadMemStats(&m) r.Logger.V(5).Info(fmt.Sprintf("Memory: Alloc=%.2f MB TotalAlloc=%.2f MB Sys= %.2f MB NumGC=%v", float32(m.Alloc)/1024.0/1024.0, float32(m.TotalAlloc)/1024.0/1024.0, float32(m.Sys)/1024.0/1024.0, m.NumGC)) - // Get label group object to process if it exists + // Get LabelGroup object to process if it exists labelGroup := &susqlv1.LabelGroup{} // Get deep copy of LabelGroup object in reconciler cache @@ -209,7 +209,7 @@ func (r *LabelGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) case susqlv1.Aggregating: r.Logger.V(5).Info("[Reconcile-Aggregating] Entered aggregating case.") // trace - // Get list of pods matching the label group and namespace + // Get list of pods matching the LabelGroup and namespace podsInNamespace, err := r.filterPodsInNamespace(ctx, labelGroup.Namespace, labelGroup.Status.KubernetesLabels) if err != nil || len(podsInNamespace) == 0 { diff --git a/internal/controller/resource_manager.go b/internal/controller/resource_manager.go index dfe1d15..809fd98 100644 --- a/internal/controller/resource_manager.go +++ b/internal/controller/resource_manager.go @@ -60,7 +60,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] 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