Skip to content

Commit

Permalink
Merge pull request #69 from ksrt12/main
Browse files Browse the repository at this point in the history
chart: update to 0.5.0
  • Loading branch information
blind-oracle authored Mar 8, 2024
2 parents 89669e5 + f408320 commit b3a78fa
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 48 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```
2 changes: 1 addition & 1 deletion deploy/k8s/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
28 changes: 20 additions & 8 deletions deploy/k8s/chart/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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`) |
Expand Down Expand Up @@ -47,19 +47,31 @@ 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 |
| podDisruptionBudget.enabled | bool | `true` | If enabled, PodDisruptionBudget resources are created |
| 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 |
Expand All @@ -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)
24 changes: 11 additions & 13 deletions deploy/k8s/chart/templates/autoscaling.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
26 changes: 26 additions & 0 deletions deploy/k8s/chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
65 changes: 57 additions & 8 deletions deploy/k8s/chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"service": {
"type": "object",
"title": "Service",
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
Expand Down Expand Up @@ -86,6 +87,7 @@
"autoscaling": {
"type": "object",
"title": "Autoscaling",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean",
Expand All @@ -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
}
}
},
Expand Down Expand Up @@ -147,6 +149,7 @@
"type": "object",
"title": "Config",
"description": "Configuration for the cortex-tenant",
"additionalProperties": false,
"properties": {
"listen": {
"type": "string",
Expand Down Expand Up @@ -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"
}
}
}
}
}
42 changes: 35 additions & 7 deletions deploy/k8s/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: {}
Expand Down
Binary file added docs/cortex-tenant-0.5.0.tgz
Binary file not shown.
Loading

0 comments on commit b3a78fa

Please sign in to comment.