├── .github ├── pull_request_template.md ├── stale.yml └── workflows │ ├── lint-test.yml │ └── renovate-config-validator.yml ├── .gitignore ├── .helmignore ├── .prettierignore ├── CHANGELOG.md ├── Chart.lock ├── Chart.yaml ├── LICENSE ├── MAINTAINERS.md ├── Makefile ├── README.md ├── README.md.gotmpl ├── ci ├── test-configmap-values.yaml ├── test-deployment-values.yaml └── test-sts-values.yaml ├── ct.yaml ├── docs ├── .gitignore ├── 404.html ├── Gemfile ├── Gemfile.lock ├── _config.yml ├── _layouts │ ├── home.html │ └── page.html ├── cortex-0.2.0.tgz ├── cortex-0.3.0.tgz ├── cortex-0.4.0.tgz ├── cortex-0.4.1.tgz ├── cortex-0.5.0.tgz ├── cortex-0.6.0.tgz ├── cortex-0.7.0.tgz ├── cortex-1.0.0.tgz ├── cortex-1.0.1.tgz ├── cortex-1.1.0.tgz ├── cortex-1.2.0.tgz ├── cortex-1.3.0.tgz ├── cortex-1.4.0.tgz ├── cortex-1.5.0.tgz ├── cortex-1.5.1.tgz ├── cortex-1.6.0.tgz ├── cortex-1.7.0.tgz ├── cortex-2.0.0.tgz ├── cortex-2.0.1.tgz ├── cortex-2.1.0.tgz ├── cortex-2.2.0.tgz ├── cortex-2.3.0.tgz ├── cortex-2.4.0.tgz ├── cortex-2.5.0.tgz ├── cortex-2.6.0.tgz ├── development.md ├── development │ └── developing_the_docs.md ├── favicon.ico ├── guides.md ├── guides │ ├── configure_configmap.markdown │ ├── configure_memberlist.markdown │ ├── configure_memcached.markdown │ ├── configure_ruler_and_alertmanager_with_configmap.markdown │ ├── configure_rules_via_configmap.markdown │ ├── configure_rules_via_sidecar.markdown │ ├── getting_started_with_block_storage.markdown │ └── upgrade-v1.markdown ├── index.markdown └── index.yaml ├── renovate.json ├── templates ├── NOTES.txt ├── _helpers.tpl ├── alertmanager │ ├── _helpers-alertmanager.tpl │ ├── alertmanager-dep.yaml │ ├── alertmanager-poddisruptionbudget.yaml │ ├── alertmanager-servicemonitor.yaml │ ├── alertmanager-statefulset.yaml │ ├── alertmanager-svc-headless.yaml │ └── alertmanager-svc.yaml ├── clusterrole.yaml ├── clusterrolebinding.yaml ├── compactor │ ├── _helpers-compactor.tpl │ ├── compactor-poddisruptionbudget.yaml │ ├── compactor-servicemonitor.yaml │ ├── compactor-statefulset.yaml │ └── compactor-svc.yaml ├── configmap.yaml ├── distributor │ ├── _helpers-distributor.tpl │ ├── distributor-dep.yaml │ ├── distributor-hpa.yaml │ ├── distributor-poddisruptionbudget.yaml │ ├── distributor-servicemonitor.yaml │ ├── distributor-svc-headless.yaml │ └── distributor-svc.yaml ├── ingester │ ├── _helpers-ingester.tpl │ ├── ingester-dep.yaml │ ├── ingester-hpa.yaml │ ├── ingester-poddisruptionbudget.yaml │ ├── ingester-servicemonitor.yaml │ ├── ingester-statefulset.yaml │ ├── ingester-svc-headless.yaml │ └── ingester-svc.yaml ├── nginx │ ├── _helpers-nginx.tpl │ ├── nginx-config.yaml │ ├── nginx-dep.yaml │ ├── nginx-hpa.yaml │ ├── nginx-ingress.yaml │ ├── nginx-poddisruptionbudget.yaml │ └── nginx-svc.yaml ├── overrides-exporter │ ├── _helpers-overrides-exporter.tpl │ ├── overrides-exporter-dep.yaml │ ├── overrides-exporter-servicemonitor.yaml │ └── overrides-exporter-svc.yaml ├── purger │ ├── _helpers-purger.tpl │ ├── purger-dep.yaml │ ├── purger-servicemonitor.yaml │ ├── purger-svc-headless.yaml │ └── purger-svc.yaml ├── querier │ ├── _helpers-querier.tpl │ ├── querier-dep.yaml │ ├── querier-hpa.yaml │ ├── querier-poddisruptionbudget.yaml │ ├── querier-servicemonitor.yaml │ └── querier-svc.yaml ├── query-frontend │ ├── _helpers-query-frontend.tpl │ ├── query-frontend-dep.yaml │ ├── query-frontend-servicemonitor.yaml │ ├── query-frontend-svc-headless.yaml │ ├── query-frontend-svc.yaml │ └── query-poddisruptionbudget.yaml ├── query-scheduler │ ├── _helpers-query-scheduler.tpl │ ├── query-scheduler-dep.yaml │ ├── query-scheduler-poddisruptionbudget.yaml │ ├── query-scheduler-servicemonitor.yaml │ ├── query-scheduler-svc-headless.yaml │ └── query-scheduler-svc.yaml ├── ruler │ ├── _helpers-ruler.tpl │ ├── ruler-configmap.yaml │ ├── ruler-dep.yaml │ ├── ruler-hpa.yaml │ ├── ruler-poddisruptionbudget.yaml │ ├── ruler-servicemonitor.yaml │ └── ruler-svc.yaml ├── runtime-configmap.yaml ├── secret.yaml ├── serviceaccount.yaml ├── store-gateway │ ├── _helpers-store-gateway.tpl │ ├── store-gateway-hpa.yaml │ ├── store-gateway-poddisruptionbudget.yaml │ ├── store-gateway-servicemonitor.yaml │ ├── store-gateway-statefulset.yaml │ ├── store-gateway-svc-headless.yaml │ └── store-gateway-svc.yaml └── svc-memberlist-headless.yaml ├── tools └── chart-version-tag.sh └── values.yaml /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 7 | 8 | **What this PR does**: 9 | 10 | **Which issue(s) this PR fixes**: 11 | Fixes # 12 | 13 | **Checklist** 14 | - [ ] `CHANGELOG.md` updated - the order of entries should be `[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`, `[DEPENDENCY]` 15 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Days without any activity until an issue is labeled as stale 2 | daysUntilStale: 60 3 | 4 | # Days after having the stale label that the issue will be closed 5 | daysUntilClose: 30 6 | 7 | # Labels that prevent issues from being marked as stale 8 | exemptLabels: 9 | - dependencies 10 | - keepalive 11 | - bug 12 | - help wanted 13 | 14 | # Label to use to identify a stale issue 15 | staleLabel: stale 16 | 17 | # Comment to post when marking an issue as stale. Leave as false 18 | # to disable. 19 | markComment: > 20 | This issue has been automatically marked as stale because it has not had any 21 | activity in the past 60 days. It will be closed in 30 days if no further 22 | activity occurs. Thank you for your contributions. 23 | 24 | # Comment to post when closing a stale issue. Leave as 25 | # false to disable. 26 | closeComment: false -------------------------------------------------------------------------------- /.github/workflows/lint-test.yml: -------------------------------------------------------------------------------- 1 | name: Lint and Test Charts 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | lint-test: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v4 12 | with: 13 | fetch-depth: 0 14 | 15 | - name: Set up Helm 16 | uses: azure/setup-helm@v4 17 | with: 18 | version: v3.12.1 19 | 20 | # Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and 21 | # yamllint (https://github.com/adrienverge/yamllint) which require Python 22 | - uses: actions/setup-python@v5 23 | with: 24 | python-version: '3.13' 25 | check-latest: true 26 | 27 | - name: Set up chart-testing 28 | uses: helm/chart-testing-action@v2.7.0 29 | 30 | - name: Run chart-testing (lint) 31 | run: ct lint --config ct.yaml 32 | 33 | - name: Updated README.md 34 | run: | 35 | make README.md 36 | git diff --exit-code -- README.md 37 | 38 | - name: Create kind cluster 39 | uses: helm/kind-action@v1.12.0 40 | 41 | - name: Run chart-testing (install) 42 | run: | 43 | kubectl create namespace cortex 44 | ct install --config ct.yaml --namespace cortex 45 | -------------------------------------------------------------------------------- /.github/workflows/renovate-config-validator.yml: -------------------------------------------------------------------------------- 1 | name: Validate renovate config 2 | 3 | on: 4 | push: 5 | paths: 6 | - renovate.json 7 | 8 | jobs: 9 | validate: 10 | name: validate 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v4 15 | - name: Validate 16 | uses: rinchsan/renovate-config-validator@v0.2.0 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | charts 2 | ./*.tgz 3 | cortex -------------------------------------------------------------------------------- /.helmignore: -------------------------------------------------------------------------------- 1 | # Git 2 | .git/ 3 | .gitignore 4 | .github/ 5 | 6 | # IDE 7 | .project 8 | .idea/ 9 | *.tmproj 10 | 11 | # Common backup files 12 | *.swp 13 | *.bak 14 | *.tmp 15 | *~ 16 | 17 | # Cortex ignore 18 | docs/ 19 | tools/ 20 | ct.yaml 21 | ci/ 22 | README.md.gotmpl 23 | .prettierignore 24 | CHANGELOG.md 25 | MAINTAINERS.md 26 | LICENSE 27 | Makefile 28 | renovate.json 29 | 30 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | *.yaml -------------------------------------------------------------------------------- /Chart.lock: -------------------------------------------------------------------------------- 1 | dependencies: 2 | - name: memcached 3 | repository: https://charts.bitnami.com/bitnami 4 | version: 6.14.0 5 | - name: memcached 6 | repository: https://charts.bitnami.com/bitnami 7 | version: 6.14.0 8 | - name: memcached 9 | repository: https://charts.bitnami.com/bitnami 10 | version: 6.14.0 11 | - name: memcached 12 | repository: https://charts.bitnami.com/bitnami 13 | version: 6.14.0 14 | digest: sha256:53271a70f0777e768309ece8663bc07002374ec7873b8dfb0b212d2813a4d12f 15 | generated: "2025-04-17T16:15:50.77219916Z" 16 | -------------------------------------------------------------------------------- /Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | version: 2.6.0 3 | appVersion: v1.19.0 4 | description: 'Horizontally scalable, highly available, multi-tenant, long term Prometheus.' 5 | home: https://cortexmetrics.io/ 6 | icon: https://avatars2.githubusercontent.com/u/43045022?s=200&v=4 7 | kubeVersion: ^1.19.0-0 8 | maintainers: 9 | - email: thayward@infoblox.com 10 | name: Tom Hayward 11 | url: https://github.com/kd7lxl 12 | - email: niclas.schad@stackit.cloud 13 | name: Niclas Schad 14 | url: https://github.com/nschad 15 | name: cortex 16 | sources: 17 | - https://github.com/cortexproject/cortex-helm-chart 18 | dependencies: 19 | - name: memcached 20 | alias: memcached-frontend 21 | version: 6.14.0 22 | repository: https://charts.bitnami.com/bitnami 23 | condition: memcached-frontend.enabled 24 | - name: memcached 25 | alias: memcached-blocks-index 26 | version: 6.14.0 27 | repository: https://charts.bitnami.com/bitnami 28 | condition: memcached-blocks-index.enabled 29 | - name: memcached 30 | alias: memcached-blocks 31 | version: 6.14.0 32 | repository: https://charts.bitnami.com/bitnami 33 | condition: memcached-blocks.enabled 34 | - name: memcached 35 | alias: memcached-blocks-metadata 36 | version: 6.14.0 37 | repository: https://charts.bitnami.com/bitnami 38 | condition: memcached-blocks-metadata.enabled 39 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | - Niclas Schad, STACKIT ([@nschad](https://github.com/nschad)) 2 | - Tom Hayward, Infoblox ([@kd7lxl](https://github.com/kd7lxl)) 3 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: README.md 2 | README.md: 3 | docker run --rm --volume "$(shell pwd):/helm-docs" -u $(shell id -u) jnorwood/helm-docs:v1.11.0 4 | -------------------------------------------------------------------------------- /README.md.gotmpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ template "chart.header" . }} 4 | {{ template "chart.deprecationWarning" . }} 5 | 6 | {{ template "chart.badgesSection" . }} 7 | 8 | {{ template "chart.description" . }} 9 | 10 | {{ template "chart.homepageLine" . }} 11 | 12 | {{ template "chart.maintainersSection" . }} 13 | 14 | ## Documentation 15 | 16 | Checkout our documentation for the cortex-helm-chart [here](https://cortexproject.github.io/cortex-helm-chart/) 17 | 18 | ## Dependencies 19 | 20 | ### Key-Value store 21 | 22 | Cortex requires a Key-Value (KV) store to store the ring. It can use traditional KV stores like [Consul](https://www.consul.io/) or [etcd](https://etcd.io/), but it can also build its own KV store on top of memberlist library using a gossip algorithm. 23 | 24 | The recommended approach is to use the built-in memberlist as a KV store, where supported. 25 | 26 | External KV stores can be installed alongside Cortex using their respective helm charts https://github.com/bitnami/charts/tree/master/bitnami/etcd and https://github.com/hashicorp/consul-k8s/tree/main/charts/consul. 27 | 28 | ### Storage 29 | 30 | Cortex requires a storage backend to store metrics and indexes. 31 | See [cortex documentation](https://cortexmetrics.io/docs/) for details on storage types and documentation 32 | 33 | ## Installation 34 | 35 | [Helm](https://helm.sh) must be installed to use the charts. 36 | Please refer to Helm's [documentation](https://helm.sh/docs/) to get started. 37 | 38 | Once Helm is set up properly, add the repo as follows: 39 | 40 | ```bash 41 | helm repo add cortex-helm https://cortexproject.github.io/cortex-helm-chart 42 | ``` 43 | 44 | Cortex can now be installed with the following command: 45 | 46 | ```bash 47 | helm install cortex --namespace cortex cortex-helm/cortex 48 | ``` 49 | 50 | If you have custom options or values you want to override: 51 | 52 | ```bash 53 | helm install cortex --namespace cortex -f my-cortex-values.yaml cortex-helm/cortex 54 | ``` 55 | 56 | Specific versions of the chart can be installed using the `--version` option, with the default being the latest release. 57 | What versions are available for installation can be listed with the following command: 58 | 59 | ```bash 60 | helm search repo cortex-helm 61 | ``` 62 | 63 | As part of this chart many different pods and services are installed which all 64 | have varying resource requirements. Please make sure that you have sufficient 65 | resources (CPU/memory) available in your cluster before installing Cortex Helm 66 | chart. 67 | 68 | 69 | ## Upgrades 70 | 71 | To upgrade Cortex use the following command: 72 | 73 | ```bash 74 | helm upgrade cortex -f my-cortex-values.yaml cortex-helm/cortex 75 | ``` 76 | Note that it might be necessary to use `--reset-values` since some default values in the values.yaml might have changed or were removed. 77 | 78 | Source code can be found [here](https://cortexmetrics.io/) 79 | 80 | {{ template "chart.requirementsSection" . }} 81 | 82 | 83 | {{ define "chart.valuesTable" }} 84 | | Key | Type | Default | Description | 85 | |-----|------|---------|-------------| 86 | {{- range .Values }} 87 | | {{ .Key | replace "." ".​" }} | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} | 88 | {{- end }} 89 | {{ end }} 90 | 91 | {{ template "chart.valuesSection" . }} 92 | -------------------------------------------------------------------------------- /ci/test-configmap-values.yaml: -------------------------------------------------------------------------------- 1 | ingress: 2 | enabled: true 3 | 4 | useConfigMap: true 5 | 6 | config: 7 | ingester: 8 | lifecycler: 9 | join_after: 30s 10 | final_sleep: 30s 11 | tokens_file_path: "/data/tokens" 12 | ring: 13 | replication_factor: 1 14 | kvstore: 15 | store: "memberlist" 16 | 17 | blocks_storage: 18 | backend: "filesystem" 19 | tsdb: 20 | dir: "/data/tsdb" 21 | bucket_store: 22 | sync_dir: "/data/tsdb-sync" 23 | filesystem: 24 | dir: "/data/store" 25 | 26 | distributor: 27 | ring: 28 | kvstore: 29 | store: memberlist 30 | 31 | ruler: 32 | ring: 33 | kvstore: 34 | store: memberlist 35 | 36 | ruler_storage: 37 | backend: "filesystem" 38 | filesystem: 39 | dir: "/data/store" 40 | 41 | alertmanager_storage: 42 | backend: "filesystem" 43 | filesystem: 44 | dir: "/data/store" 45 | 46 | memberlist: 47 | join_members: 48 | - '{{ include "cortex.fullname" $ }}-memberlist' 49 | 50 | ingester: 51 | replicas: 1 52 | autoscaling: 53 | enabled: true 54 | minReplicas: 1 55 | statefulSet: 56 | enabled: false 57 | extraVolumes: 58 | - name: tmp-test 59 | emptyDir: {} 60 | extraVolumeMounts: 61 | - name: tmp-test 62 | mountPath: /tmp-test 63 | compactor: 64 | replicas: 1 65 | extraVolumes: 66 | - name: tmp-test 67 | emptyDir: {} 68 | extraVolumeMounts: 69 | - name: tmp-test 70 | mountPath: /tmp-test 71 | distributor: 72 | replicas: 1 73 | autoscaling: 74 | enabled: true 75 | minReplicas: 1 76 | extraVolumes: 77 | - name: tmp-test 78 | emptyDir: {} 79 | extraVolumeMounts: 80 | - name: tmp-test 81 | mountPath: /tmp-test 82 | querier: 83 | replicas: 1 84 | autoscaling: 85 | enabled: true 86 | extraVolumes: 87 | - name: tmp-test 88 | emptyDir: {} 89 | extraVolumeMounts: 90 | - name: tmp-test 91 | mountPath: /tmp-test 92 | query_frontend: 93 | replicas: 1 94 | extraVolumes: 95 | - name: tmp-test 96 | emptyDir: {} 97 | extraVolumeMounts: 98 | - name: tmp-test 99 | mountPath: /tmp-test 100 | nginx: 101 | replicas: 1 102 | autoscaling: 103 | enabled: true 104 | extraVolumes: 105 | - name: tmp-test 106 | emptyDir: {} 107 | extraVolumeMounts: 108 | - name: tmp-test 109 | mountPath: /tmp-test 110 | config: 111 | httpSnippet: |- 112 | # http snippet 113 | mainSnippet: |- 114 | # main snippet 115 | serverSnippet: |- 116 | # server snippet 117 | runtimeconfigmap: 118 | annotations: 119 | foo: bar 120 | alertmanager: 121 | replicas: 1 122 | statefulSet: 123 | enabled: false 124 | extraVolumes: 125 | - name: tmp-test 126 | emptyDir: {} 127 | extraVolumeMounts: 128 | - name: tmp-test 129 | mountPath: /tmp-test 130 | ruler: 131 | replicas: 1 132 | enabled: true 133 | extraVolumes: 134 | - name: tmp-test 135 | emptyDir: {} 136 | extraVolumeMounts: 137 | - name: tmp-test 138 | mountPath: /tmp-test 139 | store_gateway: 140 | replicas: 1 141 | extraVolumes: 142 | - name: tmp-test 143 | emptyDir: {} 144 | extraVolumeMounts: 145 | - name: tmp-test 146 | mountPath: /tmp-test 147 | 148 | memcached-frontend: 149 | enabled: true 150 | architecture: standalone 151 | replicaCount: 1 152 | resources: 153 | requests: 154 | cpu: 0 155 | memory: 0 156 | memcached-blocks: 157 | enabled: true 158 | architecture: standalone 159 | replicaCount: 1 160 | resources: 161 | requests: 162 | cpu: 0 163 | memory: 0 164 | memcached-blocks-index: 165 | enabled: true 166 | architecture: standalone 167 | replicaCount: 1 168 | resources: 169 | requests: 170 | cpu: 0 171 | memory: 0 172 | memcached-blocks-metadata: 173 | enabled: true 174 | architecture: standalone 175 | replicaCount: 1 176 | resources: 177 | requests: 178 | cpu: 0 179 | memory: 0 180 | -------------------------------------------------------------------------------- /ci/test-deployment-values.yaml: -------------------------------------------------------------------------------- 1 | ingress: 2 | enabled: true 3 | 4 | config: 5 | ingester: 6 | lifecycler: 7 | join_after: 30s 8 | final_sleep: 30s 9 | tokens_file_path: "/data/tokens" 10 | ring: 11 | replication_factor: 1 12 | kvstore: 13 | store: "memberlist" 14 | 15 | blocks_storage: 16 | backend: "filesystem" 17 | tsdb: 18 | dir: "/data/tsdb" 19 | bucket_store: 20 | sync_dir: "/data/tsdb-sync" 21 | filesystem: 22 | dir: "/data/store" 23 | 24 | distributor: 25 | ring: 26 | kvstore: 27 | store: memberlist 28 | 29 | ruler: 30 | ring: 31 | kvstore: 32 | store: memberlist 33 | 34 | ruler_storage: 35 | backend: "filesystem" 36 | filesystem: 37 | dir: "/data/store" 38 | 39 | alertmanager_storage: 40 | backend: "filesystem" 41 | filesystem: 42 | dir: "/data/store" 43 | 44 | memberlist: 45 | join_members: 46 | - '{{ include "cortex.fullname" $ }}-memberlist' 47 | 48 | ingester: 49 | replicas: 1 50 | autoscaling: 51 | enabled: true 52 | minReplicas: 1 53 | statefulSet: 54 | enabled: false 55 | extraVolumes: 56 | - name: tmp-test 57 | emptyDir: {} 58 | extraVolumeMounts: 59 | - name: tmp-test 60 | mountPath: /tmp-test 61 | compactor: 62 | replicas: 1 63 | extraVolumes: 64 | - name: tmp-test 65 | emptyDir: {} 66 | extraVolumeMounts: 67 | - name: tmp-test 68 | mountPath: /tmp-test 69 | distributor: 70 | replicas: 1 71 | autoscaling: 72 | enabled: true 73 | minReplicas: 1 74 | extraVolumes: 75 | - name: tmp-test 76 | emptyDir: {} 77 | extraVolumeMounts: 78 | - name: tmp-test 79 | mountPath: /tmp-test 80 | querier: 81 | replicas: 1 82 | autoscaling: 83 | enabled: true 84 | extraVolumes: 85 | - name: tmp-test 86 | emptyDir: {} 87 | extraVolumeMounts: 88 | - name: tmp-test 89 | mountPath: /tmp-test 90 | query_frontend: 91 | replicas: 1 92 | extraVolumes: 93 | - name: tmp-test 94 | emptyDir: {} 95 | extraVolumeMounts: 96 | - name: tmp-test 97 | mountPath: /tmp-test 98 | query_scheduler: 99 | replicas: 1 100 | enabled: true 101 | extraVolumes: 102 | - name: tmp-test 103 | emptyDir: {} 104 | extraVolumeMounts: 105 | - name: tmp-test 106 | mountPath: /tmp-test 107 | nginx: 108 | replicas: 1 109 | autoscaling: 110 | enabled: true 111 | extraVolumes: 112 | - name: tmp-test 113 | emptyDir: {} 114 | extraVolumeMounts: 115 | - name: tmp-test 116 | mountPath: /tmp-test 117 | config: 118 | httpSnippet: |- 119 | # http snippet 120 | mainSnippet: |- 121 | # main snippet 122 | serverSnippet: |- 123 | # server snippet 124 | runtimeconfigmap: 125 | annotations: 126 | foo: bar 127 | alertmanager: 128 | replicas: 3 129 | statefulSet: 130 | enabled: false 131 | extraVolumes: 132 | - name: tmp-test 133 | emptyDir: {} 134 | extraVolumeMounts: 135 | - name: tmp-test 136 | mountPath: /tmp-test 137 | ruler: 138 | replicas: 1 139 | enabled: true 140 | extraVolumes: 141 | - name: tmp-test 142 | emptyDir: {} 143 | extraVolumeMounts: 144 | - name: tmp-test 145 | mountPath: /tmp-test 146 | store_gateway: 147 | replicas: 1 148 | extraVolumes: 149 | - name: tmp-test 150 | emptyDir: {} 151 | extraVolumeMounts: 152 | - name: tmp-test 153 | mountPath: /tmp-test 154 | 155 | memcached-frontend: 156 | enabled: true 157 | architecture: standalone 158 | replicaCount: 1 159 | resources: 160 | requests: 161 | cpu: 0 162 | memory: 0 163 | memcached-blocks: 164 | enabled: true 165 | architecture: standalone 166 | replicaCount: 1 167 | resources: 168 | requests: 169 | cpu: 0 170 | memory: 0 171 | memcached-blocks-index: 172 | enabled: true 173 | architecture: standalone 174 | replicaCount: 1 175 | resources: 176 | requests: 177 | cpu: 0 178 | memory: 0 179 | memcached-blocks-metadata: 180 | enabled: true 181 | architecture: standalone 182 | replicaCount: 1 183 | resources: 184 | requests: 185 | cpu: 0 186 | memory: 0 187 | -------------------------------------------------------------------------------- /ci/test-sts-values.yaml: -------------------------------------------------------------------------------- 1 | ingress: 2 | enabled: true 3 | 4 | config: 5 | ingester: 6 | lifecycler: 7 | join_after: 30s 8 | final_sleep: 30s 9 | tokens_file_path: "/data/tokens" 10 | ring: 11 | replication_factor: 1 12 | kvstore: 13 | store: "memberlist" 14 | 15 | blocks_storage: 16 | backend: "filesystem" 17 | tsdb: 18 | dir: "/data/tsdb" 19 | bucket_store: 20 | sync_dir: "/data/tsdb-sync" 21 | filesystem: 22 | dir: "/data/store" 23 | 24 | distributor: 25 | ring: 26 | kvstore: 27 | store: memberlist 28 | 29 | ruler: 30 | ring: 31 | kvstore: 32 | store: memberlist 33 | 34 | ruler_storage: 35 | backend: "filesystem" 36 | filesystem: 37 | dir: "/data/store" 38 | 39 | alertmanager_storage: 40 | backend: "filesystem" 41 | filesystem: 42 | dir: "/data/store" 43 | 44 | memberlist: 45 | join_members: 46 | - '{{ include "cortex.fullname" $ }}-memberlist' 47 | 48 | ingester: 49 | replicas: 1 50 | autoscaling: 51 | enabled: true 52 | minReplicas: 1 53 | statefulSet: 54 | enabled: true 55 | extraVolumes: 56 | - name: tmp-test 57 | emptyDir: {} 58 | extraVolumeMounts: 59 | - name: tmp-test 60 | mountPath: /tmp-test 61 | compactor: 62 | replicas: 1 63 | extraVolumes: 64 | - name: tmp-test 65 | emptyDir: {} 66 | extraVolumeMounts: 67 | - name: tmp-test 68 | mountPath: /tmp-test 69 | distributor: 70 | replicas: 1 71 | autoscaling: 72 | enabled: true 73 | minReplicas: 1 74 | extraVolumes: 75 | - name: tmp-test 76 | emptyDir: {} 77 | extraVolumeMounts: 78 | - name: tmp-test 79 | mountPath: /tmp-test 80 | querier: 81 | replicas: 1 82 | autoscaling: 83 | enabled: true 84 | extraVolumes: 85 | - name: tmp-test 86 | emptyDir: {} 87 | extraVolumeMounts: 88 | - name: tmp-test 89 | mountPath: /tmp-test 90 | query_frontend: 91 | replicas: 1 92 | extraVolumes: 93 | - name: tmp-test 94 | emptyDir: {} 95 | extraVolumeMounts: 96 | - name: tmp-test 97 | mountPath: /tmp-test 98 | nginx: 99 | replicas: 1 100 | autoscaling: 101 | enabled: true 102 | extraVolumes: 103 | - name: tmp-test 104 | emptyDir: {} 105 | extraVolumeMounts: 106 | - name: tmp-test 107 | mountPath: /tmp-test 108 | config: 109 | httpSnippet: |- 110 | # http snippet 111 | mainSnippet: |- 112 | # main snippet 113 | serverSnippet: |- 114 | # server snippet 115 | runtimeconfigmap: 116 | annotations: 117 | foo: bar 118 | alertmanager: 119 | replicas: 3 120 | statefulSet: 121 | enabled: true 122 | extraVolumes: 123 | - name: tmp-test 124 | emptyDir: {} 125 | extraVolumeMounts: 126 | - name: tmp-test 127 | mountPath: /tmp-test 128 | ruler: 129 | replicas: 1 130 | enabled: true 131 | extraVolumes: 132 | - name: tmp-test 133 | emptyDir: {} 134 | extraVolumeMounts: 135 | - name: tmp-test 136 | mountPath: /tmp-test 137 | store_gateway: 138 | replicas: 1 139 | extraVolumes: 140 | - name: tmp-test 141 | emptyDir: {} 142 | extraVolumeMounts: 143 | - name: tmp-test 144 | mountPath: /tmp-test 145 | 146 | memcached-frontend: 147 | enabled: true 148 | architecture: standalone 149 | replicaCount: 1 150 | resources: 151 | requests: 152 | cpu: 0 153 | memory: 0 154 | memcached-blocks: 155 | enabled: true 156 | architecture: standalone 157 | replicaCount: 1 158 | resources: 159 | requests: 160 | cpu: 0 161 | memory: 0 162 | memcached-blocks-index: 163 | enabled: true 164 | architecture: standalone 165 | replicaCount: 1 166 | resources: 167 | requests: 168 | cpu: 0 169 | memory: 0 170 | memcached-blocks-metadata: 171 | enabled: true 172 | architecture: standalone 173 | replicaCount: 1 174 | resources: 175 | requests: 176 | cpu: 0 177 | memory: 0 178 | -------------------------------------------------------------------------------- /ct.yaml: -------------------------------------------------------------------------------- 1 | # See https://github.com/helm/chart-testing#configuration 2 | remote: origin 3 | validate-maintainers: false # ct requires the maintainers to be a github name, which is not valid for this chart. 4 | charts: 5 | - "./" 6 | chart-repos: 7 | - base-charts=https://charts.helm.sh/stable 8 | - bitnami=https://charts.bitnami.com/bitnami 9 | helm-extra-args: --timeout 600s 10 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | .sass-cache 3 | .jekyll-cache 4 | .jekyll-metadata 5 | vendor 6 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | --- 2 | permalink: /404.html 3 | layout: default 4 | --- 5 | 6 | 19 | 20 |
21 |

404

22 | 23 |

Page not found :(

24 |

The requested page could not be found.

25 |
26 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | # Hello! This is where you manage which Jekyll version is used to run. 3 | # When you want to use a different version, change it below, save the 4 | # file and run `bundle install`. Run Jekyll with `bundle exec`, like so: 5 | # 6 | # bundle exec jekyll serve 7 | # 8 | # This will help ensure the proper Jekyll version is running. 9 | # Happy Jekylling! 10 | # gem "jekyll", "~> 4.2.0" 11 | # This is the default theme for new Jekyll sites. You may change this to anything you like. 12 | gem "minima", "~> 2.5" 13 | # If you want to use GitHub Pages, remove the "gem "jekyll"" above and 14 | # uncomment the line below. To upgrade, run `bundle update github-pages`. 15 | gem "github-pages","~> 228", group: :jekyll_plugins 16 | gem "just-the-docs" 17 | # If you have any plugins, put them here! 18 | group :jekyll_plugins do 19 | gem "jekyll-feed", "~> 0.12" 20 | end 21 | 22 | # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem 23 | # and associated library. 24 | platforms :mingw, :x64_mingw, :mswin, :jruby do 25 | gem "tzinfo", "~> 2.0" 26 | gem "tzinfo-data" 27 | end 28 | 29 | # Performance-booster for watching directories on Windows 30 | gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] 31 | 32 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | title: cortex-helm-chart 2 | email: cortex-team@googlegroups.com 3 | description: >- 4 | Cortex is a horizontally scalable, highly available, multi-tenant, long term Prometheus. 5 | The cortex-helm-chart helps the operator with deploying cortex on a Kubernetes cluster. 6 | twitter_username: CortexMetrics 7 | github_username: cortexproject 8 | 9 | # Build settings 10 | remote_theme: pmarsceill/just-the-docs 11 | # color_scheme: "dark" 12 | 13 | footer_content: "Copyright © 2022 cortexproject. Distributed by an Apache License 2.0." 14 | -------------------------------------------------------------------------------- /docs/_layouts/home.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | {{ content }} -------------------------------------------------------------------------------- /docs/_layouts/page.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | {{ content }} -------------------------------------------------------------------------------- /docs/cortex-0.2.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-0.2.0.tgz -------------------------------------------------------------------------------- /docs/cortex-0.3.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-0.3.0.tgz -------------------------------------------------------------------------------- /docs/cortex-0.4.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-0.4.0.tgz -------------------------------------------------------------------------------- /docs/cortex-0.4.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-0.4.1.tgz -------------------------------------------------------------------------------- /docs/cortex-0.5.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-0.5.0.tgz -------------------------------------------------------------------------------- /docs/cortex-0.6.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-0.6.0.tgz -------------------------------------------------------------------------------- /docs/cortex-0.7.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-0.7.0.tgz -------------------------------------------------------------------------------- /docs/cortex-1.0.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-1.0.0.tgz -------------------------------------------------------------------------------- /docs/cortex-1.0.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-1.0.1.tgz -------------------------------------------------------------------------------- /docs/cortex-1.1.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-1.1.0.tgz -------------------------------------------------------------------------------- /docs/cortex-1.2.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-1.2.0.tgz -------------------------------------------------------------------------------- /docs/cortex-1.3.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-1.3.0.tgz -------------------------------------------------------------------------------- /docs/cortex-1.4.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-1.4.0.tgz -------------------------------------------------------------------------------- /docs/cortex-1.5.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-1.5.0.tgz -------------------------------------------------------------------------------- /docs/cortex-1.5.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-1.5.1.tgz -------------------------------------------------------------------------------- /docs/cortex-1.6.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-1.6.0.tgz -------------------------------------------------------------------------------- /docs/cortex-1.7.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-1.7.0.tgz -------------------------------------------------------------------------------- /docs/cortex-2.0.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-2.0.0.tgz -------------------------------------------------------------------------------- /docs/cortex-2.0.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-2.0.1.tgz -------------------------------------------------------------------------------- /docs/cortex-2.1.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-2.1.0.tgz -------------------------------------------------------------------------------- /docs/cortex-2.2.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-2.2.0.tgz -------------------------------------------------------------------------------- /docs/cortex-2.3.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-2.3.0.tgz -------------------------------------------------------------------------------- /docs/cortex-2.4.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-2.4.0.tgz -------------------------------------------------------------------------------- /docs/cortex-2.5.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-2.5.0.tgz -------------------------------------------------------------------------------- /docs/cortex-2.6.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/cortex-2.6.0.tgz -------------------------------------------------------------------------------- /docs/development.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Development 4 | nav_order: 3 5 | has_children: true 6 | permalink: /docs/development 7 | --- 8 | # Development 9 | {: .no_toc } 10 | 11 | Tutorials on how to develop the chart locally 12 | {: .fs-6 .fw-300 } -------------------------------------------------------------------------------- /docs/development/developing_the_docs.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Working with the cortex-helm-chart docs 4 | parent: Development 5 | has_children: false 6 | has_toc: false 7 | --- 8 | # Working with the cortex-helm-chart docs 9 | {: .no_toc } 10 | 11 | ## Table of contents 12 | {: .no_toc .text-delta } 13 | 14 | 1. TOC 15 | {:toc} 16 | 17 | --- 18 | # Setup 19 | 20 | The cortex-helm-chart docs uses [jekyll](https://jekyllrb.com/) with the [just-the-docs](https://github.com/pmarsceill/just-the-docs) theme. Unfortunately due to security concerns GitHub doesn't let us preview from pull requests or different branches. However GitHub created [this](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll) guide on how to test your changes locally. 21 | 22 | # Preview 23 | 24 | After installing ruby and bundle. Simply change into the `/docs` folder of the cortex-helm-chart and run: 25 | 26 | ``` 27 | bundle exec jekyll serve --incremental --livereload 28 | ``` 29 | 30 | For further options you can consult `bundle exec jekyll serve --help` -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cortexproject/cortex-helm-chart/f98b14d0076bdd02a023ca75fcb7e2498aad1c06/docs/favicon.ico -------------------------------------------------------------------------------- /docs/guides.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Guides 4 | nav_order: 2 5 | has_children: true 6 | has_toc: true 7 | permalink: /docs/guides 8 | --- 9 | # Guides 10 | {: .no_toc } 11 | 12 | Guides & Best-Practices on how to configure the cortex-helm-chart. 13 | {: .fs-6 .fw-300 } -------------------------------------------------------------------------------- /docs/guides/configure_configmap.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Configuring Cortex with configmap 4 | parent: Guides 5 | has_children: false 6 | has_toc: false 7 | --- 8 | # Configuring Cortex with configmap 9 | {: .no_toc } 10 | 11 | ## Table of contents 12 | {: .no_toc .text-delta } 13 | 14 | 1. TOC 15 | {:toc} 16 | 17 | --- 18 | # Configuring Cortex with configmap 19 | 20 | By default, cortex configuration is managed using a `Secret`. To use a `ConfigMap` instead, set **useConfigMap**: 21 | 22 | {% raw %} 23 | ```yaml 24 | useConfigMap: true 25 | ``` 26 | {% endraw %} 27 | 28 | Note: if **useConfigMap** is enabled, sensitive values should be stored in separate secrets, then referenced in the config [using environment variables](https://cortexmetrics.io/docs/configuration/configuration-file/#use-environment-variables-in-the-configuration). Use `extraVolumes`, `extraVolumeMounts`, `extraEnvs`, and `extraArgs` to add environment variables from secrets. 29 | -------------------------------------------------------------------------------- /docs/guides/configure_memberlist.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Configure memberlist 4 | parent: Guides 5 | has_children: false 6 | has_toc: false 7 | --- 8 | # Configure memberlist 9 | {: .no_toc } 10 | 11 | ## Table of contents 12 | {: .no_toc .text-delta } 13 | 14 | 1. TOC 15 | {:toc} 16 | 17 | --- 18 | # Setup 19 | 20 | The cortex-helm-chart recommends using memberlist as the kvstore (not available yet for the ha-tracker kvstore). Cortex components deployed with the cortex-helm-chart will automatically join the gossip ring. More Information on why memberlist might be a good idea can be found [here](https://grafana.com/blog/2020/03/25/how-were-using-gossip-to-improve-cortex-and-loki-availability/) 21 | 22 | For example: 23 | 24 | ```yaml 25 | [...] 26 | kvstore: 27 | store: "memberlist" 28 | ``` 29 | -------------------------------------------------------------------------------- /docs/guides/configure_memcached.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Configure memcached 4 | parent: Guides 5 | has_children: false 6 | has_toc: false 7 | --- 8 | # Configuring memcached as the caching store 9 | {: .no_toc } 10 | 11 | ## Table of contents 12 | {: .no_toc .text-delta } 13 | 14 | 1. TOC 15 | {:toc} 16 | 17 | --- 18 | # Configuring memcached as the caching store 19 | 20 | Correctly configuring memcached for your needs is a very delicate task. But courtesy of [@thobianchi](https://github.com/thobianchi) this might be a good start. 21 | 22 | {% raw %} 23 | ```yaml 24 | index_cache: 25 | backend: memcached 26 | memcached: 27 | addresses: 'dns+{{ include "cortex.fullname" $ }}-memcached-blocks-index:11211' 28 | timeout: 300ms 29 | max_idle_connections: 750 30 | max_async_concurrency: 100 31 | max_async_buffer_size: 10000000 32 | max_get_multi_concurrency: 750 33 | max_get_multi_batch_size: 1000 34 | max_item_size: 16777216 35 | chunks_cache: 36 | backend: memcached 37 | memcached: 38 | addresses: 'dns+{{ include "cortex.fullname" $ }}-memcached-blocks:11211' 39 | timeout: 300ms 40 | max_idle_connections: 750 41 | max_async_concurrency: 100 42 | max_async_buffer_size: 10000000 43 | max_get_multi_concurrency: 750 44 | max_get_multi_batch_size: 1000 45 | max_item_size: 33554432 46 | metadata_cache: 47 | backend: memcached 48 | memcached: 49 | addresses: 'dns+{{ include "cortex.fullname" $ }}-blocks-metadata:11211' 50 | timeout: 300ms 51 | max_idle_connections: 750 52 | max_async_concurrency: 100 53 | max_async_buffer_size: 10000000 54 | max_get_multi_concurrency: 750 55 | max_get_multi_batch_size: 1000 56 | max_item_size: 16777216 57 | ``` 58 | {% endraw %} 59 | -------------------------------------------------------------------------------- /docs/guides/configure_ruler_and_alertmanager_with_configmap.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Configure Ruler and Alertmanager with configmap 4 | parent: Guides 5 | has_children: false 6 | has_toc: false 7 | --- 8 | # Configure Ruler and Alertmanager with configmap 9 | {: .no_toc } 10 | 11 | ## Table of contents 12 | {: .no_toc .text-delta } 13 | 14 | 1. TOC 15 | {:toc} 16 | 17 | --- 18 | # Preface 19 | 20 | Cortex's Ruler and Alertmanager can be setup to use ConfigMaps to provide themselves with a configuration that can be dynamically updated. 21 | We simply put ConfigMaps into the same namespace where cortex is running, and they are automatically detected and mounted as files to the Ruler and/or AlertManager containers. 22 | The containers are also constantly polling for changes to the ConfigMaps. If any changes are found, the configuration file on the container will be updated. 23 | 24 | It should be noted that this guide is assuming that multi-tenancy is enabled : 25 | ```yaml 26 | auth_enabled: true 27 | ``` 28 | # Setup 29 | 30 | In order to get this working, we must do a couple things. 31 | 32 | ## Create Ruler ConfigMap 33 | 34 | To provide the Ruler with the *rules* to alert on, we must create a ConfigMap with the desired ruleset. How you maintain and deploy the ConfigMap is completely in your control, the only requirement is that the ConfigMap be on the same namespace as the Ruler. 35 | 36 | **IMPORTANT** things to note: 37 | 38 | - This ruleset is ONLY for tenantfoo (We will explicitly map it to tenantfoo later). 39 | - The section under `tenantfoo.yaml` is validated and interpreted exactly as a [Prometheus alerting rules configuration](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) would be. How you configure this is completely up to you. 40 | - [Prometheus recording rules](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) are also configured here in the same way as alerting rules. 41 | 42 | ```yaml 43 | kind: ConfigMap 44 | metadata: 45 | name: tenantfoo-ruler-config 46 | namespace: cortex 47 | apiVersion: v1 48 | data: 49 | tenantfoo.yaml: |- 50 | groups: 51 | - name: 52 | rules: 53 | - alert: 54 | expr: 55 | for: 56 | labels: 57 | severity: 58 | annotations: 59 | description: 60 | 61 | ``` 62 | 63 | ## Create Alertmanager ConfigMap 64 | 65 | To provide the Alertmanager with the information needed to *route* notifications to stakeholders, we must create a ConfigMap with the desired routing rules. How you maintain and deploy the ConfigMap is completely in your control, the only requirement is that the ConfigMap be on the same namespace as the Alertmanager. 66 | 67 | **IMPORTANT** things to note: 68 | 69 | - These routing rules are ONLY for tenantfoo. The Alertmanager takes the key under `data` (excluding `.yaml`) and uses it as the tenant name for that specific config. 70 | - The section under `tenantfoo.yaml` is validated and interpreted exactly as a [Alertmanager configuration](hhttps://prometheus.io/docs/alerting/latest/configuration/#configuration-file) would be. How you configure this is completely up to you. 71 | 72 | ```yaml 73 | kind: ConfigMap 74 | metadata: 75 | name: tenantfoo-alertmanager-config 76 | namespace: cortex 77 | apiVersion: v1 78 | data: 79 | tenantfoo.yaml: | 80 | global: 81 | resolve_timeout: 82 | http_config: {} 83 | smtp_from: ExamplePerson 84 | smtp_hello: example.com 85 | smtp_smarthost: example-smtp.example.com 86 | route: 87 | receiver: team-X-mails 88 | group_by: ['alertname'] 89 | group_wait: 90 | group_interval: 91 | repeat_interval: 92 | receivers: 93 | - name: 'team-X-mails' 94 | email_configs: 95 | - to: 'example@example.com' 96 | ``` 97 | 98 | ## Helm Chart Configuration 99 | 100 | Now that the ConfigMaps are created, we can tinker the helm chart to achieve our goal. 101 | 102 | ### Configuration for Ruler and Alertmanager Config 103 | Add this to the `values.yaml` under the `config` section as shown. 104 | 105 | ```yaml 106 | config: 107 | ruler: 108 | enable_api: true 109 | # already set-up temporary emptyDir volume. Cortex will parse rules from /data/rules 110 | # and copy them here for prometheus rule evaluation 111 | rule_path: /rules 112 | 113 | ruler_storage: 114 | backend: "local" 115 | local: 116 | # where your mounted configmap data will be temporary stored 117 | directory: /data/rules 118 | 119 | alertmanager: 120 | enable_api: true 121 | # temporary volume if not using stateful alertmanagers 122 | data_dir: /data 123 | 124 | alertmanager_storage: 125 | backend: "local" 126 | local: 127 | # temporary volume if not using stateful alertmanagers 128 | path: /data 129 | ``` 130 | 131 | ### Configuration for Ruler and Alertmanager 132 | Add this to the `values.yaml`. 133 | Note that when we mount `tenantfoo-ruler-config`, we mount it under a folder which should be named after the tenant it corresponds to. In this situation, since we want `tenantfoo-ruler-config` to be the alerting rules for `tenantfoo`, we mount it under `/data/rules/tenantfoo`. 134 | Also note that for `tenantfoo-alertmanager-config`, we similarily mount it under a folder specific to that tenant. Although it will not use the folder name as the tenant name (it instead uses the key name under `data` in the ConfigMap), it simplifies things if you do so. 135 | 136 | ```yaml 137 | ruler: 138 | extraVolumes: 139 | - configMap: 140 | defaultMode: 420 141 | name: tenantfoo-ruler-config 142 | name: tenantfoo-ruler-config 143 | extraVolumeMounts: 144 | - name: tenantfoo-ruler-config 145 | mountPath: /data/rules/tenantfoo 146 | alertmanager: 147 | extraVolumes: 148 | - configMap: 149 | defaultMode: 420 150 | name: tenantfoo-alertmanager-config 151 | name: tenantfoo-alertmanager-config 152 | extraVolumeMounts: 153 | - name: tenantfoo-alertmanager-config 154 | mountPath: /data/tenantfoo 155 | ``` 156 | 157 | # Result 158 | 159 | You can now install the helm chart. 160 | 161 | You may use the section below to verify the configuration went according to plan. 162 | 163 | ### Verify Alertmanager 164 | 165 | 1. Port-forward the alertmanager pod 166 | 2. Run `curl -X GET -H "X-Scope-OrgID: " localhost:8080/api/v1/alerts` 167 | 3. Verify the correct configuration shows up 168 | 169 | ### Verify Ruler 170 | 171 | 1. Port-forward the ruler pod 172 | 2. Run `curl -X GET -H "X-Scope-OrgID: " localhost:8080/api/v1/rules` 173 | 3. Verify the correct configuration shows up 174 | 175 | # Moving forward 176 | 177 | You can also follow this guide if you don't have multi-tenancy enabled. However, in this case, you will not get alerting/routing rules specific to each tenant. 178 | 179 | Defining fine-grained alerting/routing rules per tenant is when you really get to eat the fruits of your labour when deploying multi-tenant alertmanager/ruler. For example, lets say you currently only have routing rules for tenantfoo. If you wanted to add specific routing rules for another tenant, tenantB, you will do the following: 180 | 181 | 1. Create another set of ConfigMaps for the new tenants, being sure to adhere to the naming policies stated in this guide 182 | 183 | 2. Add entries under `extraVolumes` and `extraVolumeMounts` for the Ruler and Alertmanager. All while being sure to adhere to the naming policies stated in this guide 184 | 185 | 3. [Verify the new tenant is configured](#result) -------------------------------------------------------------------------------- /docs/guides/configure_rules_via_configmap.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Configure rules via configmap 4 | parent: Guides 5 | has_children: false 6 | has_toc: false 7 | --- 8 | # Configure rules via configmap 9 | {: .no_toc } 10 | 11 | ## Table of contents 12 | {: .no_toc .text-delta } 13 | 14 | 1. TOC 15 | {:toc} 16 | 17 | --- 18 | # Configure rules via configmap 19 | 20 | In your cortex-helm-chart you can now specify a static configuration of ruler rules. 21 | 22 | ```yaml 23 | ruler: 24 | directories: 25 | tenant_foo: 26 | rules1.txt: | 27 | groups: 28 | - name: should_fire 29 | rules: 30 | - alert: HighPercentageError 31 | expr: | 32 | sum(rate({app="foo", env="production"} |= "error" [5m])) by (job) 33 | / 34 | sum(rate({app="foo", env="production"}[5m])) by (job) 35 | > 0.05 36 | for: 10m 37 | labels: 38 | severity: warning 39 | annotations: 40 | summary: High error rate 41 | ``` -------------------------------------------------------------------------------- /docs/guides/configure_rules_via_sidecar.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Configure rules via sidecar 4 | parent: Guides 5 | has_children: false 6 | has_toc: false 7 | --- 8 | # Configure rules via sidecar 9 | {: .no_toc } 10 | 11 | ## Table of contents 12 | {: .no_toc .text-delta } 13 | 14 | 1. TOC 15 | {:toc} 16 | 17 | --- 18 | # Rules and AlertManager configuration 19 | Cortex can be configured to use a sidecar container in the Ruler and AlertManager to dynamically discover rules and AlertManager config/templates that are declared as ConfigMaps to allow easy and extensible configuration that avoids having to store state in the Cortex system itself (via config service, etc). 20 | Put ConfigMaps into the specified namespace, and they are automatically detected and added as files to the Ruler and/or AlertManager containers, both of which are polling for changes on the filesystem and will make the new configurations go live dynamically. 21 | This feature is disabled by default. Here is a simple example: 22 | 23 | Please note that this is only supported with the **local** backend. Otherwise cortex will overwrite what the operator[^1] puts in the folder with what is in s3/gcs/azure/swift. Cortex does not 2-way sync the files. Also please be aware of the following: 24 | - local alertmanager config storage is read-only (cortex API is severely limited to read-only requests) 25 | - local alertmanager storage does not support state persistency (however your configurations are saved in etcd via kubernetes) 26 | - local ruler storage does not support RuleGroups 27 | - local ruler storage does not support namespaces 28 | 29 | [^1]: Also referenced here as the sidecar. Effectively the sidecar is an image which is an kubernetes operator. 30 | 31 | ## Helm values config 32 | 33 | ```yaml 34 | ruler: 35 | sidecar: 36 | enabled: true 37 | searchNamespace: cortex-rules 38 | 39 | alertmanager: 40 | sidecar: 41 | enabled: true 42 | searchNamespace: cortex-alertmanager 43 | ``` 44 | And here are the related configuration values in AlertManager and Ruler: 45 | ```yaml 46 | config: 47 | ruler: 48 | enable_api: true 49 | # already set-up temporary emptyDir volume. Cortex will parse rules from /data/rules 50 | # and copy them here for prometheus rule evaluation 51 | rule_path: /rules 52 | 53 | ruler_storage: 54 | backend: "local" 55 | local: 56 | # temporary volume of type emptyDir 57 | directory: /data/rules 58 | 59 | alertmanager: 60 | enable_api: true 61 | # temporary volume if not using stateful alertmanagers 62 | data_dir: /data 63 | 64 | alertmanager_storage: 65 | backend: "local" 66 | local: 67 | # temporary volume if not using stateful alertmanagers 68 | path: /data 69 | ``` 70 | 71 | ## Creating alerting/recording rules and alertmanager configs 72 | 73 | In AlertManager, the `data_dir` and local storage directory should be the same. 74 | In the Ruler, there need to be two separate volumes. One is used by Cortex for evaluating alerting and recording rules (/rules) and should be temporary. The other is used by the user (YOU) to temporarily store your alerting and recording rules (/data/rules). 75 | Example ConfigMap containing an alerting rule: 76 | 77 | {% raw %} 78 | ```yaml 79 | kind: ConfigMap 80 | metadata: 81 | annotations: 82 | # Override destination folder so we can save the config under /data/rules//tenantfoo.yaml 83 | k8s-sidecar-target-directory: /data/rules/tenantfoo 84 | labels: 85 | # Label cortex_rules must exist unless overridden by ruler.sidecar.label 86 | cortex_rules: "1" 87 | name: rules-cortex-9f99md47tc 88 | namespace: cortex-rules 89 | apiVersion: v1 90 | data: 91 | tenantfoo.yaml: |- 92 | groups: 93 | - name: tenantfoo-system-metrics 94 | rules: 95 | - alert: HighCPUUsage 96 | expr: avg(100 - rate(node_cpu_seconds_total{instance=~"qag1ge1l.+",mode="idle"}[5m]) * 100) by (instance) > 100 97 | for: 3m 98 | labels: 99 | severity: warning 100 | annotations: 101 | description: Metrics from {{ $labels.job }} on {{ $labels.instance }} show CPU > 90% for 3m. 102 | title: Node {{ $labels.instance }} has high CPU usage 103 | 104 | ``` 105 | {% endraw %} 106 | 107 | Example ConfigMap containing an alertmanager-config: 108 | 109 | ```yaml 110 | apiVersion: v1 111 | kind: ConfigMap 112 | metadata: 113 | annotations: 114 | k8s-sidecar-target-directory: /data/tenantfoo 115 | labels: 116 | cortex_alertmanager: "1" 117 | name: alertmanager-example-config 118 | data: 119 | tenantfoo.yaml: |- 120 | global: 121 | resolve_timeout: 5m 122 | http_config: {} 123 | smtp_hello: localhost 124 | smtp_require_tls: true 125 | route: 126 | receiver: team-X-mails 127 | group_by: 128 | - alertname 129 | routes: 130 | - receiver: "null" 131 | match: 132 | alertname: Watchdog 133 | group_wait: 30s 134 | group_interval: 5m 135 | repeat_interval: 12h 136 | receivers: 137 | - name: 'team-X-mails' 138 | email_configs: 139 | - to: 'team-X+alerts@example.org' 140 | ``` -------------------------------------------------------------------------------- /docs/guides/getting_started_with_block_storage.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Getting started with block storage 4 | parent: Guides 5 | has_children: false 6 | has_toc: false 7 | nav_order: 1 8 | --- 9 | # Getting started with block storage 10 | {: .no_toc } 11 | 12 | ## Table of contents 13 | {: .no_toc .text-delta } 14 | 15 | 1. TOC 16 | {:toc} 17 | 18 | --- 19 | # Getting Started 20 | 21 | A quick example configuration on how to get started with block storage can be found here 22 | 23 | ```yaml 24 | # This file provides helm values to configure Cortex for blocks storage on AWS S3. 25 | # Be sure to edit region, endpoint, and bucket_name for your environment. 26 | config: 27 | alertmanager_storage: 28 | s3: 29 | bucket_name: # your bucket name 30 | region: us-east-1 31 | endpoint: s3.us-east-1.amazonaws.com 32 | blocks_storage: 33 | backend: s3 34 | s3: 35 | bucket_name: # your bucket name 36 | region: us-east-1 37 | # -- The S3 bucket endpoint. It could be an AWS S3 endpoint listed at 38 | # https://docs.aws.amazon.com/general/latest/gr/s3.html or the address of an 39 | # S3-compatible service in hostname:port format. 40 | endpoint: s3.us-east-1.amazonaws.com 41 | bucket_store: 42 | sync_dir: "/data" 43 | tsdb: 44 | dir: "/data" 45 | querier: 46 | # -- Comma separated list of store-gateway addresses in DNS Service Discovery 47 | # format. This option should be set when using the blocks storage and the 48 | # store-gateway sharding is disabled (when enabled, the store-gateway instances 49 | # form a ring and addresses are picked from the ring). 50 | store_gateway_addresses: dns+cortex-store-gateway-headless.cortex.svc:9095 51 | ruler_storage: 52 | s3: 53 | bucket_name: # your bucket name 54 | region: us-east-1 55 | endpoint: s3.us-east-1.amazonaws.com 56 | ``` 57 | -------------------------------------------------------------------------------- /docs/guides/upgrade-v1.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Upgrading to chart version v1.0.0 4 | parent: Guides 5 | has_children: false 6 | has_toc: false 7 | --- 8 | # Upgrading to chart version v1.0.0 9 | {: .no_toc } 10 | 11 | ## Table of contents 12 | {: .no_toc .text-delta } 13 | 14 | 1. TOC 15 | {:toc} 16 | 17 | --- 18 | # Upgrading to chart version v1.0.0 19 | 20 | cortex-helm-chart v1.0.0 introduced a number of breaking changes in an attempt to provide better defaults for new users. Care should be taken when upgrading so that the new defaults are not inherited unexpectedly. Many of the new defaults are safe and simple to apply with an upgrade, but some require special procedures to migrate to, and some may not match your desired configuration. 21 | 22 | This guide covers a few topics, but is not exhaustive. Please review the [release notes](https://github.com/cortexproject/cortex-helm-chart/releases/tag/v1.0.0) and [diff](https://github.com/cortexproject/cortex-helm-chart/compare/v0.6.0...v1.0.0) before upgrading to ensure you haven't missed anything important to your installation. You may want to use a tool like [helm-diff](https://github.com/databus23/helm-diff) to see what changes will be applied. 23 | 24 | ## Migrating to Memberlist 25 | 26 | The default kvstore changed from `consul` to `memberlist`. Migrating from one kvstore to another requires either downtime or a multi-stage process. 27 | 28 | ### Downtime 29 | 30 | If you are okay with downtime, the simplest way to migrate kvstores is to scale down all cortex components, then `helm upgrade --reset-values` to cortex-helm-chart v1.x.x to apply the new default kvstore, `memberlist`. Keep in mind this will apply all the new defaults, so ensure any values you would like to preserve that are unrelated to the kvstore are overridden with `-f` and your custom values file or `--set`. 31 | 32 | ### Multi KV 33 | 34 | Cortex provides a configuration called Multi KV to migrate from one kvstore to another without downtime. Please read the doc on Multi KV before continuing this guide: https://cortexmetrics.io/docs/configuration/arguments/#multi-kv 35 | 36 | Assuming you have an existing installation of cortex-helm-chart v0.6.0, here is an example of how to convert it to `memberlist`. 37 | #### Stage 1 - mirror to both kvstores 38 | 39 | _Be sure to augment this command with any other options you used for the initial installation._ 40 | ``` 41 | helm upgrade cortex cortex-helm/cortex --version 0.6.0 -f kvstore-mirror.yaml 42 | ``` 43 | 44 | kvstore-mirror.yaml: 45 | ```yaml 46 | config: 47 | alertmanager: 48 | sharding_ring: 49 | kvstore: &kvstore 50 | store: multi 51 | multi: 52 | primary: consul 53 | secondary: memberlist 54 | mirror_enabled: true 55 | compactor: 56 | sharding_ring: 57 | kvstore: *kvstore 58 | distributor: 59 | ring: 60 | kvstore: *kvstore 61 | ingester: 62 | lifecycler: 63 | ring: 64 | kvstore: *kvstore 65 | store_gateway: 66 | sharding_ring: 67 | kvstore: *kvstore 68 | ``` 69 | 70 | #### Stage 2 - use runtime config to make memberlist the primary 71 | 72 | _Be sure to augment this command with any other options you used for the initial installation._ 73 | ``` 74 | helm upgrade cortex cortex-helm/cortex --version 0.6.0 -f kvstore-mirror.yaml -f kvstore-runtime.yaml 75 | ``` 76 | 77 | kvstore-runtime.yaml: 78 | ```yaml 79 | runtimeconfigmap: 80 | runtime_config: 81 | multi_kv_config: 82 | mirror_enabled: false 83 | primary: memberlist 84 | ``` 85 | 86 | #### Stage 3 - disable consul 87 | 88 | _Be sure to augment this command with any other options you used for the initial installation._ 89 | ``` 90 | helm upgrade cortex cortex-helm/cortex --version 0.6.0 -f kvstore-memberlist.yaml 91 | ``` 92 | 93 | kvstore-memberlist.yaml: 94 | ```yaml 95 | config: 96 | alertmanager: 97 | sharding_ring: 98 | kvstore: &kvstore 99 | store: memberlist 100 | compactor: 101 | sharding_ring: 102 | kvstore: *kvstore 103 | distributor: 104 | ring: 105 | kvstore: *kvstore 106 | ingester: 107 | lifecycler: 108 | ring: 109 | kvstore: *kvstore 110 | store_gateway: 111 | sharding_ring: 112 | kvstore: *kvstore 113 | ``` 114 | 115 | ## Migrate from chucks to block storage 116 | 117 | https://cortexmetrics.io/docs/blocks-storage/migrate-cortex-cluster-from-chunks-to-blocks/ 118 | -------------------------------------------------------------------------------- /docs/index.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: home 3 | title: Home 4 | nav_order: 1 5 | description: "Horizontally scalable, highly available, multi-tenant, long term Prometheus." 6 | permalink: / 7 | --- 8 | 9 | # Welcome 10 | Cortex Logo 12 | This is the official cortex-helm-chart documentation. Here you can find Guides & Best-Practices on How-To setup cortex. 13 | 14 | --- 15 | ## About the project 16 | 17 | Cortex is a horizontally scalable, highly available, multi-tenant, long term Prometheus. The cortex-helm-chart helps the operator with deploying cortex on a Kubernetes cluster. 18 | 19 | Follow our socials: 20 | * [Twitter](https://twitter.com/CortexMetrics) 21 | 22 | Join us on Slack: 23 | * [Slack](https://cloud-native.slack.com/?redir=%2Fmessages%2Fcortex%2F) 24 | 25 | ### License 26 | 27 | cortex-helm-chart is distributed by an [Apache License 2.0](https://github.com/cortexproject/cortex-helm-chart/blob/master/LICENSE). 28 | 29 | ### Contributing 30 | 31 | When contributing to this repository, please first discuss the change you wish to make via issue before making a change. Read more about becoming a contributor in [our GitHub repo](https://github.com/cortexproject/cortex-helm-chart/blob/master/CONTRIBUTING). 32 | 33 | #### Thank you to the contributors of cortex-helm-chart! 34 | 35 |
    36 | {% for contributor in site.github.contributors %} 37 |
  • 38 | {{ contributor.login }} 39 |
  • 40 | {% endfor %} 41 |
-------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:base", 5 | ":gitSignOff", 6 | ":rebaseStalePrs" 7 | ], 8 | "assignees": [ 9 | "nschad", 10 | "kd7lxl" 11 | ], 12 | "labels": ["dependencies"], 13 | "regexManagers": [{ 14 | "description": "Update cortex in Chart.yaml", 15 | "fileMatch": ["^Chart\\.yaml$"], 16 | "matchStrings": [ 17 | "appVersion: (?.*?)\\n" 18 | ], 19 | "depNameTemplate": "quay.io/cortexproject/cortex", 20 | "datasourceTemplate": "docker" 21 | }, 22 | { 23 | "description": "Update cortex in README.md", 24 | "fileMatch": ["^README\\.md$"], 25 | "matchStrings": [ 26 | "\\bAppVersion:\\s+(?v\\d+\\.\\d+\\.\\d+(?:\\+\\d+)?)", 27 | "\\bAppVersion-+(?v\\d+\\.\\d+\\.\\d+(?:\\+\\d+)?)" 28 | ], 29 | "depNameTemplate": "quay.io/cortexproject/cortex", 30 | "datasourceTemplate": "docker" 31 | }, 32 | { 33 | "description": "Update nginx image in README.md", 34 | "fileMatch": ["^README\\.md$"], 35 | "matchStrings": [ 36 | "\\|\\s+nginx.​image.​tag\\s+\\|\\s+float\\s+\\|\\s+\\`(?.*?)\\`\\s+\\|\\s+\\|\\s+" 37 | ], 38 | "depNameTemplate": "nginx", 39 | "datasourceTemplate": "docker" 40 | }, 41 | { 42 | "description": "Update kiwigrid/k8s-sidecar image in README.md", 43 | "fileMatch": ["^README\\.md$"], 44 | "matchStrings": [ 45 | "\\|\\s+ruler.​sidecar.​image.​tag\\s+\\|\\s+string\\s+\\|\\s+`\"(?.*?)\"`\\s+\\|\\s+\\|\\s+", 46 | "\\|\\s+alertmanager.​sidecar.​image.​tag\\s+\\|\\s+string\\s+\\|\\s+`\"(?.*?)\"`\\s+\\|\\s+\\|\\s+" 47 | ], 48 | "depNameTemplate": "kiwigrid/k8s-sidecar", 49 | "datasourceTemplate": "docker" 50 | }, 51 | { 52 | "description": "Update memcached image in README.md", 53 | "fileMatch": ["^README\\.md$"], 54 | "matchStrings": [ 55 | "\\|[^|]*\\|[^|]*\\(memcached\\)[^|]*\\|\\s+(?.*?)\\s+\\|\\s+" 56 | ], 57 | "depNameTemplate": "memcached", 58 | "registryUrlTemplate": "https://charts.bitnami.com/bitnami", 59 | "datasourceTemplate": "helm" 60 | } 61 | ] 62 | } 63 | -------------------------------------------------------------------------------- /templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | Verify the application is working by running these commands: 2 | kubectl --namespace {{ .Release.Namespace }} port-forward service/{{ include "cortex.querierFullname" . }} {{ .Values.config.server.http_listen_port }} 3 | curl http://127.0.0.1:{{ .Values.config.server.http_listen_port }}/services 4 | -------------------------------------------------------------------------------- /templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* vim: set filetype=mustache: */}} 2 | {{/* 3 | Expand the name of the chart. 4 | */}} 5 | {{- define "cortex.name" -}} 6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 7 | {{- end -}} 8 | 9 | {{/* 10 | Create a default fully qualified app name. 11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 12 | If release name contains chart name it will be used as a full name. 13 | */}} 14 | {{- define "cortex.fullname" -}} 15 | {{- if .Values.fullnameOverride -}} 16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} 17 | {{- else -}} 18 | {{- $name := default .Chart.Name .Values.nameOverride -}} 19 | {{- if contains $name .Release.Name -}} 20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} 21 | {{- else -}} 22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 23 | {{- end -}} 24 | {{- end -}} 25 | {{- end -}} 26 | 27 | {{/* 28 | Create chart name and version as used by the chart label. 29 | */}} 30 | {{- define "cortex.chart" -}} 31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 32 | {{- end -}} 33 | 34 | {{/* 35 | Create the name of the service account 36 | */}} 37 | {{- define "cortex.serviceAccountName" -}} 38 | {{- if .Values.serviceAccount.create -}} 39 | {{ default (include "cortex.fullname" .) .Values.serviceAccount.name }} 40 | {{- else -}} 41 | {{ default "default" .Values.serviceAccount.name }} 42 | {{- end -}} 43 | {{- end -}} 44 | 45 | {{/* 46 | Create the app name of cortex clients. Defaults to the same logic as "cortex.fullname", and default client expects "prometheus". 47 | */}} 48 | {{- define "client.name" -}} 49 | {{- if .Values.client.name -}} 50 | {{- .Values.client.name -}} 51 | {{- else if .Values.client.fullnameOverride -}} 52 | {{- .Values.client.fullnameOverride | trunc 63 | trimSuffix "-" -}} 53 | {{- else -}} 54 | {{- $name := default "prometheus" .Values.client.nameOverride -}} 55 | {{- if contains $name .Release.Name -}} 56 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} 57 | {{- else -}} 58 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 59 | {{- end -}} 60 | {{- end -}} 61 | {{- end -}} 62 | 63 | 64 | {{/* 65 | Common labels 66 | */}} 67 | {{- define "cortex.labels" -}} 68 | helm.sh/chart: {{ include "cortex.chart" . }} 69 | {{ include "cortex.selectorLabels" . }} 70 | {{- if .Chart.AppVersion }} 71 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} 72 | {{- end }} 73 | app.kubernetes.io/managed-by: {{ .Release.Service }} 74 | {{- end }} 75 | 76 | {{/* 77 | Selector labels 78 | */}} 79 | {{- define "cortex.selectorLabels" -}} 80 | app.kubernetes.io/name: {{ include "cortex.name" . }} 81 | app.kubernetes.io/instance: {{ .Release.Name }} 82 | {{- end }} 83 | 84 | {{/* 85 | Create configuration parameters for memcached configuration 86 | */}} 87 | {{- define "cortex.memcached" -}} 88 | {{- if index .Values "memcached-blocks-index" "enabled" }} 89 | - "-blocks-storage.bucket-store.index-cache.backend=memcached" 90 | - "-blocks-storage.bucket-store.index-cache.memcached.addresses=dns+{{ .Release.Name }}-memcached-blocks-index.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:11211" 91 | {{- end -}} 92 | {{- if index .Values "memcached-blocks" "enabled" }} 93 | - "-blocks-storage.bucket-store.chunks-cache.backend=memcached" 94 | - "-blocks-storage.bucket-store.chunks-cache.memcached.addresses=dns+{{ .Release.Name }}-memcached-blocks.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:11211" 95 | {{- end -}} 96 | {{- if index .Values "memcached-blocks-metadata" "enabled" }} 97 | - "-blocks-storage.bucket-store.metadata-cache.backend=memcached" 98 | - "-blocks-storage.bucket-store.metadata-cache.memcached.addresses=dns+{{ .Release.Name }}-memcached-blocks-metadata.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:11211" 99 | {{- end -}} 100 | {{- end -}} 101 | 102 | {{/* 103 | Create configuration for frontend memcached configuration 104 | */}} 105 | {{- define "cortex.frontend-memcached" -}} 106 | {{- if index .Values "memcached-frontend" "enabled" }} 107 | - "-frontend.memcached.addresses=dns+{{ .Release.Name }}-memcached-frontend.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:11211" 108 | {{- end -}} 109 | {{- end -}} 110 | 111 | {{/* 112 | Determine the policy api version 113 | */}} 114 | {{- define "cortex.pdbVersion" -}} 115 | {{- if or (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") (semverCompare ">=1.21-0" .Capabilities.KubeVersion.Version) -}} 116 | policy/v1 117 | {{- else -}} 118 | policy/v1beta1 119 | {{- end -}} 120 | {{- end -}} 121 | 122 | {{/* 123 | Get checksum of config secret or configMap 124 | */}} 125 | {{- define "cortex.configChecksum" -}} 126 | {{- if .Values.useExternalConfig -}} 127 | {{- .Values.externalConfigVersion -}} 128 | {{- else if .Values.useConfigMap -}} 129 | {{- include (print $.Template.BasePath "/configmap.yaml") . | sha256sum -}} 130 | {{- else -}} 131 | {{- include (print $.Template.BasePath "/secret.yaml") . | sha256sum -}} 132 | {{- end -}} 133 | {{- end -}} 134 | 135 | {{/* 136 | Get volume of config secret of configMap 137 | */}} 138 | {{- define "cortex.configVolume" -}} 139 | - name: config 140 | {{- if .Values.useExternalConfig }} 141 | secret: 142 | secretName: {{ .Values.externalConfigSecretName }} 143 | {{- else if .Values.useConfigMap }} 144 | configMap: 145 | name: {{ template "cortex.fullname" . }}-config 146 | {{- else }} 147 | secret: 148 | secretName: {{ template "cortex.fullname" . }} 149 | {{- end }} 150 | {{- end -}} 151 | 152 | {{/* 153 | Get cortex hpa version by k8s version 154 | */}} 155 | {{- define "cortex.hpaVersion" -}} 156 | {{- if or (.Capabilities.APIVersions.Has "autoscaling/v2/HorizontalPodAutoscaler") (semverCompare ">=1.23-0" .Capabilities.KubeVersion.Version) -}} 157 | autoscaling/v2 158 | {{- else -}} 159 | autoscaling/v2beta2 160 | {{- end -}} 161 | {{- end -}} 162 | -------------------------------------------------------------------------------- /templates/alertmanager/_helpers-alertmanager.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | alertmanager fullname 4 | */}} 5 | {{- define "cortex.alertmanagerFullname" -}} 6 | {{ include "cortex.fullname" . }}-alertmanager 7 | {{- end }} 8 | 9 | {{/* 10 | alertmanager common labels 11 | */}} 12 | {{- define "cortex.alertmanagerLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: alertmanager 15 | {{- end }} 16 | 17 | {{/* 18 | alertmanager selector labels 19 | */}} 20 | {{- define "cortex.alertmanagerSelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: alertmanager 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/alertmanager/alertmanager-dep.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.alertmanager.enabled -}} 2 | {{- if not .Values.alertmanager.statefulSet.enabled -}} 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: {{ include "cortex.alertmanagerFullname" . }} 7 | namespace: {{ .Release.Namespace }} 8 | labels: 9 | {{- include "cortex.alertmanagerLabels" . | nindent 4 }} 10 | app.kubernetes.io/part-of: memberlist 11 | annotations: 12 | {{- toYaml .Values.alertmanager.annotations | nindent 4 }} 13 | spec: 14 | replicas: {{ .Values.alertmanager.replicas }} 15 | selector: 16 | matchLabels: 17 | {{- include "cortex.alertmanagerSelectorLabels" . | nindent 6 }} 18 | strategy: 19 | {{- toYaml .Values.alertmanager.strategy | nindent 4 }} 20 | template: 21 | metadata: 22 | labels: 23 | {{- include "cortex.alertmanagerLabels" . | nindent 8 }} 24 | app.kubernetes.io/part-of: memberlist 25 | {{- with .Values.alertmanager.podLabels }} 26 | {{- toYaml . | nindent 8 }} 27 | {{- end }} 28 | annotations: 29 | checksum/config: {{ include "cortex.configChecksum" . }} 30 | {{- with .Values.alertmanager.podAnnotations }} 31 | {{- toYaml . | nindent 8 }} 32 | {{- end }} 33 | spec: 34 | serviceAccountName: {{ .Values.alertmanager.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }} 35 | {{- if .Values.alertmanager.priorityClassName }} 36 | priorityClassName: {{ .Values.alertmanager.priorityClassName }} 37 | {{- end }} 38 | {{- if .Values.alertmanager.securityContext.enabled }} 39 | securityContext: {{- omit .Values.alertmanager.securityContext "enabled" | toYaml | nindent 8 }} 40 | {{- end }} 41 | initContainers: 42 | {{- toYaml .Values.alertmanager.initContainers | nindent 8 }} 43 | {{- if .Values.image.pullSecrets }} 44 | imagePullSecrets: 45 | {{- range .Values.image.pullSecrets }} 46 | - name: {{ . }} 47 | {{- end }} 48 | {{- end }} 49 | containers: 50 | {{- if .Values.alertmanager.sidecar.enabled }} 51 | - name: {{ template "cortex.name" . }}-sc-alertmanager 52 | {{- if .Values.alertmanager.sidecar.image.sha }} 53 | image: "{{ .Values.alertmanager.sidecar.image.repository }}:{{ .Values.alertmanager.sidecar.image.tag }}@sha256:{{ .Values.alertmanager.sidecar.image.sha }}" 54 | {{- else }} 55 | image: "{{ .Values.alertmanager.sidecar.image.repository }}:{{ .Values.alertmanager.sidecar.image.tag }}" 56 | {{- end }} 57 | imagePullPolicy: {{ .Values.alertmanager.sidecar.imagePullPolicy }} 58 | env: 59 | {{- if .Values.alertmanager.sidecar.watchMethod }} 60 | - name: METHOD 61 | value: {{ .Values.alertmanager.sidecar.watchMethod }} 62 | {{ end }} 63 | - name: LABEL 64 | value: "{{ .Values.alertmanager.sidecar.label }}" 65 | {{- if .Values.alertmanager.sidecar.labelValue }} 66 | - name: LABEL_VALUE 67 | value: {{ quote .Values.alertmanager.sidecar.labelValue }} 68 | {{- end }} 69 | - name: FOLDER 70 | value: "{{ .Values.alertmanager.sidecar.folder }}{{- with .Values.alertmanager.sidecar.defaultFolderName }}/{{ . }}{{- end }}" 71 | {{- if .Values.alertmanager.sidecar.resource}} 72 | - name: RESOURCE 73 | value: {{ quote .Values.alertmanager.sidecar.resource }} 74 | {{- end }} 75 | {{- if .Values.alertmanager.sidecar.enableUniqueFilenames }} 76 | - name: UNIQUE_FILENAMES 77 | value: "{{ .Values.alertmanager.sidecar.enableUniqueFilenames }}" 78 | {{- end }} 79 | {{- if .Values.alertmanager.sidecar.searchNamespace }} 80 | - name: NAMESPACE 81 | value: "{{ .Values.alertmanager.sidecar.searchNamespace }}" 82 | {{- end }} 83 | {{- if .Values.alertmanager.sidecar.skipTlsVerify }} 84 | - name: SKIP_TLS_VERIFY 85 | value: "{{ .Values.alertmanager.sidecar.skipTlsVerify }}" 86 | {{- end }} 87 | {{- if .Values.alertmanager.sidecar.folderAnnotation }} 88 | - name: FOLDER_ANNOTATION 89 | value: "{{ .Values.alertmanager.sidecar.folderAnnotation }}" 90 | {{- end }} 91 | resources: 92 | {{- toYaml .Values.alertmanager.sidecar.resources | nindent 12 }} 93 | {{- if .Values.alertmanager.sidecar.containerSecurityContext.enabled }} 94 | securityContext: {{- omit .Values.alertmanager.sidecar.containerSecurityContext "enabled" | toYaml | nindent 12 }} 95 | {{- end }} 96 | volumeMounts: 97 | - name: storage 98 | mountPath: "/data" 99 | {{- end }} 100 | - name: alertmanager 101 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" 102 | imagePullPolicy: {{ .Values.image.pullPolicy }} 103 | args: 104 | - "-target=alertmanager" 105 | - "-config.file=/etc/cortex/cortex.yaml" 106 | {{- range $key, $value := .Values.alertmanager.extraArgs }} 107 | - "-{{ $key }}={{ $value }}" 108 | {{- end }} 109 | volumeMounts: 110 | {{- if .Values.alertmanager.extraVolumeMounts }} 111 | {{- toYaml .Values.alertmanager.extraVolumeMounts | nindent 12}} 112 | {{- end }} 113 | - name: config 114 | mountPath: /etc/cortex 115 | - name: runtime-config 116 | mountPath: /etc/cortex-runtime-config 117 | - name: storage 118 | mountPath: "/data" 119 | {{- with .Values.alertmanager.persistentVolume.subPath }} 120 | subPath: {{ . }} 121 | {{- end }} 122 | ports: 123 | - name: http-metrics 124 | containerPort: {{ .Values.config.server.http_listen_port }} 125 | protocol: TCP 126 | - name: gossip 127 | containerPort: {{ .Values.config.memberlist.bind_port }} 128 | protocol: TCP 129 | startupProbe: 130 | {{- toYaml .Values.alertmanager.startupProbe | nindent 12 }} 131 | livenessProbe: 132 | {{- toYaml .Values.alertmanager.livenessProbe | nindent 12 }} 133 | readinessProbe: 134 | {{- toYaml .Values.alertmanager.readinessProbe | nindent 12 }} 135 | resources: 136 | {{- toYaml .Values.alertmanager.resources | nindent 12 }} 137 | {{- if .Values.alertmanager.containerSecurityContext.enabled }} 138 | securityContext: {{- omit .Values.alertmanager.containerSecurityContext "enabled" | toYaml | nindent 12 }} 139 | {{- end }} 140 | {{- if .Values.alertmanager.env }} 141 | env: 142 | {{- toYaml .Values.alertmanager.env | nindent 12 }} 143 | {{- end }} 144 | {{- if .Values.alertmanager.extraContainers }} 145 | {{- toYaml .Values.alertmanager.extraContainers | nindent 8}} 146 | {{- end }} 147 | nodeSelector: 148 | {{- toYaml .Values.alertmanager.nodeSelector | nindent 8 }} 149 | {{- if .Values.alertmanager.topologySpreadConstraints }} 150 | topologySpreadConstraints: 151 | {{- toYaml .Values.alertmanager.topologySpreadConstraints | nindent 8}} 152 | {{- end }} 153 | affinity: 154 | {{- toYaml .Values.alertmanager.affinity | nindent 8 }} 155 | tolerations: 156 | {{- toYaml .Values.alertmanager.tolerations | nindent 8 }} 157 | terminationGracePeriodSeconds: {{ .Values.alertmanager.terminationGracePeriodSeconds }} 158 | volumes: 159 | {{- include "cortex.configVolume" . | nindent 8 }} 160 | - name: runtime-config 161 | configMap: 162 | name: {{ template "cortex.fullname" . }}-runtime-config 163 | - name: storage 164 | emptyDir: {} 165 | {{- if .Values.alertmanager.extraVolumes }} 166 | {{- toYaml .Values.alertmanager.extraVolumes | nindent 8 }} 167 | {{- end }} 168 | {{- end -}} 169 | {{- end -}} 170 | -------------------------------------------------------------------------------- /templates/alertmanager/alertmanager-poddisruptionbudget.yaml: -------------------------------------------------------------------------------- 1 | {{- if and (gt (int .Values.alertmanager.replicas) 1) (.Values.alertmanager.podDisruptionBudget) }} 2 | apiVersion: {{ include "cortex.pdbVersion" . }} 3 | kind: PodDisruptionBudget 4 | metadata: 5 | name: {{ include "cortex.alertmanagerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.alertmanagerLabels" . | nindent 4 }} 9 | spec: 10 | selector: 11 | matchLabels: 12 | {{- include "cortex.alertmanagerSelectorLabels" . | nindent 6 }} 13 | {{- toYaml .Values.alertmanager.podDisruptionBudget | nindent 2 }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /templates/alertmanager/alertmanager-servicemonitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.alertmanager.serviceMonitor.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "cortex.alertmanagerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.alertmanagerLabels" . | nindent 4 }} 9 | {{- if .Values.alertmanager.serviceMonitor.additionalLabels }} 10 | {{ toYaml .Values.alertmanager.serviceMonitor.additionalLabels | indent 4 }} 11 | {{- end }} 12 | {{- if .Values.alertmanager.serviceMonitor.annotations }} 13 | annotations: 14 | {{ toYaml .Values.alertmanager.serviceMonitor.annotations | indent 4 }} 15 | {{- end }} 16 | spec: 17 | selector: 18 | matchLabels: 19 | {{- include "cortex.alertmanagerSelectorLabels" . | nindent 6 }} 20 | namespaceSelector: 21 | matchNames: 22 | - {{ .Release.Namespace | quote }} 23 | {{- if .Values.alertmanager.serviceMonitor.podTargetLabels }} 24 | podTargetLabels: 25 | {{- range .Values.alertmanager.serviceMonitor.podTargetLabels }} 26 | - {{ . }} 27 | {{- end }} 28 | {{- end }} 29 | endpoints: 30 | - port: http-metrics 31 | {{- if .Values.alertmanager.serviceMonitor.interval }} 32 | interval: {{ .Values.alertmanager.serviceMonitor.interval }} 33 | {{- end }} 34 | {{- if .Values.alertmanager.serviceMonitor.scrapeTimeout }} 35 | scrapeTimeout: {{ .Values.alertmanager.serviceMonitor.scrapeTimeout }} 36 | {{- end }} 37 | {{- if .Values.alertmanager.serviceMonitor.relabelings }} 38 | relabelings: 39 | {{- toYaml .Values.alertmanager.serviceMonitor.relabelings | nindent 4 }} 40 | {{- end }} 41 | {{- if .Values.alertmanager.serviceMonitor.metricRelabelings }} 42 | metricRelabelings: 43 | {{- toYaml .Values.alertmanager.serviceMonitor.metricRelabelings | nindent 4 }} 44 | {{- end }} 45 | {{- with .Values.alertmanager.serviceMonitor.extraEndpointSpec }} 46 | {{- toYaml . | nindent 4 }} 47 | {{- end }} 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /templates/alertmanager/alertmanager-svc-headless.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.alertmanager.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.alertmanagerFullname" . }}-headless 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.alertmanagerLabels" . | nindent 4 }} 9 | {{- with .Values.alertmanager.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.alertmanager.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | clusterIP: None 17 | publishNotReadyAddresses: true 18 | ports: 19 | - port: {{ .Values.config.server.http_listen_port }} 20 | protocol: TCP 21 | name: http-metrics 22 | targetPort: http-metrics 23 | - port: {{ .Values.config.server.grpc_listen_port }} 24 | protocol: TCP 25 | name: grpc 26 | targetPort: grpc 27 | - port: 9094 28 | protocol: UDP 29 | name: alert-clu-udp 30 | targetPort: alert-clu-udp 31 | - port: 9094 32 | protocol: TCP 33 | name: alert-clu-tcp 34 | targetPort: alert-clu-tcp 35 | selector: 36 | {{- include "cortex.alertmanagerSelectorLabels" . | nindent 4 }} 37 | {{- end -}} 38 | -------------------------------------------------------------------------------- /templates/alertmanager/alertmanager-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.alertmanager.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.alertmanagerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.alertmanagerLabels" . | nindent 4 }} 9 | {{- with .Values.alertmanager.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.alertmanager.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | ports: 17 | - port: {{ .Values.config.server.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.alertmanagerSelectorLabels" . | nindent 4 }} 23 | {{- end -}} 24 | -------------------------------------------------------------------------------- /templates/clusterrole.yaml: -------------------------------------------------------------------------------- 1 | {{- if or .Values.ruler.sidecar.enabled .Values.alertmanager.sidecar.enabled }} 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: {{ template "cortex.fullname" . }}-clusterrole 6 | labels: 7 | {{- include "cortex.labels" . | nindent 4 }} 8 | rules: 9 | - apiGroups: [""] # "" indicates the core API group 10 | resources: ["configmaps", "secrets"] 11 | verbs: ["get", "watch", "list"] 12 | {{- end }} 13 | -------------------------------------------------------------------------------- /templates/clusterrolebinding.yaml: -------------------------------------------------------------------------------- 1 | {{- if or .Values.ruler.sidecar.enabled .Values.alertmanager.sidecar.enabled }} 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRoleBinding 4 | metadata: 5 | name: {{ template "cortex.fullname" . }}-clusterrolebinding 6 | labels: 7 | {{- include "cortex.labels" . | nindent 4 }} 8 | roleRef: 9 | apiGroup: rbac.authorization.k8s.io 10 | kind: ClusterRole 11 | name: {{ template "cortex.fullname" . }}-clusterrole 12 | subjects: 13 | - kind: ServiceAccount 14 | name: {{ template "cortex.serviceAccountName" . }} 15 | namespace: {{ .Release.Namespace }} 16 | {{- end }} 17 | -------------------------------------------------------------------------------- /templates/compactor/_helpers-compactor.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | compactor fullname 4 | */}} 5 | {{- define "cortex.compactorFullname" -}} 6 | {{ include "cortex.fullname" . }}-compactor 7 | {{- end }} 8 | 9 | {{/* 10 | compactor common labels 11 | */}} 12 | {{- define "cortex.compactorLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: compactor 15 | {{- end }} 16 | 17 | {{/* 18 | compactor selector labels 19 | */}} 20 | {{- define "cortex.compactorSelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: compactor 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/compactor/compactor-poddisruptionbudget.yaml: -------------------------------------------------------------------------------- 1 | {{- if and (gt (int .Values.compactor.replicas) 1) (.Values.compactor.podDisruptionBudget) }} 2 | apiVersion: {{ include "cortex.pdbVersion" . }} 3 | kind: PodDisruptionBudget 4 | metadata: 5 | name: {{ include "cortex.compactorFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.compactorLabels" . | nindent 4 }} 9 | spec: 10 | selector: 11 | matchLabels: 12 | {{- include "cortex.compactorSelectorLabels" . | nindent 6 }} 13 | {{- toYaml .Values.compactor.podDisruptionBudget | nindent 2 }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /templates/compactor/compactor-servicemonitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.compactor.serviceMonitor.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "cortex.compactorFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.compactorLabels" . | nindent 4 }} 9 | {{- if .Values.compactor.serviceMonitor.additionalLabels }} 10 | {{ toYaml .Values.compactor.serviceMonitor.additionalLabels | indent 4 }} 11 | {{- end }} 12 | {{- if .Values.compactor.serviceMonitor.annotations }} 13 | annotations: 14 | {{ toYaml .Values.compactor.serviceMonitor.annotations | indent 4 }} 15 | {{- end }} 16 | spec: 17 | selector: 18 | matchLabels: 19 | {{- include "cortex.compactorSelectorLabels" . | nindent 6 }} 20 | namespaceSelector: 21 | matchNames: 22 | - {{ .Release.Namespace | quote }} 23 | {{- if .Values.compactor.serviceMonitor.podTargetLabels }} 24 | podTargetLabels: 25 | {{- range .Values.compactor.serviceMonitor.podTargetLabels }} 26 | - {{ . }} 27 | {{- end }} 28 | {{- end }} 29 | endpoints: 30 | - port: http-metrics 31 | {{- if .Values.compactor.serviceMonitor.interval }} 32 | interval: {{ .Values.compactor.serviceMonitor.interval }} 33 | {{- end }} 34 | {{- if .Values.compactor.serviceMonitor.scrapeTimeout }} 35 | scrapeTimeout: {{ .Values.compactor.serviceMonitor.scrapeTimeout }} 36 | {{- end }} 37 | {{- if .Values.compactor.serviceMonitor.relabelings }} 38 | relabelings: 39 | {{- toYaml .Values.compactor.serviceMonitor.relabelings | nindent 4 }} 40 | {{- end }} 41 | {{- if .Values.compactor.serviceMonitor.metricRelabelings }} 42 | metricRelabelings: 43 | {{- toYaml .Values.compactor.serviceMonitor.metricRelabelings | nindent 4 }} 44 | {{- end }} 45 | {{- with .Values.compactor.serviceMonitor.extraEndpointSpec }} 46 | {{- toYaml . | nindent 4 }} 47 | {{- end }} 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /templates/compactor/compactor-statefulset.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.compactor.enabled -}} 2 | apiVersion: apps/v1 3 | kind: StatefulSet 4 | metadata: 5 | name: {{ include "cortex.compactorFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.compactorLabels" . | nindent 4 }} 9 | app.kubernetes.io/part-of: memberlist 10 | annotations: 11 | {{- toYaml .Values.compactor.annotations | nindent 4 }} 12 | spec: 13 | replicas: {{ .Values.compactor.replicas }} 14 | selector: 15 | matchLabels: 16 | {{- include "cortex.compactorSelectorLabels" . | nindent 6 }} 17 | updateStrategy: 18 | {{- toYaml .Values.compactor.strategy | nindent 4 }} 19 | serviceName: {{ template "cortex.fullname" . }}-compactor 20 | {{- if .Values.compactor.persistentVolume.enabled }} 21 | {{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.Version }} 22 | {{- with .Values.compactor.persistentVolume.retentionPolicy }} 23 | persistentVolumeClaimRetentionPolicy: 24 | {{- toYaml . | nindent 4 }} 25 | {{- end }} 26 | {{- end }} 27 | volumeClaimTemplates: 28 | - metadata: 29 | name: storage 30 | {{- if .Values.compactor.persistentVolume.annotations }} 31 | annotations: 32 | {{ toYaml .Values.compactor.persistentVolume.annotations | nindent 10 }} 33 | {{- end }} 34 | spec: 35 | {{- if .Values.compactor.persistentVolume.storageClass }} 36 | {{- if (eq "-" .Values.compactor.persistentVolume.storageClass) }} 37 | storageClassName: "" 38 | {{- else }} 39 | storageClassName: "{{ .Values.compactor.persistentVolume.storageClass }}" 40 | {{- end }} 41 | {{- end }} 42 | accessModes: 43 | {{ toYaml .Values.compactor.persistentVolume.accessModes | nindent 10 }} 44 | resources: 45 | requests: 46 | storage: "{{ .Values.compactor.persistentVolume.size }}" 47 | {{- end }} 48 | template: 49 | metadata: 50 | labels: 51 | {{- include "cortex.compactorLabels" . | nindent 8 }} 52 | app.kubernetes.io/part-of: memberlist 53 | {{- with .Values.compactor.podLabels }} 54 | {{- toYaml . | nindent 8 }} 55 | {{- end }} 56 | annotations: 57 | checksum/config: {{ include "cortex.configChecksum" . }} 58 | {{- with .Values.compactor.podAnnotations }} 59 | {{- toYaml . | nindent 8 }} 60 | {{- end }} 61 | spec: 62 | serviceAccountName: {{ .Values.compactor.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }} 63 | {{- if .Values.compactor.priorityClassName }} 64 | priorityClassName: {{ .Values.compactor.priorityClassName }} 65 | {{- end }} 66 | {{- if .Values.compactor.securityContext.enabled }} 67 | securityContext: {{- omit .Values.compactor.securityContext "enabled" | toYaml | nindent 8 }} 68 | {{- end }} 69 | initContainers: 70 | {{- toYaml .Values.compactor.initContainers | nindent 8 }} 71 | {{- if .Values.image.pullSecrets }} 72 | imagePullSecrets: 73 | {{- range .Values.image.pullSecrets }} 74 | - name: {{ . }} 75 | {{- end }} 76 | {{- end }} 77 | nodeSelector: 78 | {{- toYaml .Values.compactor.nodeSelector | nindent 8 }} 79 | {{- if .Values.compactor.topologySpreadConstraints }} 80 | topologySpreadConstraints: 81 | {{- toYaml .Values.compactor.topologySpreadConstraints | nindent 8}} 82 | {{- end }} 83 | affinity: 84 | {{- toYaml .Values.compactor.affinity | nindent 8 }} 85 | tolerations: 86 | {{- toYaml .Values.compactor.tolerations | nindent 8 }} 87 | terminationGracePeriodSeconds: {{ .Values.compactor.terminationGracePeriodSeconds }} 88 | volumes: 89 | {{- include "cortex.configVolume" . | nindent 8 }} 90 | - name: runtime-config 91 | configMap: 92 | name: {{ template "cortex.fullname" . }}-runtime-config 93 | {{- if not .Values.compactor.persistentVolume.enabled }} 94 | - name: storage 95 | emptyDir: {} 96 | {{- end }} 97 | {{- if .Values.compactor.extraVolumes }} 98 | {{- toYaml .Values.compactor.extraVolumes | nindent 8 }} 99 | {{- end }} 100 | containers: 101 | {{- if .Values.compactor.extraContainers }} 102 | {{ toYaml .Values.compactor.extraContainers | nindent 8 }} 103 | {{- end }} 104 | - name: compactor 105 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" 106 | imagePullPolicy: {{ .Values.image.pullPolicy }} 107 | args: 108 | - "-target=compactor" 109 | - "-config.file=/etc/cortex/cortex.yaml" 110 | {{- include "cortex.memcached" . | nindent 12}} 111 | {{- range $key, $value := .Values.compactor.extraArgs }} 112 | - "-{{ $key }}={{ $value }}" 113 | {{- end }} 114 | volumeMounts: 115 | {{- if .Values.compactor.extraVolumeMounts }} 116 | {{- toYaml .Values.compactor.extraVolumeMounts | nindent 12}} 117 | {{- end }} 118 | - name: config 119 | mountPath: /etc/cortex 120 | - name: runtime-config 121 | mountPath: /etc/cortex-runtime-config 122 | - name: storage 123 | mountPath: "/data" 124 | {{- if .Values.compactor.persistentVolume.subPath }} 125 | subPath: {{ .Values.compactor.persistentVolume.subPath }} 126 | {{- end }} 127 | ports: 128 | - name: http-metrics 129 | containerPort: {{ .Values.config.server.http_listen_port }} 130 | protocol: TCP 131 | - name: gossip 132 | containerPort: {{ .Values.config.memberlist.bind_port }} 133 | protocol: TCP 134 | startupProbe: 135 | {{- toYaml .Values.compactor.startupProbe | nindent 12 }} 136 | {{- if .Values.compactor.livenessProbe }} 137 | livenessProbe: 138 | {{- toYaml .Values.compactor.livenessProbe | nindent 12 }} 139 | {{- end }} 140 | readinessProbe: 141 | {{- toYaml .Values.compactor.readinessProbe | nindent 12 }} 142 | resources: 143 | {{- toYaml .Values.compactor.resources | nindent 12 }} 144 | {{- if .Values.compactor.containerSecurityContext.enabled }} 145 | securityContext: {{- omit .Values.compactor.containerSecurityContext "enabled" | toYaml | nindent 12 }} 146 | {{- end }} 147 | {{- if .Values.compactor.env }} 148 | env: 149 | {{- toYaml .Values.compactor.env | nindent 12 }} 150 | {{- end }} 151 | {{- end -}} 152 | -------------------------------------------------------------------------------- /templates/compactor/compactor-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.compactor.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.compactorFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.compactorLabels" . | nindent 4 }} 9 | {{- with .Values.compactor.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.compactor.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | ports: 17 | - port: {{ .Values.config.server.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.compactorSelectorLabels" . | nindent 4 }} 23 | {{- end -}} 24 | -------------------------------------------------------------------------------- /templates/configmap.yaml: -------------------------------------------------------------------------------- 1 | {{- if (and (not .Values.useExternalConfig) (.Values.useConfigMap)) }} 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: {{ template "cortex.fullname" . }}-config 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.labels" . | nindent 4 }} 9 | data: 10 | cortex.yaml: | 11 | {{- tpl (toYaml .Values.config) . | nindent 4 }} 12 | {{- end }} 13 | -------------------------------------------------------------------------------- /templates/distributor/_helpers-distributor.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | distributor fullname 4 | */}} 5 | {{- define "cortex.distributorFullname" -}} 6 | {{ include "cortex.fullname" . }}-distributor 7 | {{- end }} 8 | 9 | {{/* 10 | distributor common labels 11 | */}} 12 | {{- define "cortex.distributorLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: distributor 15 | {{- end }} 16 | 17 | {{/* 18 | distributor selector labels 19 | */}} 20 | {{- define "cortex.distributorSelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: distributor 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/distributor/distributor-dep.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.distributor.enabled -}} 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: {{ include "cortex.distributorFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.distributorLabels" . | nindent 4 }} 9 | app.kubernetes.io/part-of: memberlist 10 | annotations: 11 | {{- toYaml .Values.distributor.annotations | nindent 4 }} 12 | spec: 13 | {{- if not .Values.distributor.autoscaling.enabled }} 14 | replicas: {{ .Values.distributor.replicas }} 15 | {{- end }} 16 | selector: 17 | matchLabels: 18 | {{- include "cortex.distributorSelectorLabels" . | nindent 6 }} 19 | strategy: 20 | {{- toYaml .Values.distributor.strategy | nindent 4 }} 21 | template: 22 | metadata: 23 | labels: 24 | {{- include "cortex.distributorLabels" . | nindent 8 }} 25 | app.kubernetes.io/part-of: memberlist 26 | {{- with .Values.distributor.podLabels }} 27 | {{- toYaml . | nindent 8 }} 28 | {{- end }} 29 | annotations: 30 | checksum/config: {{ include "cortex.configChecksum" . }} 31 | {{- with .Values.distributor.podAnnotations }} 32 | {{- toYaml . | nindent 8 }} 33 | {{- end }} 34 | spec: 35 | serviceAccountName: {{ .Values.distributor.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }} 36 | {{- if .Values.distributor.priorityClassName }} 37 | priorityClassName: {{ .Values.distributor.priorityClassName }} 38 | {{- end }} 39 | {{- if .Values.distributor.securityContext.enabled }} 40 | securityContext: {{- omit .Values.distributor.securityContext "enabled" | toYaml | nindent 8 }} 41 | {{- end }} 42 | initContainers: 43 | {{- toYaml .Values.distributor.initContainers | nindent 8 }} 44 | {{- if .Values.image.pullSecrets }} 45 | imagePullSecrets: 46 | {{- range .Values.image.pullSecrets }} 47 | - name: {{ . }} 48 | {{- end }} 49 | {{- end }} 50 | containers: 51 | - name: distributor 52 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" 53 | imagePullPolicy: {{ .Values.image.pullPolicy }} 54 | args: 55 | - "-target=distributor" 56 | - "-config.file=/etc/cortex/cortex.yaml" 57 | {{- range $key, $value := .Values.distributor.extraArgs }} 58 | - "-{{ $key }}={{ $value }}" 59 | {{- end }} 60 | volumeMounts: 61 | {{- if .Values.distributor.extraVolumeMounts }} 62 | {{- toYaml .Values.distributor.extraVolumeMounts | nindent 12}} 63 | {{- end }} 64 | - name: config 65 | mountPath: /etc/cortex 66 | - name: runtime-config 67 | mountPath: /etc/cortex-runtime-config 68 | - name: storage 69 | mountPath: "/data" 70 | subPath: {{ .Values.distributor.persistentVolume.subPath }} 71 | ports: 72 | - name: http-metrics 73 | containerPort: {{ .Values.config.server.http_listen_port }} 74 | protocol: TCP 75 | - name: gossip 76 | containerPort: {{ .Values.config.memberlist.bind_port }} 77 | protocol: TCP 78 | - name: grpc 79 | containerPort: {{ .Values.config.server.grpc_listen_port }} 80 | protocol: TCP 81 | startupProbe: 82 | {{- toYaml .Values.distributor.startupProbe | nindent 12 }} 83 | livenessProbe: 84 | {{- toYaml .Values.distributor.livenessProbe | nindent 12 }} 85 | readinessProbe: 86 | {{- toYaml .Values.distributor.readinessProbe | nindent 12 }} 87 | resources: 88 | {{- toYaml .Values.distributor.resources | nindent 12 }} 89 | {{- if .Values.distributor.containerSecurityContext.enabled }} 90 | securityContext: {{- omit .Values.distributor.containerSecurityContext "enabled" | toYaml | nindent 12 }} 91 | {{- end }} 92 | {{- if .Values.distributor.env }} 93 | env: 94 | {{- toYaml .Values.distributor.env | nindent 12 }} 95 | {{- end }} 96 | {{- with .Values.distributor.lifecycle }} 97 | lifecycle: 98 | {{- toYaml . | nindent 12 }} 99 | {{- end }} 100 | {{- if .Values.distributor.extraContainers }} 101 | {{- toYaml .Values.distributor.extraContainers | nindent 8}} 102 | {{- end }} 103 | nodeSelector: 104 | {{- toYaml .Values.distributor.nodeSelector | nindent 8 }} 105 | {{- if .Values.distributor.topologySpreadConstraints }} 106 | topologySpreadConstraints: 107 | {{- toYaml .Values.distributor.topologySpreadConstraints | nindent 8}} 108 | {{- end }} 109 | affinity: 110 | {{- toYaml .Values.distributor.affinity | nindent 8 }} 111 | tolerations: 112 | {{- toYaml .Values.distributor.tolerations | nindent 8 }} 113 | terminationGracePeriodSeconds: {{ .Values.distributor.terminationGracePeriodSeconds }} 114 | volumes: 115 | {{- include "cortex.configVolume" . | nindent 8 }} 116 | - name: runtime-config 117 | configMap: 118 | name: {{ template "cortex.fullname" . }}-runtime-config 119 | - name: storage 120 | emptyDir: {} 121 | {{- if .Values.distributor.extraVolumes }} 122 | {{- toYaml .Values.distributor.extraVolumes | nindent 8}} 123 | {{- end }} 124 | {{- end }} 125 | -------------------------------------------------------------------------------- /templates/distributor/distributor-hpa.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.distributor.enabled .Values.distributor.autoscaling.enabled }} 2 | {{- with .Values.distributor.autoscaling -}} 3 | apiVersion: {{ include "cortex.hpaVersion" $ }} 4 | kind: HorizontalPodAutoscaler 5 | metadata: 6 | name: {{ include "cortex.distributorFullname" $ }} 7 | namespace: {{ $.Release.Namespace }} 8 | labels: 9 | {{- include "cortex.distributorLabels" $ | nindent 4 }} 10 | spec: 11 | scaleTargetRef: 12 | apiVersion: apps/v1 13 | kind: Deployment 14 | name: {{ include "cortex.distributorFullname" $ }} 15 | minReplicas: {{ .minReplicas }} 16 | maxReplicas: {{ .maxReplicas }} 17 | metrics: 18 | {{- with .targetMemoryUtilizationPercentage }} 19 | - type: Resource 20 | resource: 21 | name: memory 22 | target: 23 | type: Utilization 24 | averageUtilization: {{ . }} 25 | {{- end }} 26 | {{- with .targetCPUUtilizationPercentage }} 27 | - type: Resource 28 | resource: 29 | name: cpu 30 | target: 31 | type: Utilization 32 | averageUtilization: {{ . }} 33 | {{- end }} 34 | {{- with .extraMetrics }} 35 | {{- toYaml . | nindent 4 }} 36 | {{- end }} 37 | {{- with .behavior }} 38 | behavior: 39 | {{- toYaml . | nindent 4 }} 40 | {{- end }} 41 | {{- end }} 42 | {{- end }} 43 | -------------------------------------------------------------------------------- /templates/distributor/distributor-poddisruptionbudget.yaml: -------------------------------------------------------------------------------- 1 | {{- if and (gt (int .Values.distributor.replicas) 1) (.Values.distributor.podDisruptionBudget) (.Values.distributor.enabled) }} 2 | apiVersion: {{ include "cortex.pdbVersion" . }} 3 | kind: PodDisruptionBudget 4 | metadata: 5 | name: {{ include "cortex.distributorFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.distributorLabels" . | nindent 4 }} 9 | spec: 10 | selector: 11 | matchLabels: 12 | {{- include "cortex.distributorSelectorLabels" . | nindent 6 }} 13 | {{- toYaml .Values.distributor.podDisruptionBudget | nindent 2 }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /templates/distributor/distributor-servicemonitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.distributor.serviceMonitor.enabled .Values.distributor.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "cortex.distributorFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.distributorLabels" . | nindent 4 }} 9 | {{- if .Values.distributor.serviceMonitor.additionalLabels }} 10 | {{ toYaml .Values.distributor.serviceMonitor.additionalLabels | indent 4 }} 11 | {{- end }} 12 | {{- if .Values.distributor.serviceMonitor.annotations }} 13 | annotations: 14 | {{ toYaml .Values.distributor.serviceMonitor.annotations | indent 4 }} 15 | {{- end }} 16 | spec: 17 | selector: 18 | matchLabels: 19 | {{- include "cortex.distributorSelectorLabels" . | nindent 6 }} 20 | namespaceSelector: 21 | matchNames: 22 | - {{ .Release.Namespace | quote }} 23 | {{- if .Values.distributor.serviceMonitor.podTargetLabels }} 24 | podTargetLabels: 25 | {{- range .Values.distributor.serviceMonitor.podTargetLabels }} 26 | - {{ . }} 27 | {{- end }} 28 | {{- end }} 29 | endpoints: 30 | - port: http-metrics 31 | {{- if .Values.distributor.serviceMonitor.interval }} 32 | interval: {{ .Values.distributor.serviceMonitor.interval }} 33 | {{- end }} 34 | {{- if .Values.distributor.serviceMonitor.scrapeTimeout }} 35 | scrapeTimeout: {{ .Values.distributor.serviceMonitor.scrapeTimeout }} 36 | {{- end }} 37 | {{- if .Values.distributor.serviceMonitor.relabelings }} 38 | relabelings: 39 | {{- toYaml .Values.distributor.serviceMonitor.relabelings | nindent 4 }} 40 | {{- end }} 41 | {{- if .Values.distributor.serviceMonitor.metricRelabelings }} 42 | metricRelabelings: 43 | {{- toYaml .Values.distributor.serviceMonitor.metricRelabelings | nindent 4 }} 44 | {{- end }} 45 | {{- with .Values.distributor.serviceMonitor.extraEndpointSpec }} 46 | {{- toYaml . | nindent 4 }} 47 | {{- end }} 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /templates/distributor/distributor-svc-headless.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.distributor.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.distributorFullname" . }}-headless 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.distributorLabels" . | nindent 4 }} 9 | {{- with .Values.distributor.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.distributor.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | clusterIP: None 17 | publishNotReadyAddresses: true 18 | ports: 19 | - port: {{ .Values.config.server.grpc_listen_port }} 20 | protocol: TCP 21 | name: grpc 22 | targetPort: grpc 23 | selector: 24 | {{- include "cortex.distributorSelectorLabels" . | nindent 4 }} 25 | {{- end }} -------------------------------------------------------------------------------- /templates/distributor/distributor-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.distributor.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.distributorFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.distributorLabels" . | nindent 4 }} 9 | {{- with .Values.distributor.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.distributor.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | ports: 17 | - port: {{ .Values.config.server.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.distributorSelectorLabels" . | nindent 4 }} 23 | {{- end }} -------------------------------------------------------------------------------- /templates/ingester/_helpers-ingester.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | ingester fullname 4 | */}} 5 | {{- define "cortex.ingesterFullname" -}} 6 | {{ include "cortex.fullname" . }}-ingester 7 | {{- end }} 8 | 9 | {{/* 10 | ingester common labels 11 | */}} 12 | {{- define "cortex.ingesterLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: ingester 15 | {{- end }} 16 | 17 | {{/* 18 | ingester selector labels 19 | */}} 20 | {{- define "cortex.ingesterSelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: ingester 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/ingester/ingester-dep.yaml: -------------------------------------------------------------------------------- 1 | {{- if and (not .Values.ingester.statefulSet.enabled) .Values.ingester.enabled -}} 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: {{ include "cortex.ingesterFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.ingesterLabels" . | nindent 4 }} 9 | app.kubernetes.io/part-of: memberlist 10 | annotations: 11 | {{- toYaml .Values.ingester.annotations | nindent 4 }} 12 | spec: 13 | {{- if not .Values.ingester.autoscaling.enabled }} 14 | replicas: {{ .Values.ingester.replicas }} 15 | {{- end }} 16 | selector: 17 | matchLabels: 18 | {{- include "cortex.ingesterSelectorLabels" . | nindent 6 }} 19 | strategy: 20 | {{- toYaml .Values.ingester.strategy | nindent 4 }} 21 | template: 22 | metadata: 23 | labels: 24 | {{- include "cortex.ingesterLabels" . | nindent 8 }} 25 | app.kubernetes.io/part-of: memberlist 26 | {{- with .Values.ingester.podLabels }} 27 | {{- toYaml . | nindent 8 }} 28 | {{- end }} 29 | annotations: 30 | checksum/config: {{ include "cortex.configChecksum" . }} 31 | {{- with .Values.ingester.podAnnotations }} 32 | {{- toYaml . | nindent 8 }} 33 | {{- end }} 34 | spec: 35 | serviceAccountName: {{ .Values.ingester.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }} 36 | {{- if .Values.ingester.priorityClassName }} 37 | priorityClassName: {{ .Values.ingester.priorityClassName }} 38 | {{- end }} 39 | {{- if .Values.ingester.securityContext.enabled }} 40 | securityContext: {{- omit .Values.ingester.securityContext "enabled" | toYaml | nindent 8 }} 41 | {{- end }} 42 | initContainers: 43 | {{- toYaml .Values.ingester.initContainers | nindent 8 }} 44 | {{- if .Values.image.pullSecrets }} 45 | imagePullSecrets: 46 | {{- range .Values.image.pullSecrets }} 47 | - name: {{ . }} 48 | {{- end }} 49 | {{- end }} 50 | containers: 51 | - name: ingester 52 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" 53 | imagePullPolicy: {{ .Values.image.pullPolicy }} 54 | args: 55 | - "-target=ingester" 56 | - "-config.file=/etc/cortex/cortex.yaml" 57 | {{- include "cortex.memcached" . | nindent 12}} 58 | {{- range $key, $value := .Values.ingester.extraArgs }} 59 | - "-{{ $key }}={{ $value }}" 60 | {{- end }} 61 | volumeMounts: 62 | {{- if .Values.ingester.extraVolumeMounts }} 63 | {{- toYaml .Values.ingester.extraVolumeMounts | nindent 12}} 64 | {{- end }} 65 | - name: config 66 | mountPath: /etc/cortex 67 | - name: runtime-config 68 | mountPath: /etc/cortex-runtime-config 69 | - name: storage 70 | mountPath: "/data" 71 | {{- with .Values.ingester.persistentVolume.subPath }} 72 | subPath: {{ . }} 73 | {{- end }} 74 | ports: 75 | - name: http-metrics 76 | containerPort: {{ .Values.config.server.http_listen_port }} 77 | protocol: TCP 78 | - name: grpc 79 | containerPort: {{ .Values.config.server.grpc_listen_port }} 80 | protocol: TCP 81 | - name: gossip 82 | containerPort: {{ .Values.config.memberlist.bind_port }} 83 | protocol: TCP 84 | {{- if .Values.ingester.startupProbe }} 85 | startupProbe: 86 | {{- toYaml .Values.ingester.startupProbe | nindent 12 }} 87 | {{- end }} 88 | {{- if .Values.ingester.livenessProbe }} 89 | livenessProbe: 90 | {{- toYaml .Values.ingester.livenessProbe | nindent 12 }} 91 | {{- end }} 92 | readinessProbe: 93 | {{- toYaml .Values.ingester.readinessProbe | nindent 12 }} 94 | resources: 95 | {{- toYaml .Values.ingester.resources | nindent 12 }} 96 | {{- if .Values.ingester.containerSecurityContext.enabled }} 97 | securityContext: {{- omit .Values.ingester.containerSecurityContext "enabled" | toYaml | nindent 12 }} 98 | {{- end }} 99 | env: 100 | {{- if .Values.ingester.env }} 101 | {{ toYaml .Values.ingester.env | nindent 12 }} 102 | {{- end }} 103 | {{- with .Values.ingester.lifecycle }} 104 | lifecycle: 105 | {{- toYaml . | nindent 12 }} 106 | {{- end }} 107 | {{- with .Values.ingester.extraContainers }} 108 | {{- toYaml . | nindent 8 }} 109 | {{- end }} 110 | nodeSelector: 111 | {{- toYaml .Values.ingester.nodeSelector | nindent 8 }} 112 | {{- if .Values.ingester.topologySpreadConstraints }} 113 | topologySpreadConstraints: 114 | {{- toYaml .Values.ingester.topologySpreadConstraints | nindent 8}} 115 | {{- end }} 116 | affinity: 117 | {{- toYaml .Values.ingester.affinity | nindent 8 }} 118 | tolerations: 119 | {{- toYaml .Values.ingester.tolerations | nindent 8 }} 120 | terminationGracePeriodSeconds: {{ .Values.ingester.terminationGracePeriodSeconds }} 121 | volumes: 122 | {{- include "cortex.configVolume" . | nindent 8 }} 123 | - name: runtime-config 124 | configMap: 125 | name: {{ template "cortex.fullname" . }}-runtime-config 126 | - name: storage 127 | emptyDir: {} 128 | {{- if .Values.ingester.extraVolumes }} 129 | {{- toYaml .Values.ingester.extraVolumes | nindent 8}} 130 | {{- end }} 131 | {{- end -}} 132 | -------------------------------------------------------------------------------- /templates/ingester/ingester-hpa.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.ingester.enabled .Values.ingester.autoscaling.enabled -}} 2 | {{- with .Values.ingester.autoscaling -}} 3 | apiVersion: {{ include "cortex.hpaVersion" $ }} 4 | kind: HorizontalPodAutoscaler 5 | metadata: 6 | name: {{ include "cortex.ingesterFullname" $ }} 7 | namespace: {{ $.Release.Namespace }} 8 | labels: 9 | {{- include "cortex.ingesterLabels" $ | nindent 4 }} 10 | spec: 11 | scaleTargetRef: 12 | apiVersion: apps/v1 13 | kind: {{ if $.Values.ingester.statefulSet.enabled }}StatefulSet{{ else }}Deployment{{ end }} 14 | name: {{ include "cortex.ingesterFullname" $ }} 15 | minReplicas: {{ .minReplicas }} 16 | maxReplicas: {{ .maxReplicas }} 17 | metrics: 18 | - type: Resource 19 | resource: 20 | name: memory 21 | target: 22 | type: Utilization 23 | averageUtilization: {{ .targetMemoryUtilizationPercentage }} 24 | {{- with .extraMetrics }} 25 | {{- toYaml . | nindent 4 }} 26 | {{- end }} 27 | {{- with .behavior }} 28 | behavior: 29 | {{- toYaml . | nindent 4 }} 30 | {{- end }} 31 | {{- end }} 32 | {{- end }} 33 | -------------------------------------------------------------------------------- /templates/ingester/ingester-poddisruptionbudget.yaml: -------------------------------------------------------------------------------- 1 | {{- if and (gt (int .Values.ingester.replicas) 1) (.Values.ingester.podDisruptionBudget) (.Values.ingester.enabled) }} 2 | apiVersion: {{ include "cortex.pdbVersion" . }} 3 | kind: PodDisruptionBudget 4 | metadata: 5 | name: {{ include "cortex.ingesterFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.ingesterLabels" . | nindent 4 }} 9 | spec: 10 | selector: 11 | matchLabels: 12 | {{- include "cortex.ingesterSelectorLabels" . | nindent 6 }} 13 | {{- toYaml .Values.ingester.podDisruptionBudget | nindent 2 }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /templates/ingester/ingester-servicemonitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.ingester.serviceMonitor.enabled .Values.ingester.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "cortex.ingesterFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.ingesterLabels" . | nindent 4 }} 9 | {{- if .Values.ingester.serviceMonitor.additionalLabels }} 10 | {{ toYaml .Values.ingester.serviceMonitor.additionalLabels | indent 4 }} 11 | {{- end }} 12 | {{- if .Values.ingester.serviceMonitor.annotations }} 13 | annotations: 14 | {{ toYaml .Values.ingester.serviceMonitor.annotations | indent 4 }} 15 | {{- end }} 16 | spec: 17 | selector: 18 | matchLabels: 19 | {{- include "cortex.ingesterSelectorLabels" . | nindent 6 }} 20 | namespaceSelector: 21 | matchNames: 22 | - {{ .Release.Namespace | quote }} 23 | {{- if .Values.ingester.serviceMonitor.podTargetLabels }} 24 | podTargetLabels: 25 | {{- range .Values.ingester.serviceMonitor.podTargetLabels }} 26 | - {{ . }} 27 | {{- end }} 28 | {{- end }} 29 | endpoints: 30 | - port: http-metrics 31 | {{- if .Values.ingester.serviceMonitor.interval }} 32 | interval: {{ .Values.ingester.serviceMonitor.interval }} 33 | {{- end }} 34 | {{- if .Values.ingester.serviceMonitor.scrapeTimeout }} 35 | scrapeTimeout: {{ .Values.ingester.serviceMonitor.scrapeTimeout }} 36 | {{- end }} 37 | {{- if .Values.ingester.serviceMonitor.relabelings }} 38 | relabelings: 39 | {{- toYaml .Values.ingester.serviceMonitor.relabelings | nindent 4 }} 40 | {{- end }} 41 | {{- if .Values.ingester.serviceMonitor.metricRelabelings }} 42 | metricRelabelings: 43 | {{- toYaml .Values.ingester.serviceMonitor.metricRelabelings | nindent 4 }} 44 | {{- end }} 45 | {{- with .Values.ingester.serviceMonitor.extraEndpointSpec }} 46 | {{- toYaml . | nindent 4 }} 47 | {{- end }} 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /templates/ingester/ingester-statefulset.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.ingester.statefulSet.enabled .Values.ingester.enabled -}} 2 | apiVersion: apps/v1 3 | kind: StatefulSet 4 | metadata: 5 | name: {{ include "cortex.ingesterFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.ingesterLabels" . | nindent 4 }} 9 | app.kubernetes.io/part-of: memberlist 10 | annotations: 11 | {{- toYaml .Values.ingester.annotations | nindent 4 }} 12 | spec: 13 | {{- if not .Values.ingester.autoscaling.enabled }} 14 | replicas: {{ .Values.ingester.replicas }} 15 | {{- end }} 16 | selector: 17 | matchLabels: 18 | {{- include "cortex.ingesterSelectorLabels" . | nindent 6 }} 19 | updateStrategy: 20 | {{- toYaml .Values.ingester.statefulStrategy | nindent 4 }} 21 | podManagementPolicy: "{{ .Values.ingester.statefulSet.podManagementPolicy }}" 22 | serviceName: {{ template "cortex.fullname" . }}-ingester-headless 23 | {{- if .Values.ingester.persistentVolume.enabled }} 24 | {{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.Version }} 25 | {{- with .Values.ingester.persistentVolume.retentionPolicy }} 26 | persistentVolumeClaimRetentionPolicy: 27 | {{- toYaml . | nindent 4 }} 28 | {{- end }} 29 | {{- end }} 30 | volumeClaimTemplates: 31 | - metadata: 32 | name: storage 33 | {{- if .Values.ingester.persistentVolume.annotations }} 34 | annotations: 35 | {{ toYaml .Values.ingester.persistentVolume.annotations | nindent 10 }} 36 | {{- end }} 37 | spec: 38 | {{- if .Values.ingester.persistentVolume.storageClass }} 39 | {{- if (eq "-" .Values.ingester.persistentVolume.storageClass) }} 40 | storageClassName: "" 41 | {{- else }} 42 | storageClassName: "{{ .Values.ingester.persistentVolume.storageClass }}" 43 | {{- end }} 44 | {{- end }} 45 | accessModes: 46 | {{ toYaml .Values.ingester.persistentVolume.accessModes | nindent 10 }} 47 | resources: 48 | requests: 49 | storage: "{{ .Values.ingester.persistentVolume.size }}" 50 | {{- end }} 51 | template: 52 | metadata: 53 | labels: 54 | {{- include "cortex.ingesterLabels" . | nindent 8 }} 55 | app.kubernetes.io/part-of: memberlist 56 | {{- with .Values.ingester.podLabels }} 57 | {{- toYaml . | nindent 8 }} 58 | {{- end }} 59 | annotations: 60 | checksum/config: {{ include "cortex.configChecksum" . }} 61 | {{- with .Values.ingester.podAnnotations }} 62 | {{- toYaml . | nindent 8 }} 63 | {{- end }} 64 | spec: 65 | serviceAccountName: {{ .Values.ingester.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }} 66 | {{- if .Values.ingester.priorityClassName }} 67 | priorityClassName: {{ .Values.ingester.priorityClassName }} 68 | {{- end }} 69 | {{- if .Values.ingester.securityContext.enabled }} 70 | securityContext: {{- omit .Values.ingester.securityContext "enabled" | toYaml | nindent 8 }} 71 | {{- end }} 72 | initContainers: 73 | {{- toYaml .Values.ingester.initContainers | nindent 8 }} 74 | {{- if .Values.image.pullSecrets }} 75 | imagePullSecrets: 76 | {{- range .Values.image.pullSecrets }} 77 | - name: {{ . }} 78 | {{- end }} 79 | {{- end }} 80 | nodeSelector: 81 | {{- toYaml .Values.ingester.nodeSelector | nindent 8 }} 82 | {{- if .Values.ingester.topologySpreadConstraints }} 83 | topologySpreadConstraints: 84 | {{- toYaml .Values.ingester.topologySpreadConstraints | nindent 8}} 85 | {{- end }} 86 | affinity: 87 | {{- toYaml .Values.ingester.affinity | nindent 8 }} 88 | tolerations: 89 | {{- toYaml .Values.ingester.tolerations | nindent 8 }} 90 | terminationGracePeriodSeconds: {{ .Values.ingester.terminationGracePeriodSeconds }} 91 | volumes: 92 | {{- include "cortex.configVolume" . | nindent 8 }} 93 | - name: runtime-config 94 | configMap: 95 | name: {{ template "cortex.fullname" . }}-runtime-config 96 | {{- if not .Values.ingester.persistentVolume.enabled }} 97 | - name: storage 98 | emptyDir: {} 99 | {{- end }} 100 | {{- if .Values.ingester.extraVolumes }} 101 | {{- toYaml .Values.ingester.extraVolumes | nindent 8 }} 102 | {{- end }} 103 | containers: 104 | {{- if .Values.ingester.extraContainers }} 105 | {{- toYaml .Values.ingester.extraContainers | nindent 8 }} 106 | {{- end }} 107 | - name: ingester 108 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" 109 | imagePullPolicy: {{ .Values.image.pullPolicy }} 110 | args: 111 | - "-target=ingester" 112 | - "-config.file=/etc/cortex/cortex.yaml" 113 | {{- include "cortex.memcached" . | nindent 12}} 114 | {{- range $key, $value := .Values.ingester.extraArgs }} 115 | - "-{{ $key }}={{ $value }}" 116 | {{- end }} 117 | volumeMounts: 118 | {{- if .Values.ingester.extraVolumeMounts }} 119 | {{- toYaml .Values.ingester.extraVolumeMounts | nindent 12}} 120 | {{- end }} 121 | - name: config 122 | mountPath: /etc/cortex 123 | - name: runtime-config 124 | mountPath: /etc/cortex-runtime-config 125 | - name: storage 126 | mountPath: "/data" 127 | {{- with .Values.ingester.persistentVolume.subPath }} 128 | subPath: {{ . }} 129 | {{- end }} 130 | ports: 131 | - name: http-metrics 132 | containerPort: {{ .Values.config.server.http_listen_port }} 133 | protocol: TCP 134 | - name: grpc 135 | containerPort: {{ .Values.config.server.grpc_listen_port }} 136 | protocol: TCP 137 | - name: gossip 138 | containerPort: {{ .Values.config.memberlist.bind_port }} 139 | protocol: TCP 140 | {{- if .Values.ingester.startupProbe }} 141 | startupProbe: 142 | {{- toYaml .Values.ingester.startupProbe | nindent 12 }} 143 | {{- end }} 144 | {{- if .Values.ingester.livenessProbe }} 145 | livenessProbe: 146 | {{- toYaml .Values.ingester.livenessProbe | nindent 12 }} 147 | {{- end }} 148 | readinessProbe: 149 | {{- toYaml .Values.ingester.readinessProbe | nindent 12 }} 150 | resources: 151 | {{- toYaml .Values.ingester.resources | nindent 12 }} 152 | {{- if .Values.ingester.containerSecurityContext.enabled }} 153 | securityContext: {{- omit .Values.ingester.containerSecurityContext "enabled" | toYaml | nindent 12 }} 154 | {{- end }} 155 | {{- if .Values.ingester.env }} 156 | env: 157 | {{- toYaml .Values.ingester.env | nindent 12 }} 158 | {{- end }} 159 | {{- with .Values.ingester.lifecycle }} 160 | lifecycle: 161 | {{- toYaml . | nindent 12 }} 162 | {{- end }} 163 | {{- end -}} 164 | -------------------------------------------------------------------------------- /templates/ingester/ingester-svc-headless.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.ingester.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.ingesterFullname" . }}-headless 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.ingesterLabels" . | nindent 4 }} 9 | {{- with .Values.ingester.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.ingester.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | clusterIP: None 17 | ports: 18 | - port: {{ .Values.config.server.grpc_listen_port }} 19 | protocol: TCP 20 | name: grpc 21 | targetPort: grpc 22 | selector: 23 | {{- include "cortex.ingesterSelectorLabels" . | nindent 4 }} 24 | {{- end }} -------------------------------------------------------------------------------- /templates/ingester/ingester-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.ingester.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.ingesterFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.ingesterLabels" . | nindent 4 }} 9 | {{- with .Values.ingester.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.ingester.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | ports: 17 | - port: {{ .Values.config.server.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.ingesterSelectorLabels" . | nindent 4 }} 23 | {{- end }} -------------------------------------------------------------------------------- /templates/nginx/_helpers-nginx.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | nginx fullname 4 | */}} 5 | {{- define "cortex.nginxFullname" -}} 6 | {{ include "cortex.fullname" . }}-nginx 7 | {{- end }} 8 | 9 | {{/* 10 | nginx common labels 11 | */}} 12 | {{- define "cortex.nginxLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: nginx 15 | {{- end }} 16 | 17 | {{/* 18 | nginx selector labels 19 | */}} 20 | {{- define "cortex.nginxSelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: nginx 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/nginx/nginx-config.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.nginx.enabled }} 2 | {{- $rootDomain := printf "%s.svc.%s:%d" .Release.Namespace .Values.clusterDomain (.Values.config.server.http_listen_port | int) }} 3 | kind: ConfigMap 4 | apiVersion: v1 5 | metadata: 6 | name: {{ include "cortex.nginxFullname" . }} 7 | namespace: {{ .Release.Namespace }} 8 | labels: 9 | {{- include "cortex.nginxLabels" . | nindent 4 }} 10 | data: 11 | nginx.conf: |- 12 | worker_processes 5; ## Default: 1 13 | error_log /dev/stderr; 14 | pid /tmp/nginx.pid; 15 | worker_rlimit_nofile 8192; 16 | 17 | events { 18 | worker_connections 4096; ## Default: 1024 19 | } 20 | 21 | {{- with .Values.nginx.config.mainSnippet }} 22 | {{ tpl . $ | nindent 4 }} 23 | {{- end }} 24 | 25 | http { 26 | default_type application/octet-stream; 27 | client_max_body_size {{.Values.nginx.config.client_max_body_size}}; 28 | log_format main '$remote_addr - $remote_user [$time_local] $status ' 29 | '"$request" $body_bytes_sent "$http_referer" ' 30 | '"$http_user_agent" "$http_x_forwarded_for" $http_x_scope_orgid'; 31 | 32 | {{- if .Values.nginx.config.verboseLogging }} 33 | access_log /dev/stderr main; 34 | {{- else }} 35 | map $status $loggable { 36 | ~^[23] 0; 37 | default 1; 38 | } 39 | access_log /dev/stderr main if=$loggable; 40 | {{- end }} 41 | 42 | sendfile on; 43 | tcp_nopush on; 44 | resolver {{ default (printf "kube-dns.kube-system.svc.%s" .Values.clusterDomain ) .Values.nginx.config.dnsResolver }}{{- if .Values.nginx.config.dnsTTL }} valid={{ .Values.nginx.config.dnsTTL }}{{- end }}; 45 | 46 | {{- with .Values.nginx.config.httpSnippet }} 47 | {{ tpl . $ | nindent 6 }} 48 | {{- end }} 49 | 50 | server { # simple reverse-proxy 51 | listen {{ .Values.nginx.http_listen_port }}; 52 | proxy_connect_timeout 300s; 53 | proxy_send_timeout 300s; 54 | proxy_read_timeout 300s; 55 | proxy_http_version 1.1; 56 | 57 | {{- range $key, $value := .Values.nginx.config.setHeaders }} 58 | proxy_set_header {{ $key }} {{ $value }}; 59 | {{- end }} 60 | 61 | {{ if .Values.nginx.config.basicAuthSecretName -}} 62 | auth_basic "Restricted Content"; 63 | auth_basic_user_file /etc/apache2/.htpasswd; 64 | {{- end }} 65 | 66 | {{- with .Values.nginx.config.serverSnippet }} 67 | {{ tpl . $ | nindent 8 }} 68 | {{- end }} 69 | 70 | location = /healthz { 71 | # auth_basic off is not set here, even when a basic auth directive is 72 | # included in the server block, as Nginx's NGX_HTTP_REWRITE_PHASE 73 | # (point when this return statement is evaluated) comes before the 74 | # NGX_HTTP_ACCESS_PHASE (point when basic auth is evaluated). Thus, 75 | # this return statement returns a response before basic auth is 76 | # evaluated. 77 | return 200 'alive'; 78 | } 79 | 80 | {{- if .Values.distributor.enabled }} 81 | 82 | # Distributor Config 83 | location = /ring { 84 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-distributor.{{ $rootDomain }}$request_uri; 85 | } 86 | 87 | location = /all_user_stats { 88 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-distributor.{{ $rootDomain }}$request_uri; 89 | } 90 | {{- $push_endpoint := .Values.nginx.config.override_push_endpoint | default (printf "%s://%s-distributor.%s" .Values.nginx.config.upstream_protocol (include "cortex.fullname" .) $rootDomain) }} 91 | # Push API endpoints 92 | location = /api/prom/push { 93 | proxy_pass {{ $push_endpoint }}$request_uri; 94 | } 95 | 96 | ## New Remote write API. Ref: https://cortexmetrics.io/docs/api/#remote-write 97 | location = /api/v1/push { 98 | proxy_pass {{ $push_endpoint }}$request_uri; 99 | } 100 | {{- end }} 101 | 102 | {{- if .Values.alertmanager.enabled }} 103 | 104 | # Alertmanager Config 105 | location ~ /api/prom/alertmanager/.* { 106 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-alertmanager.{{ $rootDomain }}$request_uri; 107 | } 108 | 109 | location ~ /api/v1/alerts { 110 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-alertmanager.{{ $rootDomain }}$request_uri; 111 | } 112 | 113 | location ~ /multitenant_alertmanager/status { 114 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-alertmanager.{{ $rootDomain }}$request_uri; 115 | } 116 | 117 | location = /api/prom/api/v1/alerts { 118 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-alertmanager.{{ $rootDomain }}/api/v1/alerts; 119 | } 120 | 121 | {{- end }} 122 | 123 | {{- if .Values.ruler.enabled }} 124 | 125 | # Ruler Config 126 | location ~ /api/v1/rules { 127 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-ruler.{{ $rootDomain }}$request_uri; 128 | } 129 | 130 | location ~ /ruler/ring { 131 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-ruler.{{ $rootDomain }}$request_uri; 132 | } 133 | 134 | location ~ /api/prom/rules { 135 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-ruler.{{ $rootDomain }}$request_uri; 136 | } 137 | 138 | {{- end }} 139 | 140 | {{- if .Values.query_frontend.enabled }} 141 | 142 | # Query Config 143 | location ~ /api/prom/.* { 144 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-query-frontend.{{ $rootDomain }}$request_uri; 145 | } 146 | 147 | ## New Query frontend APIs as per https://cortexmetrics.io/docs/api/#querier--query-frontend 148 | location ~ ^{{.Values.config.api.prometheus_http_prefix}}/api/v1/(read|metadata|labels|series|query_range|query) { 149 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-query-frontend.{{ $rootDomain }}$request_uri; 150 | } 151 | 152 | location ~ {{.Values.config.api.prometheus_http_prefix}}/api/v1/label/.* { 153 | proxy_pass {{ .Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" . }}-query-frontend.{{ $rootDomain }}$request_uri; 154 | } 155 | 156 | {{- end }} 157 | 158 | {{- if and (.Values.config.auth_enabled) (.Values.nginx.config.auth_orgs) }} 159 | # Auth orgs 160 | {{- range $org := compact .Values.nginx.config.auth_orgs | uniq }} 161 | location = /api/v1/push/{{ $org }} { 162 | proxy_set_header X-Scope-OrgID {{ $org }}; 163 | proxy_pass {{ $.Values.nginx.config.upstream_protocol }}://{{ template "cortex.fullname" $ }}-distributor.{{ $rootDomain }}/api/v1/push; 164 | } 165 | {{- end }} 166 | {{- end }} 167 | } 168 | } 169 | {{- end }} 170 | -------------------------------------------------------------------------------- /templates/nginx/nginx-dep.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.nginx.enabled }} 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: {{ include "cortex.nginxFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.nginxLabels" . | nindent 4 }} 9 | annotations: 10 | {{- toYaml .Values.nginx.annotations | nindent 4 }} 11 | spec: 12 | {{- if not .Values.nginx.autoscaling.enabled }} 13 | replicas: {{ .Values.nginx.replicas }} 14 | {{- end }} 15 | selector: 16 | matchLabels: 17 | {{- include "cortex.nginxSelectorLabels" . | nindent 6 }} 18 | strategy: 19 | {{- toYaml .Values.nginx.strategy | nindent 4 }} 20 | template: 21 | metadata: 22 | labels: 23 | {{- include "cortex.nginxLabels" . | nindent 8 }} 24 | {{- with .Values.nginx.podLabels }} 25 | {{- toYaml . | nindent 8 }} 26 | {{- end }} 27 | annotations: 28 | checksum/config: {{ include (print $.Template.BasePath "/nginx/nginx-config.yaml") . | sha256sum }} 29 | {{- with .Values.nginx.podAnnotations }} 30 | {{- toYaml . | nindent 8 }} 31 | {{- end }} 32 | spec: 33 | serviceAccountName: {{ .Values.nginx.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }} 34 | {{- if .Values.nginx.priorityClassName }} 35 | priorityClassName: {{ .Values.nginx.priorityClassName }} 36 | {{- end }} 37 | {{- if .Values.nginx.securityContext.enabled }} 38 | securityContext: {{- omit .Values.nginx.securityContext "enabled" | toYaml | nindent 8 }} 39 | {{- end }} 40 | initContainers: 41 | {{- toYaml .Values.nginx.initContainers | nindent 8 }} 42 | {{- if .Values.image.pullSecrets }} 43 | imagePullSecrets: 44 | {{- range .Values.image.pullSecrets }} 45 | - name: {{ . }} 46 | {{- end }} 47 | {{- end }} 48 | containers: 49 | - name: nginx 50 | image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}" 51 | imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} 52 | {{- if .Values.nginx.extraArgs }} 53 | args: 54 | {{- range $key, $value := .Values.nginx.extraArgs }} 55 | - "-{{ $key }}={{ $value }}" 56 | {{- end }} 57 | {{- end }} 58 | volumeMounts: 59 | {{- if .Values.nginx.extraVolumeMounts }} 60 | {{- toYaml .Values.nginx.extraVolumeMounts | nindent 12}} 61 | {{- end }} 62 | - name: config 63 | mountPath: /etc/nginx 64 | {{- if .Values.nginx.config.basicAuthSecretName }} 65 | - name: htpasswd 66 | mountPath: /etc/apache2 67 | readOnly: true 68 | {{- end }} 69 | ports: 70 | - name: http-metrics 71 | containerPort: {{ .Values.nginx.http_listen_port }} 72 | protocol: TCP 73 | startupProbe: 74 | {{- toYaml .Values.nginx.startupProbe | nindent 12 }} 75 | livenessProbe: 76 | {{- toYaml .Values.nginx.livenessProbe | nindent 12 }} 77 | readinessProbe: 78 | {{- toYaml .Values.nginx.readinessProbe | nindent 12 }} 79 | resources: 80 | {{- toYaml .Values.nginx.resources | nindent 12 }} 81 | {{- if .Values.nginx.containerSecurityContext.enabled }} 82 | securityContext: {{- omit .Values.nginx.containerSecurityContext "enabled" | toYaml | nindent 12 }} 83 | {{- end }} 84 | {{- if .Values.nginx.env }} 85 | env: 86 | {{- toYaml .Values.nginx.env | nindent 12 }} 87 | {{- end }} 88 | {{- if .Values.nginx.extraContainers }} 89 | {{- toYaml .Values.nginx.extraContainers | nindent 8}} 90 | {{- end }} 91 | nodeSelector: 92 | {{- toYaml .Values.nginx.nodeSelector | nindent 8 }} 93 | {{- if .Values.nginx.topologySpreadConstraints }} 94 | topologySpreadConstraints: 95 | {{- toYaml .Values.nginx.topologySpreadConstraints | nindent 8}} 96 | {{- end }} 97 | affinity: 98 | {{- toYaml .Values.nginx.affinity | nindent 8 }} 99 | tolerations: 100 | {{- toYaml .Values.nginx.tolerations | nindent 8 }} 101 | terminationGracePeriodSeconds: {{ .Values.nginx.terminationGracePeriodSeconds }} 102 | volumes: 103 | - name: config 104 | configMap: 105 | name: {{ template "cortex.fullname" . }}-nginx 106 | {{- if .Values.nginx.config.basicAuthSecretName }} 107 | - name: htpasswd 108 | secret: 109 | defaultMode: 420 110 | secretName: {{ .Values.nginx.config.basicAuthSecretName }} 111 | {{- end }} 112 | {{- if .Values.nginx.extraVolumes }} 113 | {{- toYaml .Values.nginx.extraVolumes | nindent 8}} 114 | {{- end }} 115 | {{- end }} 116 | -------------------------------------------------------------------------------- /templates/nginx/nginx-hpa.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.nginx.enabled .Values.nginx.autoscaling.enabled }} 2 | {{- with .Values.nginx.autoscaling -}} 3 | apiVersion: {{ include "cortex.hpaVersion" $ }} 4 | kind: HorizontalPodAutoscaler 5 | metadata: 6 | name: {{ include "cortex.nginxFullname" $ }} 7 | namespace: {{ $.Release.Namespace }} 8 | labels: 9 | {{- include "cortex.nginxLabels" $ | nindent 4 }} 10 | spec: 11 | scaleTargetRef: 12 | apiVersion: apps/v1 13 | kind: Deployment 14 | name: {{ include "cortex.nginxFullname" $ }} 15 | minReplicas: {{ .minReplicas }} 16 | maxReplicas: {{ .maxReplicas }} 17 | metrics: 18 | {{- with .targetMemoryUtilizationPercentage }} 19 | - type: Resource 20 | resource: 21 | name: memory 22 | target: 23 | type: Utilization 24 | averageUtilization: {{ . }} 25 | {{- end }} 26 | {{- with .targetCPUUtilizationPercentage }} 27 | - type: Resource 28 | resource: 29 | name: cpu 30 | target: 31 | type: Utilization 32 | averageUtilization: {{ . }} 33 | {{- end }} 34 | {{- with .extraMetrics }} 35 | {{- toYaml . | nindent 4 }} 36 | {{- end }} 37 | {{- with .behavior }} 38 | behavior: 39 | {{- toYaml . | nindent 4 }} 40 | {{- end }} 41 | {{- end }} 42 | {{- end }} 43 | -------------------------------------------------------------------------------- /templates/nginx/nginx-ingress.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.ingress.enabled .Values.nginx.enabled -}} 2 | apiVersion: networking.k8s.io/v1 3 | kind: Ingress 4 | metadata: 5 | name: {{ include "cortex.nginxFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.nginxLabels" . | nindent 4 }} 9 | annotations: 10 | {{- toYaml .Values.ingress.annotations | nindent 4 }} 11 | spec: 12 | {{- if .Values.ingress.ingressClass.enabled }} 13 | ingressClassName: {{ .Values.ingress.ingressClass.name }} 14 | {{- end }} 15 | {{- if .Values.ingress.tls }} 16 | tls: 17 | {{- range .Values.ingress.tls }} 18 | - hosts: 19 | {{- range .hosts }} 20 | - {{ . | quote }} 21 | {{- end }} 22 | secretName: {{ .secretName }} 23 | {{- end }} 24 | {{- end }} 25 | rules: 26 | {{- range .Values.ingress.hosts }} 27 | - host: {{ .host | quote }} 28 | http: 29 | paths: 30 | {{- range .paths }} 31 | - path: {{ . }} 32 | pathType: "Prefix" 33 | backend: 34 | service: 35 | name: {{ include "cortex.nginxFullname" $ }} 36 | port: 37 | number: {{ $.Values.nginx.http_listen_port }} 38 | {{- end }} 39 | {{- end }} 40 | {{- end }} 41 | -------------------------------------------------------------------------------- /templates/nginx/nginx-poddisruptionbudget.yaml: -------------------------------------------------------------------------------- 1 | {{- if and (.Values.nginx.enabled) (gt (int .Values.nginx.replicas) 1) (.Values.nginx.podDisruptionBudget) }} 2 | apiVersion: {{ include "cortex.pdbVersion" . }} 3 | kind: PodDisruptionBudget 4 | metadata: 5 | name: {{ include "cortex.nginxFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.nginxLabels" . | nindent 4 }} 9 | spec: 10 | selector: 11 | matchLabels: 12 | {{- include "cortex.nginxSelectorLabels" . | nindent 6 }} 13 | {{- toYaml .Values.nginx.podDisruptionBudget | nindent 2 }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /templates/nginx/nginx-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.nginx.enabled }} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.nginxFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.nginxLabels" . | nindent 4 }} 9 | {{- with .Values.nginx.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.nginx.service.annotations | nindent 4 }} 14 | spec: 15 | type: {{ .Values.nginx.service.type }} 16 | ports: 17 | - port: {{ .Values.nginx.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.nginxSelectorLabels" . | nindent 4 }} 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/overrides-exporter/_helpers-overrides-exporter.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | overrides-exporter fullname 4 | */}} 5 | {{- define "cortex.overridesExporterFullname" -}} 6 | {{ include "cortex.fullname" . }}-overrides-exporter 7 | {{- end }} 8 | 9 | {{/* 10 | overrides-exporter common labels 11 | */}} 12 | {{- define "cortex.overridesExporterLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: overrides-exporter 15 | {{- end }} 16 | 17 | {{/* 18 | overrides-exporter selector labels 19 | */}} 20 | {{- define "cortex.overridesExporterSelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: overrides-exporter 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/overrides-exporter/overrides-exporter-dep.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.overrides_exporter.enabled }} 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: {{ include "cortex.overridesExporterFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.overridesExporterLabels" . | nindent 4 }} 9 | annotations: 10 | {{- toYaml .Values.overrides_exporter.annotations | nindent 4 }} 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | {{- include "cortex.overridesExporterSelectorLabels" . | nindent 6 }} 16 | strategy: 17 | {{- toYaml .Values.overrides_exporter.strategy | nindent 4 }} 18 | template: 19 | metadata: 20 | labels: 21 | {{- include "cortex.overridesExporterLabels" . | nindent 8 }} 22 | {{- with .Values.overrides_exporter.podLabels }} 23 | {{- toYaml . | nindent 8 }} 24 | {{- end }} 25 | annotations: 26 | {{- if .Values.useExternalConfig }} 27 | checksum/config: {{ .Values.externalConfigVersion }} 28 | {{- else }} 29 | checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} 30 | {{- end }} 31 | {{- with .Values.overrides_exporter.podAnnotations }} 32 | {{- toYaml . | nindent 8 }} 33 | {{- end }} 34 | spec: 35 | serviceAccountName: {{ template "cortex.serviceAccountName" . }} 36 | {{- if .Values.overrides_exporter.priorityClassName }} 37 | priorityClassName: {{ .Values.overrides_exporter.priorityClassName }} 38 | {{- end }} 39 | {{- if .Values.overrides_exporter.securityContext.enabled }} 40 | securityContext: {{- omit .Values.overrides_exporter.securityContext "enabled" | toYaml | nindent 8 }} 41 | {{- end }} 42 | initContainers: 43 | {{- toYaml .Values.overrides_exporter.initContainers | nindent 8 }} 44 | {{- if .Values.image.pullSecrets }} 45 | imagePullSecrets: 46 | {{- range .Values.image.pullSecrets }} 47 | - name: {{ . }} 48 | {{- end }} 49 | {{- end }} 50 | containers: 51 | - name: overrides-exporter 52 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" 53 | imagePullPolicy: {{ .Values.image.pullPolicy }} 54 | args: 55 | - "-target=overrides-exporter" 56 | - "-config.file=/etc/cortex/cortex.yaml" 57 | {{- range $key, $value := .Values.overrides_exporter.extraArgs }} 58 | - "-{{ $key }}={{ $value }}" 59 | {{- end }} 60 | volumeMounts: 61 | {{- if .Values.overrides_exporter.extraVolumeMounts }} 62 | {{- toYaml .Values.overrides_exporter.extraVolumeMounts | nindent 12 }} 63 | {{- end }} 64 | - name: config 65 | mountPath: /etc/cortex 66 | - name: runtime-config 67 | mountPath: /etc/cortex-runtime-config 68 | ports: 69 | - name: http-metrics 70 | containerPort: {{ .Values.config.server.http_listen_port }} 71 | protocol: TCP 72 | startupProbe: 73 | {{- toYaml .Values.overrides_exporter.startupProbe | nindent 12 }} 74 | livenessProbe: 75 | {{- toYaml .Values.overrides_exporter.livenessProbe | nindent 12 }} 76 | readinessProbe: 77 | {{- toYaml .Values.overrides_exporter.readinessProbe | nindent 12 }} 78 | resources: 79 | {{- toYaml .Values.overrides_exporter.resources | nindent 12 }} 80 | {{- if .Values.overrides_exporter.containerSecurityContext.enabled }} 81 | securityContext: {{- omit .Values.overrides_exporter.containerSecurityContext "enabled" | toYaml | nindent 12 }} 82 | {{- end }} 83 | {{- if .Values.overrides_exporter.env }} 84 | env: 85 | {{- toYaml .Values.overrides_exporter.env | nindent 12 }} 86 | {{- end }} 87 | {{- with .Values.overrides_exporter.lifecycle }} 88 | lifecycle: 89 | {{- toYaml . | nindent 12 }} 90 | {{- end }} 91 | {{- if .Values.overrides_exporter.extraContainers }} 92 | {{- toYaml .Values.overrides_exporter.extraContainers | nindent 8 }} 93 | {{- end }} 94 | nodeSelector: 95 | {{- toYaml .Values.overrides_exporter.nodeSelector | nindent 8 }} 96 | {{- if .Values.overrides_exporter.topologySpreadConstraints }} 97 | topologySpreadConstraints: 98 | {{- toYaml .Values.overrides_exporter.topologySpreadConstraints | nindent 8}} 99 | {{- end }} 100 | affinity: 101 | {{- toYaml .Values.overrides_exporter.affinity | nindent 8 }} 102 | tolerations: 103 | {{- toYaml .Values.overrides_exporter.tolerations | nindent 8 }} 104 | terminationGracePeriodSeconds: {{ .Values.overrides_exporter.terminationGracePeriodSeconds }} 105 | volumes: 106 | {{- include "cortex.configVolume" . | nindent 8 }} 107 | - name: runtime-config 108 | configMap: 109 | name: {{ template "cortex.fullname" . }}-runtime-config 110 | {{- if .Values.overrides_exporter.extraVolumes }} 111 | {{- toYaml .Values.overrides_exporter.extraVolumes | nindent 8 }} 112 | {{- end }} 113 | {{- end }} 114 | -------------------------------------------------------------------------------- /templates/overrides-exporter/overrides-exporter-servicemonitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.overrides_exporter.enabled .Values.overrides_exporter.serviceMonitor.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "cortex.overridesExporterFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.overridesExporterLabels" . | nindent 4 }} 9 | {{- if .Values.overrides_exporter.serviceMonitor.additionalLabels }} 10 | {{ toYaml .Values.overrides_exporter.serviceMonitor.additionalLabels | indent 4 }} 11 | {{- end }} 12 | {{- if .Values.overrides_exporter.serviceMonitor.annotations }} 13 | annotations: 14 | {{ toYaml .Values.overrides_exporter.serviceMonitor.annotations | indent 4 }} 15 | {{- end }} 16 | spec: 17 | selector: 18 | matchLabels: 19 | {{- include "cortex.overridesExporterSelectorLabels" . | nindent 6 }} 20 | namespaceSelector: 21 | matchNames: 22 | - {{ .Release.Namespace | quote }} 23 | {{- if .Values.overrides_exporter.serviceMonitor.podTargetLabels }} 24 | podTargetLabels: 25 | {{- range .Values.overrides_exporter.serviceMonitor.podTargetLabels }} 26 | - {{ . }} 27 | {{- end }} 28 | {{- end }} 29 | endpoints: 30 | - port: http-metrics 31 | {{- if .Values.overrides_exporter.serviceMonitor.interval }} 32 | interval: {{ .Values.overrides_exporter.serviceMonitor.interval }} 33 | {{- end }} 34 | {{- if .Values.overrides_exporter.serviceMonitor.scrapeTimeout }} 35 | scrapeTimeout: {{ .Values.overrides_exporter.serviceMonitor.scrapeTimeout }} 36 | {{- end }} 37 | {{- if .Values.overrides_exporter.serviceMonitor.relabelings }} 38 | relabelings: 39 | {{- toYaml .Values.overrides_exporter.serviceMonitor.relabelings | nindent 4 }} 40 | {{- end }} 41 | {{- if .Values.overrides_exporter.serviceMonitor.metricRelabelings }} 42 | metricRelabelings: 43 | {{- toYaml .Values.overrides_exporter.serviceMonitor.metricRelabelings | nindent 4 }} 44 | {{- end }} 45 | {{- with .Values.overrides_exporter.serviceMonitor.extraEndpointSpec }} 46 | {{- toYaml . | nindent 4 }} 47 | {{- end }} 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /templates/overrides-exporter/overrides-exporter-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.overrides_exporter.enabled }} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.overridesExporterFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.overridesExporterLabels" . | nindent 4 }} 9 | {{- with .Values.overrides_exporter.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.overrides_exporter.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | ports: 17 | - port: {{ .Values.config.server.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.overridesExporterSelectorLabels" . | nindent 4 }} 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/purger/_helpers-purger.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | purger fullname 4 | */}} 5 | {{- define "cortex.purgerFullname" -}} 6 | {{ include "cortex.fullname" . }}-purger 7 | {{- end }} 8 | 9 | {{/* 10 | purger common labels 11 | */}} 12 | {{- define "cortex.purgerLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: purger 15 | {{- end }} 16 | 17 | {{/* 18 | purger selector labels 19 | */}} 20 | {{- define "cortex.purgerSelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: purger 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/purger/purger-dep.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.purger.enabled }} 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: {{ include "cortex.purgerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.purgerLabels" . | nindent 4 }} 9 | annotations: 10 | {{- toYaml .Values.purger.annotations | nindent 4 }} 11 | spec: 12 | replicas: {{ .Values.purger.replicas }} 13 | selector: 14 | matchLabels: 15 | {{- include "cortex.purgerSelectorLabels" . | nindent 6 }} 16 | strategy: 17 | {{- toYaml .Values.purger.strategy | nindent 4 }} 18 | template: 19 | metadata: 20 | labels: 21 | {{- include "cortex.purgerLabels" . | nindent 8 }} 22 | {{- with .Values.purger.podLabels }} 23 | {{- toYaml . | nindent 8 }} 24 | {{- end }} 25 | annotations: 26 | checksum/config: {{ include "cortex.configChecksum" . }} 27 | {{- with .Values.query_frontend.podAnnotations }} 28 | {{- toYaml . | nindent 8 }} 29 | {{- end }} 30 | spec: 31 | serviceAccountName: {{ .Values.purger.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }} 32 | {{- if .Values.purger.securityContext.enabled }} 33 | securityContext: {{- omit .Values.purger.securityContext "enabled" | toYaml | nindent 8 }} 34 | {{- end }} 35 | initContainers: 36 | {{- toYaml .Values.purger.initContainers | nindent 8 }} 37 | {{- if .Values.image.pullSecrets }} 38 | imagePullSecrets: 39 | {{- range .Values.image.pullSecrets }} 40 | - name: {{ . }} 41 | {{- end }} 42 | {{- end }} 43 | containers: 44 | - name: purger 45 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" 46 | imagePullPolicy: {{ .Values.image.pullPolicy }} 47 | args: 48 | - "-target=purger" 49 | - "-config.file=/etc/cortex/cortex.yaml" 50 | {{- range $key, $value := .Values.purger.extraArgs }} 51 | - "-{{ $key }}={{ $value }}" 52 | {{- end }} 53 | volumeMounts: 54 | {{- if .Values.purger.extraVolumeMounts }} 55 | {{- toYaml .Values.purger.extraVolumeMounts | nindent 12}} 56 | {{- end }} 57 | - name: config 58 | mountPath: /etc/cortex 59 | - name: runtime-config 60 | mountPath: /etc/cortex-runtime-config 61 | ports: 62 | - name: http-metrics 63 | containerPort: {{ .Values.config.server.http_listen_port }} 64 | protocol: TCP 65 | - name: grpc 66 | containerPort: {{ .Values.config.server.grpc_listen_port }} 67 | protocol: TCP 68 | startupProbe: 69 | {{- toYaml .Values.purger.startupProbe | nindent 12 }} 70 | livenessProbe: 71 | {{- toYaml .Values.purger.livenessProbe | nindent 12 }} 72 | readinessProbe: 73 | {{- toYaml .Values.purger.readinessProbe | nindent 12 }} 74 | resources: 75 | {{- toYaml .Values.purger.resources | nindent 12 }} 76 | {{- if .Values.purger.containerSecurityContext.enabled }} 77 | securityContext: {{- omit .Values.purger.containerSecurityContext "enabled" | toYaml | nindent 12 }} 78 | {{- end }} 79 | {{- if .Values.purger.env }} 80 | env: 81 | {{- toYaml .Values.purger.env | nindent 12 }} 82 | {{- end }} 83 | {{- with .Values.purger.lifecycle }} 84 | lifecycle: 85 | {{- toYaml . | nindent 12 }} 86 | {{- end }} 87 | {{- if .Values.purger.extraContainers }} 88 | {{- toYaml .Values.purger.extraContainers | nindent 8}} 89 | {{- end }} 90 | nodeSelector: 91 | {{- toYaml .Values.purger.nodeSelector | nindent 8 }} 92 | {{- if .Values.purger.topologySpreadConstraints }} 93 | topologySpreadConstraints: 94 | {{- toYaml .Values.purger.topologySpreadConstraints | nindent 8}} 95 | {{- end }} 96 | affinity: 97 | {{- toYaml .Values.purger.affinity | nindent 8 }} 98 | tolerations: 99 | {{- toYaml .Values.purger.tolerations | nindent 8 }} 100 | terminationGracePeriodSeconds: {{ .Values.purger.terminationGracePeriodSeconds }} 101 | volumes: 102 | {{- include "cortex.configVolume" . | nindent 8 }} 103 | - name: runtime-config 104 | configMap: 105 | name: {{ template "cortex.fullname" . }}-runtime-config 106 | {{- if .Values.purger.extraVolumes }} 107 | {{- toYaml .Values.purger.extraVolumes | nindent 8}} 108 | {{- end }} 109 | {{- end -}} -------------------------------------------------------------------------------- /templates/purger/purger-servicemonitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.purger.serviceMonitor.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "cortex.purgerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.purgerLabels" . | nindent 4 }} 9 | {{- if .Values.purger.serviceMonitor.additionalLabels }} 10 | {{ toYaml .Values.purger.serviceMonitor.additionalLabels | indent 4 }} 11 | {{- end }} 12 | {{- if .Values.purger.serviceMonitor.annotations }} 13 | annotations: 14 | {{ toYaml .Values.purger.serviceMonitor.annotations | indent 4 }} 15 | {{- end }} 16 | spec: 17 | selector: 18 | matchLabels: 19 | {{- include "cortex.purgerSelectorLabels" . | nindent 6 }} 20 | namespaceSelector: 21 | matchNames: 22 | - {{ .Release.Namespace | quote }} 23 | {{- if .Values.purger.serviceMonitor.podTargetLabels }} 24 | podTargetLabels: 25 | {{- range .Values.purger.serviceMonitor.podTargetLabels }} 26 | - {{ . }} 27 | {{- end }} 28 | {{- end }} 29 | endpoints: 30 | - port: http-metrics 31 | {{- if .Values.purger.serviceMonitor.interval }} 32 | interval: {{ .Values.purger.serviceMonitor.interval }} 33 | {{- end }} 34 | {{- if .Values.purger.serviceMonitor.scrapeTimeout }} 35 | scrapeTimeout: {{ .Values.purger.serviceMonitor.scrapeTimeout }} 36 | {{- end }} 37 | {{- if .Values.purger.serviceMonitor.relabelings }} 38 | relabelings: 39 | {{- toYaml .Values.purger.serviceMonitor.relabelings | nindent 4 }} 40 | {{- end }} 41 | {{- if .Values.purger.serviceMonitor.metricRelabelings }} 42 | metricRelabelings: 43 | {{- toYaml .Values.purger.serviceMonitor.metricRelabelings | nindent 4 }} 44 | {{- end }} 45 | {{- with .Values.purger.serviceMonitor.extraEndpointSpec }} 46 | {{- toYaml . | nindent 4 }} 47 | {{- end }} 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /templates/purger/purger-svc-headless.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.purger.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.purgerFullname" . }}-headless 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.purgerLabels" . | nindent 4 }} 9 | {{- with .Values.purger.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.purger.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | clusterIP: None 17 | publishNotReadyAddresses: true 18 | ports: 19 | - port: {{ .Values.config.server.grpc_listen_port }} 20 | protocol: TCP 21 | name: grpc 22 | targetPort: grpc 23 | selector: 24 | {{- include "cortex.purgerSelectorLabels" . | nindent 4 }} 25 | {{- end }} -------------------------------------------------------------------------------- /templates/purger/purger-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.purger.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.purgerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.purgerLabels" . | nindent 4 }} 9 | {{- with .Values.purger.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.purger.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | ports: 17 | - port: {{ .Values.config.server.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.purgerSelectorLabels" . | nindent 4 }} 23 | {{- end -}} 24 | -------------------------------------------------------------------------------- /templates/querier/_helpers-querier.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | querier fullname 4 | */}} 5 | {{- define "cortex.querierFullname" -}} 6 | {{ include "cortex.fullname" . }}-querier 7 | {{- end }} 8 | 9 | {{/* 10 | querier common labels 11 | */}} 12 | {{- define "cortex.querierLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: querier 15 | {{- end }} 16 | 17 | {{/* 18 | querier selector labels 19 | */}} 20 | {{- define "cortex.querierSelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: querier 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/querier/querier-dep.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.querier.enabled -}} 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: {{ include "cortex.querierFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.querierLabels" . | nindent 4 }} 9 | annotations: 10 | {{- toYaml .Values.querier.annotations | nindent 4 }} 11 | spec: 12 | {{- if not .Values.querier.autoscaling.enabled }} 13 | replicas: {{ .Values.querier.replicas }} 14 | {{- end }} 15 | selector: 16 | matchLabels: 17 | {{- include "cortex.querierSelectorLabels" . | nindent 6 }} 18 | strategy: 19 | {{- toYaml .Values.querier.strategy | nindent 4 }} 20 | template: 21 | metadata: 22 | labels: 23 | {{- include "cortex.querierLabels" . | nindent 8 }} 24 | {{- with .Values.querier.podLabels }} 25 | {{- toYaml . | nindent 8 }} 26 | {{- end }} 27 | annotations: 28 | checksum/config: {{ include "cortex.configChecksum" . }} 29 | {{- with .Values.querier.podAnnotations }} 30 | {{- toYaml . | nindent 8 }} 31 | {{- end }} 32 | spec: 33 | serviceAccountName: {{ .Values.querier.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }} 34 | {{- if .Values.querier.priorityClassName }} 35 | priorityClassName: {{ .Values.querier.priorityClassName }} 36 | {{- end }} 37 | {{- if .Values.querier.securityContext.enabled }} 38 | securityContext: {{- omit .Values.querier.securityContext "enabled" | toYaml | nindent 8 }} 39 | {{- end }} 40 | initContainers: 41 | {{- toYaml .Values.querier.initContainers | nindent 8 }} 42 | {{- if .Values.image.pullSecrets }} 43 | imagePullSecrets: 44 | {{- range .Values.image.pullSecrets }} 45 | - name: {{ . }} 46 | {{- end }} 47 | {{- end }} 48 | containers: 49 | - name: querier 50 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" 51 | imagePullPolicy: {{ .Values.image.pullPolicy }} 52 | args: 53 | - "-target=querier" 54 | - "-config.file=/etc/cortex/cortex.yaml" 55 | {{- if .Values.query_scheduler.enabled }} 56 | - "-querier.scheduler-address={{ template "cortex.querySchedulerFullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.grpc_listen_port }}" 57 | {{- end }} 58 | {{- if and .Values.query_frontend.enabled (not .Values.query_scheduler.enabled) }} 59 | - "-querier.frontend-address={{ template "cortex.queryFrontendFullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.grpc_listen_port }}" 60 | {{- end }} 61 | {{- include "cortex.memcached" . | nindent 12}} 62 | {{- range $key, $value := .Values.querier.extraArgs }} 63 | - "-{{ $key }}={{ $value }}" 64 | {{- end }} 65 | volumeMounts: 66 | {{- if .Values.querier.extraVolumeMounts }} 67 | {{- toYaml .Values.querier.extraVolumeMounts | nindent 12}} 68 | {{- end }} 69 | - name: config 70 | mountPath: /etc/cortex 71 | - name: runtime-config 72 | mountPath: /etc/cortex-runtime-config 73 | - name: storage 74 | mountPath: "/data" 75 | subPath: {{ .Values.querier.persistentVolume.subPath }} 76 | ports: 77 | - name: http-metrics 78 | containerPort: {{ .Values.config.server.http_listen_port }} 79 | protocol: TCP 80 | startupProbe: 81 | {{- toYaml .Values.querier.startupProbe | nindent 12 }} 82 | livenessProbe: 83 | {{- toYaml .Values.querier.livenessProbe | nindent 12 }} 84 | readinessProbe: 85 | {{- toYaml .Values.querier.readinessProbe | nindent 12 }} 86 | resources: 87 | {{- toYaml .Values.querier.resources | nindent 12 }} 88 | {{- if .Values.querier.containerSecurityContext.enabled }} 89 | securityContext: {{- omit .Values.querier.containerSecurityContext "enabled" | toYaml | nindent 12 }} 90 | {{- end }} 91 | env: 92 | {{- if .Values.querier.env }} 93 | {{- toYaml .Values.querier.env | nindent 12 }} 94 | {{- end }} 95 | {{- with .Values.querier.lifecycle }} 96 | lifecycle: 97 | {{- toYaml . | nindent 12 }} 98 | {{- end }} 99 | {{- if .Values.querier.extraContainers }} 100 | {{- toYaml .Values.querier.extraContainers | nindent 8}} 101 | {{- end }} 102 | nodeSelector: 103 | {{- toYaml .Values.querier.nodeSelector | nindent 8 }} 104 | {{- if .Values.querier.topologySpreadConstraints }} 105 | topologySpreadConstraints: 106 | {{- toYaml .Values.querier.topologySpreadConstraints | nindent 8}} 107 | {{- end }} 108 | affinity: 109 | {{- toYaml .Values.querier.affinity | nindent 8 }} 110 | tolerations: 111 | {{- toYaml .Values.querier.tolerations | nindent 8 }} 112 | terminationGracePeriodSeconds: {{ .Values.querier.terminationGracePeriodSeconds }} 113 | volumes: 114 | {{- include "cortex.configVolume" . | nindent 8 }} 115 | - name: runtime-config 116 | configMap: 117 | name: {{ template "cortex.fullname" . }}-runtime-config 118 | - name: storage 119 | emptyDir: {} 120 | {{- if .Values.querier.extraVolumes }} 121 | {{- toYaml .Values.querier.extraVolumes | nindent 8}} 122 | {{- end }} 123 | {{- end -}} 124 | -------------------------------------------------------------------------------- /templates/querier/querier-hpa.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.querier.enabled .Values.querier.autoscaling.enabled -}} 2 | {{- with .Values.querier.autoscaling -}} 3 | apiVersion: {{ include "cortex.hpaVersion" $ }} 4 | kind: HorizontalPodAutoscaler 5 | metadata: 6 | name: {{ include "cortex.querierFullname" $ }} 7 | namespace: {{ $.Release.Namespace }} 8 | labels: 9 | {{- include "cortex.querierLabels" $ | nindent 4 }} 10 | spec: 11 | scaleTargetRef: 12 | apiVersion: apps/v1 13 | kind: Deployment 14 | name: {{ include "cortex.querierFullname" $ }} 15 | minReplicas: {{ .minReplicas }} 16 | maxReplicas: {{ .maxReplicas }} 17 | metrics: 18 | {{- with .targetMemoryUtilizationPercentage }} 19 | - type: Resource 20 | resource: 21 | name: memory 22 | target: 23 | type: Utilization 24 | averageUtilization: {{ . }} 25 | {{- end }} 26 | {{- with .targetCPUUtilizationPercentage }} 27 | - type: Resource 28 | resource: 29 | name: cpu 30 | target: 31 | type: Utilization 32 | averageUtilization: {{ . }} 33 | {{- end }} 34 | {{- with .extraMetrics }} 35 | {{- toYaml . | nindent 4 }} 36 | {{- end }} 37 | {{- with .behavior }} 38 | behavior: 39 | {{- toYaml . | nindent 4 }} 40 | {{- end }} 41 | {{- end }} 42 | {{- end }} 43 | -------------------------------------------------------------------------------- /templates/querier/querier-poddisruptionbudget.yaml: -------------------------------------------------------------------------------- 1 | {{- if and (gt (int .Values.querier.replicas) 1) (.Values.querier.podDisruptionBudget) (.Values.querier.enabled) }} 2 | apiVersion: {{ include "cortex.pdbVersion" . }} 3 | kind: PodDisruptionBudget 4 | metadata: 5 | name: {{ include "cortex.querierFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.querierLabels" . | nindent 4 }} 9 | spec: 10 | selector: 11 | matchLabels: 12 | {{- include "cortex.querierSelectorLabels" . | nindent 6 }} 13 | {{- toYaml .Values.querier.podDisruptionBudget | nindent 2 }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /templates/querier/querier-servicemonitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.querier.serviceMonitor.enabled .Values.querier.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "cortex.querierFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.querierLabels" . | nindent 4 }} 9 | {{- if .Values.querier.serviceMonitor.additionalLabels }} 10 | {{ toYaml .Values.querier.serviceMonitor.additionalLabels | indent 4 }} 11 | {{- end }} 12 | {{- if .Values.querier.serviceMonitor.annotations }} 13 | annotations: 14 | {{ toYaml .Values.querier.serviceMonitor.annotations | indent 4 }} 15 | {{- end }} 16 | spec: 17 | selector: 18 | matchLabels: 19 | {{- include "cortex.querierSelectorLabels" . | nindent 6 }} 20 | namespaceSelector: 21 | matchNames: 22 | - {{ .Release.Namespace | quote }} 23 | {{- if .Values.querier.serviceMonitor.podTargetLabels }} 24 | podTargetLabels: 25 | {{- range .Values.querier.serviceMonitor.podTargetLabels }} 26 | - {{ . }} 27 | {{- end }} 28 | {{- end }} 29 | endpoints: 30 | - port: http-metrics 31 | {{- if .Values.querier.serviceMonitor.interval }} 32 | interval: {{ .Values.querier.serviceMonitor.interval }} 33 | {{- end }} 34 | {{- if .Values.querier.serviceMonitor.scrapeTimeout }} 35 | scrapeTimeout: {{ .Values.querier.serviceMonitor.scrapeTimeout }} 36 | {{- end }} 37 | {{- if .Values.querier.serviceMonitor.relabelings }} 38 | relabelings: 39 | {{- toYaml .Values.querier.serviceMonitor.relabelings | nindent 4 }} 40 | {{- end }} 41 | {{- if .Values.querier.serviceMonitor.metricRelabelings }} 42 | metricRelabelings: 43 | {{- toYaml .Values.querier.serviceMonitor.metricRelabelings | nindent 4 }} 44 | {{- end }} 45 | {{- with .Values.querier.serviceMonitor.extraEndpointSpec }} 46 | {{- toYaml . | nindent 4 }} 47 | {{- end }} 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /templates/querier/querier-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.querier.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.querierFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.querierLabels" . | nindent 4 }} 9 | {{- with .Values.querier.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.querier.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | ports: 17 | - port: {{ .Values.config.server.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.querierSelectorLabels" . | nindent 4 }} 23 | {{- end -}} -------------------------------------------------------------------------------- /templates/query-frontend/_helpers-query-frontend.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | query-frontend fullname 4 | */}} 5 | {{- define "cortex.queryFrontendFullname" -}} 6 | {{ include "cortex.fullname" . }}-query-frontend 7 | {{- end }} 8 | 9 | {{/* 10 | query-frontend common labels 11 | */}} 12 | {{- define "cortex.queryFrontendLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: query-frontend 15 | {{- end }} 16 | 17 | {{/* 18 | query-frontend selector labels 19 | */}} 20 | {{- define "cortex.queryFrontendSelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: query-frontend 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/query-frontend/query-frontend-dep.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.query_frontend.enabled -}} 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: {{ include "cortex.queryFrontendFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.queryFrontendLabels" . | nindent 4 }} 9 | annotations: 10 | {{- toYaml .Values.query_frontend.annotations | nindent 4 }} 11 | spec: 12 | replicas: {{ .Values.query_frontend.replicas }} 13 | selector: 14 | matchLabels: 15 | {{- include "cortex.queryFrontendSelectorLabels" . | nindent 6 }} 16 | strategy: 17 | {{- toYaml .Values.query_frontend.strategy | nindent 4 }} 18 | template: 19 | metadata: 20 | labels: 21 | {{- include "cortex.queryFrontendLabels" . | nindent 8 }} 22 | {{- with .Values.query_frontend.podLabels }} 23 | {{- toYaml . | nindent 8 }} 24 | {{- end }} 25 | annotations: 26 | checksum/config: {{ include "cortex.configChecksum" . }} 27 | {{- with .Values.query_frontend.podAnnotations }} 28 | {{- toYaml . | nindent 8 }} 29 | {{- end }} 30 | spec: 31 | serviceAccountName: {{ .Values.query_frontend.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }} 32 | {{- if .Values.query_frontend.priorityClassName }} 33 | priorityClassName: {{ .Values.query_frontend.priorityClassName }} 34 | {{- end }} 35 | {{- if .Values.query_frontend.securityContext.enabled }} 36 | securityContext: {{- omit .Values.query_frontend.securityContext "enabled" | toYaml | nindent 8 }} 37 | {{- end }} 38 | initContainers: 39 | {{- toYaml .Values.query_frontend.initContainers | nindent 8 }} 40 | {{- if .Values.image.pullSecrets }} 41 | imagePullSecrets: 42 | {{- range .Values.image.pullSecrets }} 43 | - name: {{ . }} 44 | {{- end }} 45 | {{- end }} 46 | containers: 47 | - name: query-frontend 48 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" 49 | imagePullPolicy: {{ .Values.image.pullPolicy }} 50 | args: 51 | - "-target=query-frontend" 52 | - "-config.file=/etc/cortex/cortex.yaml" 53 | {{- include "cortex.frontend-memcached" . | nindent 12 }} 54 | {{- if .Values.query_scheduler.enabled }} 55 | - "-frontend.scheduler-address={{ template "cortex.querySchedulerFullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.server.grpc_listen_port }}" 56 | {{- end }} 57 | {{- range $key, $value := .Values.query_frontend.extraArgs }} 58 | - "-{{ $key }}={{ $value }}" 59 | {{- end }} 60 | volumeMounts: 61 | {{- if .Values.query_frontend.extraVolumeMounts }} 62 | {{- toYaml .Values.query_frontend.extraVolumeMounts | nindent 12}} 63 | {{- end }} 64 | - name: config 65 | mountPath: /etc/cortex 66 | - name: runtime-config 67 | mountPath: /etc/cortex-runtime-config 68 | ports: 69 | - name: http-metrics 70 | containerPort: {{ .Values.config.server.http_listen_port }} 71 | protocol: TCP 72 | - name: grpc 73 | containerPort: {{ .Values.config.server.grpc_listen_port }} 74 | protocol: TCP 75 | startupProbe: 76 | {{- toYaml .Values.query_frontend.startupProbe | nindent 12 }} 77 | livenessProbe: 78 | {{- toYaml .Values.query_frontend.livenessProbe | nindent 12 }} 79 | readinessProbe: 80 | {{- toYaml .Values.query_frontend.readinessProbe | nindent 12 }} 81 | resources: 82 | {{- toYaml .Values.query_frontend.resources | nindent 12 }} 83 | {{- if .Values.query_frontend.containerSecurityContext.enabled }} 84 | securityContext: {{- omit .Values.query_frontend.containerSecurityContext "enabled" | toYaml | nindent 12 }} 85 | {{- end }} 86 | {{- if .Values.query_frontend.env }} 87 | env: 88 | {{- toYaml .Values.query_frontend.env | nindent 12 }} 89 | {{- end }} 90 | {{- with .Values.query_frontend.lifecycle }} 91 | lifecycle: 92 | {{- toYaml . | nindent 12 }} 93 | {{- end }} 94 | {{- if .Values.query_frontend.extraContainers }} 95 | {{- toYaml .Values.query_frontend.extraContainers | nindent 8}} 96 | {{- end }} 97 | nodeSelector: 98 | {{- toYaml .Values.query_frontend.nodeSelector | nindent 8 }} 99 | {{- if .Values.query_frontend.topologySpreadConstraints }} 100 | topologySpreadConstraints: 101 | {{- toYaml .Values.query_frontend.topologySpreadConstraints | nindent 8}} 102 | {{- end }} 103 | affinity: 104 | {{- toYaml .Values.query_frontend.affinity | nindent 8 }} 105 | tolerations: 106 | {{- toYaml .Values.query_frontend.tolerations | nindent 8 }} 107 | terminationGracePeriodSeconds: {{ .Values.query_frontend.terminationGracePeriodSeconds }} 108 | volumes: 109 | {{- include "cortex.configVolume" . | nindent 8 }} 110 | - name: runtime-config 111 | configMap: 112 | name: {{ template "cortex.fullname" . }}-runtime-config 113 | {{- if .Values.query_frontend.extraVolumes }} 114 | {{- toYaml .Values.query_frontend.extraVolumes | nindent 8}} 115 | {{- end }} 116 | {{- end -}} 117 | -------------------------------------------------------------------------------- /templates/query-frontend/query-frontend-servicemonitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.query_frontend.serviceMonitor.enabled .Values.query_frontend.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "cortex.queryFrontendFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.queryFrontendLabels" . | nindent 4 }} 9 | {{- if .Values.query_frontend.serviceMonitor.additionalLabels }} 10 | {{ toYaml .Values.query_frontend.serviceMonitor.additionalLabels | indent 4 }} 11 | {{- end }} 12 | {{- if .Values.query_frontend.serviceMonitor.annotations }} 13 | annotations: 14 | {{ toYaml .Values.query_frontend.serviceMonitor.annotations | indent 4 }} 15 | {{- end }} 16 | spec: 17 | selector: 18 | matchLabels: 19 | {{- include "cortex.queryFrontendSelectorLabels" . | nindent 6 }} 20 | namespaceSelector: 21 | matchNames: 22 | - {{ .Release.Namespace | quote }} 23 | {{- if .Values.query_frontend.serviceMonitor.podTargetLabels }} 24 | podTargetLabels: 25 | {{- range .Values.query_frontend.serviceMonitor.podTargetLabels }} 26 | - {{ . }} 27 | {{- end }} 28 | {{- end }} 29 | endpoints: 30 | - port: http-metrics 31 | {{- if .Values.query_frontend.serviceMonitor.interval }} 32 | interval: {{ .Values.query_frontend.serviceMonitor.interval }} 33 | {{- end }} 34 | {{- if .Values.query_frontend.serviceMonitor.scrapeTimeout }} 35 | scrapeTimeout: {{ .Values.query_frontend.serviceMonitor.scrapeTimeout }} 36 | {{- end }} 37 | {{- if .Values.query_frontend.serviceMonitor.relabelings }} 38 | relabelings: 39 | {{- toYaml .Values.query_frontend.serviceMonitor.relabelings | nindent 4 }} 40 | {{- end }} 41 | {{- if .Values.query_frontend.serviceMonitor.metricRelabelings }} 42 | metricRelabelings: 43 | {{- toYaml .Values.query_frontend.serviceMonitor.metricRelabelings | nindent 4 }} 44 | {{- end }} 45 | {{- with .Values.query_frontend.serviceMonitor.extraEndpointSpec }} 46 | {{- toYaml . | nindent 4 }} 47 | {{- end }} 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /templates/query-frontend/query-frontend-svc-headless.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.query_frontend.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.queryFrontendFullname" . }}-headless 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.queryFrontendLabels" . | nindent 4 }} 9 | {{- with .Values.query_frontend.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.query_frontend.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | clusterIP: None 17 | publishNotReadyAddresses: true 18 | ports: 19 | - port: {{ .Values.config.server.grpc_listen_port }} 20 | protocol: TCP 21 | name: grpc 22 | targetPort: grpc 23 | selector: 24 | {{- include "cortex.queryFrontendSelectorLabels" . | nindent 4 }} 25 | {{- end -}} -------------------------------------------------------------------------------- /templates/query-frontend/query-frontend-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.query_frontend.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.queryFrontendFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.queryFrontendLabels" . | nindent 4 }} 9 | {{- with .Values.query_frontend.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.query_frontend.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | ports: 17 | - port: {{ .Values.config.server.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.queryFrontendSelectorLabels" . | nindent 4 }} 23 | {{- end -}} -------------------------------------------------------------------------------- /templates/query-frontend/query-poddisruptionbudget.yaml: -------------------------------------------------------------------------------- 1 | {{- if and (gt (int .Values.query_frontend.replicas) 1) (.Values.query_frontend.podDisruptionBudget) (.Values.query_frontend.enabled) }} 2 | apiVersion: {{ include "cortex.pdbVersion" . }} 3 | kind: PodDisruptionBudget 4 | metadata: 5 | name: {{ include "cortex.queryFrontendFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.queryFrontendLabels" . | nindent 4 }} 9 | spec: 10 | selector: 11 | matchLabels: 12 | {{- include "cortex.queryFrontendSelectorLabels" . | nindent 6 }} 13 | {{- toYaml .Values.query_frontend.podDisruptionBudget | nindent 2 }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /templates/query-scheduler/_helpers-query-scheduler.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | query-scheduler fullname 4 | */}} 5 | {{- define "cortex.querySchedulerFullname" -}} 6 | {{ include "cortex.fullname" . }}-query-scheduler 7 | {{- end }} 8 | 9 | {{/* 10 | query-scheduler common labels 11 | */}} 12 | {{- define "cortex.querySchedulerLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: query-scheduler 15 | {{- end }} 16 | 17 | {{/* 18 | query-scheduler selector labels 19 | */}} 20 | {{- define "cortex.querySchedulerSelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: query-scheduler 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/query-scheduler/query-scheduler-dep.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.query_scheduler.enabled }} 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: {{ include "cortex.querySchedulerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.querySchedulerLabels" . | nindent 4 }} 9 | annotations: 10 | {{- toYaml .Values.query_scheduler.annotations | nindent 4 }} 11 | spec: 12 | replicas: {{ .Values.query_scheduler.replicas }} 13 | selector: 14 | matchLabels: 15 | {{- include "cortex.querySchedulerSelectorLabels" . | nindent 6 }} 16 | strategy: 17 | {{- toYaml .Values.query_scheduler.strategy | nindent 4 }} 18 | template: 19 | metadata: 20 | labels: 21 | {{- include "cortex.querySchedulerLabels" . | nindent 8 }} 22 | {{- with .Values.query_scheduler.podLabels }} 23 | {{- toYaml . | nindent 8 }} 24 | {{- end }} 25 | annotations: 26 | {{- if .Values.useExternalConfig }} 27 | checksum/config: {{ .Values.externalConfigVersion }} 28 | {{- else }} 29 | checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} 30 | {{- end }} 31 | {{- with .Values.query_scheduler.podAnnotations }} 32 | {{- toYaml . | nindent 8 }} 33 | {{- end }} 34 | spec: 35 | serviceAccountName: {{ template "cortex.serviceAccountName" . }} 36 | {{- if .Values.query_scheduler.priorityClassName }} 37 | priorityClassName: {{ .Values.query_scheduler.priorityClassName }} 38 | {{- end }} 39 | {{- if .Values.query_scheduler.securityContext.enabled }} 40 | securityContext: {{- omit .Values.query_scheduler.securityContext "enabled" | toYaml | nindent 8 }} 41 | {{- end }} 42 | initContainers: 43 | {{- toYaml .Values.query_scheduler.initContainers | nindent 8 }} 44 | {{- if .Values.image.pullSecrets }} 45 | imagePullSecrets: 46 | {{- range .Values.image.pullSecrets }} 47 | - name: {{ . }} 48 | {{- end }} 49 | {{- end }} 50 | containers: 51 | - name: query-scheduler 52 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" 53 | imagePullPolicy: {{ .Values.image.pullPolicy }} 54 | args: 55 | - "-target=query-scheduler" 56 | - "-config.file=/etc/cortex/cortex.yaml" 57 | {{- range $key, $value := .Values.query_scheduler.extraArgs }} 58 | - "-{{ $key }}={{ $value }}" 59 | {{- end }} 60 | volumeMounts: 61 | {{- if .Values.query_scheduler.extraVolumeMounts }} 62 | {{- toYaml .Values.query_scheduler.extraVolumeMounts | nindent 12 }} 63 | {{- end }} 64 | - name: config 65 | mountPath: /etc/cortex 66 | - name: runtime-config 67 | mountPath: /etc/cortex-runtime-config 68 | ports: 69 | - name: http-metrics 70 | containerPort: {{ .Values.config.server.http_listen_port }} 71 | protocol: TCP 72 | - name: grpc 73 | containerPort: {{ .Values.config.server.grpc_listen_port }} 74 | protocol: TCP 75 | startupProbe: 76 | {{- toYaml .Values.query_scheduler.startupProbe | nindent 12 }} 77 | livenessProbe: 78 | {{- toYaml .Values.query_scheduler.livenessProbe | nindent 12 }} 79 | readinessProbe: 80 | {{- toYaml .Values.query_scheduler.readinessProbe | nindent 12 }} 81 | resources: 82 | {{- toYaml .Values.query_scheduler.resources | nindent 12 }} 83 | {{- if .Values.query_scheduler.containerSecurityContext.enabled }} 84 | securityContext: {{- omit .Values.query_scheduler.containerSecurityContext "enabled" | toYaml | nindent 12 }} 85 | {{- end }} 86 | {{- if .Values.query_scheduler.env }} 87 | env: 88 | {{- toYaml .Values.query_scheduler.env | nindent 12 }} 89 | {{- end }} 90 | {{- with .Values.query_scheduler.lifecycle }} 91 | lifecycle: 92 | {{- toYaml . | nindent 12 }} 93 | {{- end }} 94 | {{- if .Values.query_scheduler.extraContainers }} 95 | {{- toYaml .Values.query_scheduler.extraContainers | nindent 8 }} 96 | {{- end }} 97 | nodeSelector: 98 | {{- toYaml .Values.query_scheduler.nodeSelector | nindent 8 }} 99 | {{- if .Values.query_scheduler.topologySpreadConstraints }} 100 | topologySpreadConstraints: 101 | {{- toYaml .Values.query_scheduler.topologySpreadConstraints | nindent 8}} 102 | {{- end }} 103 | affinity: 104 | {{- toYaml .Values.query_scheduler.affinity | nindent 8 }} 105 | tolerations: 106 | {{- toYaml .Values.query_scheduler.tolerations | nindent 8 }} 107 | terminationGracePeriodSeconds: {{ .Values.query_scheduler.terminationGracePeriodSeconds }} 108 | volumes: 109 | {{- include "cortex.configVolume" . | nindent 8 }} 110 | - name: runtime-config 111 | configMap: 112 | name: {{ template "cortex.fullname" . }}-runtime-config 113 | {{- if .Values.query_scheduler.extraVolumes }} 114 | {{- toYaml .Values.query_scheduler.extraVolumes | nindent 8 }} 115 | {{- end }} 116 | {{- end }} 117 | -------------------------------------------------------------------------------- /templates/query-scheduler/query-scheduler-poddisruptionbudget.yaml: -------------------------------------------------------------------------------- 1 | {{- if and (.Values.query_scheduler.enabled) (gt (int .Values.query_scheduler.replicas) 1) (.Values.query_scheduler.podDisruptionBudget) }} 2 | apiVersion: {{ include "cortex.pdbVersion" . }} 3 | kind: PodDisruptionBudget 4 | metadata: 5 | name: {{ include "cortex.querySchedulerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.querySchedulerLabels" . | nindent 4 }} 9 | spec: 10 | selector: 11 | matchLabels: 12 | {{- include "cortex.querySchedulerSelectorLabels" . | nindent 6 }} 13 | {{- toYaml .Values.query_scheduler.podDisruptionBudget | nindent 2 }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /templates/query-scheduler/query-scheduler-servicemonitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.query_scheduler.enabled .Values.query_scheduler.serviceMonitor.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "cortex.querySchedulerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.querySchedulerLabels" . | nindent 4 }} 9 | {{- if .Values.query_scheduler.serviceMonitor.additionalLabels }} 10 | {{ toYaml .Values.query_scheduler.serviceMonitor.additionalLabels | indent 4 }} 11 | {{- end }} 12 | {{- if .Values.query_scheduler.serviceMonitor.annotations }} 13 | annotations: 14 | {{ toYaml .Values.query_scheduler.serviceMonitor.annotations | indent 4 }} 15 | {{- end }} 16 | spec: 17 | selector: 18 | matchLabels: 19 | {{- include "cortex.querySchedulerSelectorLabels" . | nindent 6 }} 20 | namespaceSelector: 21 | matchNames: 22 | - {{ .Release.Namespace | quote }} 23 | {{- if .Values.query_scheduler.serviceMonitor.podTargetLabels }} 24 | podTargetLabels: 25 | {{- range .Values.query_scheduler.serviceMonitor.podTargetLabels }} 26 | - {{ . }} 27 | {{- end }} 28 | {{- end }} 29 | endpoints: 30 | - port: http-metrics 31 | {{- if .Values.query_scheduler.serviceMonitor.interval }} 32 | interval: {{ .Values.query_scheduler.serviceMonitor.interval }} 33 | {{- end }} 34 | {{- if .Values.query_scheduler.serviceMonitor.scrapeTimeout }} 35 | scrapeTimeout: {{ .Values.query_scheduler.serviceMonitor.scrapeTimeout }} 36 | {{- end }} 37 | {{- if .Values.query_scheduler.serviceMonitor.relabelings }} 38 | relabelings: 39 | {{- toYaml .Values.query_scheduler.serviceMonitor.relabelings | nindent 4 }} 40 | {{- end }} 41 | {{- if .Values.query_scheduler.serviceMonitor.metricRelabelings }} 42 | metricRelabelings: 43 | {{- toYaml .Values.query_scheduler.serviceMonitor.metricRelabelings | nindent 4 }} 44 | {{- end }} 45 | {{- with .Values.query_scheduler.serviceMonitor.extraEndpointSpec }} 46 | {{- toYaml . | nindent 4 }} 47 | {{- end }} 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /templates/query-scheduler/query-scheduler-svc-headless.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.query_scheduler.enabled }} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.querySchedulerFullname" . }}-headless 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.querySchedulerLabels" . | nindent 4 }} 9 | {{- with .Values.query_scheduler.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.query_scheduler.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | clusterIP: None 17 | publishNotReadyAddresses: true 18 | ports: 19 | - port: {{ .Values.config.server.grpc_listen_port }} 20 | protocol: TCP 21 | name: grpc 22 | targetPort: grpc 23 | selector: 24 | {{- include "cortex.querySchedulerSelectorLabels" . | nindent 4 }} 25 | {{- end }} 26 | -------------------------------------------------------------------------------- /templates/query-scheduler/query-scheduler-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.query_scheduler.enabled }} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.querySchedulerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.querySchedulerLabels" . | nindent 4 }} 9 | {{- with .Values.query_scheduler.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.query_scheduler.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | ports: 17 | - port: {{ .Values.config.server.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.querySchedulerSelectorLabels" . | nindent 4 }} 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/ruler/_helpers-ruler.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | ruler fullname 4 | */}} 5 | {{- define "cortex.rulerFullname" -}} 6 | {{ include "cortex.fullname" . }}-ruler 7 | {{- end }} 8 | 9 | {{/* 10 | ruler common labels 11 | */}} 12 | {{- define "cortex.rulerLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: ruler 15 | {{- end }} 16 | 17 | {{/* 18 | ruler selector labels 19 | */}} 20 | {{- define "cortex.rulerSelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: ruler 23 | {{- end }} 24 | 25 | {{/* 26 | format rules dir 27 | */}} 28 | {{- define "cortex.rulerRulesDirName" -}} 29 | rules-{{ . | replace "_" "-" | trimSuffix "-" }} 30 | {{- end }} 31 | 32 | {{/* 33 | ruler config validation 34 | Ref: https://cortexmetrics.io/docs/guides/ruler-sharding/ 35 | */}} 36 | {{- define "cortex.rulerValidation" -}} 37 | {{- with .Values.ruler -}} 38 | {{- if .validation.enabled -}} 39 | {{- if or (gt (int .replicas) 1) .autoscaling.enabled -}} 40 | {{- with $.Values.config.ruler -}} 41 | {{- if not .enable_sharding -}} 42 | {{- fail "must enable_sharding to scale the ruler" -}} 43 | {{- end }} 44 | {{- if not ((.ring | default dict).kvstore | default dict).store -}} 45 | {{- fail "must configure kvstore to scale the ruler" -}} 46 | {{- end }} 47 | {{- end }} 48 | {{- end }} 49 | {{- end }} 50 | {{- end }} 51 | {{- end }} 52 | -------------------------------------------------------------------------------- /templates/ruler/ruler-configmap.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.ruler.enabled }} 2 | {{- range $dir, $files := .Values.ruler.directories }} 3 | --- 4 | apiVersion: v1 5 | kind: ConfigMap 6 | metadata: 7 | name: {{ include "cortex.rulerFullname" $ }}-{{ include "cortex.rulerRulesDirName" $dir }} 8 | namespace: {{ $.Release.Namespace }} 9 | labels: 10 | {{- include "cortex.rulerLabels" $ | nindent 4 }} 11 | data: 12 | {{- toYaml $files | nindent 2}} 13 | {{- end }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /templates/ruler/ruler-hpa.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.ruler.enabled .Values.ruler.autoscaling.enabled }} 2 | {{- with .Values.ruler.autoscaling -}} 3 | apiVersion: {{ include "cortex.hpaVersion" $ }} 4 | kind: HorizontalPodAutoscaler 5 | metadata: 6 | name: {{ include "cortex.rulerFullname" $ }} 7 | namespace: {{ $.Release.Namespace }} 8 | labels: 9 | {{- include "cortex.rulerLabels" $ | nindent 4 }} 10 | spec: 11 | scaleTargetRef: 12 | apiVersion: apps/v1 13 | kind: Deployment 14 | name: {{ include "cortex.rulerFullname" $ }} 15 | minReplicas: {{ .minReplicas }} 16 | maxReplicas: {{ .maxReplicas }} 17 | metrics: 18 | {{- with .targetMemoryUtilizationPercentage }} 19 | - type: Resource 20 | resource: 21 | name: memory 22 | target: 23 | type: Utilization 24 | averageUtilization: {{ . }} 25 | {{- end }} 26 | {{- with .targetCPUUtilizationPercentage }} 27 | - type: Resource 28 | resource: 29 | name: cpu 30 | target: 31 | type: Utilization 32 | averageUtilization: {{ . }} 33 | {{- end }} 34 | {{- with .extraMetrics }} 35 | {{- toYaml . | nindent 4 }} 36 | {{- end }} 37 | {{- with .behavior }} 38 | behavior: 39 | {{- toYaml . | nindent 4 }} 40 | {{- end }} 41 | {{- end }} 42 | {{- end }} 43 | -------------------------------------------------------------------------------- /templates/ruler/ruler-poddisruptionbudget.yaml: -------------------------------------------------------------------------------- 1 | {{- if and (gt (int .Values.ruler.replicas) 1) (.Values.ruler.podDisruptionBudget) }} 2 | apiVersion: {{ include "cortex.pdbVersion" . }} 3 | kind: PodDisruptionBudget 4 | metadata: 5 | name: {{ include "cortex.rulerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.rulerLabels" . | nindent 4 }} 9 | spec: 10 | selector: 11 | matchLabels: 12 | {{- include "cortex.rulerSelectorLabels" . | nindent 6 }} 13 | {{- toYaml .Values.ruler.podDisruptionBudget | nindent 2 }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /templates/ruler/ruler-servicemonitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.ruler.serviceMonitor.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "cortex.rulerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.rulerLabels" . | nindent 4 }} 9 | {{- if .Values.ruler.serviceMonitor.additionalLabels }} 10 | {{ toYaml .Values.ruler.serviceMonitor.additionalLabels | indent 4 }} 11 | {{- end }} 12 | {{- if .Values.ruler.serviceMonitor.annotations }} 13 | annotations: 14 | {{ toYaml .Values.ruler.serviceMonitor.annotations | indent 4 }} 15 | {{- end }} 16 | spec: 17 | selector: 18 | matchLabels: 19 | {{- include "cortex.rulerSelectorLabels" . | nindent 6 }} 20 | namespaceSelector: 21 | matchNames: 22 | - {{ .Release.Namespace | quote }} 23 | {{- if .Values.ruler.serviceMonitor.podTargetLabels }} 24 | podTargetLabels: 25 | {{- range .Values.ruler.serviceMonitor.podTargetLabels }} 26 | - {{ . }} 27 | {{- end }} 28 | {{- end }} 29 | endpoints: 30 | - port: http-metrics 31 | {{- if .Values.ruler.serviceMonitor.interval }} 32 | interval: {{ .Values.ruler.serviceMonitor.interval }} 33 | {{- end }} 34 | {{- if .Values.ruler.serviceMonitor.scrapeTimeout }} 35 | scrapeTimeout: {{ .Values.ruler.serviceMonitor.scrapeTimeout }} 36 | {{- end }} 37 | {{- if .Values.ruler.serviceMonitor.relabelings }} 38 | relabelings: 39 | {{- toYaml .Values.ruler.serviceMonitor.relabelings | nindent 4 }} 40 | {{- end }} 41 | {{- if .Values.ruler.serviceMonitor.metricRelabelings }} 42 | metricRelabelings: 43 | {{- toYaml .Values.ruler.serviceMonitor.metricRelabelings | nindent 4 }} 44 | {{- end }} 45 | {{- with .Values.ruler.serviceMonitor.extraEndpointSpec }} 46 | {{- toYaml . | nindent 4 }} 47 | {{- end }} 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /templates/ruler/ruler-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.ruler.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.rulerFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.rulerLabels" . | nindent 4 }} 9 | {{- with .Values.ruler.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.ruler.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | ports: 17 | - port: {{ .Values.config.server.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.rulerSelectorLabels" . | nindent 4 }} 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/runtime-configmap.yaml: -------------------------------------------------------------------------------- 1 | {{- with .Values.runtimeconfigmap }} 2 | {{- if .create }} 3 | apiVersion: v1 4 | kind: ConfigMap 5 | metadata: 6 | name: {{ template "cortex.fullname" $ }}-runtime-config 7 | namespace: {{ $.Release.Namespace }} 8 | labels: 9 | {{- include "cortex.labels" $ | nindent 4 }} 10 | {{- with .annotations }} 11 | annotations: 12 | {{- toYaml . | nindent 4 }} 13 | {{- end }} 14 | data: 15 | runtime_config.yaml: | 16 | {{- tpl (toYaml .runtime_config) $ | nindent 4 }} 17 | {{- end }} 18 | {{- end }} 19 | -------------------------------------------------------------------------------- /templates/secret.yaml: -------------------------------------------------------------------------------- 1 | {{- if (and (not .Values.useExternalConfig) (not .Values.useConfigMap)) }} 2 | apiVersion: v1 3 | kind: Secret 4 | metadata: 5 | name: {{ template "cortex.fullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.labels" . | nindent 4 }} 9 | data: 10 | cortex.yaml: {{ tpl (toYaml .Values.config) . | b64enc }} 11 | {{- end }} 12 | -------------------------------------------------------------------------------- /templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.serviceAccount.create }} 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: {{ template "cortex.serviceAccountName" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.labels" . | nindent 4 }} 9 | annotations: 10 | {{- toYaml .Values.serviceAccount.annotations | nindent 4 }} 11 | automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} 12 | {{- end }} 13 | -------------------------------------------------------------------------------- /templates/store-gateway/_helpers-store-gateway.tpl: -------------------------------------------------------------------------------- 1 | 2 | {{/* 3 | store-gateway fullname 4 | */}} 5 | {{- define "cortex.storeGatewayFullname" -}} 6 | {{ include "cortex.fullname" . }}-store-gateway 7 | {{- end }} 8 | 9 | {{/* 10 | store-gateway common labels 11 | */}} 12 | {{- define "cortex.storeGatewayLabels" -}} 13 | {{ include "cortex.labels" . }} 14 | app.kubernetes.io/component: store-gateway 15 | {{- end }} 16 | 17 | {{/* 18 | store-gateway selector labels 19 | */}} 20 | {{- define "cortex.storeGatewaySelectorLabels" -}} 21 | {{ include "cortex.selectorLabels" . }} 22 | app.kubernetes.io/component: store-gateway 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /templates/store-gateway/store-gateway-hpa.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.store_gateway.enabled .Values.store_gateway.autoscaling.enabled -}} 2 | {{- with .Values.store_gateway.autoscaling -}} 3 | apiVersion: {{ include "cortex.hpaVersion" $ }} 4 | kind: HorizontalPodAutoscaler 5 | metadata: 6 | name: {{ include "cortex.storeGatewayFullname" $ }} 7 | namespace: {{ $.Release.Namespace }} 8 | labels: 9 | {{- include "cortex.storeGatewayLabels" $ | nindent 4 }} 10 | spec: 11 | scaleTargetRef: 12 | apiVersion: apps/v1 13 | kind: StatefulSet 14 | name: {{ include "cortex.storeGatewayFullname" $ }} 15 | minReplicas: {{ .minReplicas }} 16 | maxReplicas: {{ .maxReplicas }} 17 | metrics: 18 | - type: Resource 19 | resource: 20 | name: memory 21 | target: 22 | type: Utilization 23 | averageUtilization: {{ .targetMemoryUtilizationPercentage }} 24 | {{- with .extraMetrics }} 25 | {{- toYaml . | nindent 4 }} 26 | {{- end }} 27 | {{- with .behavior }} 28 | behavior: 29 | {{- toYaml . | nindent 4 }} 30 | {{- end }} 31 | {{- end }} 32 | {{- end }} 33 | -------------------------------------------------------------------------------- /templates/store-gateway/store-gateway-poddisruptionbudget.yaml: -------------------------------------------------------------------------------- 1 | {{- if and (gt (int .Values.store_gateway.replicas) 1) (.Values.store_gateway.podDisruptionBudget) (.Values.store_gateway.enabled) }} 2 | apiVersion: {{ include "cortex.pdbVersion" . }} 3 | kind: PodDisruptionBudget 4 | metadata: 5 | name: {{ include "cortex.storeGatewayFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.storeGatewayLabels" . | nindent 4 }} 9 | spec: 10 | selector: 11 | matchLabels: 12 | {{- include "cortex.storeGatewaySelectorLabels" . | nindent 6 }} 13 | {{- toYaml .Values.store_gateway.podDisruptionBudget | nindent 2 }} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /templates/store-gateway/store-gateway-servicemonitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.store_gateway.serviceMonitor.enabled .Values.store_gateway.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "cortex.storeGatewayFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.storeGatewayLabels" . | nindent 4 }} 9 | {{- if .Values.store_gateway.serviceMonitor.additionalLabels }} 10 | {{ toYaml .Values.store_gateway.serviceMonitor.additionalLabels | indent 4 }} 11 | {{- end }} 12 | {{- if .Values.store_gateway.serviceMonitor.annotations }} 13 | annotations: 14 | {{ toYaml .Values.store_gateway.serviceMonitor.annotations | indent 4 }} 15 | {{- end }} 16 | spec: 17 | selector: 18 | matchLabels: 19 | {{- include "cortex.storeGatewaySelectorLabels" . | nindent 6 }} 20 | namespaceSelector: 21 | matchNames: 22 | - {{ .Release.Namespace | quote }} 23 | {{- if .Values.store_gateway.serviceMonitor.podTargetLabels }} 24 | podTargetLabels: 25 | {{- range .Values.store_gateway.serviceMonitor.podTargetLabels }} 26 | - {{ . }} 27 | {{- end }} 28 | {{- end }} 29 | endpoints: 30 | - port: http-metrics 31 | {{- if .Values.store_gateway.serviceMonitor.interval }} 32 | interval: {{ .Values.store_gateway.serviceMonitor.interval }} 33 | {{- end }} 34 | {{- if .Values.store_gateway.serviceMonitor.scrapeTimeout }} 35 | scrapeTimeout: {{ .Values.store_gateway.serviceMonitor.scrapeTimeout }} 36 | {{- end }} 37 | {{- if .Values.store_gateway.serviceMonitor.relabelings }} 38 | relabelings: 39 | {{- toYaml .Values.store_gateway.serviceMonitor.relabelings | nindent 4 }} 40 | {{- end }} 41 | {{- if .Values.store_gateway.serviceMonitor.metricRelabelings }} 42 | metricRelabelings: 43 | {{- toYaml .Values.store_gateway.serviceMonitor.metricRelabelings | nindent 4 }} 44 | {{- end }} 45 | {{- with .Values.store_gateway.serviceMonitor.extraEndpointSpec }} 46 | {{- toYaml . | nindent 4 }} 47 | {{- end }} 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /templates/store-gateway/store-gateway-statefulset.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.store_gateway.enabled -}} 2 | apiVersion: apps/v1 3 | kind: StatefulSet 4 | metadata: 5 | name: {{ include "cortex.storeGatewayFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.storeGatewayLabels" . | nindent 4 }} 9 | app.kubernetes.io/part-of: memberlist 10 | annotations: 11 | {{- toYaml .Values.store_gateway.annotations | nindent 4 }} 12 | spec: 13 | {{- if not .Values.store_gateway.autoscaling.enabled }} 14 | replicas: {{ .Values.store_gateway.replicas }} 15 | {{- end }} 16 | selector: 17 | matchLabels: 18 | {{- include "cortex.storeGatewaySelectorLabels" . | nindent 6 }} 19 | updateStrategy: 20 | {{- toYaml .Values.store_gateway.strategy | nindent 4 }} 21 | podManagementPolicy: {{ .Values.store_gateway.podManagementPolicy | quote }} 22 | serviceName: {{ template "cortex.fullname" . }}-store-gateway-headless 23 | {{- if .Values.store_gateway.persistentVolume.enabled }} 24 | {{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.Version }} 25 | {{- with .Values.store_gateway.persistentVolume.retentionPolicy }} 26 | persistentVolumeClaimRetentionPolicy: 27 | {{- toYaml . | nindent 4 }} 28 | {{- end }} 29 | {{- end }} 30 | volumeClaimTemplates: 31 | - metadata: 32 | name: storage 33 | {{- if .Values.store_gateway.persistentVolume.annotations }} 34 | annotations: 35 | {{ toYaml .Values.store_gateway.persistentVolume.annotations | nindent 10 }} 36 | {{- end }} 37 | spec: 38 | {{- if .Values.store_gateway.persistentVolume.storageClass }} 39 | {{- if (eq "-" .Values.store_gateway.persistentVolume.storageClass) }} 40 | storageClassName: "" 41 | {{- else }} 42 | storageClassName: "{{ .Values.store_gateway.persistentVolume.storageClass }}" 43 | {{- end }} 44 | {{- end }} 45 | accessModes: 46 | {{- toYaml .Values.store_gateway.persistentVolume.accessModes | nindent 10 }} 47 | resources: 48 | requests: 49 | storage: "{{ .Values.store_gateway.persistentVolume.size }}" 50 | {{- end }} 51 | template: 52 | metadata: 53 | labels: 54 | {{- include "cortex.storeGatewayLabels" . | nindent 8 }} 55 | app.kubernetes.io/part-of: memberlist 56 | {{- with .Values.store_gateway.podLabels }} 57 | {{- toYaml . | nindent 8 }} 58 | {{- end }} 59 | annotations: 60 | checksum/config: {{ include "cortex.configChecksum" . }} 61 | {{- with .Values.store_gateway.podAnnotations }} 62 | {{- toYaml . | nindent 8 }} 63 | {{- end }} 64 | spec: 65 | serviceAccountName: {{ .Values.store_gateway.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }} 66 | {{- if .Values.store_gateway.priorityClassName }} 67 | priorityClassName: {{ .Values.store_gateway.priorityClassName }} 68 | {{- end }} 69 | {{- if .Values.store_gateway.securityContext.enabled }} 70 | securityContext: {{- omit .Values.store_gateway.securityContext "enabled" | toYaml | nindent 8 }} 71 | {{- end }} 72 | initContainers: 73 | {{- toYaml .Values.store_gateway.initContainers | nindent 8 }} 74 | {{- if .Values.image.pullSecrets }} 75 | imagePullSecrets: 76 | {{- range .Values.image.pullSecrets }} 77 | - name: {{ . }} 78 | {{- end }} 79 | {{- end }} 80 | nodeSelector: 81 | {{- toYaml .Values.store_gateway.nodeSelector | nindent 8 }} 82 | {{- if .Values.store_gateway.topologySpreadConstraints }} 83 | topologySpreadConstraints: 84 | {{- toYaml .Values.store_gateway.topologySpreadConstraints | nindent 8}} 85 | {{- end }} 86 | affinity: 87 | {{- toYaml .Values.store_gateway.affinity | nindent 8 }} 88 | tolerations: 89 | {{- toYaml .Values.store_gateway.tolerations | nindent 8 }} 90 | terminationGracePeriodSeconds: {{ .Values.store_gateway.terminationGracePeriodSeconds }} 91 | volumes: 92 | {{- include "cortex.configVolume" . | nindent 8 }} 93 | - name: runtime-config 94 | configMap: 95 | name: {{ template "cortex.fullname" . }}-runtime-config 96 | {{- if not .Values.store_gateway.persistentVolume.enabled }} 97 | - name: storage 98 | emptyDir: {} 99 | {{- end }} 100 | {{- if .Values.store_gateway.extraVolumes }} 101 | {{- toYaml .Values.store_gateway.extraVolumes | nindent 8 }} 102 | {{- end }} 103 | containers: 104 | {{- if .Values.store_gateway.extraContainers }} 105 | {{ toYaml .Values.store_gateway.extraContainers | nindent 8 }} 106 | {{- end }} 107 | - name: store-gateway 108 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" 109 | imagePullPolicy: {{ .Values.image.pullPolicy }} 110 | args: 111 | - "-target=store-gateway" 112 | - "-config.file=/etc/cortex/cortex.yaml" 113 | {{- include "cortex.memcached" . | nindent 12}} 114 | {{- range $key, $value := .Values.store_gateway.extraArgs }} 115 | - "-{{ $key }}={{ $value }}" 116 | {{- end }} 117 | volumeMounts: 118 | {{- if .Values.store_gateway.extraVolumeMounts }} 119 | {{- toYaml .Values.store_gateway.extraVolumeMounts | nindent 12}} 120 | {{- end }} 121 | - name: config 122 | mountPath: /etc/cortex 123 | - name: runtime-config 124 | mountPath: /etc/cortex-runtime-config 125 | - name: storage 126 | mountPath: "/data" 127 | {{- if .Values.store_gateway.persistentVolume.subPath }} 128 | subPath: {{ .Values.store_gateway.persistentVolume.subPath }} 129 | {{- end }} 130 | ports: 131 | - name: http-metrics 132 | containerPort: {{ .Values.config.server.http_listen_port }} 133 | protocol: TCP 134 | - name: grpc 135 | containerPort: {{ .Values.config.server.grpc_listen_port }} 136 | protocol: TCP 137 | - name: gossip 138 | containerPort: {{ .Values.config.memberlist.bind_port }} 139 | protocol: TCP 140 | startupProbe: 141 | {{- toYaml .Values.store_gateway.startupProbe | nindent 12 }} 142 | {{- if .Values.store_gateway.livenessProbe }} 143 | livenessProbe: 144 | {{- toYaml .Values.store_gateway.livenessProbe | nindent 12 }} 145 | {{- end }} 146 | readinessProbe: 147 | {{- toYaml .Values.store_gateway.readinessProbe | nindent 12 }} 148 | resources: 149 | {{- toYaml .Values.store_gateway.resources | nindent 12 }} 150 | {{- if .Values.store_gateway.containerSecurityContext.enabled }} 151 | securityContext: {{- omit .Values.store_gateway.containerSecurityContext "enabled" | toYaml | nindent 12 }} 152 | {{- end }} 153 | {{- if .Values.store_gateway.env }} 154 | env: 155 | {{- toYaml .Values.store_gateway.env | nindent 12 }} 156 | {{- end }} 157 | {{- end -}} 158 | -------------------------------------------------------------------------------- /templates/store-gateway/store-gateway-svc-headless.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.store_gateway.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.storeGatewayFullname" . }}-headless 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.storeGatewayLabels" . | nindent 4 }} 9 | {{- with .Values.store_gateway.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.store_gateway.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | clusterIP: None 17 | ports: 18 | - port: {{ .Values.config.server.grpc_listen_port }} 19 | protocol: TCP 20 | name: grpc 21 | targetPort: grpc 22 | selector: 23 | {{- include "cortex.storeGatewaySelectorLabels" . | nindent 4 }} 24 | {{- end -}} 25 | -------------------------------------------------------------------------------- /templates/store-gateway/store-gateway-svc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.store_gateway.enabled -}} 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: {{ include "cortex.storeGatewayFullname" . }} 6 | namespace: {{ .Release.Namespace }} 7 | labels: 8 | {{- include "cortex.storeGatewayLabels" . | nindent 4 }} 9 | {{- with .Values.store_gateway.service.labels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | annotations: 13 | {{- toYaml .Values.store_gateway.service.annotations | nindent 4 }} 14 | spec: 15 | type: ClusterIP 16 | ports: 17 | - port: {{ .Values.config.server.http_listen_port }} 18 | protocol: TCP 19 | name: http-metrics 20 | targetPort: http-metrics 21 | selector: 22 | {{- include "cortex.storeGatewaySelectorLabels" . | nindent 4 }} 23 | {{- end -}} 24 | -------------------------------------------------------------------------------- /templates/svc-memberlist-headless.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ include "cortex.fullname" . }}-memberlist 5 | namespace: {{ .Release.Namespace }} 6 | labels: 7 | {{- include "cortex.labels" . | nindent 4 }} 8 | {{- with .Values.memberlist.service.labels }} 9 | {{- toYaml . | nindent 4 }} 10 | {{- end }} 11 | annotations: 12 | {{- toYaml .Values.memberlist.service.annotations | nindent 4 }} 13 | spec: 14 | type: ClusterIP 15 | clusterIP: None 16 | ports: 17 | - port: {{ .Values.config.memberlist.bind_port }} 18 | protocol: TCP 19 | appProtocol: tcp 20 | name: gossip 21 | targetPort: gossip 22 | selector: 23 | {{- include "cortex.selectorLabels" . | nindent 4 }} 24 | app.kubernetes.io/part-of: memberlist 25 | -------------------------------------------------------------------------------- /tools/chart-version-tag.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o nounset 4 | set -o pipefail 5 | 6 | RELEASE_TAG=$(git describe --tags --exact-match 2>/dev/null) 7 | set -o errexit 8 | if [ -z "$RELEASE_TAG" ] 9 | then 10 | WORKING_SUFFIX=$(if git status --porcelain | grep -qE '^(?:[^?][^ ]|[^ ][^?])\s'; then echo "-WIP"; else echo ""; fi) 11 | BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) 12 | TAG_PREFIX=$(git describe --tags 2>/dev/null) 13 | echo "$TAG_PREFIX-${BRANCH_NAME//\//-}$WORKING_SUFFIX" 14 | else 15 | echo "$RELEASE_TAG" 16 | fi --------------------------------------------------------------------------------