diff --git a/.gitignore b/.gitignore index 460c20f..2660880 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,7 @@ generate .out *.rpm *.deb -config.yaml \ No newline at end of file +config.yaml +.vscode +.idea +.DS_Store diff --git a/deploy/k8s/chart/Chart.yaml b/deploy/k8s/chart/Chart.yaml index 42ad8b5..38ac7e4 100644 --- a/deploy/k8s/chart/Chart.yaml +++ b/deploy/k8s/chart/Chart.yaml @@ -1,6 +1,8 @@ apiVersion: v2 description: A Helm Chart for cortex-tenant name: cortex-tenant -version: 0.3.2 # This is the chart version +version: 0.4.0 # This is the chart version appVersion: 1.11.0 # version number of the application being deployed. type: application +sources: + - https://github.com/blind-oracle/cortex-tenant diff --git a/deploy/k8s/chart/README.md b/deploy/k8s/chart/README.md index 872c3ce..6bcdb9d 100644 --- a/deploy/k8s/chart/README.md +++ b/deploy/k8s/chart/README.md @@ -1,9 +1,13 @@ # cortex-tenant -![Version: 0.3.2](https://img.shields.io/badge/Version-0.3.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.11.0](https://img.shields.io/badge/AppVersion-1.11.0-informational?style=flat-square) +![Version: 0.4.0](https://img.shields.io/badge/Version-0.4.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.11.0](https://img.shields.io/badge/AppVersion-1.11.0-informational?style=flat-square) A Helm Chart for cortex-tenant +## Source Code + +* + ## Values | Key | Type | Default | Description | @@ -48,6 +52,7 @@ A Helm Chart for cortex-tenant | podDisruptionBudget.minAvailable | int | `1` | Minimum number of pods that must remain scheduled | | podSecurityContext | object | `{}` | [Security Context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context) | | podTopologySpreadConstraints | list | `[]` | [Pod Topology Spread Constraints](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) | +| replicas | int | `1` | Number of replicas. Ignored if `autoscaling.enabled` is true | | resources.limits | object | `{"memory":"256Mi"}` | Resources limits | | resources.requests | object | `{"cpu":"100m","memory":"128Mi"}` | Resources requests | | securityContext | object | `{}` | [Security Context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context) | @@ -71,4 +76,4 @@ A Helm Chart for cortex-tenant | tolerations | list | `[]` | [Taints and Tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.11.2](https://github.com/norwoodj/helm-docs/releases/v1.11.2) +Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3) diff --git a/deploy/k8s/chart/templates/deployment.yaml b/deploy/k8s/chart/templates/deployment.yaml index dcf24cf..aeec939 100644 --- a/deploy/k8s/chart/templates/deployment.yaml +++ b/deploy/k8s/chart/templates/deployment.yaml @@ -9,6 +9,9 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicas }} + {{- end }} selector: matchLabels: {{- include "cortex-tenant.selectorLabels" . | nindent 6 }} diff --git a/deploy/k8s/chart/values.schema.json b/deploy/k8s/chart/values.schema.json new file mode 100644 index 0000000..9b1458d --- /dev/null +++ b/deploy/k8s/chart/values.schema.json @@ -0,0 +1,523 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "A helm chart for cortex-tenant", + "description": "Prometheus remote write proxy which marks timeseries with a Cortex/Mimir tenant ID based on labels.", + "type": "object", + "required": [ + "config" + ], + "properties": { + "nameOverride": { + "type": [ + "string", + "null" + ], + "title": "Name override", + "description": "Overrides the chart name" + }, + "fullnameOverride": { + "type": [ + "string", + "null" + ], + "title": "Fullname override", + "description": "Overrides the fullname of the chart" + }, + "image": { + "type": "object", + "title": "Image", + "properties": { + "repository": { + "type": "string", + "title": "Repository", + "description": "Image repository" + }, + "pullPolicy": { + "type": "string", + "title": "Pull policy", + "description": "Image pull policy", + "enum": [ + "Always", + "Never", + "IfNotPresent" + ] + }, + "tag": { + "type": "string", + "title": "Tag", + "description": "Image tag" + } + } + }, + "service": { + "type": "object", + "title": "Service", + "properties": { + "type": { + "type": "string", + "title": "Type", + "description": "Service type", + "enum": [ + "ClusterIP", + "NodePort", + "LoadBalancer" + ] + }, + "port": { + "type": "integer", + "title": "Port", + "description": "Service port", + "default": 8080 + }, + "targetPort": { + "type": "integer", + "title": "Target port", + "description": "Service target port", + "default": 8080 + } + } + }, + "replicas": { + "type": "integer", + "title": "Replicas", + "description": "Number of replicas", + "default": 1 + }, + "autoscaling": { + "type": "object", + "title": "Autoscaling", + "properties": { + "enabled": { + "type": "boolean", + "title": "Enabled", + "description": "Enable autoscaling" + }, + "minReplica": { + "type": "integer", + "title": "Min replicas", + "description": "Minimum number of replicas", + "default": 1 + }, + "maxReplicas": { + "type": "integer", + "title": "Max replicas", + "description": "Maximum number of replicas", + "default": 2 + }, + "targetCPUUtilizationPercentage": { + "type": "integer", + "title": "Target CPU utilization percentage", + "description": "Target CPU utilization percentage", + "default": 50 + }, + "targetMemoryAverageValue": { + "type": "string", + "title": "Target memory average value", + "description": "Target memory average value", + "default": "100Mi" + } + } + }, + "envs": { + "type": "array", + "title": "Envs", + "description": "Environment variables", + "items": { + "type": "object", + "title": "Env", + "properties": { + "name": { + "type": "string", + "title": "Name", + "description": "Environment variable name" + }, + "value": { + "type": [ + "string", + "integer", + "boolean" + ], + "title": "Value", + "description": "Environment variable value" + } + } + } + }, + "config": { + "type": "object", + "title": "Config", + "description": "Configuration for the cortex-tenant", + "properties": { + "listen": { + "type": "string", + "title": "Listen", + "description": "Where to listen for incoming write requests from Prometheus" + }, + "listen_pprof": { + "type": "string", + "title": "Listen Profiling API", + "description": "Profiling API, leave empty to disable" + }, + "target": { + "type": "string", + "title": "Target URL", + "description": "Where to send the modified requests (Cortex)", + "format": "uri" + }, + "enable_ipv6": { + "type": "boolean", + "title": "Enable IPv6", + "description": "Whether to enable querying for IPv6 records" + }, + "log_level": { + "type": "string", + "title": "Log level", + "enum": [ + "debug", + "info", + "warn", + "error" + ], + "default": "warn" + }, + "timeout": { + "type": "string", + "title": "Timeout", + "description": "HTTP request timeout", + "format": "duration" + }, + "timeout_shutdown": { + "type": "string", + "title": "Shutdown timeout", + "description": "Timeout to wait on shutdown to allow load balancers detect that we're going away", + "format": "duration" + }, + "concurrency": { + "type": "integer", + "title": "Concurrency", + "description": "Max number of parallel incoming HTTP requests to handle", + "default": 1000 + }, + "metadata": { + "type": "boolean", + "title": "Metadata", + "description": "Whether to forward metrics metadata from Prometheus to Cortex" + }, + "log_response_errors": { + "type": "boolean", + "title": "Log response errors", + "description": "If true response codes from metrics backend will be logged to stdout" + }, + "max_connection_duration": { + "type": "string", + "title": "Max Connection Duration", + "description": "Maximum duration to keep outgoing connections alive (to Cortex/Mimir)", + "format": "duration" + }, + "auth": { + "type": "object", + "title": "Authentication", + "properties": { + "enabled": { + "type": "boolean", + "title": "Enabled", + "description": "Egress HTTP basic auth -> add `Authentication` header to outgoing requests", + "default": false + }, + "username": { + "type": [ + "string", + "null" + ], + "title": "Username", + "description": "Username" + }, + "password": { + "type": [ + "string", + "null" + ], + "title": "Password", + "description": "Password" + }, + "existingSecret": { + "type": [ + "string", + "null" + ], + "title": "Existing Secret", + "description": "Secret should pass the `CT_AUTH_EGRESS_USERNAME` and `CT_AUTH_EGRESS_PASSWORD` env variables" + } + } + }, + "tenant": { + "type": "object", + "title": "Tenant configuration", + "properties": { + "label": { + "type": "string", + "title": "Label", + "description": "Which label to look for the tenant information", + "default": "tenant" + }, + "prefix": { + "type": "string", + "title": "Prefix", + "description": "Optional hard-coded prefix with delimeter for all tenant values" + }, + "label_remove": { + "type": "boolean", + "title": "Label Remove", + "description": "Whether to remove the tenant label from the request", + "default": false + }, + "header": { + "type": "string", + "title": "Header", + "description": "To which header to add the tenant ID", + "default": "X-Scope-OrgID" + }, + "default": { + "type": "string", + "title": "Default", + "description": "Which tenant ID to use if the label is missing in any of the timeseries", + "default": "cortex-tenant-default" + }, + "accept_all": { + "type": "boolean", + "title": "Accept All", + "description": "Enable if you want all metrics from Prometheus to be accepted with a 204 HTTP code", + "default": false + } + } + } + } + }, + "resources": { + "type": "object", + "title": "Resources", + "description": "Resource limits and requests", + "properties": { + "limits": { + "type": "object", + "title": "Limits", + "description": "Resource limits", + "properties": { + "memory": { + "type": [ + "string", + "integer", + "null" + ], + "title": "Memory", + "description": "Maximum memory limit" + }, + "cpu": { + "type": [ + "string", + "integer", + "null" + ], + "title": "CPU", + "description": "Maximum CPU limit" + } + } + }, + "requests": { + "type": "object", + "title": "Requests", + "description": "Resource requests", + "properties": { + "cpu": { + "type": [ + "string", + "integer", + "null" + ], + "title": "CPU", + "description": "CPU request" + }, + "memory": { + "type": [ + "string", + "integer", + "null" + ], + "title": "Memory", + "description": "Memory request" + } + } + } + } + }, + "podDisruptionBudget": { + "type": "object", + "title": "Pod Disruption Budget", + "properties": { + "enabled": { + "type": "boolean", + "title": "Enabled", + "description": "Whether pod disruption budget is enabled" + }, + "minAvailable": { + "type": [ + "integer", + "string" + ], + "title": "Minimum Available", + "description": "Minimum number of available pods during disruption. Also may be a percentage" + }, + "maxUnavailable": { + "type": [ + "integer", + "string" + ], + "title": "Maximum Unavailable", + "description": "Maximum number of unavailable pods during disruption. Also may be a percentage" + } + } + }, + "annotations": { + "type": "object", + "title": "Annotations", + "description": "Annotations for the deployment" + }, + "podAnnotations": { + "type": "object", + "title": "Pod Annotations", + "description": "Annotations for the pods" + }, + "podSecurityContext": { + "type": "object", + "title": "Pod Security Context", + "description": "Security context for the pods" + }, + "securityContext": { + "type": "object", + "title": "Security Context", + "description": "Security context" + }, + "nodeSelector": { + "type": "object", + "title": "Node Selector" + }, + "tolerations": { + "type": "array", + "title": "Tolerations" + }, + "affinity": { + "type": "object", + "title": "Affinity" + }, + "podTopologySpreadConstraints": { + "type": "array", + "title": "Pod Topology Spread Constraints" + }, + "serviceMonitor": { + "type": "object", + "title": "Service Monitor", + "description": "Service monitor", + "properties": { + "enabled": { + "type": "boolean", + "title": "Enabled", + "description": "Whether service monitor is enabled", + "default": false + }, + "namespace": { + "type": [ + "string", + "null" + ], + "title": "Namespace", + "description": "Alternative namespace for ServiceMonitor resources" + }, + "targetPort": { + "type": "integer", + "title": "Target Port", + "description": "Service targetPort", + "default": 9090 + }, + "namespaceSelector": { + "type": "object", + "title": "Namespace Selector", + "description": "Namespace selector for ServiceMonitor resources" + }, + "annotations": { + "type": "object", + "title": "Annotations", + "description": "Annotations for the service monitor" + }, + "labels": { + "type": "object", + "title": "Labels", + "description": "Additional ServiceMonitor labels" + }, + "interval": { + "type": [ + "string", + "null" + ], + "title": "Interval", + "description": "ServiceMonitor scrape interval", + "format": "duration" + }, + "scrapeTimeout": { + "type": [ + "string", + "null" + ], + "title": "Scrape Timeout", + "description": "ServiceMonitor scrape timeout in Go duration format (e.g. 15s)", + "format": "duration" + }, + "relabelings": { + "type": "array", + "title": "Relabelings", + "description": "ServiceMonitor relabel configs to apply to samples before scraping" + }, + "metricRelabelings": { + "type": "array", + "title": "Metric Relabelings", + "description": "ServiceMonitor relabel configs to apply to samples as the last" + }, + "targetLabels": { + "type": "array", + "title": "Target Labels", + "description": "ServiceMonitor will add labels from the service to the Prometheus metric" + }, + "scheme": { + "type": "string", + "title": "Scheme", + "description": "ServiceMonitor will use http by default, but you can pick https as well", + "default": "http" + }, + "tlsConfig": { + "type": [ + "object", + "null" + ], + "title": "TLS Config" + }, + "prometheusRule": { + "type": "object", + "title": "Prometheus Rule", + "properties": { + "enabled": { + "type": "boolean", + "title": "Enabled" + }, + "additionalLabels": { + "type": "object", + "title": "Additional Labels" + }, + "rules": { + "type": "array", + "title": "Rules" + } + } + } + } + } + } +} diff --git a/deploy/k8s/chart/values.yaml b/deploy/k8s/chart/values.yaml index e6d61b4..3a9326a 100644 --- a/deploy/k8s/chart/values.yaml +++ b/deploy/k8s/chart/values.yaml @@ -19,6 +19,9 @@ service: # The target port to which traffic is forwarded targetPort: 8080 +# -- Number of replicas. Ignored if `autoscaling.enabled` is true +replicas: 1 + autoscaling: # -- If enabled, HorizontalPodAutoscaler resources are created enabled: true @@ -186,7 +189,7 @@ serviceMonitor: # https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#relabelconfig # (defines `metric_relabel_configs`) metricRelabelings: [] - # --ServiceMonitor will add labels from the service to the Prometheus metric + # -- ServiceMonitor will add labels from the service to the Prometheus metric # https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitorspec targetLabels: [] # -- ServiceMonitor will use http by default, but you can pick https as well diff --git a/docs/cortex-tenant-0.4.0.tgz b/docs/cortex-tenant-0.4.0.tgz new file mode 100644 index 0000000..1ff85ad Binary files /dev/null and b/docs/cortex-tenant-0.4.0.tgz differ diff --git a/docs/index.yaml b/docs/index.yaml index 4c3d72d..684f032 100644 --- a/docs/index.yaml +++ b/docs/index.yaml @@ -3,7 +3,19 @@ entries: cortex-tenant: - apiVersion: v2 appVersion: 1.11.0 - created: "2023-08-24T12:48:05.911353+02:00" + created: "2023-11-15T23:28:52.818836+03:00" + description: A Helm Chart for cortex-tenant + digest: 60131d246dca1ead2fea8a2c188f25a5fe3c4d90368ba091a4bd0e4e8e6dcceb + name: cortex-tenant + sources: + - https://github.com/blind-oracle/cortex-tenant + type: application + urls: + - cortex-tenant-0.4.0.tgz + version: 0.4.0 + - apiVersion: v2 + appVersion: 1.11.0 + created: "2023-11-15T23:28:52.817654+03:00" description: A Helm Chart for cortex-tenant digest: 56abb06ce3f646b94932d36b0d4ed5e5386ec390ebfd7d9110036291086d6f39 name: cortex-tenant @@ -61,4 +73,4 @@ entries: urls: - cortex-tenant-0.1.0.tgz version: 0.1.0 -generated: "2023-08-24T12:48:05.899646+02:00" +generated: "2023-11-15T23:28:52.81508+03:00"