diff --git a/api/v1beta1/grafana.go b/api/v1beta1/grafana.go index b531196..217685f 100644 --- a/api/v1beta1/grafana.go +++ b/api/v1beta1/grafana.go @@ -5,6 +5,7 @@ type Grafana struct { Admin *Admin `json:"admin,omitempty"` Datasources []*Datasource `json:"datasources,omitempty"` DashboardProviders []*Provider `json:"dashboardproviders,omitempty"` + Storage *StorageSpec `json:"storage,omitempty"` } type Admin struct { ExistingSecret string `json:"existingSecret,omitempty" yaml:"existingSecret,omitempty"` diff --git a/api/v1beta1/logging-operator.go b/api/v1beta1/logging-operator.go index bca2029..28a690e 100644 --- a/api/v1beta1/logging-operator.go +++ b/api/v1beta1/logging-operator.go @@ -1,5 +1,6 @@ package v1beta1 type LoggingOperator struct { - Deploy bool `json:"deploy,omitempty"` + Deploy bool `json:"deploy,omitempty"` + FluentdPVC *StorageSpec `json:"fluentdStorage,omitempty" yaml:"fluentdStorage,omitempty"` } diff --git a/dashboards/kubelet/json/kubelet.json b/dashboards/kubelet/json/kubelet.json index 2726a93..25a99f4 100644 --- a/dashboards/kubelet/json/kubelet.json +++ b/dashboards/kubelet/json/kubelet.json @@ -73,7 +73,7 @@ "tableColumn": "", "targets": [ { - "expr": "sum(up{cluster=\"$cluster\", job=\"kubelet\"})", + "expr": "sum(up{cluster=\"$cluster\", job=\"kubernetes-nodes\"})", "format": "time_series", "intervalFactor": 2, "legendFormat": "", @@ -153,10 +153,10 @@ "tableColumn": "", "targets": [ { - "expr": "sum(kubelet_running_pod_count{cluster=\"$cluster\", job=\"kubelet\", instance=~\"$instance\"})", + "expr": "sum(kubelet_running_pod_count{cluster=\"$cluster\", job=\"kubernetes-nodes\", instance=~\"$instance\"})", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}}", + "legendFormat": "{{instance}}", "refId": "A" } ], @@ -233,10 +233,10 @@ "tableColumn": "", "targets": [ { - "expr": "sum(kubelet_running_container_count{cluster=\"$cluster\", job=\"kubelet\", instance=~\"$instance\"})", + "expr": "sum(kubelet_running_container_count{cluster=\"$cluster\", job=\"kubernetes-nodes\", instance=~\"$instance\"})", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}}", + "legendFormat": "{{instance}}", "refId": "A" } ], @@ -313,10 +313,10 @@ "tableColumn": "", "targets": [ { - "expr": "sum(volume_manager_total_volumes{cluster=\"$cluster\", job=\"kubelet\", instance=~\"$instance\", state=\"actual_state_of_world\"})", + "expr": "sum(volume_manager_total_volumes{cluster=\"$cluster\", job=\"kubernetes-nodes\", instance=~\"$instance\", state=\"actual_state_of_world\"})", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}}", + "legendFormat": "{{instance}}", "refId": "A" } ], @@ -393,10 +393,10 @@ "tableColumn": "", "targets": [ { - "expr": "sum(volume_manager_total_volumes{cluster=\"$cluster\", job=\"kubelet\", instance=~\"$instance\",state=\"desired_state_of_world\"})", + "expr": "sum(volume_manager_total_volumes{cluster=\"$cluster\", job=\"kubernetes-nodes\", instance=~\"$instance\",state=\"desired_state_of_world\"})", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}}", + "legendFormat": "{{instance}}", "refId": "A" } ], @@ -473,10 +473,10 @@ "tableColumn": "", "targets": [ { - "expr": "sum(rate(kubelet_node_config_error{cluster=\"$cluster\", job=\"kubelet\", instance=~\"$instance\"}[5m]))", + "expr": "sum(rate(kubelet_node_config_error{cluster=\"$cluster\", job=\"kubernetes-nodes\", instance=~\"$instance\"}[5m]))", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}}", + "legendFormat": "{{instance}}", "refId": "A" } ], @@ -545,10 +545,10 @@ "steppedLine": false, "targets": [ { - "expr": "sum(rate(kubelet_runtime_operations_total{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])) by (operation_type, instance)", + "expr": "sum(rate(kubelet_runtime_operations_total{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])) by (operation_type, instance)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} {{`{{operation_type}}`}}", + "legendFormat": "{{instance}} {{operation_type}}", "refId": "A" } ], @@ -624,10 +624,10 @@ "steppedLine": false, "targets": [ { - "expr": "sum(rate(kubelet_runtime_operations_errors_total{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])) by (instance, operation_type)", + "expr": "sum(rate(kubelet_runtime_operations_errors_total{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])) by (instance, operation_type)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} {{`{{operation_type}}`}}", + "legendFormat": "{{instance}} {{operation_type}}", "refId": "A" } ], @@ -716,10 +716,10 @@ "steppedLine": false, "targets": [ { - "expr": "histogram_quantile(0.99, sum(rate(kubelet_runtime_operations_duration_seconds_bucket{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])) by (instance, operation_type, le))", + "expr": "histogram_quantile(0.99, sum(rate(kubelet_runtime_operations_duration_seconds_bucket{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])) by (instance, operation_type, le))", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} {{`{{operation_type}}`}}", + "legendFormat": "{{instance}} {{operation_type}}", "refId": "A" } ], @@ -808,17 +808,17 @@ "steppedLine": false, "targets": [ { - "expr": "sum(rate(kubelet_pod_start_duration_seconds_count{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])) by (instance)", + "expr": "sum(rate(kubelet_pod_start_duration_seconds_count{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])) by (instance)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} pod", + "legendFormat": "{{instance}} pod", "refId": "A" }, { - "expr": "sum(rate(kubelet_pod_worker_duration_seconds_count{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])) by (instance)", + "expr": "sum(rate(kubelet_pod_worker_duration_seconds_count{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])) by (instance)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} worker", + "legendFormat": "{{instance}} worker", "refId": "B" } ], @@ -894,17 +894,17 @@ "steppedLine": false, "targets": [ { - "expr": "histogram_quantile(0.99, sum(rate(kubelet_pod_start_duration_seconds_count{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])) by (instance, le))", + "expr": "histogram_quantile(0.99, sum(rate(kubelet_pod_start_duration_seconds_count{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])) by (instance, le))", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} pod", + "legendFormat": "{{instance}} pod", "refId": "A" }, { - "expr": "histogram_quantile(0.99, sum(rate(kubelet_pod_worker_duration_seconds_bucket{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])) by (instance, le))", + "expr": "histogram_quantile(0.99, sum(rate(kubelet_pod_worker_duration_seconds_bucket{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])) by (instance, le))", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} worker", + "legendFormat": "{{instance}} worker", "refId": "B" } ], @@ -995,10 +995,10 @@ "steppedLine": false, "targets": [ { - "expr": "sum(rate(storage_operation_duration_seconds_count{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])) by (instance, operation_name, volume_plugin)", + "expr": "sum(rate(storage_operation_duration_seconds_count{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])) by (instance, operation_name, volume_plugin)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} {{`{{operation_name}}`}} {{`{{volume_plugin}}`}}", + "legendFormat": "{{instance}} {{operation_name}} {{volume_plugin}}", "refId": "A" } ], @@ -1076,10 +1076,10 @@ "steppedLine": false, "targets": [ { - "expr": "sum(rate(storage_operation_errors_total{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])) by (instance, operation_name, volume_plugin)", + "expr": "sum(rate(storage_operation_errors_total{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])) by (instance, operation_name, volume_plugin)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} {{`{{operation_name}}`}} {{`{{volume_plugin}}`}}", + "legendFormat": "{{instance}} {{operation_name}} {{volume_plugin}}", "refId": "A" } ], @@ -1170,10 +1170,10 @@ "steppedLine": false, "targets": [ { - "expr": "histogram_quantile(0.99, sum(rate(storage_operation_duration_seconds_bucket{cluster=\"$cluster\", job=\"kubelet\", instance=~\"$instance\"}[5m])) by (instance, operation_name, volume_plugin, le))", + "expr": "histogram_quantile(0.99, sum(rate(storage_operation_duration_seconds_bucket{cluster=\"$cluster\", job=\"kubernetes-nodes\", instance=~\"$instance\"}[5m])) by (instance, operation_name, volume_plugin, le))", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} {{`{{operation_name}}`}} {{`{{volume_plugin}}`}}", + "legendFormat": "{{instance}} {{operation_name}} {{volume_plugin}}", "refId": "A" } ], @@ -1262,10 +1262,10 @@ "steppedLine": false, "targets": [ { - "expr": "sum(rate(kubelet_cgroup_manager_duration_seconds_count{cluster=\"$cluster\", job=\"kubelet\", instance=~\"$instance\"}[5m])) by (instance, operation_type)", + "expr": "sum(rate(kubelet_cgroup_manager_duration_seconds_count{cluster=\"$cluster\", job=\"kubernetes-nodes\", instance=~\"$instance\"}[5m])) by (instance, operation_type)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{operation_type}}`}}", + "legendFormat": "{{operation_type}}", "refId": "A" } ], @@ -1341,10 +1341,10 @@ "steppedLine": false, "targets": [ { - "expr": "histogram_quantile(0.99, sum(rate(kubelet_cgroup_manager_duration_seconds_bucket{cluster=\"$cluster\", job=\"kubelet\", instance=~\"$instance\"}[5m])) by (instance, operation_type, le))", + "expr": "histogram_quantile(0.99, sum(rate(kubelet_cgroup_manager_duration_seconds_bucket{cluster=\"$cluster\", job=\"kubernetes-nodes\", instance=~\"$instance\"}[5m])) by (instance, operation_type, le))", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} {{`{{operation_type}}`}}", + "legendFormat": "{{instance}} {{operation_type}}", "refId": "A" } ], @@ -1434,10 +1434,10 @@ "steppedLine": false, "targets": [ { - "expr": "sum(rate(kubelet_pleg_relist_duration_seconds_count{cluster=\"$cluster\", job=\"kubelet\", instance=~\"$instance\"}[5m])) by (instance)", + "expr": "sum(rate(kubelet_pleg_relist_duration_seconds_count{cluster=\"$cluster\", job=\"kubernetes-nodes\", instance=~\"$instance\"}[5m])) by (instance)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}}", + "legendFormat": "{{instance}}", "refId": "A" } ], @@ -1513,10 +1513,10 @@ "steppedLine": false, "targets": [ { - "expr": "histogram_quantile(0.99, sum(rate(kubelet_pleg_relist_interval_seconds_bucket{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])) by (instance, le))", + "expr": "histogram_quantile(0.99, sum(rate(kubelet_pleg_relist_interval_seconds_bucket{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])) by (instance, le))", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}}", + "legendFormat": "{{instance}}", "refId": "A" } ], @@ -1605,10 +1605,10 @@ "steppedLine": false, "targets": [ { - "expr": "histogram_quantile(0.99, sum(rate(kubelet_pleg_relist_duration_seconds_bucket{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])) by (instance, le))", + "expr": "histogram_quantile(0.99, sum(rate(kubelet_pleg_relist_duration_seconds_bucket{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])) by (instance, le))", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}}", + "legendFormat": "{{instance}}", "refId": "A" } ], @@ -1697,28 +1697,28 @@ "steppedLine": false, "targets": [ { - "expr": "sum(rate(rest_client_requests_total{cluster=\"$cluster\",job=\"kubelet\", instance=~\"$instance\",code=~\"2..\"}[5m]))", + "expr": "sum(rate(rest_client_requests_total{cluster=\"$cluster\",job=\"kubernetes-nodes\", instance=~\"$instance\",code=~\"2..\"}[5m]))", "format": "time_series", "intervalFactor": 2, "legendFormat": "2xx", "refId": "A" }, { - "expr": "sum(rate(rest_client_requests_total{cluster=\"$cluster\",job=\"kubelet\", instance=~\"$instance\",code=~\"3..\"}[5m]))", + "expr": "sum(rate(rest_client_requests_total{cluster=\"$cluster\",job=\"kubernetes-nodes\", instance=~\"$instance\",code=~\"3..\"}[5m]))", "format": "time_series", "intervalFactor": 2, "legendFormat": "3xx", "refId": "B" }, { - "expr": "sum(rate(rest_client_requests_total{cluster=\"$cluster\",job=\"kubelet\", instance=~\"$instance\",code=~\"4..\"}[5m]))", + "expr": "sum(rate(rest_client_requests_total{cluster=\"$cluster\",job=\"kubernetes-nodes\", instance=~\"$instance\",code=~\"4..\"}[5m]))", "format": "time_series", "intervalFactor": 2, "legendFormat": "4xx", "refId": "C" }, { - "expr": "sum(rate(rest_client_requests_total{cluster=\"$cluster\",job=\"kubelet\", instance=~\"$instance\",code=~\"5..\"}[5m]))", + "expr": "sum(rate(rest_client_requests_total{cluster=\"$cluster\",job=\"kubernetes-nodes\", instance=~\"$instance\",code=~\"5..\"}[5m]))", "format": "time_series", "intervalFactor": 2, "legendFormat": "5xx", @@ -1810,10 +1810,10 @@ "steppedLine": false, "targets": [ { - "expr": "histogram_quantile(0.99, sum(rate(rest_client_request_latency_seconds_bucket{cluster=\"$cluster\",job=\"kubelet\", instance=~\"$instance\"}[5m])) by (instance, verb, url, le))", + "expr": "histogram_quantile(0.99, sum(rate(rest_client_request_latency_seconds_bucket{cluster=\"$cluster\",job=\"kubernetes-nodes\", instance=~\"$instance\"}[5m])) by (instance, verb, url, le))", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}} {{`{{verb}}`}} {{`{{url}}`}}", + "legendFormat": "{{instance}} {{verb}} {{url}}", "refId": "A" } ], @@ -1902,10 +1902,10 @@ "steppedLine": false, "targets": [ { - "expr": "process_resident_memory_bytes{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}", + "expr": "process_resident_memory_bytes{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}}", + "legendFormat": "{{instance}}", "refId": "A" } ], @@ -1981,10 +1981,10 @@ "steppedLine": false, "targets": [ { - "expr": "rate(process_cpu_seconds_total{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}[5m])", + "expr": "rate(process_cpu_seconds_total{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}[5m])", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}}", + "legendFormat": "{{instance}}", "refId": "A" } ], @@ -2060,10 +2060,10 @@ "steppedLine": false, "targets": [ { - "expr": "go_goroutines{cluster=\"$cluster\",job=\"kubelet\",instance=~\"$instance\"}", + "expr": "go_goroutines{cluster=\"$cluster\",job=\"kubernetes-nodes\",instance=~\"$instance\"}", "format": "time_series", "intervalFactor": 2, - "legendFormat": "{{`{{instance}}`}}", + "legendFormat": "{{instance}}", "refId": "A" } ], @@ -2164,7 +2164,7 @@ "multi": false, "name": "instance", "options": [], - "query": "label_values(kubelet_runtime_operations{cluster=\"$cluster\", job=\"kubelet\"}, instance)", + "query": "label_values(kubelet_runtime_operations{cluster=\"$cluster\", job=\"kubernetes-nodes\"}, instance)", "refresh": 2, "regex": "", "sort": 1, diff --git a/dashboards/persistentvolumesusage/json/persistentvolumesusage.json b/dashboards/persistentvolumesusage/json/persistentvolumesusage.json new file mode 100644 index 0000000..64db342 --- /dev/null +++ b/dashboards/persistentvolumesusage/json/persistentvolumesusage.json @@ -0,0 +1,490 @@ +{ + "__inputs": [], + "__requires": [], + "annotations": { + "list": [] + }, + "editable": false, + "gnetId": null, + "graphTooltip": 0, + "hideControls": false, + "id": null, + "links": [], + "refresh": "", + "rows": [ + { + "collapse": false, + "collapsed": false, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "$datasource", + "fill": 1, + "gridPos": {}, + "id": 2, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": null, + "seriesOverrides": [], + "spaceLength": 10, + "span": 9, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "(\n sum without(instance, node) (kubelet_volume_stats_capacity_bytes{job=\"kubernetes-nodes\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n -\n sum without(instance, node) (kubelet_volume_stats_available_bytes{job=\"kubernetes-nodes\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n)\n", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Used Space", + "refId": "A" + }, + { + "expr": "sum without(instance, node) (kubelet_volume_stats_available_bytes{job=\"kubernetes-nodes\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Free Space", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Volume Space Usage", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + } + ] + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "rgba(50, 172, 45, 0.97)", + "rgba(237, 129, 40, 0.89)", + "rgba(245, 54, 54, 0.9)" + ], + "datasource": "$datasource", + "format": "percent", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": true, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": {}, + "id": 3, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "span": 3, + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "expr": "(\n kubelet_volume_stats_capacity_bytes{job=\"kubernetes-nodes\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"}\n -\n kubelet_volume_stats_available_bytes{job=\"kubernetes-nodes\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"}\n)\n/\nkubelet_volume_stats_capacity_bytes{job=\"kubernetes-nodes\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"}\n* 100\n", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": "80, 90", + "title": "Volume Space Usage", + "tooltip": { + "shared": false + }, + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + } + ], + "repeat": null, + "repeatIteration": null, + "repeatRowId": null, + "showTitle": false, + "title": "Dashboard Row", + "titleSize": "h6", + "type": "row" + }, + { + "collapse": false, + "collapsed": false, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "$datasource", + "fill": 1, + "gridPos": {}, + "id": 4, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": null, + "seriesOverrides": [], + "spaceLength": 10, + "span": 9, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "sum without(instance, node) (kubelet_volume_stats_inodes_used{job=\"kubernetes-nodes\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Used inodes", + "refId": "A" + }, + { + "expr": "(\n sum without(instance, node) (kubelet_volume_stats_inodes{job=\"kubernetes-nodes\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n -\n sum without(instance, node) (kubelet_volume_stats_inodes_used{job=\"kubernetes-nodes\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n)\n", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": " Free inodes", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Volume inodes Usage", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "none", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + } + ] + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "rgba(50, 172, 45, 0.97)", + "rgba(237, 129, 40, 0.89)", + "rgba(245, 54, 54, 0.9)" + ], + "datasource": "$datasource", + "format": "percent", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": true, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": {}, + "id": 5, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "span": 3, + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "expr": "kubelet_volume_stats_inodes_used{job=\"kubernetes-nodes\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"}\n/\nkubelet_volume_stats_inodes{job=\"kubernetes-nodes\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"}\n* 100\n", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": "80, 90", + "title": "Volume inodes Usage", + "tooltip": { + "shared": false + }, + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + } + ], + "repeat": null, + "repeatIteration": null, + "repeatRowId": null, + "showTitle": false, + "title": "Dashboard Row", + "titleSize": "h6", + "type": "row" + } + ], + "schemaVersion": 14, + "style": "dark", + "tags": [ + "kubernetes-mixin" + ], + "templating": { + "list": [ + { + "current": { + "text": "Prometheus", + "value": "Prometheus" + }, + "hide": 0, + "label": null, + "name": "datasource", + "options": [], + "query": "prometheus", + "refresh": 1, + "regex": "", + "type": "datasource" + }, + { + "allValue": null, + "current": {}, + "datasource": "$datasource", + "hide": 2, + "includeAll": false, + "label": "cluster", + "multi": false, + "name": "cluster", + "options": [], + "query": "label_values(kubelet_volume_stats_capacity_bytes, cluster)", + "refresh": 2, + "regex": "", + "sort": 1, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "allValue": null, + "current": {}, + "datasource": "$datasource", + "hide": 0, + "includeAll": false, + "label": "Namespace", + "multi": false, + "name": "namespace", + "options": [], + "query": "label_values(kubelet_volume_stats_capacity_bytes{job=\"kubernetes-nodes\"}, namespace)", + "refresh": 2, + "regex": "", + "sort": 1, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "allValue": null, + "current": {}, + "datasource": "$datasource", + "hide": 0, + "includeAll": false, + "label": "PersistentVolumeClaim", + "multi": false, + "name": "volume", + "options": [], + "query": "label_values(kubelet_volume_stats_capacity_bytes{job=\"kubernetes-nodes\", namespace=\"$namespace\"}, persistentvolumeclaim)", + "refresh": 2, + "regex": "", + "sort": 1, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + } + ] + }, + "time": { + "from": "now-7d", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "", + "title": "Kubernetes / Persistent Volumes", + "uid": "919b92a8e8041bd567af9edab12c840c", + "version": 0 +} \ No newline at end of file diff --git a/dashboards/persistentvolumesusage/kustomization.yaml b/dashboards/persistentvolumesusage/kustomization.yaml new file mode 100644 index 0000000..1e549d9 --- /dev/null +++ b/dashboards/persistentvolumesusage/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: caos-system + +configMapGenerator: +- name: grafana-persistentvolumesusage + files: + - json/persistentvolumesusage.json + +generatorOptions: + disableNameSuffixHash: true diff --git a/internal/bundle/application/applications/grafana/config/dashboards.go b/internal/bundle/application/applications/grafana/config/dashboards.go index b109793..6ceb69d 100644 --- a/internal/bundle/application/applications/grafana/config/dashboards.go +++ b/internal/bundle/application/applications/grafana/config/dashboards.go @@ -57,12 +57,20 @@ func getGrafanaDashboards(dashboardsfolder string, toolsetCRDSpec *toolsetsv1bet providers = append(providers, provider) } - // provider := &ConfigProvider{ - // ConfigMaps: []string{ - // "grafana-dashboard-kubelet", - // }, - // Folder: filepath.Join(dashboardsfolder, "kubelet"), - // } - // providers = append(providers, provider) + provider := &Provider{ + ConfigMaps: []string{ + "grafana-dashboard-kubelet", + }, + Folder: filepath.Join(dashboardsfolder, "kubelet"), + } + providers = append(providers, provider) + + provider = &Provider{ + ConfigMaps: []string{ + "grafana-persistentvolumesusage", + }, + Folder: filepath.Join(dashboardsfolder, "persistentvolumesusage"), + } + providers = append(providers, provider) return providers } diff --git a/internal/bundle/application/applications/grafana/helm.go b/internal/bundle/application/applications/grafana/helm.go index 7bf2059..8755bde 100644 --- a/internal/bundle/application/applications/grafana/helm.go +++ b/internal/bundle/application/applications/grafana/helm.go @@ -84,6 +84,15 @@ func (g *Grafana) SpecToHelmValues(toolset *toolsetsv1beta1.ToolsetSpec) interfa values.Grafana.Admin.UserKey = toolset.Grafana.Admin.UserKey values.Grafana.Admin.PasswordKey = toolset.Grafana.Admin.PasswordKey } + if toolset.Grafana.Storage != nil { + values.Grafana.Persistence.Enabled = true + values.Grafana.Persistence.Size = toolset.Grafana.Storage.Size + values.Grafana.Persistence.StorageClassName = toolset.Grafana.Storage.StorageClass + + if toolset.Grafana.Storage.AccessModes != nil { + values.Grafana.Persistence.AccessModes = toolset.Grafana.Storage.AccessModes + } + } return values } diff --git a/internal/bundle/application/applications/grafana/helm/default.go b/internal/bundle/application/applications/grafana/helm/default.go index 7124871..475f0a5 100644 --- a/internal/bundle/application/applications/grafana/helm/default.go +++ b/internal/bundle/application/applications/grafana/helm/default.go @@ -2,6 +2,8 @@ package helm import prometheusoperator "github.com/caos/boom/internal/bundle/application/applications/prometheusoperator/helm" +import "github.com/caos/boom/internal/bundle/application/applications/grafanastandalone" + func DefaultValues(imageTags map[string]string) *Values { grafana := &GrafanaValues{ FullnameOverride: "grafana", @@ -24,6 +26,19 @@ func DefaultValues(imageTags map[string]string) *Values { ServiceMonitor: &ServiceMonitor{ SelfMonitor: false, }, + Persistence: &Persistence{ + Type: "pvc", + Enabled: false, + AccessModes: []string{"ReadWriteOnce"}, + Size: "10Gi", + Finalizers: []string{"kubernetes.io/pvc-protection"}, + }, + TestFramework: &grafanastandalone.TestFramework{ + Enabled: false, + Image: "dduportal/bats", + Tag: imageTags["dduportal/bats"], + }, + Plugins: []string{"grafana-piechart-panel"}, } return &Values{ diff --git a/internal/bundle/application/applications/grafana/helm/values.go b/internal/bundle/application/applications/grafana/helm/values.go index 2c4c435..a2a5553 100644 --- a/internal/bundle/application/applications/grafana/helm/values.go +++ b/internal/bundle/application/applications/grafana/helm/values.go @@ -61,19 +61,31 @@ type Admin struct { PasswordKey string `yaml:"passwordKey"` } +type Persistence struct { + Type string `yaml:"type"` + Enabled bool `yaml:"enabled"` + AccessModes []string `yaml:"accessModes"` + Size string `yaml:"size"` + StorageClassName string `yaml:"storageClassName"` + Finalizers []string `yaml:"finalizers"` +} + type GrafanaValues struct { - FullnameOverride string `yaml:"fullnameOverride,omitempty"` - Enabled bool `yaml:"enabled"` - DefaultDashboardsEnabled bool `yaml:"defaultDashboardsEnabled"` - AdminPassword string `yaml:"adminPassword"` - Admin *Admin `yaml:"admin"` - Ingress *Ingress `yaml:"ingress"` - Sidecar *Sidecar `yaml:"sidecar"` - ExtraConfigmapMounts []interface{} `yaml:"extraConfigmapMounts"` - AdditionalDataSources []*grafanastandalone.Datasource `yaml:"additionalDataSources"` - ServiceMonitor *ServiceMonitor `yaml:"serviceMonitor"` - DashboardProviders *DashboardProviders `yaml:"dashboardProviders,omitempty"` - DashboardsConfigMaps map[string]string `yaml:"dashboardsConfigMaps,omitempty"` + FullnameOverride string `yaml:"fullnameOverride,omitempty"` + Enabled bool `yaml:"enabled"` + DefaultDashboardsEnabled bool `yaml:"defaultDashboardsEnabled"` + AdminPassword string `yaml:"adminPassword"` + Admin *Admin `yaml:"admin"` + Ingress *Ingress `yaml:"ingress"` + Sidecar *Sidecar `yaml:"sidecar"` + ExtraConfigmapMounts []interface{} `yaml:"extraConfigmapMounts"` + AdditionalDataSources []*grafanastandalone.Datasource `yaml:"additionalDataSources"` + ServiceMonitor *ServiceMonitor `yaml:"serviceMonitor"` + DashboardProviders *DashboardProviders `yaml:"dashboardProviders,omitempty"` + DashboardsConfigMaps map[string]string `yaml:"dashboardsConfigMaps,omitempty"` + Persistence *Persistence `yaml:"persistence,omitempty"` + TestFramework *grafanastandalone.TestFramework `yaml:"testFramework,omitempty"` + Plugins []string `yaml:"plugins,omitempty"` } type Rules struct { diff --git a/internal/bundle/application/applications/loggingoperator/logging/logging.go b/internal/bundle/application/applications/loggingoperator/logging/logging.go index ef820d9..574fd4a 100644 --- a/internal/bundle/application/applications/loggingoperator/logging/logging.go +++ b/internal/bundle/application/applications/loggingoperator/logging/logging.go @@ -1,9 +1,18 @@ package logging +type Storage struct { + StorageClassName string + AccessModes []string + Storage string +} + type Config struct { Name string Namespace string ControlNamespace string + Replicas int + FluentdPVC *Storage + FluentbitPVC *Storage } type Requests struct { Storage string `yaml:"storage,omitempty"` @@ -11,15 +20,26 @@ type Requests struct { type Resources struct { Requests *Requests `yaml:"requests,omitempty"` } -type FluentdPvcSpec struct { +type PvcSpec struct { AccessModes []string `yaml:"accessModes,omitempty"` Resources *Resources `yaml:"resources,omitempty"` StorageClassName string `yaml:"storageClassName,omitempty"` } +type Pvc struct { + PvcSpec *PvcSpec `yaml:"spec,omitempty"` +} +type KubernetesStorage struct { + Pvc *Pvc `yaml:"pvc,omitempty"` +} +type Scaling struct { + Replicas int `yaml:"replicas"` +} type Fluentd struct { - Metrics *Metrics `yaml:"metrics,omitempty"` - FluentdPvcSpec *FluentdPvcSpec `yaml:"fluentdPvcSpec,omitempty"` - LogLevel string `yaml:"logLevel,omitempty"` + Metrics *Metrics `yaml:"metrics,omitempty"` + BufferStorageVolume *KubernetesStorage `yaml:"bufferStorageVolume,omitempty"` + LogLevel string `yaml:"logLevel,omitempty"` + DisablePvc bool `yaml:"disablePvc"` + Scaling *Scaling `yaml:"scaling,omitempty"` } type Metrics struct { Port int `yaml:"port"` @@ -35,14 +55,17 @@ type Image struct { } type Fluentbit struct { - Metrics *Metrics `yaml:"metrics,omitempty"` - FilterKubernetes *FilterKubernetes `yaml:"filterKubernetes,omitempty"` - Image *Image `yaml:"image,omitempty"` + Metrics *Metrics `yaml:"metrics,omitempty"` + FilterKubernetes *FilterKubernetes `yaml:"filterKubernetes,omitempty"` + Image *Image `yaml:"image,omitempty"` + BufferStorageVolume *KubernetesStorage `yaml:"bufferStorageVolume,omitempty"` } type Spec struct { - Fluentd *Fluentd `yaml:"fluentd"` - Fluentbit *Fluentbit `yaml:"fluentbit"` - ControlNamespace string `yaml:"controlNamespace"` + Fluentd *Fluentd `yaml:"fluentd"` + Fluentbit *Fluentbit `yaml:"fluentbit"` + ControlNamespace string `yaml:"controlNamespace"` + EnableRecreateWorkloadOnImmutableFieldChange bool `yaml:"enableRecreateWorkloadOnImmutableFieldChange"` + FlowConfigCheckDisabled bool `yaml:"flowConfigCheckDisabled"` } type Metadata struct { Name string `yaml:"name"` @@ -56,7 +79,7 @@ type Logging struct { } func New(conf *Config) *Logging { - return &Logging{ + values := &Logging{ APIVersion: "logging.banzaicloud.io/v1beta1", Kind: "Logging", Metadata: &Metadata{ @@ -64,11 +87,14 @@ func New(conf *Config) *Logging { Namespace: conf.Namespace, }, Spec: &Spec{ - ControlNamespace: conf.ControlNamespace, + FlowConfigCheckDisabled: true, + EnableRecreateWorkloadOnImmutableFieldChange: true, + ControlNamespace: conf.ControlNamespace, Fluentd: &Fluentd{ Metrics: &Metrics{ Port: 8080, }, + DisablePvc: true, }, Fluentbit: &Fluentbit{ Metrics: &Metrics{ @@ -82,4 +108,32 @@ func New(conf *Config) *Logging { }, }, } + if conf.FluentdPVC != nil { + values.Spec.Fluentd.BufferStorageVolume = &KubernetesStorage{ + Pvc: &Pvc{ + PvcSpec: &PvcSpec{ + StorageClassName: conf.FluentdPVC.StorageClassName, + Resources: &Resources{ + Requests: &Requests{ + Storage: conf.FluentdPVC.Storage, + }, + }, + }, + }, + } + values.Spec.Fluentd.DisablePvc = false + + if conf.FluentdPVC.AccessModes != nil { + values.Spec.Fluentd.BufferStorageVolume.Pvc.PvcSpec.AccessModes = conf.FluentdPVC.AccessModes + } else { + values.Spec.Fluentd.BufferStorageVolume.Pvc.PvcSpec.AccessModes = []string{"ReadWriteOnce"} + } + } + + if conf.Replicas != 0 { + values.Spec.Fluentd.Scaling = &Scaling{ + Replicas: conf.Replicas, + } + } + return values } diff --git a/internal/bundle/application/applications/loki/helm/default.go b/internal/bundle/application/applications/loki/helm/default.go index 49e92d0..d89ba97 100644 --- a/internal/bundle/application/applications/loki/helm/default.go +++ b/internal/bundle/application/applications/loki/helm/default.go @@ -27,13 +27,17 @@ func DefaultValues(imageTags map[string]string) *Values { SchemaConfig: &SchemaConfigs{ Configs: []*SchemaConfig{ &SchemaConfig{ - From: "2018-04-15", + From: "2000-01-01", Store: "boltdb", ObjectStore: "filesystem", Schema: "v9", Index: &Index{ Prefix: "index_", - Period: "168h", + Period: "24h", + }, + Chunks: &Chunks{ + Prefix: "chunk_", + Period: "24h", }, }, }, @@ -50,11 +54,11 @@ func DefaultValues(imageTags map[string]string) *Values { }, }, ChunkStoreConfig: &ChunkStoreConfig{ - MaxLookBackPeriod: 0, + MaxLookBackPeriod: "168h", }, TableManager: &TableManager{ RetentionDeletesEnabled: false, - RetentionPeriod: 0, + RetentionPeriod: "336h", }, }, Image: &Image{ diff --git a/internal/bundle/application/applications/loki/helm/values.go b/internal/bundle/application/applications/loki/helm/values.go index d36835d..8bd6a30 100644 --- a/internal/bundle/application/applications/loki/helm/values.go +++ b/internal/bundle/application/applications/loki/helm/values.go @@ -28,12 +28,17 @@ type Index struct { Prefix string `yaml:"prefix"` Period string `yaml:"period"` } +type Chunks struct { + Prefix string `yaml:"prefix"` + Period string `yaml:"period"` +} type SchemaConfig struct { - From string `yaml:"from"` - Store string `yaml:"store"` - ObjectStore string `yaml:"object_store"` - Schema string `yaml:"schema"` - Index *Index `yaml:"index"` + From string `yaml:"from"` + Store string `yaml:"store"` + ObjectStore string `yaml:"object_store"` + Schema string `yaml:"schema"` + Index *Index `yaml:"index"` + Chunks *Chunks `yaml:"chunks"` } type SchemaConfigs struct { Configs []*SchemaConfig `yaml:"configs"` @@ -52,11 +57,11 @@ type StorageConfig struct { Filesystem *Filesystem `yaml:"filesystem"` } type ChunkStoreConfig struct { - MaxLookBackPeriod int `yaml:"max_look_back_period"` + MaxLookBackPeriod string `yaml:"max_look_back_period"` } type TableManager struct { - RetentionDeletesEnabled bool `yaml:"retention_deletes_enabled"` - RetentionPeriod int `yaml:"retention_period"` + RetentionDeletesEnabled bool `yaml:"retention_deletes_enabled"` + RetentionPeriod string `yaml:"retention_period"` } type Config struct { AuthEnabled bool `yaml:"auth_enabled"` diff --git a/internal/bundle/application/applications/loki/logs/logs.go b/internal/bundle/application/applications/loki/logs/logs.go index 29653ec..37809d0 100644 --- a/internal/bundle/application/applications/loki/logs/logs.go +++ b/internal/bundle/application/applications/loki/logs/logs.go @@ -31,19 +31,28 @@ func GetAllResources(toolsetCRDSpec *toolsetsv1beta1.ToolsetSpec) []interface{} } //logging resource so that fluentd and fluentbit are deployed - ret = append(ret, getLogging()) + ret = append(ret, getLogging(toolsetCRDSpec)) } return ret } -func getLogging() *logging.Logging { +func getLogging(toolsetCRDSpec *toolsetsv1beta1.ToolsetSpec) *logging.Logging { conf := &logging.Config{ Name: "logging", Namespace: "caos-system", ControlNamespace: "caos-system", } + if toolsetCRDSpec.LoggingOperator.FluentdPVC != nil { + conf.FluentdPVC = &logging.Storage{ + StorageClassName: toolsetCRDSpec.LoggingOperator.FluentdPVC.StorageClass, + Storage: toolsetCRDSpec.LoggingOperator.FluentdPVC.Size, + } + if toolsetCRDSpec.LoggingOperator.FluentdPVC.AccessModes != nil { + conf.FluentdPVC.AccessModes = toolsetCRDSpec.LoggingOperator.FluentdPVC.AccessModes + } + } return logging.New(conf) }