diff --git a/README.md b/README.md index f8f7dce..cc7d811 100644 --- a/README.md +++ b/README.md @@ -222,7 +222,7 @@ ADD my-config.yml /data/cortex-tenant.yml #### Using manifests -`deploy/k8s/manifests` directory contains the deployment, service and configmap manifest files for deploying this on Kubernetes. You can overwrite the default config by editing the configuration parameters in the configmap manifest. +[`deploy/k8s/manifests`](deploy/k8s/manifests) directory contains the deployment, service and configmap manifest files for deploying this on Kubernetes. You can overwrite the default config by editing the configuration parameters in the configmap manifest. ```bash kubectl apply -f deploy/k8s/manifests/cortex-tenant-deployment.yaml @@ -232,9 +232,23 @@ kubectl apply -f deploy/k8s/manifests/config-file-configmap.yml #### Using a Helm Chart -`deploy/k8s/chart` directory contains a chart for deploying this on Kubernetes. You can use `deploy/k8s/chart/testing` directory to test the deployment using helmfile. +[`deploy/k8s/chart`](deploy/k8s/chart) directory contains a chart for deploying this on Kubernetes. + +```bash +helm repo add cortex-tenant https://blind-oracle.github.io/cortex-tenant +helm install cortex-tenant cortex-tenant/cortex-tenant +``` + +You can use [`deploy/k8s/chart/testing`](deploy/k8s/chart/testing) directory to test the deployment using helmfile. ```bash helmfile -f deploy/k8s/chart/testing/helmfile.yaml template helmfile -f deploy/k8s/chart/testing/helmfile.yaml apply ``` + +#### Updating chart version + +```bash +helm package ./deploy/k8s/chart -d docs +TZ=UTC helm repo index ./docs +``` diff --git a/deploy/k8s/chart/Chart.yaml b/deploy/k8s/chart/Chart.yaml index b806040..ecd92b1 100644 --- a/deploy/k8s/chart/Chart.yaml +++ b/deploy/k8s/chart/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 description: A Helm Chart for cortex-tenant name: cortex-tenant -version: 0.4.2 # This is the chart version +version: 0.5.0 # This is the chart version appVersion: 1.13.0 # version number of the application being deployed. type: application sources: diff --git a/deploy/k8s/chart/README.md b/deploy/k8s/chart/README.md index 973e610..2176b19 100644 --- a/deploy/k8s/chart/README.md +++ b/deploy/k8s/chart/README.md @@ -1,6 +1,6 @@ # cortex-tenant -![Version: 0.4.2](https://img.shields.io/badge/Version-0.4.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.13.0](https://img.shields.io/badge/AppVersion-1.13.0-informational?style=flat-square) +![Version: 0.5.0](https://img.shields.io/badge/Version-0.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.13.0](https://img.shields.io/badge/AppVersion-1.13.0-informational?style=flat-square) A Helm Chart for cortex-tenant @@ -14,11 +14,11 @@ A Helm Chart for cortex-tenant |-----|------|---------|-------------| | affinity | object | `{}` | [Affinity and anti-affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) | | annotations | object | `{}` | Annotations for deployment | -| autoscaling.enabled | bool | `true` | If enabled, HorizontalPodAutoscaler resources are created | +| autoscaling.enabled | bool | `false` | If enabled, HorizontalPodAutoscaler resources are created | | autoscaling.maxReplica | int | `3` | Max number of pod replica autoscaled | | autoscaling.minReplica | int | `1` | Min number of pod replica autoscaled | -| autoscaling.targetCPUUtilizationPercentage | int | `50` | Target CPU utilization percentage for autoscaling | -| autoscaling.targetMemoryAverageValue | string | `"100Mi"` | Target memory average value for autoscaling | +| autoscaling.targetCPUUtilizationPercentage | int | `60` | Target CPU utilization percentage for autoscaling | +| autoscaling.targetMemoryUtilizationPercentage | int | `60` | Target memory utilization percentage for autoscaling | | config.auth.enabled | bool | `false` | Egress HTTP basic auth -> add `Authentication` header to outgoing requests | | config.auth.existingSecret | string | `nil` | Secret should pass the `CT_AUTH_EGRESS_USERNAME` and `CT_AUTH_EGRESS_PASSWORD` env variables | | config.auth.password | string | `nil` | Password (env: `CT_AUTH_EGRESS_PASSWORD`) | @@ -47,6 +47,12 @@ A Helm Chart for cortex-tenant | image.pullPolicy | string | `"IfNotPresent"` | Policy when pulling images | | image.repository | string | `"ghcr.io/blind-oracle/cortex-tenant"` | Repository to pull the image | | image.tag | string | `""` | Overrides the image tag (default is `.Chart.appVersion`) | +| livenessProbe.enabled | bool | `false` | Enable the liveness probe | +| livenessProbe.failureThreshold | int | `3` | Liveness probe failure threshold | +| livenessProbe.initialDelaySeconds | int | `5` | Initial delay seconds | +| livenessProbe.periodSeconds | int | `20` | Liveness probe period | +| livenessProbe.successThreshold | int | `1` | Liveness probe success threshold | +| livenessProbe.timeoutSeconds | int | `5` | Liveness probe timeout | | nameOverride | string | `nil` | Application name override | | nodeSelector | object | `{}` | [Node Selection](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node) | | podAnnotations | object | `{}` | Annotations for pods | @@ -54,12 +60,18 @@ 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 | +| readinessProbe.enabled | bool | `false` | Enable the readiness probe | +| readinessProbe.failureThreshold | int | `3` | Readiness probe failure threshold | +| readinessProbe.initialDelaySeconds | int | `10` | Initial delay seconds | +| readinessProbe.periodSeconds | int | `10` | Readiness probe period | +| readinessProbe.successThreshold | int | `1` | Readiness probe success threshold | +| readinessProbe.timeoutSeconds | int | `5` | Readiness probe timeout | +| replicas | int | `2` | 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) | | service.port | int | `8080` | The port on which the service listens for traffic | -| service.targetPort | int | `8080` | | +| service.targetPort | int | `8080` | The target port to which traffic is forwarded | | service.type | string | `"ClusterIP"` | The type of service | | serviceMonitor.annotations | object | `{}` | ServiceMonitor annotations | | serviceMonitor.enabled | bool | `false` | If enabled, ServiceMonitor resources for Prometheus Operator are created | @@ -73,9 +85,9 @@ A Helm Chart for cortex-tenant | serviceMonitor.scheme | string | `"http"` | ServiceMonitor will use http by default, but you can pick https as well | | serviceMonitor.scrapeTimeout | string | `nil` | ServiceMonitor scrape timeout in Go duration format (e.g. 15s) | | serviceMonitor.targetLabels | list | `[]` | ServiceMonitor will add labels from the service to the Prometheus metric https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitorspec | -| serviceMonitor.targetPort | int | `9090` | | +| serviceMonitor.targetPort | int | `9090` | ServiceMonitor targetPort | | serviceMonitor.tlsConfig | string | `nil` | ServiceMonitor will use these tlsConfig settings to make the health check requests | | tolerations | list | `[]` | [Taints and Tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0) +Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1) diff --git a/deploy/k8s/chart/templates/autoscaling.yaml b/deploy/k8s/chart/templates/autoscaling.yaml index c48de75..2a68c13 100644 --- a/deploy/k8s/chart/templates/autoscaling.yaml +++ b/deploy/k8s/chart/templates/autoscaling.yaml @@ -1,32 +1,30 @@ -{{- if .Values.autoscaling.enabled -}} +{{- with .Values.autoscaling }} +{{- if .enabled }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ include "cortex-tenant.fullname" . }} + name: {{ include "cortex-tenant.fullname" $ }} labels: - {{- include "cortex-tenant.labels" . | nindent 4 }} + {{- include "cortex-tenant.labels" $ | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "cortex-tenant.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplica }} - maxReplicas: {{ .Values.autoscaling.maxReplica }} + name: {{ include "cortex-tenant.fullname" $ }} + minReplicas: {{ .minReplica }} + maxReplicas: {{ .maxReplica }} metrics: - {{- with .Values.autoscaling.targetMemoryAverageValue }} - type: Resource resource: name: memory target: - type: AverageValue - averageValue: {{ . }} - {{- end }} - {{- with .Values.autoscaling.targetCPUUtilizationPercentage }} + type: Utilization + averageUtilization: {{ .targetMemoryUtilizationPercentage }} - type: Resource resource: name: cpu target: type: Utilization - averageUtilization: {{ . }} - {{- end }} + averageUtilization: {{ .targetCPUUtilizationPercentage }} +{{- end }} {{- end }} diff --git a/deploy/k8s/chart/templates/deployment.yaml b/deploy/k8s/chart/templates/deployment.yaml index aeec939..50f0678 100644 --- a/deploy/k8s/chart/templates/deployment.yaml +++ b/deploy/k8s/chart/templates/deployment.yaml @@ -53,6 +53,32 @@ spec: {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.livenessProbe }} + {{- if .enabled }} + livenessProbe: + httpGet: + path: /alive + port: http + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} + {{- end }} + {{- end }} + {{- with .Values.readinessProbe }} + {{- if .enabled }} + readinessProbe: + httpGet: + path: /alive + port: http + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} + {{- end }} + {{- end }} volumeMounts: - mountPath: /data/ name: config-file diff --git a/deploy/k8s/chart/values.schema.json b/deploy/k8s/chart/values.schema.json index 328a26c..100fd6e 100644 --- a/deploy/k8s/chart/values.schema.json +++ b/deploy/k8s/chart/values.schema.json @@ -52,6 +52,7 @@ "service": { "type": "object", "title": "Service", + "additionalProperties": false, "properties": { "type": { "type": "string", @@ -86,6 +87,7 @@ "autoscaling": { "type": "object", "title": "Autoscaling", + "additionalProperties": false, "properties": { "enabled": { "type": "boolean", @@ -98,23 +100,23 @@ "description": "Minimum number of replicas", "default": 1 }, - "maxReplicas": { + "maxReplica": { "type": "integer", "title": "Max replicas", "description": "Maximum number of replicas", - "default": 2 + "default": 3 }, "targetCPUUtilizationPercentage": { "type": "integer", "title": "Target CPU utilization percentage", "description": "Target CPU utilization percentage", - "default": 50 + "default": 60 }, - "targetMemoryAverageValue": { - "type": "string", - "title": "Target memory average value", - "description": "Target memory average value", - "default": "100Mi" + "targetMemoryUtilizationPercentage": { + "type": "integer", + "title": "Target memory utilization percentage", + "description": "Target memory utilization percentage", + "default": 60 } } }, @@ -147,6 +149,7 @@ "type": "object", "title": "Config", "description": "Configuration for the cortex-tenant", + "additionalProperties": false, "properties": { "listen": { "type": "string", @@ -534,6 +537,52 @@ } } } + }, + "livenessProbe": { + "$ref": "#/definitions/probe", + "title": "Liveness Probe" + }, + "readinessProbe": { + "$ref": "#/definitions/probe", + "title": "Readiness Probe" + } + }, + "definitions": { + "probe": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean", + "title": "Enabled", + "description": "Enable the probe" + }, + "initialDelaySeconds": { + "type": "integer", + "title": "Initial Delay Seconds", + "description": "Number of seconds after the container has started before liveness or readiness probes are initiated" + }, + "timeoutSeconds": { + "type": "integer", + "title": "Timeout Seconds", + "description": "Number of seconds after which the probe times out" + }, + "periodSeconds": { + "type": "integer", + "title": "Period Seconds", + "description": "How often (in seconds) to perform the probe" + }, + "successThreshold": { + "type": "integer", + "title": "Success Threshold", + "description": "Minimum consecutive successes for the probe to be considered successful after having failed" + }, + "failureThreshold": { + "type": "integer", + "title": "Failure Threshold", + "description": "Minimum consecutive failures for the probe to be considered failed after having succeeded" + } + } } } } diff --git a/deploy/k8s/chart/values.yaml b/deploy/k8s/chart/values.yaml index 9fb2524..b06e2ba 100644 --- a/deploy/k8s/chart/values.yaml +++ b/deploy/k8s/chart/values.yaml @@ -16,23 +16,23 @@ service: type: ClusterIP # -- The port on which the service listens for traffic port: 8080 - # The target port to which traffic is forwarded + # -- The target port to which traffic is forwarded targetPort: 8080 # -- Number of replicas. Ignored if `autoscaling.enabled` is true -replicas: 1 +replicas: 2 autoscaling: # -- If enabled, HorizontalPodAutoscaler resources are created - enabled: true + enabled: false # -- Min number of pod replica autoscaled minReplica: 1 # -- Max number of pod replica autoscaled maxReplica: 3 - # -- Target memory average value for autoscaling - targetMemoryAverageValue: 100Mi + # -- Target memory utilization percentage for autoscaling + targetMemoryUtilizationPercentage: 60 # -- Target CPU utilization percentage for autoscaling - targetCPUUtilizationPercentage: 50 + targetCPUUtilizationPercentage: 60 # -- Additional environment variables envs: @@ -142,6 +142,34 @@ resources: cpu: 100m memory: 128Mi +livenessProbe: + # -- Enable the liveness probe + enabled: false + # -- Initial delay seconds + initialDelaySeconds: 5 + # -- Liveness probe period + periodSeconds: 20 + # -- Liveness probe timeout + timeoutSeconds: 5 + # -- Liveness probe success threshold + successThreshold: 1 + # -- Liveness probe failure threshold + failureThreshold: 3 + +readinessProbe: + # -- Enable the readiness probe + enabled: false + # -- Initial delay seconds + initialDelaySeconds: 10 + # -- Readiness probe period + periodSeconds: 10 + # -- Readiness probe timeout + timeoutSeconds: 5 + # -- Readiness probe success threshold + successThreshold: 1 + # -- Readiness probe failure threshold + failureThreshold: 3 + podDisruptionBudget: # -- If enabled, PodDisruptionBudget resources are created enabled: true @@ -178,7 +206,7 @@ serviceMonitor: enabled: false # -- Alternative namespace for ServiceMonitor resources namespace: null - # Service targetPort + # -- ServiceMonitor targetPort targetPort: 9090 # -- Namespace selector for ServiceMonitor resources namespaceSelector: {} diff --git a/docs/cortex-tenant-0.5.0.tgz b/docs/cortex-tenant-0.5.0.tgz new file mode 100644 index 0000000..0e84989 Binary files /dev/null and b/docs/cortex-tenant-0.5.0.tgz differ diff --git a/docs/index.yaml b/docs/index.yaml index 59c444c..e52926d 100644 --- a/docs/index.yaml +++ b/docs/index.yaml @@ -3,7 +3,19 @@ entries: cortex-tenant: - apiVersion: v2 appVersion: 1.13.0 - created: "2024-01-30T14:28:03.395360787Z" + created: "2024-03-07T22:17:28.990134Z" + description: A Helm Chart for cortex-tenant + digest: f55d2d0927459b1d30aa55ac280319896daf5aa63b48cc2f4664e7649ac2c76c + name: cortex-tenant + sources: + - https://github.com/blind-oracle/cortex-tenant + type: application + urls: + - cortex-tenant-0.5.0.tgz + version: 0.5.0 + - apiVersion: v2 + appVersion: 1.13.0 + created: "2024-03-07T22:17:28.98953Z" description: A Helm Chart for cortex-tenant digest: f2b3499377fd5a34c6893e67ab79854c5c8c835b229a7cc7a67e0666cca9ab29 name: cortex-tenant @@ -15,7 +27,7 @@ entries: version: 0.4.2 - apiVersion: v2 appVersion: 1.11.0 - created: "2024-01-30T14:28:03.394653386Z" + created: "2024-03-07T22:17:28.988899Z" description: A Helm Chart for cortex-tenant digest: 60131d246dca1ead2fea8a2c188f25a5fe3c4d90368ba091a4bd0e4e8e6dcceb name: cortex-tenant @@ -27,7 +39,7 @@ entries: version: 0.4.0 - apiVersion: v2 appVersion: 1.11.0 - created: "2024-01-30T14:28:03.393982085Z" + created: "2024-03-07T22:17:28.988334Z" description: A Helm Chart for cortex-tenant digest: 56abb06ce3f646b94932d36b0d4ed5e5386ec390ebfd7d9110036291086d6f39 name: cortex-tenant @@ -37,7 +49,7 @@ entries: version: 0.3.2 - apiVersion: v2 appVersion: 1.11.0 - created: "2024-01-30T14:28:03.393404328Z" + created: "2024-03-07T22:17:28.985746Z" description: A Helm Chart for cortex-tenant digest: 834b006e449ae97219799bfa3b7bd274aa386978802dbd49279258f534cc4da5 name: cortex-tenant @@ -47,7 +59,7 @@ entries: version: 0.3.1 - apiVersion: v2 appVersion: 1.11.0 - created: "2024-01-30T14:28:03.392861087Z" + created: "2024-03-07T22:17:28.98541Z" description: A Helm Chart for cortex-tenant digest: cf12ab22dd0973e94e15d8246f66ae35738dadfc489952f919ed326a1f7eed5a name: cortex-tenant @@ -57,7 +69,7 @@ entries: version: 0.3.0 - apiVersion: v2 appVersion: 1.11.0 - created: "2024-01-30T14:28:03.392305224Z" + created: "2024-03-07T22:17:28.984841Z" description: A Helm Chart for cortex-tenant digest: c967d4dea6ff8ae827133876f588d22bfa51d10168e4bca57f161b7ab6097c7c name: cortex-tenant @@ -67,7 +79,7 @@ entries: version: 0.2.1 - apiVersion: v2 appVersion: 1.11.0 - created: "2024-01-30T14:28:03.391835068Z" + created: "2024-03-07T22:17:28.984344Z" description: A Helm Chart for cortex-tenant digest: 8b9caea0e1774a6c8f3e627a63386f532498ca5f410927c702380692e5d20b61 name: cortex-tenant @@ -77,7 +89,7 @@ entries: version: 0.2.0 - apiVersion: v2 appVersion: 1.10.1 - created: "2024-01-30T14:28:03.391370768Z" + created: "2024-03-07T22:17:28.983956Z" description: A Helm Chart for cortex-tenant digest: eabef3ad16e555543e32d9308994f76679e5fa54371cccd3957112f33a28a59e name: cortex-tenant @@ -85,4 +97,4 @@ entries: urls: - cortex-tenant-0.1.0.tgz version: 0.1.0 -generated: "2024-01-30T14:28:03.390752796Z" +generated: "2024-03-07T22:17:28.983101Z"