diff --git a/charts/cvat/.helmignore b/charts/cvat/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/cvat/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/cvat/Chart.lock b/charts/cvat/Chart.lock new file mode 100644 index 0000000..99918b8 --- /dev/null +++ b/charts/cvat/Chart.lock @@ -0,0 +1,24 @@ +dependencies: +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 12.1.15 +- name: nuclio + repository: https://nuclio.github.io/nuclio/charts + version: 0.19.0 +- name: vector + repository: https://helm.vector.dev + version: 0.19.2 +- name: clickhouse + repository: https://charts.bitnami.com/bitnami + version: 4.1.16 +- name: grafana + repository: https://grafana.github.io/helm-charts + version: 6.60.6 +- name: traefik + repository: https://helm.traefik.io/traefik + version: 25.0.0 +- name: redis + repository: https://charts.bitnami.com/bitnami + version: 18.5.0 +digest: sha256:078ab405af1d5183ac9ad4085c67dbfa10f965bb86eb01b3dd53a40d5d17f616 +generated: "2024-06-09T14:43:36.56104194+03:00" diff --git a/charts/cvat/Chart.yaml b/charts/cvat/Chart.yaml new file mode 100644 index 0000000..6ec9c7e --- /dev/null +++ b/charts/cvat/Chart.yaml @@ -0,0 +1,62 @@ +apiVersion: v2 +name: cvat +kubeVersion: ">= 1.19.0-0" +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.14.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: latest +# We dont use it, so you can override it using values.override.yaml + +dependencies: + - name: postgresql + version: "12.1.*" + repository: https://charts.bitnami.com/bitnami + condition: postgresql.enabled + + - name: nuclio + version: 0.19.0 + repository: https://nuclio.github.io/nuclio/charts + condition: nuclio.enabled + + - name: vector + version: "0.19.*" + repository: https://helm.vector.dev + condition: analytics.enabled + + - name: clickhouse + version: "4.1.*" + repository: https://charts.bitnami.com/bitnami + condition: clickhouse.enabled + + - name: grafana + version: "6.60.*" + repository: https://grafana.github.io/helm-charts + condition: analytics.enabled + + - name: traefik + version: 25.0.0 + repository: https://helm.traefik.io/traefik + condition: traefik.enabled + + - name: redis + version: "18.5.*" + repository: https://charts.bitnami.com/bitnami + condition: redis.enabled diff --git a/charts/cvat/README.md b/charts/cvat/README.md new file mode 100644 index 0000000..1fb7164 --- /dev/null +++ b/charts/cvat/README.md @@ -0,0 +1,2 @@ + +[See for details](https://docs.cvat.ai/docs/administration/advanced/k8s_deployment_with_helm/) diff --git a/charts/cvat/analytics/clickhouse/init.sh b/charts/cvat/analytics/clickhouse/init.sh new file mode 100755 index 0000000..0f21cf0 --- /dev/null +++ b/charts/cvat/analytics/clickhouse/init.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +CLICKHOUSE_DB="${CLICKHOUSE_DB:-cvat}"; + +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS ${CLICKHOUSE_DB};" + +echo " +CREATE TABLE IF NOT EXISTS ${CLICKHOUSE_DB}.events +( + \`scope\` String NOT NULL, + \`obj_name\` String NULL, + \`obj_id\` UInt64 NULL, + \`obj_val\` String NULL, + \`source\` String NOT NULL, + \`timestamp\` DateTime64(3, 'Etc/UTC') NOT NULL, + \`count\` UInt16 NULL, + \`duration\` UInt32 DEFAULT toUInt32(0), + \`project_id\` UInt64 NULL, + \`task_id\` UInt64 NULL, + \`job_id\` UInt64 NULL, + \`user_id\` UInt64 NULL, + \`user_name\` String NULL, + \`user_email\` String NULL, + \`org_id\` UInt64 NULL, + \`org_slug\` String NULL, + \`payload\` String NULL +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(timestamp) +ORDER BY (timestamp) +SETTINGS index_granularity = 8192 +;" | clickhouse-client diff --git a/charts/cvat/analytics/grafana/dashboards/all_events.json b/charts/cvat/analytics/grafana/dashboards/all_events.json new file mode 100644 index 0000000..d1e98ba --- /dev/null +++ b/charts/cvat/analytics/grafana/dashboards/all_events.json @@ -0,0 +1,735 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 90, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "builderOptions": { + "fields": [], + "filters": [], + "metrics": [ + { + "aggregation": "count", + "field": "*" + } + ], + "mode": "trend", + "orderBy": [], + "table": "events", + "timeField": "timestamp", + "timeFieldType": "DateTime64(3, 'Etc/UTC')" + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 0, + "meta": { + "builderOptions": { + "fields": [], + "filters": [], + "metrics": [ + { + "aggregation": "count", + "field": "*" + } + ], + "mode": "trend", + "orderBy": [], + "table": "events", + "timeField": "timestamp", + "timeFieldType": "DateTime64(3, 'Etc/UTC')" + } + }, + "queryType": "sql", + "rawSql": "SELECT $__timeInterval(timestamp) as time, count(*)\r\nFROM events\r\nWHERE $__timeFilter(timestamp)\r\nAND scope IN (${scopes})\r\nAND source IN (${sources})\r\nAND (-1 IN (${users}) OR user_id IN (${users}))\r\nAND (-1 IN (${organizations}) OR org_id IN (${organizations}))\r\nAND (-1 IN (${projects}) OR project_id IN (${projects}))\r\nAND (-1 IN (${tasks}) OR task_id IN (${tasks}))\r\nAND (-1 IN (${jobs}) OR job_id IN (${jobs}))\r\nGROUP BY time ORDER BY time ASC", + "refId": "A" + } + ], + "title": "Overall Activity", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "inspect": true + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "timestamp" + }, + "properties": [ + { + "id": "custom.width", + "value": 158 + } + ] + } + ] + }, + "gridPos": { + "h": 23, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 4, + "options": { + "footer": { + "enablePagination": true, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "9.3.6", + "targets": [ + { + "builderOptions": { + "fields": [ + "*" + ], + "filters": [ + { + "condition": "AND", + "filterType": "custom", + "key": "timestamp", + "operator": "WITH IN DASHBOARD TIME RANGE", + "type": "DateTime64(3, 'Etc/UTC')", + "value": "TODAY" + }, + { + "condition": "AND", + "filterType": "custom", + "key": "scope", + "operator": "IN", + "type": "String", + "value": [ + "" + ] + } + ], + "mode": "list", + "orderBy": [ + { + "dir": "ASC", + "name": "timestamp" + } + ], + "table": "events" + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 1, + "meta": { + "builderOptions": { + "fields": [ + "*" + ], + "filters": [ + { + "condition": "AND", + "filterType": "custom", + "key": "timestamp", + "operator": "WITH IN DASHBOARD TIME RANGE", + "type": "DateTime64(3, 'Etc/UTC')", + "value": "TODAY" + }, + { + "condition": "AND", + "filterType": "custom", + "key": "scope", + "operator": "IN", + "type": "String", + "value": [ + "" + ] + } + ], + "mode": "list", + "orderBy": [ + { + "dir": "ASC", + "name": "timestamp" + } + ], + "table": "events" + } + }, + "queryType": "sql", + "rawSql": "SELECT * \r\nFROM events \r\nWHERE $__timeFilter(timestamp)\r\n AND scope IN (${scopes})\r\n AND source IN (${sources})\r\n AND (-1 IN (${users}) OR user_id IN (${users}))\r\n AND (-1 IN (${organizations}) OR org_id IN (${organizations}))\r\n AND (-1 IN (${projects}) OR project_id IN (${projects}))\r\n AND (-1 IN (${tasks}) OR task_id IN (${tasks}))\r\n AND (-1 IN (${jobs}) OR job_id IN (${jobs}))\r\nORDER BY timestamp DESC\r\nLIMIT 1000", + "refId": "A" + } + ], + "title": "All events", + "type": "table" + }, + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisGridShow": false, + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 0, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 12, + "x": 0, + "y": 30 + }, + "id": 6, + "options": { + "barRadius": 0, + "barWidth": 0.51, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "orientation": "horizontal", + "showValue": "always", + "stacking": "none", + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xField": "browser", + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 + }, + "pluginVersion": "9.3.6", + "targets": [ + { + "builderOptions": { + "fields": [], + "filters": [], + "limit": 100, + "mode": "list", + "orderBy": [], + "table": "events" + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 1, + "meta": { + "builderOptions": { + "fields": [], + "filters": [], + "limit": 100, + "mode": "list", + "orderBy": [], + "table": "events" + } + }, + "queryType": "sql", + "rawSql": "SELECT\r\n browser,\r\n count()\r\nFROM\r\n(\r\n SELECT\r\n concat(JSON_VALUE(payload, '$.platform.name'), ' ', JSON_VALUE(payload, '$.platform.version')) AS browser,\r\n user_id\r\n FROM cvat.events\r\n WHERE $__timeFilter(timestamp) AND (scope = 'load:cvat') AND (browser != ' ')\r\n GROUP BY\r\n user_id,\r\n browser\r\n)\r\nGROUP BY browser\r\nORDER BY count() DESC", + "refId": "A" + } + ], + "title": "Browser", + "type": "barchart" + }, + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisGridShow": false, + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 0, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 12, + "x": 12, + "y": 30 + }, + "id": 8, + "options": { + "barRadius": 0, + "barWidth": 0.51, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "orientation": "horizontal", + "showValue": "always", + "stacking": "none", + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xField": "os", + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 + }, + "pluginVersion": "9.3.6", + "targets": [ + { + "builderOptions": { + "fields": [], + "filters": [], + "limit": 100, + "mode": "list", + "orderBy": [], + "table": "events" + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 1, + "meta": { + "builderOptions": { + "fields": [], + "filters": [], + "limit": 100, + "mode": "list", + "orderBy": [], + "table": "events" + } + }, + "queryType": "sql", + "rawSql": "SELECT\r\n os,\r\n count()\r\nFROM\r\n(\r\n SELECT\r\n JSON_VALUE(payload, '$.platform.os') AS os,\r\n user_id\r\n FROM cvat.events\r\n WHERE $__timeFilter(timestamp) AND (scope = 'load:cvat') AND (os != '')\r\n GROUP BY\r\n user_id,\r\n os\r\n)\r\nGROUP BY os\r\nORDER BY count() DESC", + "refId": "A" + } + ], + "title": "OS", + "type": "barchart" + } + ], + "refresh": false, + "schemaVersion": 37, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "allValue": "", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT scope\nFROM events\nWHERE $__timeFilter(timestamp)", + "hide": 0, + "includeAll": true, + "label": "Scope", + "multi": true, + "name": "scopes", + "options": [], + "query": "SELECT DISTINCT scope\nFROM events\nWHERE $__timeFilter(timestamp)", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query" + }, + { + "allValue": "", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT source\nFROM events\nWHERE $__timeFilter(timestamp)", + "hide": 0, + "includeAll": true, + "label": "Source", + "multi": true, + "name": "sources", + "options": [], + "query": "SELECT DISTINCT source\nFROM events\nWHERE $__timeFilter(timestamp)", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": "-1", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND user_id IS NOT NULL", + "hide": 0, + "includeAll": true, + "label": "User", + "multi": true, + "name": "users", + "options": [], + "query": "SELECT DISTINCT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND user_id IS NOT NULL", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": "-1", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL", + "hide": 0, + "includeAll": true, + "label": "Project", + "multi": true, + "name": "projects", + "options": [], + "query": "SELECT DISTINCT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": "-1", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL", + "hide": 0, + "includeAll": true, + "label": "Task", + "multi": true, + "name": "tasks", + "options": [], + "query": "SELECT DISTINCT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": "-1", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL", + "hide": 0, + "includeAll": true, + "label": "Job", + "multi": true, + "name": "jobs", + "options": [], + "query": "SELECT DISTINCT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": "-1", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT org_id\nFROM events\nWHERE $__timeFilter(timestamp)\nAND org_id IS NOT NULL", + "hide": 0, + "includeAll": true, + "label": "Organization", + "multi": true, + "name": "organizations", + "options": [], + "query": "SELECT DISTINCT org_id\nFROM events\nWHERE $__timeFilter(timestamp)\nAND org_id IS NOT NULL", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-7d", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "All events", + "uid": "EIGSTDAVz", + "version": 1, + "weekStart": "" +} \ No newline at end of file diff --git a/charts/cvat/analytics/grafana/dashboards/management.json b/charts/cvat/analytics/grafana/dashboards/management.json new file mode 100644 index 0000000..fdba301 --- /dev/null +++ b/charts/cvat/analytics/grafana/dashboards/management.json @@ -0,0 +1,506 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 25, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "User 1" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "9.3.6", + "targets": [ + { + "builderOptions": { + "fields": [], + "filters": [], + "groupBy": [ + "user_id" + ], + "metrics": [ + { + "aggregation": "count", + "alias": "value", + "field": "*" + } + ], + "mode": "trend", + "orderBy": [], + "table": "events", + "timeField": "timestamp", + "timeFieldType": "DateTime64(3, 'Etc/UTC')" + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 0, + "hide": false, + "meta": { + "builderOptions": { + "fields": [], + "filters": [], + "groupBy": [ + "user_id" + ], + "metrics": [ + { + "aggregation": "count", + "alias": "value", + "field": "*" + } + ], + "mode": "trend", + "orderBy": [], + "table": "events", + "timeField": "timestamp", + "timeFieldType": "DateTime64(3, 'Etc/UTC')" + } + }, + "queryType": "sql", + "rawSql": "SELECT $__timeInterval(timestamp) as time, toString(user_id), count() as User\r\nFROM events\r\nWHERE $__timeFilter(timestamp)\r\nGROUP BY time, user_id\r\nORDER BY time ASC, user_id ASC", + "refId": "A" + } + ], + "title": "User Activity", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 90, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "builderOptions": { + "fields": [], + "filters": [], + "metrics": [ + { + "aggregation": "count", + "alias": "Count", + "field": "*" + } + ], + "mode": "trend", + "orderBy": [], + "table": "events", + "timeField": "timestamp", + "timeFieldType": "DateTime64(3, 'Etc/UTC')" + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 0, + "queryType": "builder", + "rawSql": "SELECT $__timeInterval(timestamp) as time, count(*) Count FROM events WHERE $__timeFilter(timestamp) GROUP BY time ORDER BY time ASC", + "refId": "A" + } + ], + "title": "Overall Activity", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "filterable": false, + "inspect": true + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 16 + }, + "id": 2, + "options": { + "footer": { + "enablePagination": true, + "fields": [ + "Working time(h)", + "Activity" + ], + "reducer": [ + "sum" + ], + "show": true + }, + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "9.3.6", + "targets": [ + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 1, + "meta": { + "builderOptions": { + "fields": [], + "limit": 100, + "mode": "list" + } + }, + "queryType": "sql", + "rawSql": "SELECT\r\n user_id as User,\r\n project_id as Project,\r\n task_id as Task,\r\n job_id as Job, sum(JSONExtractUInt(payload, 'working_time')) / 1000 / 3600 as \"Working time(h)\",\r\n count() as Activity\r\nFROM events\r\nWHERE JSONHas(payload, 'working_time')\r\n AND $__timeFilter(timestamp)\r\n AND user_id IN (${users})\r\n AND (-1 IN (${projects}) OR project_id IN (${projects}))\r\n AND task_id IN (${tasks})\r\n AND job_id IN (${jobs})\r\nGROUP BY user_id, project_id, task_id, job_id", + "refId": "A" + } + ], + "title": "Working time", + "type": "table" + } + ], + "refresh": false, + "schemaVersion": 37, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND source = 'client'", + "hide": 0, + "includeAll": true, + "label": "User", + "multi": true, + "name": "users", + "options": [], + "query": "SELECT DISTINCT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND source = 'client'", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query" + }, + { + "allValue": "-1", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL\n AND source = 'client'", + "hide": 0, + "includeAll": true, + "label": "Project", + "multi": true, + "name": "projects", + "options": [], + "query": "SELECT DISTINCT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL\n AND source = 'client'", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL\n AND source = 'client'\n AND (-1 IN (${projects}) OR project_id IN (${projects}))", + "description": "", + "hide": 0, + "includeAll": true, + "label": "Task", + "multi": true, + "name": "tasks", + "options": [], + "query": "SELECT DISTINCT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL\n AND source = 'client'\n AND (-1 IN (${projects}) OR project_id IN (${projects}))", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query" + }, + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL\n AND source = 'client'\n AND task_id in (${tasks})", + "hide": 0, + "includeAll": true, + "label": "Job", + "multi": true, + "name": "jobs", + "options": [], + "query": "SELECT DISTINCT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL\n AND source = 'client'\n AND task_id in (${tasks})", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-7d", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Management", + "uid": "w0if6WAVz", + "version": 2, + "weekStart": "" +} \ No newline at end of file diff --git a/charts/cvat/analytics/grafana/dashboards/monitoring.json b/charts/cvat/analytics/grafana/dashboards/monitoring.json new file mode 100644 index 0000000..ea54db9 --- /dev/null +++ b/charts/cvat/analytics/grafana/dashboards/monitoring.json @@ -0,0 +1,1178 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 3, + "x": 0, + "y": 0 + }, + "id": 12, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.3.6", + "targets": [ + { + "builderOptions": { + "fields": [], + "filters": [], + "limit": 100, + "metrics": [ + { + "aggregation": "count", + "field": "" + } + ], + "mode": "aggregate", + "orderBy": [], + "table": "events" + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 1, + "meta": { + "builderOptions": { + "fields": [], + "filters": [], + "limit": 100, + "metrics": [ + { + "aggregation": "count", + "field": "" + } + ], + "mode": "aggregate", + "orderBy": [], + "table": "events" + } + }, + "queryType": "sql", + "rawSql": "SELECT\r\n uniqExact(user_id) as \"Active users (now)\"\r\nFROM\r\n cvat.events\r\nWHERE\r\n user_id IS NOT NULL AND\r\n timestamp >= now() - INTERVAL 15 MINUTE", + "refId": "A" + } + ], + "title": "Active users (now)", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "description": "Show active users calculated by 15 minutes time interval", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 21, + "x": 3, + "y": 0 + }, + "id": 10, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 1, + "meta": { + "builderOptions": { + "fields": [], + "limit": 100, + "mode": "list" + } + }, + "queryType": "sql", + "rawSql": "SELECT\r\n time,\r\n uniqExact(user_id) Users\r\nFROM\r\n(\r\n SELECT\r\n user_id,\r\n toStartOfInterval(timestamp, INTERVAL 15 minute) as time\r\n FROM cvat.events\r\n WHERE\r\n user_id IS NOT NULL\r\n GROUP BY\r\n user_id,\r\n time\r\n ORDER BY time ASC WITH FILL STEP toIntervalMinute(15)\r\n)\r\nGROUP BY time\r\nORDER BY time", + "refId": "A" + } + ], + "title": "Active users", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "inspect": true + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 7 + }, + "id": 2, + "options": { + "footer": { + "enablePagination": true, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "9.3.6", + "targets": [ + { + "builderOptions": { + "database": "cvat", + "fields": [ + "scope as Scope" + ], + "filters": [ + { + "condition": "AND", + "filterType": "custom", + "key": "JSONHas", + "operator": "", + "type": "string", + "value": "" + }, + { + "condition": "AND", + "filterType": "custom", + "key": "$__timeFilter", + "operator": "", + "type": "datetime", + "value": "" + }, + { + "condition": "AND", + "filterType": "custom", + "key": "user_id", + "operator": "IN", + "type": "", + "value": [ + "users" + ] + }, + { + "condition": "AND", + "filterType": "custom", + "key": "1", + "operator": "IN", + "type": "", + "value": [ + "projects", + "OR", + "project_id", + "IN", + "projects" + ] + }, + { + "condition": "AND", + "filterType": "custom", + "key": "task_id", + "operator": "IN", + "type": "", + "value": [ + "tasks" + ] + }, + { + "condition": "AND", + "filterType": "custom", + "key": "job_id", + "operator": "IN", + "type": "", + "value": [ + "jobs" + ] + }, + { + "condition": "AND", + "filterType": "custom", + "key": "source", + "operator": "=", + "type": "string", + "value": [ + "client" + ] + } + ], + "groupBy": [ + "user_id", + "project_id", + "task_id", + "job_id" + ], + "limit": 100, + "metrics": [ + { + "aggregation": "min", + "alias": "working_time", + "field": "JSONExtractUInt" + }, + { + "aggregation": "count", + "alias": "Activity", + "field": "as" + } + ], + "mode": "aggregate", + "table": "events" + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 1, + "meta": { + "builderOptions": { + "database": "cvat", + "fields": [ + "scope as Scope" + ], + "filters": [ + { + "condition": "AND", + "filterType": "custom", + "key": "JSONHas", + "operator": "", + "type": "string", + "value": "" + }, + { + "condition": "AND", + "filterType": "custom", + "key": "$__timeFilter", + "operator": "", + "type": "datetime", + "value": "" + }, + { + "condition": "AND", + "filterType": "custom", + "key": "user_id", + "operator": "IN", + "type": "", + "value": [ + "users" + ] + }, + { + "condition": "AND", + "filterType": "custom", + "key": "1", + "operator": "IN", + "type": "", + "value": [ + "projects", + "OR", + "project_id", + "IN", + "projects" + ] + }, + { + "condition": "AND", + "filterType": "custom", + "key": "task_id", + "operator": "IN", + "type": "", + "value": [ + "tasks" + ] + }, + { + "condition": "AND", + "filterType": "custom", + "key": "job_id", + "operator": "IN", + "type": "", + "value": [ + "jobs" + ] + }, + { + "condition": "AND", + "filterType": "custom", + "key": "source", + "operator": "=", + "type": "string", + "value": [ + "client" + ] + } + ], + "groupBy": [ + "user_id", + "project_id", + "task_id", + "job_id" + ], + "limit": 100, + "metrics": [ + { + "aggregation": "min", + "alias": "working_time", + "field": "JSONExtractUInt" + }, + { + "aggregation": "count", + "alias": "Activity", + "field": "as" + } + ], + "mode": "aggregate", + "table": "events" + } + }, + "queryType": "sql", + "rawSql": "SELECT\r\n scope as Scope,\r\n source as Source,\r\n avg(duration) as \"Average duration (ms)\",\r\n min(duration) as \"Min duration (ms)\",\r\n max(duration) as \"Max duration (ms)\"\r\nFROM events\r\nWHERE duration > 0\r\n AND $__timeFilter(timestamp)\r\nGROUP BY scope, source", + "refId": "A" + } + ], + "title": "Duration of events", + "type": "table" + }, + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "inspect": true + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 7 + }, + "id": 4, + "options": { + "footer": { + "enablePagination": true, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "9.3.6", + "targets": [ + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 1, + "meta": { + "builderOptions": { + "fields": [], + "limit": 100, + "mode": "list" + } + }, + "queryType": "sql", + "rawSql": "SELECT\r\n scope as Scope,\r\n source as Source,\r\n count() as Count\r\nFROM events\r\nWHERE $__timeFilter(timestamp)\r\nGROUP BY scope, source", + "refId": "A" + } + ], + "title": "Number of events", + "type": "table" + }, + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 15 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "builderOptions": { + "fields": [], + "filters": [ + { + "condition": "AND", + "filterType": "custom", + "key": "scope", + "operator": "=", + "type": "String", + "value": "send:exception" + }, + { + "condition": "AND", + "filterType": "custom", + "key": "timestamp", + "operator": "WITH IN DASHBOARD TIME RANGE", + "type": "DateTime64(3, 'Etc/UTC')", + "value": "TODAY" + } + ], + "limit": 100, + "metrics": [ + { + "aggregation": "count", + "field": "*" + } + ], + "mode": "trend", + "orderBy": [], + "table": "events", + "timeField": "timestamp", + "timeFieldType": "DateTime64(3, 'Etc/UTC')" + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 0, + "meta": { + "builderOptions": { + "fields": [], + "filters": [ + { + "condition": "AND", + "filterType": "custom", + "key": "scope", + "operator": "=", + "type": "String", + "value": "send:exception" + }, + { + "condition": "AND", + "filterType": "custom", + "key": "timestamp", + "operator": "WITH IN DASHBOARD TIME RANGE", + "type": "DateTime64(3, 'Etc/UTC')", + "value": "TODAY" + } + ], + "limit": 100, + "metrics": [ + { + "aggregation": "count", + "field": "*" + } + ], + "mode": "trend", + "orderBy": [], + "table": "events", + "timeField": "timestamp", + "timeFieldType": "DateTime64(3, 'Etc/UTC')" + } + }, + "queryType": "sql", + "rawSql": "SELECT\r\n $__timeInterval(timestamp) as time,\r\n count(*)\r\nFROM events\r\nWHERE\r\n $__timeFilter(timestamp)\r\n AND ( scope = 'send:exception' )\r\n AND ( timestamp >= $__fromTime AND timestamp <= $__toTime )\r\n AND source IN (${sources})\r\n AND (-1 IN (${users}) OR user_id IN (${users}))\r\n AND (-1 IN (${organizations}) OR org_id IN (${organizations}))\r\n AND (-1 IN (${projects}) OR project_id IN (${projects}))\r\n AND (-1 IN (${tasks}) OR task_id IN (${tasks}))\r\n AND (-1 IN (${jobs}) OR job_id IN (${jobs}))\r\nGROUP BY time\r\nORDER BY time", + "refId": "A" + } + ], + "title": "Exceptions", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "filterable": true, + "inspect": true, + "minWidth": 80 + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "user_id" + }, + "properties": [ + { + "id": "custom.width", + "value": 28 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "source" + }, + "properties": [ + { + "id": "custom.width", + "value": 68 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "project_id" + }, + "properties": [ + { + "id": "custom.width", + "value": 61 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "task_id" + }, + "properties": [ + { + "id": "custom.width", + "value": 75 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "job_id" + }, + "properties": [ + { + "id": "custom.width", + "value": 55 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "user_name" + }, + "properties": [ + { + "id": "custom.width", + "value": 115 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "timestamp" + }, + "properties": [ + { + "id": "custom.width", + "value": 153 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "error" + }, + "properties": [ + { + "id": "custom.width", + "value": 452 + } + ] + } + ] + }, + "gridPos": { + "h": 17, + "w": 24, + "x": 0, + "y": 23 + }, + "id": 8, + "options": { + "footer": { + "enablePagination": true, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "9.3.6", + "targets": [ + { + "builderOptions": { + "fields": [ + "user_id", + "project_id", + "task_id", + "job_id", + "payload" + ], + "filters": [ + { + "condition": "AND", + "filterType": "custom", + "key": "timestamp", + "operator": "WITH IN DASHBOARD TIME RANGE", + "type": "DateTime64(3, 'Etc/UTC')", + "value": "TODAY" + }, + { + "condition": "AND", + "filterType": "custom", + "key": "scope", + "operator": "=", + "type": "String", + "value": "send:exception" + } + ], + "mode": "list", + "orderBy": [], + "table": "events", + "timeField": "timestamp", + "timeFieldType": "DateTime64(3, 'Etc/UTC')" + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "format": 1, + "meta": { + "builderOptions": { + "fields": [ + "user_id", + "project_id", + "task_id", + "job_id", + "payload" + ], + "filters": [ + { + "condition": "AND", + "filterType": "custom", + "key": "timestamp", + "operator": "WITH IN DASHBOARD TIME RANGE", + "type": "DateTime64(3, 'Etc/UTC')", + "value": "TODAY" + }, + { + "condition": "AND", + "filterType": "custom", + "key": "scope", + "operator": "=", + "type": "String", + "value": "send:exception" + } + ], + "mode": "list", + "orderBy": [], + "table": "events", + "timeField": "timestamp", + "timeFieldType": "DateTime64(3, 'Etc/UTC')" + } + }, + "queryType": "sql", + "rawSql": "SELECT\r\n timestamp,\r\n user_id,\r\n user_name,\r\n source,\r\n project_id,\r\n task_id,\r\n job_id,\r\n JSONExtractString(payload, 'message') as error,\r\n JSONExtractString(payload, 'stack') as stack,\r\n payload\r\nFROM events\r\nWHERE\r\n ( timestamp >= $__fromTime AND timestamp <= $__toTime )\r\n AND scope = 'send:exception'\r\n AND source IN (${sources})\r\n AND (-1 IN (${users}) OR user_id IN (${users}))\r\n AND (-1 IN (${organizations}) OR org_id IN (${organizations}))\r\n AND (-1 IN (${projects}) OR project_id IN (${projects}))\r\n AND (-1 IN (${tasks}) OR task_id IN (${tasks}))\r\n AND (-1 IN (${jobs}) OR job_id IN (${jobs}))\r\n AND ('-1' IN (${errors}) OR error IN (${errors}))\r\nORDER BY timestamp DESC\r\nLIMIT 1000", + "refId": "A" + } + ], + "title": "Exceptions table", + "type": "table" + } + ], + "refresh": "", + "schemaVersion": 37, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT source\nFROM events\nWHERE $__timeFilter(timestamp)", + "hide": 0, + "includeAll": true, + "label": "Source", + "multi": true, + "name": "sources", + "options": [], + "query": "SELECT DISTINCT source\nFROM events\nWHERE $__timeFilter(timestamp)", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": "-1", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND user_id IS NOT NULL", + "hide": 0, + "includeAll": true, + "label": "User", + "multi": true, + "name": "users", + "options": [], + "query": "SELECT DISTINCT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND user_id IS NOT NULL", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": "-1", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL", + "hide": 0, + "includeAll": true, + "label": "Project", + "multi": true, + "name": "projects", + "options": [], + "query": "SELECT DISTINCT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": "-1", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL", + "hide": 0, + "includeAll": true, + "label": "Task", + "multi": true, + "name": "tasks", + "options": [], + "query": "SELECT DISTINCT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": "-1", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL", + "hide": 0, + "includeAll": true, + "label": "Job", + "multi": true, + "name": "jobs", + "options": [], + "query": "SELECT DISTINCT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": "-1", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT DISTINCT org_id\nFROM events\nWHERE $__timeFilter(timestamp)\nAND org_id IS NOT NULL", + "hide": 0, + "includeAll": true, + "label": "Organization", + "multi": true, + "name": "organizations", + "options": [], + "query": "SELECT DISTINCT org_id\nFROM events\nWHERE $__timeFilter(timestamp)\nAND org_id IS NOT NULL", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": "'-1'", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "grafana-clickhouse-datasource", + "uid": "PDEE91DDB90597936" + }, + "definition": "SELECT\n DISTINCT JSONExtractString(payload, 'message')\n FROM cvat.events\nWHERE $__timeFilter(timestamp)\n AND JSONHas(payload, 'message')\n AND scope='send:exception'", + "hide": 0, + "includeAll": true, + "label": "Error message", + "multi": true, + "name": "errors", + "options": [], + "query": "SELECT\n DISTINCT JSONExtractString(payload, 'message')\n FROM cvat.events\nWHERE $__timeFilter(timestamp)\n AND JSONHas(payload, 'message')\n AND scope='send:exception'", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-7d", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Monitoring", + "uid": "WvDvWK04k", + "version": 3, + "weekStart": "" +} \ No newline at end of file diff --git a/charts/cvat/analytics/grafana_conf.yml b/charts/cvat/analytics/grafana_conf.yml new file mode 100644 index 0000000..f36a300 --- /dev/null +++ b/charts/cvat/analytics/grafana_conf.yml @@ -0,0 +1,39 @@ +http: + routers: + grafana: + entryPoints: + - web + middlewares: + - analytics-auth + - strip-prefix + service: grafana + rule: Host(`{{ env "CVAT_HOST" }}`) && PathPrefix(`/analytics`) + grafana_https: + entryPoints: + - websecure + middlewares: + - analytics-auth + - strip-prefix + service: grafana + tls: {} + rule: Host(`{{ env "CVAT_HOST" }}`) && PathPrefix(`/analytics`) + + middlewares: + analytics-auth: + forwardauth: + address: http://cvat_server:8080/analytics + authRequestHeaders: + - "Cookie" + - "Authorization" + + strip-prefix: + stripprefix: + prefixes: + - /analytics + + services: + grafana: + loadBalancer: + servers: + - url: http://{{ env "DJANGO_LOG_VIEWER_HOST" }}:{{ env "DJANGO_LOG_VIEWER_PORT" }} + passHostHeader: false diff --git a/charts/cvat/analytics/vector/vector.toml b/charts/cvat/analytics/vector/vector.toml new file mode 100644 index 0000000..b8f2ec2 --- /dev/null +++ b/charts/cvat/analytics/vector/vector.toml @@ -0,0 +1,43 @@ +[sources.http-events] +type = "http_server" +address = "0.0.0.0:80" +encoding = "json" + +# Uncomment for debug +# [sinks.console] +# type = "console" +# inputs = [ "http-events" ] +# target = "stdout" + +# [sinks.console.encoding] +# codec = "json" + +[sinks.clickhouse] +inputs = [ "http-events" ] +type = "clickhouse" +database = "${CLICKHOUSE_DB}" +table = "events" +auth.strategy = "basic" +auth.user = "${CLICKHOUSE_USER}" +auth.password = "${CLICKHOUSE_PASSWORD}" +endpoint = "http://${CLICKHOUSE_HOST}:${CLICKHOUSE_PORT}" +request.concurrency = "adaptive" +encoding.only_fields = [ + "scope", + "obj_name", + "obj_id", + "obj_val", + "source", + "timestamp", + "count", + "duration", + "project_id", + "task_id", + "job_id", + "user_id", + "user_name", + "user_email", + "org_id", + "org_slug", + "payload", +] diff --git a/charts/cvat/cvat.values.yaml b/charts/cvat/cvat.values.yaml new file mode 100644 index 0000000..9cb5b0d --- /dev/null +++ b/charts/cvat/cvat.values.yaml @@ -0,0 +1,8 @@ +analytics: + enabled: true + +ingress: + enabled: true + +traefik: + enabled: true diff --git a/charts/cvat/templates/_helpers.tpl b/charts/cvat/templates/_helpers.tpl new file mode 100644 index 0000000..cb3d889 --- /dev/null +++ b/charts/cvat/templates/_helpers.tpl @@ -0,0 +1,186 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "cvat.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "cvat.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "cvat.chart" -}} +{{- printf "%s" .Chart.Name | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "cvat.labels" -}} +helm.sh/chart: {{ include "cvat.chart" . }} +{{ include "cvat.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "cvat.selectorLabels" -}} +app.kubernetes.io/name: {{ include "cvat.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +The name of the service account to use for backend pods +*/}} +{{- define "cvat.backend.serviceAccountName" -}} +{{- default "default" .Values.cvat.backend.serviceAccount.name }} +{{- end }} + +{{- define "cvat.sharedBackendEnv" }} +{{- if .Values.redis.enabled }} +- name: CVAT_REDIS_INMEM_HOST + value: "{{ .Release.Name }}-redis-master" +{{- else }} +- name: CVAT_REDIS_INMEM_HOST + value: "{{ .Values.redis.external.host }}" +{{- end }} +- name: CVAT_REDIS_INMEM_PORT + value: "6379" +- name: CVAT_REDIS_INMEM_PASSWORD + valueFrom: + secretKeyRef: + name: "{{ tpl (.Values.redis.secret.name) . }}" + key: password + +{{- if .Values.cvat.kvrocks.enabled }} +- name: CVAT_REDIS_ONDISK_HOST + value: "{{ .Release.Name }}-kvrocks" +{{- else }} +- name: CVAT_REDIS_ONDISK_HOST + value: "{{ .Values.cvat.kvrocks.external.host }}" +{{- end }} +- name: CVAT_REDIS_ONDISK_PORT + value: "6666" +- name: CVAT_REDIS_ONDISK_PASSWORD + valueFrom: + secretKeyRef: + name: "{{ tpl (.Values.cvat.kvrocks.secret.name) . }}" + key: password + +{{- if .Values.postgresql.enabled }} +- name: CVAT_POSTGRES_HOST + value: "{{ .Release.Name }}-postgresql" +- name: CVAT_POSTGRES_PORT + value: "{{ .Values.postgresql.service.ports.postgresql }}" +{{- else }} +{{- if .Values.postgresql.external.host }} +- name: CVAT_POSTGRES_HOST + value: "{{ .Values.postgresql.external.host }}" +{{- end }} +{{- if .Values.postgresql.external.port }} +- name: CVAT_POSTGRES_PORT + value: "{{ .Values.postgresql.external.port }}" +{{- end}} +{{- end }} +- name: CVAT_POSTGRES_USER + valueFrom: + secretKeyRef: + name: "{{ tpl (.Values.postgresql.secret.name) . }}" + key: username +- name: CVAT_POSTGRES_DBNAME + valueFrom: + secretKeyRef: + name: "{{ tpl (.Values.postgresql.secret.name) . }}" + key: database +- name: CVAT_POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: "{{ tpl (.Values.postgresql.secret.name) . }}" + key: password + +{{- if .Values.analytics.enabled}} +- name: CVAT_ANALYTICS + value: "1" +- name: DJANGO_LOG_SERVER_HOST + value: "{{ .Release.Name }}-vector" +- name: DJANGO_LOG_SERVER_PORT + value: "80" +{{- end }} + +- name: SMOKESCREEN_OPTS + value: {{ .Values.smokescreen.opts | toJson }} +{{- if .Values.nuclio.enabled }} +- name: CVAT_SERVERLESS + value: "1" +- name: CVAT_NUCLIO_HOST + value: "{{ .Release.Name }}-nuclio-dashboard" +- name: CVAT_NUCLIO_FUNCTION_NAMESPACE + value: "{{ .Release.Namespace }}" +{{- end }} +{{- end }} + +{{- define "cvat.sharedClickhouseEnv" }} +{{- if .Values.analytics.enabled }} +- name: CLICKHOUSE_HOST + valueFrom: + secretKeyRef: + name: cvat-analytics-secret + key: CLICKHOUSE_HOST +- name: CLICKHOUSE_PORT + valueFrom: + secretKeyRef: + name: cvat-analytics-secret + key: CLICKHOUSE_PORT +- name: CLICKHOUSE_DB + valueFrom: + secretKeyRef: + name: cvat-analytics-secret + key: CLICKHOUSE_DB +- name: CLICKHOUSE_USER + valueFrom: + secretKeyRef: + name: cvat-analytics-secret + key: CLICKHOUSE_USER +- name: CLICKHOUSE_PASSWORD + valueFrom: + secretKeyRef: + name: cvat-analytics-secret + key: CLICKHOUSE_PASSWORD +{{- end }} +{{- end }} + +{{- define "cvat.backend.worker.livenessProbe" -}} +{{- if .livenessProbe.enabled }} +livenessProbe: + exec: + command: + - python + - manage.py + - workerprobe + {{- range .args }} + - {{ . }} + {{- end }} +{{ toYaml (omit .livenessProbe "enabled") | indent 2}} +{{- end }} +{{- end }} diff --git a/charts/cvat/templates/analytics/clickhouse/secret.yml b/charts/cvat/templates/analytics/clickhouse/secret.yml new file mode 100644 index 0000000..d4e189a --- /dev/null +++ b/charts/cvat/templates/analytics/clickhouse/secret.yml @@ -0,0 +1,19 @@ +{{- if .Values.analytics.enabled }} +apiVersion: v1 +# clickhouse subchart helm only allows to use Secret for this purpose +# https://github.com/bitnami/charts/tree/main/bitnami/clickhouse#using-custom-scripts +kind: Secret +metadata: + # clickhouse subchart helm doesn't allow template name + name: cvat-clickhouse-init + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: clickhouse +{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion }} +immutable: false +{{- end }} +data: +{{ (.Files.Glob "analytics/clickhouse/*.sh").AsSecrets | indent 2 }} +{{- end}} diff --git a/charts/cvat/templates/analytics/cvat-analytics-secret.yml b/charts/cvat/templates/analytics/cvat-analytics-secret.yml new file mode 100644 index 0000000..e95f7fc --- /dev/null +++ b/charts/cvat/templates/analytics/cvat-analytics-secret.yml @@ -0,0 +1,21 @@ +{{- if .Values.analytics.enabled }} +apiVersion: v1 +kind: Secret +metadata: + # vector helm doesn't allow template name of CM + name: cvat-analytics-secret + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: analytics +{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion }} +immutable: true +{{- end }} +stringData: + CLICKHOUSE_DB: {{ .Values.analytics.clickhouseDb }} + CLICKHOUSE_USER: {{ .Values.analytics.clickhouseUser }} + CLICKHOUSE_PASSWORD: {{ .Values.analytics.clickhousePassword }} + CLICKHOUSE_HOST: {{ tpl (.Values.analytics.clickhouseHost) . }} + CLICKHOUSE_PORT: {{ .Values.analytics.clickhousePort | quote }} +{{- end }} diff --git a/charts/cvat/templates/analytics/grafana/config.yml b/charts/cvat/templates/analytics/grafana/config.yml new file mode 100644 index 0000000..4d1c9d4 --- /dev/null +++ b/charts/cvat/templates/analytics/grafana/config.yml @@ -0,0 +1,17 @@ +{{- if .Values.analytics.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + # vector helm doesn't allow template name of CM + name: cvat-grafana-dashboards + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: grafana +{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion }} +immutable: false +{{- end }} +data: +{{ (.Files.Glob "analytics/grafana/dashboards/*.json").AsConfig | indent 2 }} +{{- end}} diff --git a/charts/cvat/templates/analytics/ingress.yaml b/charts/cvat/templates/analytics/ingress.yaml new file mode 100644 index 0000000..98dad20 --- /dev/null +++ b/charts/cvat/templates/analytics/ingress.yaml @@ -0,0 +1,41 @@ +{{- if and .Values.ingress.enabled .Values.analytics.enabled -}} +{{- $fullName := include "cvat.fullname" . -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullName }}-analytics + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + annotations: + {{- if .Values.traefik.enabled }} + traefik.ingress.kubernetes.io/router.middlewares: {{ $.Release.Namespace }}-stripprefix@kubernetescrd, + {{ $.Release.Namespace }}-forwardauth@kubernetescrd + {{- end }} + {{- with .Values.ingress.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className | toYaml }} +{{- else if and .Values.traefik.enabled .Values.traefik.ingressClass.enabled }} + ingressClassName: {{ .Values.traefik.ingressClass.name | default (include "traefik.fullname" .Subcharts.traefik) }} +{{- end }} + {{- if .Values.ingress.tls }} + tls: + - hosts: + - {{ .Values.ingress.hostname }} + secretName: {{ .Values.ingress.tlsSecretName }} + {{- end }} + rules: + - host: {{ .Values.ingress.hostname }} + http: + paths: + - path: /analytics + pathType: Prefix + backend: + service: + name: {{ $.Release.Name }}-grafana + port: + number: 80 +{{- end }} diff --git a/charts/cvat/templates/analytics/middlewares/forwardauth.yaml b/charts/cvat/templates/analytics/middlewares/forwardauth.yaml new file mode 100644 index 0000000..18ef722 --- /dev/null +++ b/charts/cvat/templates/analytics/middlewares/forwardauth.yaml @@ -0,0 +1,18 @@ +{{- if and .Values.traefik.enabled .Values.analytics.enabled }} + +apiVersion: traefik.containo.us/v1alpha1 +kind: Middleware +metadata: + name: forwardauth + namespace: {{ .Release.Namespace }} + annotations: + labels: + {{- include "cvat.labels" . | nindent 4 }} +spec: + forwardAuth: + address: http://{{ .Release.Name }}-backend-service:8080/analytics + authRequestHeaders: + - "Cookie" + - "Authorization" + +{{- end }} diff --git a/charts/cvat/templates/analytics/middlewares/stripprefix.yaml b/charts/cvat/templates/analytics/middlewares/stripprefix.yaml new file mode 100644 index 0000000..350d1d5 --- /dev/null +++ b/charts/cvat/templates/analytics/middlewares/stripprefix.yaml @@ -0,0 +1,15 @@ +{{- if and .Values.traefik.enabled .Values.analytics.enabled }} + +apiVersion: traefik.containo.us/v1alpha1 +kind: Middleware +metadata: + name: stripprefix + namespace: {{ .Release.Namespace }} + annotations: + labels: + {{- include "cvat.labels" . | nindent 4 }} +spec: + stripPrefix: + prefixes: + - /analytics +{{- end }} diff --git a/charts/cvat/templates/analytics/vector/config.yml b/charts/cvat/templates/analytics/vector/config.yml new file mode 100644 index 0000000..add441d --- /dev/null +++ b/charts/cvat/templates/analytics/vector/config.yml @@ -0,0 +1,17 @@ +{{- if .Values.analytics.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + # vector helm doesn't allow template name of CM + name: cvat-vector-config + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: vector +{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion }} +immutable: false +{{- end }} +data: +{{ (.Files.Glob "analytics/vector/*.toml").AsConfig | indent 2 }} +{{- end}} diff --git a/charts/cvat/templates/cvat-postgres-secret.yml b/charts/cvat/templates/cvat-postgres-secret.yml new file mode 100644 index 0000000..a44dac4 --- /dev/null +++ b/charts/cvat/templates/cvat-postgres-secret.yml @@ -0,0 +1,16 @@ +{{- if .Values.postgresql.secret.create }} +apiVersion: v1 +kind: Secret +metadata: + name: "{{ tpl (.Values.postgresql.secret.name) . }}" + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} +type: generic +stringData: + database: {{ .Values.postgresql.auth.database }} + username: {{ .Values.postgresql.auth.username }} + password: {{ .Values.postgresql.secret.password }} + postgres-password: {{ .Values.postgresql.secret.postgres_password }} + replication-password: {{ .Values.postgresql.secret.replication_password }} +{{- end }} diff --git a/charts/cvat/templates/cvat-redis-secret.yml b/charts/cvat/templates/cvat-redis-secret.yml new file mode 100644 index 0000000..6e1b5cf --- /dev/null +++ b/charts/cvat/templates/cvat-redis-secret.yml @@ -0,0 +1,12 @@ +{{- if .Values.redis.secret.create }} +apiVersion: v1 +kind: Secret +metadata: + name: "{{ tpl (.Values.redis.secret.name) . }}" + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} +type: generic +stringData: + password: {{ .Values.redis.secret.password | toString | toYaml }} +{{- end }} diff --git a/charts/cvat/templates/cvat_backend/initializer/job.yml b/charts/cvat/templates/cvat_backend/initializer/job.yml new file mode 100644 index 0000000..c1304f9 --- /dev/null +++ b/charts/cvat/templates/cvat_backend/initializer/job.yml @@ -0,0 +1,75 @@ +{{- $localValues := .Values.cvat.backend.initializer -}} + +apiVersion: batch/v1 +kind: Job +metadata: + # Jobs are mostly immutable, so Helm can't update them when the user upgrades + # a release. Work around this by including the revision in the job name, so that + # every upgrade creates a new job. + # See also . + name: {{ .Release.Name }}-backend-initializer-r{{ .Release.Revision }} + namespace: {{ .Release.Namespace }} + labels: + app: cvat-app + tier: backend + component: initializer + {{- include "cvat.labels" . | nindent 4 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + template: + metadata: + labels: + app: cvat-app + tier: backend + component: initializer + {{- include "cvat.labels" . | nindent 8 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "cvat.backend.serviceAccountName" . }} + containers: + - name: cvat-backend + image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }} + imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }} + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["init"] + env: + {{ include "cvat.sharedBackendEnv" . | indent 10 }} + {{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + volumeMounts: + {{- toYaml . | nindent 10 }} + {{- end }} + restartPolicy: OnFailure + {{- with merge $localValues.affinity .Values.cvat.backend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.tolerations $localValues.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumes $localValues.additionalVolumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_backend/server/deployment.yml b/charts/cvat/templates/cvat_backend/server/deployment.yml new file mode 100644 index 0000000..b94c6de --- /dev/null +++ b/charts/cvat/templates/cvat_backend/server/deployment.yml @@ -0,0 +1,158 @@ +{{- $localValues := .Values.cvat.backend.server -}} + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-backend-server + namespace: {{ .Release.Namespace }} + labels: + app: cvat-app + tier: backend + component: server + {{- include "cvat.labels" . | nindent 4 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ $localValues.replicas }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 6 }} + {{- end }} + app: cvat-app + tier: backend + component: server + template: + metadata: + labels: + app: cvat-app + tier: backend + component: server + {{- include "cvat.labels" . | nindent 8 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "cvat.backend.serviceAccountName" . }} + containers: + - name: cvat-backend + image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }} + imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }} + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["run", "server"] + env: + - name: ALLOWED_HOSTS + value: {{ $localValues.envs.ALLOWED_HOSTS | squote}} + {{ include "cvat.sharedBackendEnv" . | indent 10 }} + {{ include "cvat.sharedClickhouseEnv" . | indent 10 }} + {{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }} + {{- toYaml . | nindent 10 }} + {{- end }} + ports: + - containerPort: 8080 + {{- if $localValues.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /api/server/about + port: 8080 + {{- toYaml (omit $localValues.readinessProbe "enabled") | nindent 12 }} + {{- end }} + {{- if $localValues.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /api/server/about + port: 8080 + {{- toYaml (omit $localValues.livenessProbe "enabled") | nindent 12 }} + {{- end }} + volumeMounts: + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - mountPath: /home/django/data/cache + name: cvat-backend-per-service-cache + {{- end }} + - mountPath: /home/django/data + name: cvat-backend-data + subPath: data + - mountPath: /home/django/keys + name: cvat-backend-data + subPath: keys + - mountPath: /home/django/logs + name: cvat-backend-data + subPath: logs + - mountPath: /home/django/models + name: cvat-backend-data + subPath: models + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + initContainers: + {{- if .Values.cvat.backend.permissionFix.enabled }} + - name: user-data-permission-fix + image: busybox + command: ["/bin/chmod", "-R", "777", "/home/django"] + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + {{- if .Values.cvat.backend.defaultStorage.enabled }} + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - mountPath: /home/django/data/cache + name: cvat-backend-per-service-cache + {{- end }} + - mountPath: /home/django/data + name: cvat-backend-data + subPath: data + - mountPath: /home/django/keys + name: cvat-backend-data + subPath: keys + - mountPath: /home/django/logs + name: cvat-backend-data + subPath: logs + - mountPath: /home/django/models + name: cvat-backend-data + subPath: models + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} + {{- with merge $localValues.affinity .Values.cvat.backend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.tolerations $localValues.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + {{- if .Values.cvat.backend.defaultStorage.enabled }} + - name: cvat-backend-data + persistentVolumeClaim: + claimName: "{{ .Release.Name }}-backend-data" + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - name: cvat-backend-per-service-cache + emptyDir: {} + {{- end }} + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumes $localValues.additionalVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_backend/service.yml b/charts/cvat/templates/cvat_backend/service.yml new file mode 100644 index 0000000..8d6dae3 --- /dev/null +++ b/charts/cvat/templates/cvat_backend/service.yml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-backend-service + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: backend + annotations: + {{- with .Values.cvat.backend.service.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + app: cvat-app + tier: backend + component: server + {{- include "cvat.labels" . | nindent 4 }} + {{- with .Values.cvat.backend.service.spec }} + {{- toYaml . | nindent 2 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_backend/storage.yml b/charts/cvat/templates/cvat_backend/storage.yml new file mode 100644 index 0000000..2dad2ee --- /dev/null +++ b/charts/cvat/templates/cvat_backend/storage.yml @@ -0,0 +1,26 @@ +{{- if .Values.cvat.backend.defaultStorage.enabled }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-backend-data + namespace: {{ .Release.Namespace }} + annotations: + helm.sh/resource-policy: keep + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: backend +spec: + accessModes: + {{- if .Values.cvat.backend.defaultStorage.accessModes }} + {{ .Values.cvat.backend.defaultStorage.accessModes | toYaml | nindent 4 }} + {{- else }} + - ReadWriteMany + {{- end }} + {{- if .Values.cvat.backend.defaultStorage.storageClassName }} + storageClassName: {{ .Values.cvat.backend.defaultStorage.storageClassName }} + {{- end }} + resources: + requests: + storage: {{ .Values.cvat.backend.defaultStorage.size }} +{{- end }} diff --git a/charts/cvat/templates/cvat_backend/utils/deployment.yml b/charts/cvat/templates/cvat_backend/utils/deployment.yml new file mode 100644 index 0000000..434366f --- /dev/null +++ b/charts/cvat/templates/cvat_backend/utils/deployment.yml @@ -0,0 +1,142 @@ +{{- $localValues := .Values.cvat.backend.utils -}} + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-backend-utils + namespace: {{ .Release.Namespace }} + labels: + app: cvat-app + tier: backend + component: utils + {{- include "cvat.labels" . | nindent 4 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ $localValues.replicas }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 6 }} + {{- end }} + app: cvat-app + tier: backend + component: utils + template: + metadata: + labels: + app: cvat-app + tier: backend + component: utils + {{- include "cvat.labels" . | nindent 8 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "cvat.backend.serviceAccountName" . }} + containers: + - name: cvat-backend + image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }} + imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }} + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["run", "utils"] + env: + {{ include "cvat.sharedBackendEnv" . | indent 10 }} + {{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- $probeArgs := list "notifications" "cleaning" -}} + {{- $probeConfig := dict "args" $probeArgs "livenessProbe" $.Values.cvat.backend.worker.livenessProbe -}} + {{ include "cvat.backend.worker.livenessProbe" $probeConfig | indent 10 }} + volumeMounts: + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - mountPath: /home/django/data/cache + name: cvat-backend-per-service-cache + {{- end }} + - mountPath: /home/django/data + name: cvat-backend-data + subPath: data + - mountPath: /home/django/keys + name: cvat-backend-data + subPath: keys + - mountPath: /home/django/logs + name: cvat-backend-data + subPath: logs + - mountPath: /home/django/models + name: cvat-backend-data + subPath: models + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + initContainers: + {{- if .Values.cvat.backend.permissionFix.enabled }} + - name: user-data-permission-fix + image: busybox + command: ["/bin/chmod", "-R", "777", "/home/django"] + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + {{- if .Values.cvat.backend.defaultStorage.enabled }} + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - mountPath: /home/django/data/cache + name: cvat-backend-per-service-cache + {{- end }} + - mountPath: /home/django/data + name: cvat-backend-data + subPath: data + - mountPath: /home/django/keys + name: cvat-backend-data + subPath: keys + - mountPath: /home/django/logs + name: cvat-backend-data + subPath: logs + - mountPath: /home/django/models + name: cvat-backend-data + subPath: models + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} + {{- with merge $localValues.affinity .Values.cvat.backend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.tolerations $localValues.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + {{- if .Values.cvat.backend.defaultStorage.enabled }} + - name: cvat-backend-data + persistentVolumeClaim: + claimName: "{{ .Release.Name }}-backend-data" + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - name: cvat-backend-per-service-cache + emptyDir: {} + {{- end }} + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumes $localValues.additionalVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_backend/worker_analyticsreports/deployment.yml b/charts/cvat/templates/cvat_backend/worker_analyticsreports/deployment.yml new file mode 100644 index 0000000..c2f0542 --- /dev/null +++ b/charts/cvat/templates/cvat_backend/worker_analyticsreports/deployment.yml @@ -0,0 +1,86 @@ +{{- $localValues := .Values.cvat.backend.worker.analyticsreports -}} + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-backend-worker-analyticsreports + namespace: {{ .Release.Namespace }} + labels: + app: cvat-app + tier: backend + component: worker-analyticsreports + {{- include "cvat.labels" . | nindent 4 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ $localValues.replicas }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 6 }} + {{- end }} + app: cvat-app + tier: backend + component: worker-analyticsreports + template: + metadata: + labels: + app: cvat-app + tier: backend + component: worker-analyticsreports + {{- include "cvat.labels" . | nindent 8 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "cvat.backend.serviceAccountName" . }} + containers: + - name: cvat-backend + image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }} + imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }} + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["run", "worker.analytics_reports"] + env: + {{ include "cvat.sharedBackendEnv" . | indent 10 }} + {{ include "cvat.sharedClickhouseEnv" . | indent 10 }} + {{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- $probeArgs := list "analytics_reports" -}} + {{- $probeConfig := dict "args" $probeArgs "livenessProbe" $.Values.cvat.backend.worker.livenessProbe -}} + {{ include "cvat.backend.worker.livenessProbe" $probeConfig | indent 10 }} + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + volumeMounts: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- with merge $localValues.affinity .Values.cvat.backend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.tolerations $localValues.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumes $localValues.additionalVolumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_backend/worker_annotation/deployment.yml b/charts/cvat/templates/cvat_backend/worker_annotation/deployment.yml new file mode 100644 index 0000000..2ccfdfc --- /dev/null +++ b/charts/cvat/templates/cvat_backend/worker_annotation/deployment.yml @@ -0,0 +1,145 @@ +{{- $localValues := .Values.cvat.backend.worker.annotation -}} + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-backend-worker-annotation + namespace: {{ .Release.Namespace }} + labels: + app: cvat-app + tier: backend + component: worker-annotation + {{- include "cvat.labels" . | nindent 4 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ $localValues.replicas }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 6 }} + {{- end }} + app: cvat-app + tier: backend + component: worker-annotation + template: + metadata: + labels: + app: cvat-app + tier: backend + component: worker-annotation + {{- include "cvat.labels" . | nindent 8 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "cvat.backend.serviceAccountName" . }} + containers: + - name: cvat-backend + image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }} + imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }} + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["run", "worker.annotation"] + env: + {{ include "cvat.sharedBackendEnv" . | indent 10 }} + {{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- $probeArgs := list "annotation" -}} + {{- $probeConfig := dict "args" $probeArgs "livenessProbe" $.Values.cvat.backend.worker.livenessProbe -}} + {{ include "cvat.backend.worker.livenessProbe" $probeConfig | indent 10 }} + volumeMounts: + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - mountPath: /home/django/data/cache + name: cvat-backend-per-service-cache + {{- end }} + - mountPath: /home/django/data + name: cvat-backend-data + subPath: data + - mountPath: /home/django/keys + name: cvat-backend-data + subPath: keys + - mountPath: /home/django/logs + name: cvat-backend-data + subPath: logs + - mountPath: /home/django/models + name: cvat-backend-data + subPath: models + - mountPath: /home/django/tmp_storage + name: cvat-backend-data + subPath: tmp_storage + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + initContainers: + {{- if .Values.cvat.backend.permissionFix.enabled }} + - name: user-data-permission-fix + image: busybox + command: ["/bin/chmod", "-R", "777", "/home/django"] + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + {{- if .Values.cvat.backend.defaultStorage.enabled }} + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - mountPath: /home/django/data/cache + name: cvat-backend-per-service-cache + {{- end }} + - mountPath: /home/django/data + name: cvat-backend-data + subPath: data + - mountPath: /home/django/keys + name: cvat-backend-data + subPath: keys + - mountPath: /home/django/logs + name: cvat-backend-data + subPath: logs + - mountPath: /home/django/models + name: cvat-backend-data + subPath: models + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} + {{- with merge $localValues.affinity .Values.cvat.backend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.tolerations $localValues.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + {{- if .Values.cvat.backend.defaultStorage.enabled }} + - name: cvat-backend-data + persistentVolumeClaim: + claimName: "{{ .Release.Name }}-backend-data" + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - name: cvat-backend-per-service-cache + emptyDir: {} + {{- end }} + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumes $localValues.additionalVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_backend/worker_chunks/deployment.yml b/charts/cvat/templates/cvat_backend/worker_chunks/deployment.yml new file mode 100644 index 0000000..74e80b1 --- /dev/null +++ b/charts/cvat/templates/cvat_backend/worker_chunks/deployment.yml @@ -0,0 +1,96 @@ +{{- $localValues := .Values.cvat.backend.worker.chunks -}} + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-backend-worker-chunks + namespace: {{ .Release.Namespace }} + labels: + app: cvat-app + tier: backend + component: worker-chunks + {{- include "cvat.labels" . | nindent 4 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ $localValues.replicas }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 6 }} + {{- end }} + app: cvat-app + tier: backend + component: worker-chunks + template: + metadata: + labels: + app: cvat-app + tier: backend + component: worker-chunks + {{- include "cvat.labels" . | nindent 8 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "cvat.backend.serviceAccountName" . }} + containers: + - name: cvat-backend + image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }} + imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }} + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["run", "worker.chunks"] + env: + {{ include "cvat.sharedBackendEnv" . | indent 10 }} + {{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- $probeArgs := list "chunks" -}} + {{- $probeConfig := dict "args" $probeArgs "livenessProbe" $.Values.cvat.backend.worker.livenessProbe -}} + {{ include "cvat.backend.worker.livenessProbe" $probeConfig | indent 10 }} + volumeMounts: + - mountPath: /home/django/data + name: cvat-backend-data + subPath: data + - mountPath: /home/django/logs + name: cvat-backend-data + subPath: logs + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- with merge $localValues.affinity .Values.cvat.backend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.tolerations $localValues.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + {{- if .Values.cvat.backend.defaultStorage.enabled }} + - name: cvat-backend-data + persistentVolumeClaim: + claimName: "{{ .Release.Name }}-backend-data" + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumes $localValues.additionalVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_backend/worker_export/deployment.yml b/charts/cvat/templates/cvat_backend/worker_export/deployment.yml new file mode 100644 index 0000000..06211e7 --- /dev/null +++ b/charts/cvat/templates/cvat_backend/worker_export/deployment.yml @@ -0,0 +1,146 @@ +{{- $localValues := .Values.cvat.backend.worker.export -}} + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-backend-worker-export + namespace: {{ .Release.Namespace }} + labels: + app: cvat-app + tier: backend + component: worker-export + {{- include "cvat.labels" . | nindent 4 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ $localValues.replicas }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 6 }} + {{- end }} + app: cvat-app + tier: backend + component: worker-export + template: + metadata: + labels: + app: cvat-app + tier: backend + component: worker-export + {{- include "cvat.labels" . | nindent 8 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "cvat.backend.serviceAccountName" . }} + containers: + - name: cvat-backend + image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }} + imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }} + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["run", "worker.export"] + env: + {{ include "cvat.sharedBackendEnv" . | indent 10 }} + {{ include "cvat.sharedClickhouseEnv" . | indent 10 }} + {{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- $probeArgs := list "export" -}} + {{- $probeConfig := dict "args" $probeArgs "livenessProbe" $.Values.cvat.backend.worker.livenessProbe -}} + {{ include "cvat.backend.worker.livenessProbe" $probeConfig | indent 10 }} + volumeMounts: + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - mountPath: /home/django/data/cache + name: cvat-backend-per-service-cache + {{- end }} + - mountPath: /home/django/data + name: cvat-backend-data + subPath: data + - mountPath: /home/django/keys + name: cvat-backend-data + subPath: keys + - mountPath: /home/django/logs + name: cvat-backend-data + subPath: logs + - mountPath: /home/django/models + name: cvat-backend-data + subPath: models + - mountPath: /home/django/tmp_storage + name: cvat-backend-data + subPath: tmp_storage + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + initContainers: + {{- if .Values.cvat.backend.permissionFix.enabled }} + - name: user-data-permission-fix + image: busybox + command: ["/bin/chmod", "-R", "777", "/home/django"] + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + {{- if .Values.cvat.backend.defaultStorage.enabled }} + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - mountPath: /home/django/data/cache + name: cvat-backend-per-service-cache + {{- end }} + - mountPath: /home/django/data + name: cvat-backend-data + subPath: data + - mountPath: /home/django/keys + name: cvat-backend-data + subPath: keys + - mountPath: /home/django/logs + name: cvat-backend-data + subPath: logs + - mountPath: /home/django/models + name: cvat-backend-data + subPath: models + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} + {{- with merge $localValues.affinity .Values.cvat.backend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.tolerations $localValues.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + {{- if .Values.cvat.backend.defaultStorage.enabled }} + - name: cvat-backend-data + persistentVolumeClaim: + claimName: "{{ .Release.Name }}-backend-data" + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - name: cvat-backend-per-service-cache + emptyDir: {} + {{- end }} + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumes $localValues.additionalVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_backend/worker_import/deployment.yml b/charts/cvat/templates/cvat_backend/worker_import/deployment.yml new file mode 100644 index 0000000..6172e11 --- /dev/null +++ b/charts/cvat/templates/cvat_backend/worker_import/deployment.yml @@ -0,0 +1,145 @@ +{{- $localValues := .Values.cvat.backend.worker.import -}} + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-backend-worker-import + namespace: {{ .Release.Namespace }} + labels: + app: cvat-app + tier: backend + component: worker-import + {{- include "cvat.labels" . | nindent 4 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ $localValues.replicas }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 6 }} + {{- end }} + app: cvat-app + tier: backend + component: worker-import + template: + metadata: + labels: + app: cvat-app + tier: backend + component: worker-import + {{- include "cvat.labels" . | nindent 8 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "cvat.backend.serviceAccountName" . }} + containers: + - name: cvat-backend + image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }} + imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }} + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["run", "worker.import"] + env: + {{ include "cvat.sharedBackendEnv" . | indent 10 }} + {{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- $probeArgs := list "import" -}} + {{- $probeConfig := dict "args" $probeArgs "livenessProbe" $.Values.cvat.backend.worker.livenessProbe -}} + {{ include "cvat.backend.worker.livenessProbe" $probeConfig | indent 10 }} + volumeMounts: + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - mountPath: /home/django/data/cache + name: cvat-backend-per-service-cache + {{- end }} + - mountPath: /home/django/data + name: cvat-backend-data + subPath: data + - mountPath: /home/django/keys + name: cvat-backend-data + subPath: keys + - mountPath: /home/django/logs + name: cvat-backend-data + subPath: logs + - mountPath: /home/django/models + name: cvat-backend-data + subPath: models + - mountPath: /home/django/tmp_storage + name: cvat-backend-data + subPath: tmp_storage + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + initContainers: + {{- if .Values.cvat.backend.permissionFix.enabled }} + - name: user-data-permission-fix + image: busybox + command: ["/bin/chmod", "-R", "777", "/home/django"] + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + {{- if .Values.cvat.backend.defaultStorage.enabled }} + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - mountPath: /home/django/data/cache + name: cvat-backend-per-service-cache + {{- end }} + - mountPath: /home/django/data + name: cvat-backend-data + subPath: data + - mountPath: /home/django/keys + name: cvat-backend-data + subPath: keys + - mountPath: /home/django/logs + name: cvat-backend-data + subPath: logs + - mountPath: /home/django/models + name: cvat-backend-data + subPath: models + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} + {{- with merge $localValues.affinity .Values.cvat.backend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.tolerations $localValues.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + {{- if .Values.cvat.backend.defaultStorage.enabled }} + - name: cvat-backend-data + persistentVolumeClaim: + claimName: "{{ .Release.Name }}-backend-data" + {{- if not .Values.cvat.backend.disableDistinctCachePerService }} + - name: cvat-backend-per-service-cache + emptyDir: {} + {{- end }} + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumes $localValues.additionalVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_backend/worker_qualityreports/deployment.yml b/charts/cvat/templates/cvat_backend/worker_qualityreports/deployment.yml new file mode 100644 index 0000000..5c2ae12 --- /dev/null +++ b/charts/cvat/templates/cvat_backend/worker_qualityreports/deployment.yml @@ -0,0 +1,85 @@ +{{- $localValues := .Values.cvat.backend.worker.qualityreports -}} + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-backend-worker-qualityreports + namespace: {{ .Release.Namespace }} + labels: + app: cvat-app + tier: backend + component: worker-qualityreports + {{- include "cvat.labels" . | nindent 4 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ $localValues.replicas }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 6 }} + {{- end }} + app: cvat-app + tier: backend + component: worker-qualityreports + template: + metadata: + labels: + app: cvat-app + tier: backend + component: worker-qualityreports + {{- include "cvat.labels" . | nindent 8 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "cvat.backend.serviceAccountName" . }} + containers: + - name: cvat-backend + image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }} + imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }} + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["run", "worker.quality_reports"] + env: + {{ include "cvat.sharedBackendEnv" . | indent 10 }} + {{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- $probeArgs := list "quality_reports" -}} + {{- $probeConfig := dict "args" $probeArgs "livenessProbe" $.Values.cvat.backend.worker.livenessProbe -}} + {{ include "cvat.backend.worker.livenessProbe" $probeConfig | indent 10 }} + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + volumeMounts: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- with merge $localValues.affinity .Values.cvat.backend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.tolerations $localValues.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumes $localValues.additionalVolumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_backend/worker_webhooks/deployment.yml b/charts/cvat/templates/cvat_backend/worker_webhooks/deployment.yml new file mode 100644 index 0000000..46209eb --- /dev/null +++ b/charts/cvat/templates/cvat_backend/worker_webhooks/deployment.yml @@ -0,0 +1,85 @@ +{{- $localValues := .Values.cvat.backend.worker.webhooks -}} + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-backend-worker-webhooks + namespace: {{ .Release.Namespace }} + labels: + app: cvat-app + tier: backend + component: worker-webhooks + {{- include "cvat.labels" . | nindent 4 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ $localValues.replicas }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 6 }} + {{- end }} + app: cvat-app + tier: backend + component: worker-webhooks + template: + metadata: + labels: + app: cvat-app + tier: backend + component: worker-webhooks + {{- include "cvat.labels" . | nindent 8 }} + {{- with merge $localValues.labels .Values.cvat.backend.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with merge $localValues.annotations .Values.cvat.backend.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "cvat.backend.serviceAccountName" . }} + containers: + - name: cvat-backend + image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }} + imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }} + {{- with merge $localValues.resources .Values.cvat.backend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + args: ["run", "worker.webhooks"] + env: + {{ include "cvat.sharedBackendEnv" . | indent 10 }} + {{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- $probeArgs := list "webhooks" -}} + {{- $probeConfig := dict "args" $probeArgs "livenessProbe" $.Values.cvat.backend.worker.livenessProbe -}} + {{ include "cvat.backend.worker.livenessProbe" $probeConfig | indent 10 }} + {{- with concat .Values.cvat.backend.additionalVolumeMounts $localValues.additionalVolumeMounts }} + volumeMounts: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- with merge $localValues.affinity .Values.cvat.backend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.tolerations $localValues.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with concat .Values.cvat.backend.additionalVolumes $localValues.additionalVolumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_frontend/deployment.yml b/charts/cvat/templates/cvat_frontend/deployment.yml new file mode 100644 index 0000000..f0fb0df --- /dev/null +++ b/charts/cvat/templates/cvat_frontend/deployment.yml @@ -0,0 +1,78 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-frontend + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: frontend +spec: + replicas: {{ .Values.cvat.frontend.replicas }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + app: cvat-app + tier: frontend + template: + metadata: + labels: + {{- include "cvat.labels" . | nindent 8 }} + app: cvat-app + tier: frontend + {{- with .Values.cvat.frontend.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.cvat.frontend.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + containers: + - name: cvat-frontend-app-container + image: {{ .Values.cvat.frontend.image }}:{{ .Values.cvat.frontend.tag }} + imagePullPolicy: {{ .Values.cvat.frontend.imagePullPolicy }} + {{- with .Values.cvat.frontend.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - containerPort: 80 + {{- with .Values.cvat.frontend.additionalEnv }} + env: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- with .Values.cvat.frontend.additionalVolumeMounts }} + {{- if .Values.cvat.frontend.readinessProbe.enabled }} + readinessProbe: + tcpSocket: + port: 80 + {{- toYaml (omit .Values.cvat.frontend.readinessProbe "enabled") | nindent 12 }} + {{- end }} + {{- if .Values.cvat.frontend.livenessProbe.enabled }} + livenessProbe: + tcpSocket: + port: 80 + {{- toYaml (omit .Values.cvat.frontend.livenessProbe "enabled") | nindent 12 }} + {{- end }} + volumeMounts: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- with .Values.cvat.frontend.additionalVolumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.cvat.frontend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.cvat.frontend.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_frontend/service.yml b/charts/cvat/templates/cvat_frontend/service.yml new file mode 100644 index 0000000..a29c3a8 --- /dev/null +++ b/charts/cvat/templates/cvat_frontend/service.yml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-frontend-service + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: frontend + annotations: + {{- with .Values.cvat.frontend.service.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + app: cvat-app + tier: frontend + {{- include "cvat.labels" . | nindent 4 }} + {{- with .Values.cvat.frontend.service }} + {{- toYaml . | nindent 2 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_kvrocks/secret.yml b/charts/cvat/templates/cvat_kvrocks/secret.yml new file mode 100644 index 0000000..363fa3c --- /dev/null +++ b/charts/cvat/templates/cvat_kvrocks/secret.yml @@ -0,0 +1,12 @@ +{{- if and .Values.cvat.kvrocks.enabled .Values.cvat.kvrocks.secret.create }} +apiVersion: v1 +kind: Secret +metadata: + name: "{{ tpl (.Values.cvat.kvrocks.secret.name) . }}" + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} +type: generic +stringData: + password: {{ .Values.cvat.kvrocks.secret.password | toString | quote }} +{{- end }} diff --git a/charts/cvat/templates/cvat_kvrocks/service.yml b/charts/cvat/templates/cvat_kvrocks/service.yml new file mode 100644 index 0000000..0ee96dc --- /dev/null +++ b/charts/cvat/templates/cvat_kvrocks/service.yml @@ -0,0 +1,22 @@ +{{- if .Values.cvat.kvrocks.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-kvrocks + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: kvrocks +spec: + selector: + app: cvat-app + tier: kvrocks + {{- include "cvat.labels" . | nindent 4 }} + type: ClusterIP + ports: + - name: redis + port: 6666 + targetPort: kvrocks + protocol: TCP +{{- end }} diff --git a/charts/cvat/templates/cvat_kvrocks/statefulset.yml b/charts/cvat/templates/cvat_kvrocks/statefulset.yml new file mode 100644 index 0000000..f5d0075 --- /dev/null +++ b/charts/cvat/templates/cvat_kvrocks/statefulset.yml @@ -0,0 +1,126 @@ +{{- if .Values.cvat.kvrocks.enabled }} +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-kvrocks + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: kvrocks +spec: + replicas: 1 + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + app: cvat-app + tier: kvrocks + serviceName: {{ .Release.Name }}-kvrocks + template: + metadata: + labels: + {{- include "cvat.labels" . | nindent 8 }} + app: cvat-app + tier: kvrocks + {{- with .Values.cvat.kvrocks.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.cvat.kvrocks.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + containers: + - name: cvat-kvrocks-app-container + image: {{ .Values.cvat.kvrocks.image }}:{{ .Values.cvat.kvrocks.tag }} + imagePullPolicy: {{ .Values.cvat.kvrocks.imagePullPolicy }} + args: + - --dir + - /var/lib/kvrocks/data + - --requirepass + - "$(CVAT_REDIS_ONDISK_PASSWORD)" + {{- with .Values.cvat.kvrocks.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - name: kvrocks + containerPort: 6666 + env: + - name: CVAT_REDIS_ONDISK_PASSWORD + valueFrom: + secretKeyRef: + {{- if .Values.cvat.kvrocks.secret.create }} + name: "{{ tpl (.Values.cvat.kvrocks.secret.name) . }}" + {{- else }} + name: "{{ tpl (.Values.cvat.kvrocks.existingSecret) . }}" + {{- end }} + key: password + {{- with .Values.cvat.kvrocks.additionalEnv }} + {{- toYaml . | nindent 10 }} + {{- end }} + #https://github.com/apache/kvrocks/blob/unstable/Dockerfile + {{- if .Values.cvat.kvrocks.readinessProbe.enabled }} + readinessProbe: + exec: + command: + - /bin/sh + - -c + - ./bin/redis-cli -p 6666 PING | grep -E '(PONG|NOAUTH)' + {{- toYaml (omit .Values.cvat.kvrocks.readinessProbe "enabled") | nindent 12 }} + {{- end }} + {{- if .Values.cvat.kvrocks.livenessProbe.enabled }} + livenessProbe: + exec: + command: + - /bin/sh + - -c + - ./bin/redis-cli -p 6666 PING | grep -E '(PONG|NOAUTH)' + {{- toYaml (omit .Values.cvat.kvrocks.livenessProbe "enabled") | nindent 12 }} + {{- end }} + volumeMounts: + - name: {{ .Release.Name }}-kvrocks-data + mountPath: /var/lib/kvrocks/data + {{- with .Values.cvat.kvrocks.additionalVolumeMounts }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- with .Values.cvat.kvrocks.additionalVolumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.cvat.kvrocks.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.cvat.kvrocks.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.cvat.kvrocks.defaultStorage.enabled }} + volumeClaimTemplates: + - metadata: + name: {{ .Release.Name }}-kvrocks-data + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 8 }} + app: cvat-app + tier: kvroocks + spec: + accessModes: + {{- if .Values.cvat.kvrocks.defaultStorage.accessModes }} + {{ .Values.cvat.kvrocks.defaultStorage.accessModes | toYaml | nindent 6 }} + {{- else }} + - ReadWriteOnce + {{- end }} + {{- if .Values.cvat.kvrocks.defaultStorage.storageClassName }} + storageClassName: {{ .Values.cvat.kvrocks.defaultStorage.storageClassName }} + {{- end }} + resources: + requests: + storage: {{ .Values.cvat.kvrocks.defaultStorage.size }} + {{- end}} +{{- end }} diff --git a/charts/cvat/templates/cvat_opa/deployment.yml b/charts/cvat/templates/cvat_opa/deployment.yml new file mode 100644 index 0000000..32bbeb3 --- /dev/null +++ b/charts/cvat/templates/cvat_opa/deployment.yml @@ -0,0 +1,89 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-opa + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: opa +spec: + replicas: {{ .Values.cvat.opa.replicas }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cvat.labels" . | nindent 6 }} + app: cvat-app + tier: opa + template: + metadata: + labels: + {{- include "cvat.labels" . | nindent 8 }} + app: cvat-app + tier: opa + {{- with .Values.cvat.opa.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.cvat.opa.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + containers: + - name: cvat-opa-app-container + image: {{ .Values.cvat.opa.image }}:{{ .Values.cvat.opa.tag }} + imagePullPolicy: {{ .Values.cvat.opa.imagePullPolicy }} + args: + - run + - --server + - --set=decision_logs.console=true + - --set=services.cvat.url=http://{{ .Release.Name }}-backend-service:8080 + - --set=bundles.cvat.service=cvat + - --set=bundles.cvat.resource=/api/auth/rules + - --set=bundles.cvat.polling.min_delay_seconds=10 + - --set=bundles.cvat.polling.max_delay_seconds=15 + {{- with .Values.cvat.opa.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - containerPort: 8181 + {{- with .Values.cvat.opa.additionalEnv }} + env: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- if .Values.cvat.opa.readinessProbe.enabled }} + readinessProbe: + httpGet: + port: 8181 + path: "/health?bundles" + {{- toYaml (omit .Values.cvat.opa.readinessProbe "enabled") | nindent 12 }} + {{- end }} + {{- if .Values.cvat.opa.livenessProbe.enabled }} + livenessProbe: + httpGet: + port: 8181 + path: "/health?bundles" + {{- toYaml (omit .Values.cvat.opa.livenessProbe "enabled") | nindent 12 }} + {{- end }} + {{- with .Values.cvat.opa.additionalVolumeMounts }} + volumeMounts: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- with .Values.cvat.opa.additionalVolumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.cvat.opa.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.cvat.opa.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/cvat/templates/cvat_opa/service.yml b/charts/cvat/templates/cvat_opa/service.yml new file mode 100644 index 0000000..add6430 --- /dev/null +++ b/charts/cvat/templates/cvat_opa/service.yml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + {{- if .Values.cvat.opa.composeCompatibleServiceName }} + name: opa + {{- else }} + name: {{ .Release.Name }}-opa-service + {{- end }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + app: cvat-app + tier: opa +spec: + selector: + app: cvat-app + tier: opa + {{- include "cvat.labels" . | nindent 4 }} + {{- with .Values.cvat.opa.service }} + {{- toYaml . | nindent 2 }} + {{- end }} diff --git a/charts/cvat/templates/ingress.yaml b/charts/cvat/templates/ingress.yaml new file mode 100644 index 0000000..8eddd96 --- /dev/null +++ b/charts/cvat/templates/ingress.yaml @@ -0,0 +1,46 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "cvat.fullname" . -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "cvat.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className | toYaml }} +{{- else if and .Values.traefik.enabled .Values.traefik.ingressClass.enabled }} + ingressClassName: {{ .Values.traefik.ingressClass.name | default (include "traefik.fullname" .Subcharts.traefik) }} +{{- end }} + {{- if .Values.ingress.tls }} + tls: + - hosts: + - {{ .Values.ingress.hostname }} + secretName: {{ .Values.ingress.tlsSecretName }} + {{- end }} + rules: + - host: {{ .Values.ingress.hostname }} + http: + paths: + {{- range tuple "api" "admin" "static" "django-rq" "profiler" }} + - path: "/{{ . }}" + pathType: Prefix + backend: + service: + name: {{ $.Release.Name }}-backend-service + port: + number: 8080 + {{- end }} + - path: / + pathType: Prefix + backend: + service: + name: {{ .Release.Name }}-frontend-service + port: + number: 80 +{{- end }} diff --git a/charts/cvat/test.values.yaml b/charts/cvat/test.values.yaml new file mode 100644 index 0000000..350cc38 --- /dev/null +++ b/charts/cvat/test.values.yaml @@ -0,0 +1,57 @@ +cvat: + backend: + defaultStorage: + accessModes: + - ReadWriteOnce + disableDistinctCachePerService: true + server: + additionalVolumeMounts: + - mountPath: /home/django/share + name: cvat-backend-data + subPath: share + additionalEnv: + - name: DJANGO_SETTINGS_MODULE + value: cvat.settings.testing_rest + worker: + import: + replicas: 1 + additionalVolumeMounts: + - mountPath: /home/django/share + name: cvat-backend-data + subPath: share + export: + replicas: 1 + chunks: + replicas: 1 + additionalVolumeMounts: + - mountPath: /home/django/share + name: cvat-backend-data + subPath: share + utils: + additionalEnv: + - name: DJANGO_SETTINGS_MODULE + value: cvat.settings.testing_rest + annotation: + replicas: 0 + # Images are already present in the node + imagePullPolicy: Never + frontend: + imagePullPolicy: Never + +redis: + master: + # The "flushall" command, which we use in tests, is disabled in helm by default + # https://artifacthub.io/packages/helm/bitnami/redis#redis-master-configuration-parameters + disableCommands: [] + +keydb: + resources: + requests: + +traefik: + logs: + general: + level: DEBUG + access: + enabled: true + diff --git a/charts/cvat/values.yaml b/charts/cvat/values.yaml new file mode 100644 index 0000000..782840f --- /dev/null +++ b/charts/cvat/values.yaml @@ -0,0 +1,519 @@ +# Default values for cvat. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +cvat: + backend: + labels: {} + annotations: {} + resources: {} + affinity: {} + tolerations: [] + additionalEnv: [] + additionalVolumes: [] + additionalVolumeMounts: [] + # -- The service account the backend pods will use to interact with the Kubernetes API + serviceAccount: + name: default + + initializer: + labels: {} + annotations: {} + resources: {} + affinity: {} + tolerations: [] + additionalEnv: [] + additionalVolumes: [] + additionalVolumeMounts: [] + server: + replicas: 1 + labels: {} + annotations: {} + resources: {} + affinity: {} + tolerations: [] + envs: + ALLOWED_HOSTS: "*" + additionalEnv: [] + additionalVolumes: [] + additionalVolumeMounts: [] + readinessProbe: + enabled: true + periodSeconds: 15 + initialDelaySeconds: 15 + livenessProbe: + enabled: true + periodSeconds: 15 + failureThreshold: 5 + initialDelaySeconds: 60 + worker: + livenessProbe: + enabled: true + periodSeconds: 120 + initialDelaySeconds: 30 + timeoutSeconds: 10 + export: + replicas: 2 + labels: {} + annotations: {} + resources: {} + affinity: {} + tolerations: [] + additionalEnv: [] + additionalVolumes: [] + additionalVolumeMounts: [] + import: + replicas: 2 + labels: {} + annotations: {} + resources: {} + affinity: {} + tolerations: [] + additionalEnv: [] + additionalVolumes: [] + additionalVolumeMounts: [] + annotation: + replicas: 1 + labels: {} + annotations: {} + resources: {} + affinity: {} + tolerations: [] + additionalEnv: [] + additionalVolumes: [] + additionalVolumeMounts: [] + webhooks: + replicas: 1 + labels: {} + annotations: {} + resources: {} + affinity: {} + tolerations: [] + additionalEnv: [] + additionalVolumes: [] + additionalVolumeMounts: [] + qualityreports: + replicas: 1 + labels: {} + annotations: {} + resources: {} + affinity: {} + tolerations: [] + additionalEnv: [] + additionalVolumes: [] + additionalVolumeMounts: [] + analyticsreports: + replicas: 1 + labels: {} + annotations: {} + resources: {} + affinity: {} + tolerations: [] + additionalEnv: [] + additionalVolumes: [] + additionalVolumeMounts: [] + chunks: + replicas: 2 + labels: {} + annotations: {} + resources: {} + affinity: {} + tolerations: [] + additionalEnv: [] + additionalVolumes: [] + additionalVolumeMounts: [] + utils: + replicas: 1 + labels: {} + annotations: {} + resources: {} + affinity: {} + tolerations: [] + additionalEnv: [] + additionalVolumes: [] + additionalVolumeMounts: [] + replicas: 1 + image: cvat/server + tag: dev + imagePullPolicy: Always + permissionFix: + enabled: true + service: + annotations: {} + spec: + type: ClusterIP + ports: + - port: 8080 + targetPort: 8080 + protocol: TCP + name: http + defaultStorage: + enabled: true +# storageClassName: default +# accessModes: +# - ReadWriteMany + size: 20Gi + disableDistinctCachePerService: false + frontend: + replicas: 1 + image: cvat/ui + tag: dev + imagePullPolicy: Always + labels: {} + # test: test + annotations: {} + # test.io/test: test + resources: {} + affinity: {} + tolerations: [] + # nodeAffinity: + # requiredDuringSchedulingIgnoredDuringExecution: + # nodeSelectorTerms: + # - matchExpressions: + # - key: kubernetes.io/e2e-az-name + # operator: In + # values: + # - e2e-az1 + # - e2e-az2 + additionalEnv: [] + # Example: + # - name: volume-from-secret + # - name: TEST + # value: "test" + additionalVolumes: [] + # Example(assumes that pvc was already created): + # - name: tmp + # persistentVolumeClaim: + # claimName: tmp + additionalVolumeMounts: [] + # Example: + # - mountPath: /tmp + # name: tmp + # subPath: test + readinessProbe: + enabled: true + periodSeconds: 10 + failureThreshold: 5 + livenessProbe: + enabled: true + periodSeconds: 10 + failureThreshold: 5 + service: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: http + opa: + replicas: 1 + image: openpolicyagent/opa + tag: 0.63.0 + imagePullPolicy: IfNotPresent + labels: {} + # test: test + annotations: {} + # test.io/test: test + resources: {} + affinity: {} + tolerations: [] + # nodeAffinity: + # requiredDuringSchedulingIgnoredDuringExecution: + # nodeSelectorTerms: + # - matchExpressions: + # - key: kubernetes.io/e2e-az-name + # operator: In + # values: + # - e2e-az1 + # - e2e-az2 + additionalEnv: [] + # Example: + # - name: volume-from-secret + # - name: TEST + # value: "test" + additionalVolumes: [] + # Example(assumes that pvc was already created): + # - name: tmp + # persistentVolumeClaim: + # claimName: tmp + additionalVolumeMounts: [] + # Example: + # - mountPath: /tmp + # name: tmp + # subPath: test + composeCompatibleServiceName: true # Sets service name to opa in order to be compatible with Docker Compose. Necessary because changing IAM_OPA_DATA_URL via environment variables in current images. Hinders multiple deployment due to duplicate name + readinessProbe: + enabled: true + periodSeconds: 15 + initialDelaySeconds: 15 + livenessProbe: + enabled: true + periodSeconds: 15 + initialDelaySeconds: 15 + service: + type: ClusterIP + ports: + - port: 8181 + targetPort: 8181 + protocol: TCP + name: http + + kvrocks: + enabled: true + external: + host: kvrocks-external.localdomain + existingSecret: "cvat-kvrocks-secret" + secret: + create: true + name: cvat-kvrocks-secret + password: cvat_kvrocks + image: apache/kvrocks + tag: 2.7.0 + imagePullPolicy: IfNotPresent + labels: {} + # test: test + annotations: {} + # test.io/test: test + resources: {} + affinity: {} + tolerations: [] + nodeAffinity: {} + # requiredDuringSchedulingIgnoredDuringExecution: + # nodeSelectorTerms: + # - matchExpressions: + # - key: kubernetes.io/e2e-az-name + # operator: In + # values: + # - e2e-az1 + # - e2e-az2 + additionalEnv: [] + # Example: + # - name: TEST + # value: "test" + additionalVolumes: [] + # Example(assumes that pvc was already created): + # - name: tmp + # persistentVolumeClaim: + # claimName: tmp + additionalVolumeMounts: [] + # Example: + # - mountPath: /tmp + # name: tmp + # subPath: test + readinessProbe: + enabled: true + periodSeconds: 10 + initialDelaySeconds: 30 + livenessProbe: + enabled: true + periodSeconds: 10 + initialDelaySeconds: 30 + defaultStorage: + enabled: true +# storageClassName: default +# accessModes: +# - ReadWriteOnce + size: 100Gi + +postgresql: + #See https://github.com/bitnami/charts/blob/master/bitnami/postgresql/ for more info + enabled: true # false for external db + external: + # Ignored if an empty value is set + host: "" + # Ignored if an empty value is set + port: "" + # If not external following config will be applied by default + auth: + existingSecret: "{{ .Release.Name }}-postgres-secret" + username: cvat + database: cvat + service: + ports: + postgresql: 5432 + secret: + create: true + name: "{{ .Release.Name }}-postgres-secret" + password: cvat_postgresql + postgres_password: cvat_postgresql_postgres + replication_password: cvat_postgresql_replica + +# https://artifacthub.io/packages/helm/bitnami/redis +redis: + enabled: true + external: + host: 127.0.0.1 + architecture: standalone + auth: + existingSecret: "cvat-redis-secret" + existingSecretPasswordKey: password + secret: + create: true + name: cvat-redis-secret + password: cvat_redis + # TODO: persistence options + +nuclio: + enabled: false +# See https://github.com/nuclio/nuclio/blob/master/hack/k8s/helm/nuclio/values.yaml for more info +# registry: +# loginUrl: someurl +# credentials: +# username: someuser +# password: somepass + +analytics: + # Set clickhouse.enabled to false if you disable analytics or use an external database + enabled: true + clickhouseDb: cvat + clickhouseUser: user + clickhousePassword: user + clickhouseHost: "{{ .Release.Name }}-clickhouse" + clickhousePort: 8123 + +vector: + envFrom: + - secretRef: + name: cvat-analytics-secret + existingConfigMaps: + - cvat-vector-config + dataDir: "/vector-data-dir" + containerPorts: + - name: http + containerPort: 80 + protocol: TCP + service: + ports: + - name: http + port: 80 + protocol: TCP + image: + tag: "0.26.0-alpine" + +clickhouse: + # Set to false in case of external db usage + enabled: true + shards: 1 + replicaCount: 1 + extraEnvVarsSecret: cvat-analytics-secret + initdbScriptsSecret: cvat-clickhouse-init + auth: + username: user + existingSecret: cvat-analytics-secret + existingSecretKey: CLICKHOUSE_PASSWORD + # Consider enabling zookeeper if a distributed configuration is used + zookeeper: + enabled: false + +grafana: + envFromSecret: cvat-analytics-secret + datasources: + datasources.yaml: + apiVersion: 1 + datasources: + - name: 'ClickHouse' + type: 'grafana-clickhouse-datasource' + isDefault: true + jsonData: + defaultDatabase: ${CLICKHOUSE_DB} + port: ${CLICKHOUSE_PORT} + server: ${CLICKHOUSE_HOST} + username: ${CLICKHOUSE_USER} + tlsSkipVerify: false + protocol: http + secureJsonData: + password: ${CLICKHOUSE_PASSWORD} + editable: false + dashboardProviders: + dashboardproviders.yaml: + apiVersion: 1 + providers: + - name: 'default' + orgId: 1 + folder: '' + type: file + disableDeletion: false + editable: true + options: + path: /var/lib/grafana/dashboards + dashboardsConfigMaps: + default: "cvat-grafana-dashboards" + plugins: + - grafana-clickhouse-datasource + grafana.ini: + server: + root_url: https://cvat.local/analytics + dashboards: + default_home_dashboard_path: /var/lib/grafana/dashboards/default/all_events.json + users: + viewers_can_edit: true + auth: + disable_login_form: true + disable_signout_menu: true + auth.anonymous: + enabled: true + org_role: Admin + auth.basic: + enabled: false + +ingress: + ## @param ingress.enabled Enable ingress resource generation for CVAT + ## + enabled: false + ## @param ingress.hostname Host for the ingress resource + ## + hostname: cvat.local + ## @param ingress.annotations Additional annotations for the Ingress resource. + ## + ## e.g: + ## annotations: + ## kubernetes.io/ingress.class: nginx + ## + annotations: {} + ## @param ingress.className IngressClass that will be used to implement the Ingress (Kubernetes 1.18+) + ## This is supported in Kubernetes 1.18+ and required if you have more than one IngressClass marked as the default for your cluster + ## ref: https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/ + ## + className: "" + ## @param ingress.tls Enable TLS configuration for the host defined at `ingress.hostname` parameter + ## TLS certificates will be retrieved from a TLS secret defined in tlsSecretName parameter + ## + tls: false + ## @param ingress.tlsSecretName Specifies the name of the secret containing TLS certificates. Ignored if ingress.tls is false + ## + tlsSecretName: ingress-tls-cvat + +traefik: + enabled: false + logs: + general: + format: json + access: + enabled: true + format: json + fields: + general: + defaultmode: drop + names: + ClientHost: keep + DownstreamContentSize: keep + DownstreamStatus: keep + Duration: keep + RequestHost: keep + RequestMethod: keep + RequestPath: keep + RequestPort: keep + RequestProtocol: keep + RouterName: keep + StartUTC: keep + providers: + kubernetesIngress: + allowEmptyServices: true + +smokescreen: + opts: ''