diff --git a/stable/stolon/Chart.yaml b/stable/stolon/Chart.yaml index 90cd01b45c..96c685b3f3 100644 --- a/stable/stolon/Chart.yaml +++ b/stable/stolon/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: stolon -version: 1.4.1 +version: 1.5.0 appVersion: 0.13.0 description: Stolon - PostgreSQL cloud native High Availability. home: https://github.com/sorintlab/stolon diff --git a/stable/stolon/README.md b/stable/stolon/README.md index 0abbce691e..8b3f6b140d 100644 --- a/stable/stolon/README.md +++ b/stable/stolon/README.md @@ -55,6 +55,10 @@ Kubernetes is the default store backend. `consul`, `etcdv2` or `etcdv3` can also | `store.kubeResourceKind` | Kubernetes resource kind (only for kubernetes) | `configmap` | | `pgParameters` | [`postgresql.conf`][pgconf] options used during cluster creation | `{}` | | `ports` | Ports to expose on pods | `{"stolon":{"containerPort": 5432},"metrics":{"containerPort": 8080}}`| +| `serviceMonitor.enabled` | Creates a Prometheus serviceMonitor and service object | `false`| +| `serviceMonitor.namespace` | Set to use a different value than the release namespace for deploying the ServiceMonitor object | `nil` | +| `serviceMonitor.interval` | Set to use a different value than the default Prometheus scrape interval | `nil` | +| `serviceMonitor.scrapeTimeout` | Set to use a different value than the default Prometheus scrape timeout | `nil` | | `job.autoCreateCluster` | Set to `false` to force-disable auto-cluster-creation which may clear pre-existing postgres db data | `true` | | `job.autoUpdateClusterSpec` | Set to `false` to force-disable auto-cluster-spec-update | `true` | | `clusterSpec` | Stolon cluster spec [reference](https://github.com/sorintlab/stolon/blob/master/doc/cluster_spec.md) | `{}` | diff --git a/stable/stolon/templates/keeper-statefulset.yaml b/stable/stolon/templates/keeper-statefulset.yaml index 8dca1b0ee2..e46b65c4b2 100644 --- a/stable/stolon/templates/keeper-statefulset.yaml +++ b/stable/stolon/templates/keeper-statefulset.yaml @@ -97,7 +97,7 @@ spec: value: "/etc/secrets/stolon/pg_su_password" {{ end }} - name: STKEEPER_METRICS_LISTEN_ADDRESS - value: "0.0.0.0:8080" + value: "0.0.0.0:{{ .Values.ports.metrics.containerPort }}" - name: STKEEPER_DEBUG value: {{ .Values.debug | quote}} {{- if .Values.keeper.extraEnv }} diff --git a/stable/stolon/templates/metrics-service.yaml b/stable/stolon/templates/metrics-service.yaml new file mode 100644 index 0000000000..e9870e98e3 --- /dev/null +++ b/stable/stolon/templates/metrics-service.yaml @@ -0,0 +1,19 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "stolon.fullname" . }}-metrics + labels: + app: {{ template "stolon.name" . }} + chart: {{ template "stolon.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + component: "all" +spec: + ports: + - name: metrics + port: {{ .Values.ports.metrics.containerPort }} + selector: + app: {{ template "stolon.name" . }} + release: {{ .Release.Name }} +{{- end }} diff --git a/stable/stolon/templates/metrics-servicemonitor.yaml b/stable/stolon/templates/metrics-servicemonitor.yaml new file mode 100644 index 0000000000..a1bc3282ec --- /dev/null +++ b/stable/stolon/templates/metrics-servicemonitor.yaml @@ -0,0 +1,31 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "stolon.fullname" . }} + labels: + app: {{ template "stolon.name" . }} + chart: {{ template "stolon.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- if .Values.serviceMonitor.namespace }} + namespace: {{ .Values.serviceMonitor.namespace }} + {{- end }} +spec: + endpoints: + - targetPort: "metrics" + {{- if .Values.serviceMonitor.interval }} + interval: {{ .Values.serviceMonitor.interval }} + {{- end }} + {{- if .Values.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: + app: {{ template "stolon.name" . }} + release: {{ .Release.Name }} + component: "all" +{{- end }} diff --git a/stable/stolon/templates/proxy-deployment.yaml b/stable/stolon/templates/proxy-deployment.yaml index 7aa2e8c514..84c2c85d28 100644 --- a/stable/stolon/templates/proxy-deployment.yaml +++ b/stable/stolon/templates/proxy-deployment.yaml @@ -58,7 +58,7 @@ spec: - name: STPROXY_LISTEN_ADDRESS value: {{ default "0.0.0.0" .Values.proxy.listenAddress | quote }} - name: STPROXY_METRICS_LISTEN_ADDRESS - value: "0.0.0.0:8080" + value: "0.0.0.0:{{ .Values.ports.metrics.containerPort }}" - name: STPROXY_DEBUG value: {{ .Values.debug | quote}} {{- if .Values.proxy.extraEnv }} diff --git a/stable/stolon/templates/sentinel-deployment.yaml b/stable/stolon/templates/sentinel-deployment.yaml index 9f1e7b6fe7..0ba6932dae 100644 --- a/stable/stolon/templates/sentinel-deployment.yaml +++ b/stable/stolon/templates/sentinel-deployment.yaml @@ -57,7 +57,7 @@ spec: value: {{ .Values.store.endpoints | quote}} {{- end }} - name: STSENTINEL_METRICS_LISTEN_ADDRESS - value: "0.0.0.0:8080" + value: "0.0.0.0:{{ .Values.ports.metrics.containerPort }}" - name: STSENTINEL_DEBUG value: {{ .Values.debug | quote}} {{- if .Values.sentinel.extraEnv }} diff --git a/stable/stolon/values.yaml b/stable/stolon/values.yaml index e66a712b6d..79c27d00be 100644 --- a/stable/stolon/values.yaml +++ b/stable/stolon/values.yaml @@ -66,6 +66,16 @@ ports: metrics: containerPort: 8080 +serviceMonitor: + # When set to true then use a ServiceMonitor to collect metrics + enabled: false + # Set the namespace the ServiceMonitor should be deployed to + # namespace: default + # Set how frequently Prometheus should scrape + # interval: 30s + # Set timeout for scrape + # scrapeTimeout: 10s + job: autoCreateCluster: true autoUpdateClusterSpec: true