Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
deploy/helm-chart: improve Service and annotation handling
Browse files Browse the repository at this point in the history
Signed-off-by: Paweł Krupa (paulfantom) <pawel@krupa.net.pl>
  • Loading branch information
paulfantom committed Jul 18, 2022
1 parent 107ba0f commit 5ebde17
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 45 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ We use the following categories for changes:
### Added
- Network latency metric [#1431]
- Ability to configure reader-pool and writer-pool sizes [#1451]
- Add ability to specify Deployment annotations and Pod annotations in helm charts [#1495]
- Deprecate `openTelemetry` and `prometheus` top-level objects in helm chart in favour of `.service.openTelemetry` and `.service.prometheus` [#1495]
- Allow disabling exposition of promscale port in Service object. [#1495]
- Enable prometheus annotation based scraping only when ServiceMonitor is disabled. [#1495]

### Changed
- `db.num-writer-connections` now sets the absolute number of write connections for writing metrics. [#1430]
Expand Down
57 changes: 30 additions & 27 deletions deploy/helm-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,30 +112,33 @@ helm install --name my-release -f myvalues.yaml .

## Configuration

| Parameter | Description | Default |
|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| `image` | The image (with tag) to pull | `timescale/promscale` |
| `imagePullPolicy` | The image pull policy | `IfNotPresent` |
| `replicaCount` | Number of pods for the connector | `1` |
| `upgradeStrategy` | Promscale deployment upgrade strategy, By default set to `Recreate` as during Promscale upgrade we expect no Promscale to be connected to TimescaleDB | `Recreate` |
| `resources` | Requests and limits for each of the pods | `{}` |
| `nodeSelector` | Node labels to use for scheduling | `{}` |
| `tolerations` | Tolerations to use for scheduling | `[]` |
| `affinity` | PodAffinity and PodAntiAffinity settings | `{}` |
| `extraArgs` | Additional promscale CLI arguments | `[]` |
| `extraEnv` | Additional promscale environment variables | `[]` |
| `extraEnvFrom` | Additional promscale environment variables originating from e.g. secrets or configmaps | `[]` |
| `connection.uri` | DB uri string used for database connection. When not empty it takes priority over other settings in `connection` map. | `""` |
| `connection.user` | Username to connect to TimescaleDB with | `postgres` |
| `connection.password` | The DB password for user specified in `connection.user` | `""` |
| `connection.host` | Hostname of timescaledb instance | `db.timescaledb.svc.cluster.local` |
| `connection.port` | Port the db listens to | `5432` |
| `connection.dbName` | Database name in TimescaleDB to connect to | `timescale` |
| `connection.sslMode` | SSL mode for connection | `require` |
| `config` | Promscale configuration options. Full list of options is available at [docs/configuration.md](https://github.com/timescale/promscale/blob/master/docs/configuration.md) | `` |
| `prometheus.port` | Port the connector Service accepts prometheus remote_write connections on | `9201` |
| `prometheus.annotations` | Annotations to allow prometheus metrics collection. | `{ "prometheus.io/scrape": 'true', "prometheus.io/port": '9201', "prometheus.io/path": '/metrics'}` |
| `openTelemetry.port` | Port the connector Service will accept otlp connections on | `9202` |
| `service.type` | Type of Service to be used | `ClusterIP` |
| `service.annotations` | Annotations to set to the Service | `{}` |
| `serviceMonitor.enabled` | Enable creation of serviceMonitor object used by prometheus-operator. `prometheus.annotations` should be set to `{}` when using this option. | `false` |
| Parameter | Description | Default |
|---------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| `image` | The image (with tag) to pull | `timescale/promscale` |
| `imagePullPolicy` | The image pull policy | `IfNotPresent` |
| `replicaCount` | Number of pods for the connector | `1` |
| `upgradeStrategy` | Promscale deployment upgrade strategy, By default set to `Recreate` as during Promscale upgrade we expect no Promscale to be connected to TimescaleDB | `Recreate` |
| `resources` | Requests and limits for each of the pods | `{}` |
| `nodeSelector` | Node labels to use for scheduling | `{}` |
| `tolerations` | Tolerations to use for scheduling | `[]` |
| `affinity` | PodAffinity and PodAntiAffinity settings | `{}` |
| `extraArgs` | Additional promscale CLI arguments | `[]` |
| `extraEnv` | Additional promscale environment variables | `[]` |
| `extraEnvFrom` | Additional promscale environment variables originating from e.g. secrets or configmaps | `[]` |
| `annotations` | Annotations added to promscale Deployment | `{}` |
| `podAnnotations` | Annotations added to promscale Pods | `{}` |
| `connection.uri` | DB uri string used for database connection. When not empty it takes priority over other settings in `connection` map. | `""` |
| `connection.user` | Username to connect to TimescaleDB with | `postgres` |
| `connection.password` | The DB password for user specified in `connection.user` | `""` |
| `connection.host` | Hostname of timescaledb instance | `db.timescaledb.svc.cluster.local` |
| `connection.port` | Port the db listens to | `5432` |
| `connection.dbName` | Database name in TimescaleDB to connect to | `timescale` |
| `connection.sslMode` | SSL mode for connection | `require` |
| `config` | Promscale configuration options. Full list of options is available at [docs/configuration.md](https://github.com/timescale/promscale/blob/master/docs/configuration.md) | `` |
| `service.type` | Type of Service to be used | `ClusterIP` |
| `service.annotations` | Annotations to set to the Service | `{}` |
| `service.prometheus.enabled` | Expose prometheus remote_write port in the Service object to allow sending prometheus data to promscale. | `true` |
| `service.prometheus.port` | Port the connector Service accepts prometheus remote_write connections on | `9201` |
| `service.openTelemetry.port` | Port the connector Service will accept otlp connections on | `9202` |
| `service.openTelemetry.enabled` | Expose OpenTelemetry port in the Service object to allow sending OTel data to promscale. | `true` |
| `serviceMonitor.enabled` | Enable creation of serviceMonitor object used by prometheus-operator. Setting this to false enables prometheus annotation-based scraping. | `false` |
14 changes: 11 additions & 3 deletions deploy/helm-chart/templates/deployment-promscale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ metadata:
name: {{ include "promscale.fullname" . }}
namespace: {{ template "promscale.namespace" . }}
labels:
{{ include "promscale-helm.labels" . | indent 4 }}
{{ include "promscale-helm.labels" . | nindent 4 }}
{{- if .Values.annotations }}
annotations: {{ toYaml .Values.annotations | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
Expand All @@ -20,8 +23,13 @@ spec:
annotations:
checksum/connection: {{ printf "%s" .Values.connection | sha256sum }}
checksum/config: {{ printf "%s" .Values.config | sha256sum }}
{{- if .Values.prometheus.annotations }}
{{- .Values.prometheus.annotations | toYaml | nindent 8 }}
prometheus.io/port: '9201'
prometheus.io/path: '/metrics'
prometheus.io/scrape: {{ not .Values.serviceMonitor.enabled | quote }}
{{- if .Values.podAnnotations }}
{{- range $key, $value := .Values.podAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
containers:
Expand Down
10 changes: 8 additions & 2 deletions deploy/helm-chart/templates/svc-promscale.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if or .Values.service.prometheus.enabled .Values.service.openTelemetry.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -14,11 +15,16 @@ spec:
app: {{ include "promscale.fullname" . }}
type: {{ .Values.service.type }}
ports:
{{ if .Values.service.prometheus.enabled }}
- name: metrics-port
port: {{ .Values.prometheus.port }}
port: {{ .Values.service.prometheus.port }}
targetPort: metrics-port
protocol: TCP
{{- end }}
{{ if .Values.service.openTelemetry.enabled }}
- name: otel-port
port: {{ .Values.openTelemetry.port }}
port: {{ .Values.service.openTelemetry.port }}
targetPort: otel-port
protocol: TCP
{{- end }}
{{- end }}
Loading

0 comments on commit 5ebde17

Please sign in to comment.