diff --git a/f2soperator/operation/operator/balancer.go b/f2soperator/operation/operator/balancer.go index 1c0d2ab..41bb7af 100644 --- a/f2soperator/operation/operator/balancer.go +++ b/f2soperator/operation/operator/balancer.go @@ -130,10 +130,12 @@ func scaleDeployments() { for _, function := range functions.Items { var resultScale int currentAvailableReplicas, availableReplicasErr := prometheus.ReadCurrentPrometheusMetricValue(&configuration.ActiveConfiguration, fmt.Sprintf("kube_deployment_status_replicas_available{functionname=\"%s\"}", function.Name)) - requiredContainers, requiredContainersErr := prometheus.ReadCurrentPrometheusMetricValue(&configuration.ActiveConfiguration, fmt.Sprintf("job:function_containers_required:containers{functionname=\"%s\"}", function.Name)) - if availableReplicasErr != nil || requiredContainersErr != nil { - // no invocations / metrics => scale to minimum - logging.Error("there was an error when trying to read metric [kube_deployment_status_replicas_available] or [job:function_containers_required:containers]. setting result scale to 0") + requiredContainers, requiredContainersErr := prometheus.ReadCurrentPrometheusMetricValue(&configuration.ActiveConfiguration, fmt.Sprintf("job:function_containers_required:containers{functionname=\"%s\"} or vector(0)", function.Name)) + if availableReplicasErr != nil { + logging.Error("there was an error when trying to read metric [kube_deployment_status_replicas_available]. setting result-scale to 0") + resultScale = 0 + } else if requiredContainersErr != nil { + logging.Error("there was an error when trying to read metric [job:function_containers_required:containers]. setting result-scale to 0") resultScale = 0 } else { resultScale = int(math.Ceil(requiredContainers)) diff --git a/f2soperator/state/configuration/api/clientset/v1alpha1/clientset.go b/f2soperator/state/configuration/api/clientset/v1alpha1/clientset.go index 873cdd1..ccd6838 100644 --- a/f2soperator/state/configuration/api/clientset/v1alpha1/clientset.go +++ b/f2soperator/state/configuration/api/clientset/v1alpha1/clientset.go @@ -27,7 +27,7 @@ func NewForConfig(c *rest.Config, scheme *runtime.Scheme) (*V1Alpha1Client, erro config.NegotiatedSerializer = serializer.NewCodecFactory(scheme) config.UserAgent = rest.DefaultKubernetesUserAgent() - logging.Info("Rest Client Group Version:", fmt.Sprintf("%s", config.GroupVersion)) + logging.Debug("Rest Client Group Version:", fmt.Sprintf("%s", config.GroupVersion)) client, err := rest.RESTClientFor(&config) if err != nil { diff --git a/f2soperator/state/configuration/api/clientset/v1alpha1/functions.go b/f2soperator/state/configuration/api/clientset/v1alpha1/functions.go index 09d0b1e..ab3d28b 100644 --- a/f2soperator/state/configuration/api/clientset/v1alpha1/functions.go +++ b/f2soperator/state/configuration/api/clientset/v1alpha1/functions.go @@ -27,7 +27,7 @@ type functionClient struct { func (c *functionClient) List(opts metav1.ListOptions) (*v1alpha1.FunctionList, error) { result := v1alpha1.FunctionList{} - logging.Info("get function list for namespace", c.ns) + logging.Info(fmt.Sprintf("get function list for namespace %s", c.ns)) ctx := context.TODO() err := c.restClient. Get(). @@ -36,7 +36,7 @@ func (c *functionClient) List(opts metav1.ListOptions) (*v1alpha1.FunctionList, //VersionedParams(&opts, scheme.ParameterCodec). Do(ctx). Into(&result) - logging.Error(fmt.Sprintf("%s", err)) + logging.Error(fmt.Sprintf("could not get function list for namespace %s: %s", c.ns, err.Error())) return &result, err } @@ -104,6 +104,6 @@ func (c *functionClient) Delete(uid string, opts metav1.DeleteOptions) error { } } - logging.Error(fmt.Sprint("function could not be found")) + logging.Error(fmt.Sprint("function with uid %s could not be found", uid)) return fmt.Errorf("function could not be found") } diff --git a/helm/templates/grafana/grafana-configmap.yaml b/helm/templates/grafana/grafana-configmap.yaml new file mode 100644 index 0000000..83fe683 --- /dev/null +++ b/helm/templates/grafana/grafana-configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: grafana-config + namespace: f2s +data: + f2s-grafana-config.ini: | + [auth.anonymous] + enabled = true diff --git a/helm/templates/grafana/grafana-deployment.yaml b/helm/templates/grafana/grafana-deployment.yaml index f762e5b..f01bdef 100644 --- a/helm/templates/grafana/grafana-deployment.yaml +++ b/helm/templates/grafana/grafana-deployment.yaml @@ -33,7 +33,14 @@ spec: - name: grafana-provisioning-dashboards mountPath: /var/lib/grafana/provisioning/dashboards readOnly: true + - name: grafana-config + mountPath: /etc/grafana/custom.ini + subPath: f2s-grafana-config.ini + readOnly: true volumes: + - name: grafana-config + configMap: + name: grafana-config - name: grafana-storage emptyDir: {} - name: grafana-provisioning-datasources