From 7f23af26b7cf793ce50dd1814900964dda93ae6f Mon Sep 17 00:00:00 2001 From: Michael Marshall Date: Wed, 19 Oct 2022 08:23:08 -0700 Subject: [PATCH] Replace monitoring solution with kube-prometheus-stack dependency (#299) * Replace monitoring solution with kube-prometheus-stack dependency * Enable pod monitors * Download necessary chart dependencies for CI * Actually run dependency update * Enable missed podMonitor * Disable alertmanager by default for feature parity Related issues #294 #65 Supersedes #296 and #297 ### Motivation Our helm chart is out of date. I propose we make a breaking change for the monitoring solution and start using the `kube-prometheus-stack` as a dependency. This should make upgrades easier and will let users leverage all of that chart's features. This change will result in the removal of the StreamNative Grafana Dashboards. We'll need to figure out the right way to address that. The apache/pulsar project has grafana dashboards, but they have not been maintained. With this added dependency, we'll have the benefit of being able to use k8s `ConfigMap`s to configure grafana dashboards. ### Modifications * Remove old prometheus and grafana configuration * Add kube-prometheus-stack chart as a dependency * Enable several components by default. I am not opinionated on these, but it is based on the other values in the chart. ### Verifying this change This is a large change that will require manual validation, and may break deployments. I propose this triggers a helm chart 3.0.0 release. --- .ci/helm.sh | 2 + charts/pulsar/Chart.yaml | 5 + .../templates/grafana-admin-secret.yaml | 35 ---- .../pulsar/templates/grafana-configmap.yaml | 31 ---- .../pulsar/templates/grafana-deployment.yaml | 91 ---------- charts/pulsar/templates/grafana-ingress.yaml | 66 ------- charts/pulsar/templates/grafana-service.yaml | 48 ----- .../templates/prometheus-configmap.yaml | 66 ------- .../templates/prometheus-deployment.yaml | 97 ---------- charts/pulsar/templates/prometheus-pvc.yaml | 40 ---- charts/pulsar/templates/prometheus-rbac.yaml | 59 ------ .../pulsar/templates/prometheus-service.yaml | 39 ---- .../templates/prometheus-storageclass.yaml | 37 ---- charts/pulsar/values.yaml | 171 +++--------------- 14 files changed, 34 insertions(+), 753 deletions(-) delete mode 100644 charts/pulsar/templates/grafana-admin-secret.yaml delete mode 100644 charts/pulsar/templates/grafana-configmap.yaml delete mode 100644 charts/pulsar/templates/grafana-deployment.yaml delete mode 100644 charts/pulsar/templates/grafana-ingress.yaml delete mode 100644 charts/pulsar/templates/grafana-service.yaml delete mode 100644 charts/pulsar/templates/prometheus-configmap.yaml delete mode 100644 charts/pulsar/templates/prometheus-deployment.yaml delete mode 100644 charts/pulsar/templates/prometheus-pvc.yaml delete mode 100644 charts/pulsar/templates/prometheus-rbac.yaml delete mode 100644 charts/pulsar/templates/prometheus-service.yaml delete mode 100644 charts/pulsar/templates/prometheus-storageclass.yaml diff --git a/.ci/helm.sh b/.ci/helm.sh index ad4e01f..a59ded8 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -110,6 +110,8 @@ function ci::install_pulsar_chart() { ${CHARTS_HOME}/scripts/pulsar/prepare_helm_release.sh -k ${CLUSTER} -n ${NAMESPACE} ${extra_opts} sleep 10 + echo ${HELM} dependency update ${CHARTS_HOME}/charts/pulsar + ${HELM} dependency update ${CHARTS_HOME}/charts/pulsar echo ${HELM} install --set initialize=true --values ${value_file} ${CLUSTER} ${CHARTS_HOME}/charts/pulsar ${HELM} template --values ${value_file} ${CLUSTER} ${CHARTS_HOME}/charts/pulsar ${HELM} install --set initialize=true --values ${value_file} --namespace=${NAMESPACE} ${CLUSTER} ${CHARTS_HOME}/charts/pulsar diff --git a/charts/pulsar/Chart.yaml b/charts/pulsar/Chart.yaml index cd390dc..ad51daf 100644 --- a/charts/pulsar/Chart.yaml +++ b/charts/pulsar/Chart.yaml @@ -29,3 +29,8 @@ icon: https://pulsar.apache.org/img/pulsar.svg maintainers: - name: The Apache Pulsar Team email: dev@pulsar.apache.org +dependencies: + - name: kube-prometheus-stack + version: 41.x.x + repository: https://prometheus-community.github.io/helm-charts + condition: kube-prometheus-stack.enabled \ No newline at end of file diff --git a/charts/pulsar/templates/grafana-admin-secret.yaml b/charts/pulsar/templates/grafana-admin-secret.yaml deleted file mode 100644 index d38e823..0000000 --- a/charts/pulsar/templates/grafana-admin-secret.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -{{- if or .Values.monitoring.grafana .Values.extra.monitoring }} -apiVersion: v1 -kind: Secret -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}-secret" - namespace: {{ template "pulsar.namespace" . }} - labels: - {{- include "pulsar.standardLabels" . | nindent 4 }} - component: {{ .Values.grafana.component }} -type: Opaque -stringData: - {{- if .Values.grafana.admin}} - GRAFANA_ADMIN_PASSWORD: {{ .Values.grafana.admin.password | default "pulsar" }} - GRAFANA_ADMIN_USER: {{ .Values.grafana.admin.user | default "pulsar" }} - {{- end }} -{{- end }} diff --git a/charts/pulsar/templates/grafana-configmap.yaml b/charts/pulsar/templates/grafana-configmap.yaml deleted file mode 100644 index 9d5fa71..0000000 --- a/charts/pulsar/templates/grafana-configmap.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -{{- if or .Values.monitoring.grafana .Values.extra.monitoring }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}" - namespace: {{ template "pulsar.namespace" . }} - labels: - {{- include "pulsar.standardLabels" . | nindent 4 }} - component: {{ .Values.grafana.component }} -data: -{{ toYaml .Values.grafana.configData | indent 2 }} -{{- end }} diff --git a/charts/pulsar/templates/grafana-deployment.yaml b/charts/pulsar/templates/grafana-deployment.yaml deleted file mode 100644 index 86787d9..0000000 --- a/charts/pulsar/templates/grafana-deployment.yaml +++ /dev/null @@ -1,91 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -{{- if or .Values.monitoring.grafana .Values.extra.monitoring }} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}" - namespace: {{ template "pulsar.namespace" . }} - labels: - {{- include "pulsar.standardLabels" . | nindent 4 }} - component: {{ .Values.grafana.component }} -spec: - replicas: {{ .Values.grafana.replicaCount }} - selector: - matchLabels: - {{- include "pulsar.matchLabels" . | nindent 6 }} - component: {{ .Values.grafana.component }} - template: - metadata: - labels: - {{- include "pulsar.template.labels" . | nindent 8 }} - component: {{ .Values.grafana.component }} - annotations: - {{- if .Values.grafana.restartPodsOnConfigMapChange }} - checksum/config: {{ include (print $.Template.BasePath "/grafana-configmap.yaml") . | sha256sum }} - {{- end }} -{{- with .Values.grafana.annotations }} -{{ toYaml . | indent 8 }} -{{- end }} - spec: - {{- if .Values.grafana.nodeSelector }} - nodeSelector: -{{ toYaml .Values.grafana.nodeSelector | indent 8 }} - {{- end }} - {{- if .Values.grafana.tolerations }} - tolerations: -{{ toYaml .Values.grafana.tolerations | indent 8 }} - {{- end }} - terminationGracePeriodSeconds: {{ .Values.grafana.gracePeriod }} - containers: - - name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}" - image: "{{ .Values.images.grafana.repository }}:{{ .Values.images.grafana.tag }}" - imagePullPolicy: {{ .Values.images.grafana.pullPolicy }} - {{- if .Values.grafana.resources }} - resources: -{{ toYaml .Values.grafana.resources | indent 10 }} - {{- end }} - ports: - - name: server - containerPort: {{ .Values.grafana.service.targetPort }} - envFrom: - - configMapRef: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}" - env: - # for supporting apachepulsar/pulsar-grafana - - name: PROMETHEUS_URL - value: http://{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}:9090/ - # for supporting streamnative/apache-pulsar-grafana-dashboard - - name: PULSAR_PROMETHEUS_URL - value: http://{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}:9090/ - - name: PULSAR_CLUSTER - value: {{ template "pulsar.fullname" . }} - - name: GRAFANA_ADMIN_USER - valueFrom: - secretKeyRef: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}-secret" - key: GRAFANA_ADMIN_USER - - name: GRAFANA_ADMIN_PASSWORD - valueFrom: - secretKeyRef: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}-secret" - key: GRAFANA_ADMIN_PASSWORD - {{- include "pulsar.imagePullSecrets" . | nindent 6}} -{{- end }} diff --git a/charts/pulsar/templates/grafana-ingress.yaml b/charts/pulsar/templates/grafana-ingress.yaml deleted file mode 100644 index f556726..0000000 --- a/charts/pulsar/templates/grafana-ingress.yaml +++ /dev/null @@ -1,66 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -{{- if or .Values.monitoring.grafana .Values.extra.monitoring }} -{{- if .Values.grafana.ingress.enabled }} -{{- if semverCompare "<1.19-0" .Capabilities.KubeVersion.Version }} -apiVersion: extensions/v1beta1 -{{- else }} -apiVersion: networking.k8s.io/v1 -{{- end }} -kind: Ingress -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}" - namespace: {{ template "pulsar.namespace" . }} - labels: - app: {{ template "pulsar.name" . }} - chart: {{ template "pulsar.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -{{- with .Values.grafana.ingress.annotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} -spec: -{{- if .Values.grafana.ingress.tls }} - tls: -{{ toYaml .Values.grafana.ingress.tls | indent 4 }} -{{- end }} - rules: - - http: - paths: - - path: {{ .Values.grafana.ingress.path }} - {{- if semverCompare "<1.19-0" .Capabilities.KubeVersion.Version }} - backend: - serviceName: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}" - servicePort: {{ .Values.grafana.ingress.port }} - {{- else }} - pathType: ImplementationSpecific - backend: - service: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}" - port: - number: {{ .Values.grafana.ingress.port }} - {{- end }} - {{- if .Values.grafana.ingress.hostname }} - host: {{ .Values.grafana.ingress.hostname }} - {{- end }} - - {{- end }} - {{- end }} diff --git a/charts/pulsar/templates/grafana-service.yaml b/charts/pulsar/templates/grafana-service.yaml deleted file mode 100644 index 4aa7f2d..0000000 --- a/charts/pulsar/templates/grafana-service.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -{{- if or .Values.monitoring.grafana .Values.extra.monitoring }} -apiVersion: v1 -kind: Service -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}" - namespace: {{ template "pulsar.namespace" . }} - labels: - {{- include "pulsar.standardLabels" . | nindent 4 }} - component: {{ .Values.grafana.component }} - annotations: -{{- with .Values.grafana.service.annotations }} -{{ toYaml . | indent 4 }} -{{- end }} -spec: - type: {{ .Values.grafana.service.type }} - ports: - - name: server - port: {{ .Values.grafana.service.port }} - targetPort: {{ .Values.grafana.service.targetPort }} - protocol: TCP - selector: - {{- include "pulsar.matchLabels" . | nindent 4 }} - component: {{ .Values.grafana.component }} - sessionAffinity: None -{{- if .Values.grafana.service.loadBalancerSourceRanges }} - loadBalancerSourceRanges: -{{ toYaml .Values.grafana.service.loadBalancerSourceRanges | indent 4 }} -{{- end }} -{{- end }} diff --git a/charts/pulsar/templates/prometheus-configmap.yaml b/charts/pulsar/templates/prometheus-configmap.yaml deleted file mode 100644 index ffe9660..0000000 --- a/charts/pulsar/templates/prometheus-configmap.yaml +++ /dev/null @@ -1,66 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -{{- if or .Values.monitoring.prometheus .Values.extra.monitoring }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}" - namespace: {{ template "pulsar.namespace" . }} - labels: - {{- include "pulsar.standardLabels" . | nindent 4 }} - component: {{ .Values.prometheus.component }} -data: - # Include prometheus configuration file, setup to monitor all the - # Kubernetes pods with the "scrape=true" annotation. - prometheus.yml: | - global: - scrape_interval: 15s - scrape_configs: - - job_name: 'prometheus' - static_configs: - - targets: ['localhost:9090'] - - job_name: 'kubernetes-pods' - kubernetes_sd_configs: - - role: pod - relabel_configs: - - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] - action: keep - regex: true - - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] - action: replace - target_label: __metrics_path__ - regex: (.+) - - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] - action: replace - regex: ([^:]+)(?::\d+)?;(\d+) - replacement: $1:$2 - target_label: __address__ - - action: labelmap - regex: __meta_kubernetes_pod_label_(.+) - - source_labels: [__meta_kubernetes_namespace] - action: replace - target_label: kubernetes_namespace - - source_labels: [__meta_kubernetes_pod_label_component] - action: replace - target_label: job - - source_labels: [__meta_kubernetes_pod_name] - action: replace - target_label: kubernetes_pod_name -{{- end }} diff --git a/charts/pulsar/templates/prometheus-deployment.yaml b/charts/pulsar/templates/prometheus-deployment.yaml deleted file mode 100644 index f294b2a..0000000 --- a/charts/pulsar/templates/prometheus-deployment.yaml +++ /dev/null @@ -1,97 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -{{- if or .Values.monitoring.prometheus .Values.extra.monitoring }} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}" - namespace: {{ template "pulsar.namespace" . }} - labels: - {{- include "pulsar.standardLabels" . | nindent 4 }} - component: {{ .Values.prometheus.component }} -spec: - replicas: {{ .Values.prometheus.replicaCount }} - selector: - matchLabels: - {{- include "pulsar.matchLabels" . | nindent 6 }} - component: {{ .Values.prometheus.component }} - template: - metadata: - labels: - {{- include "pulsar.template.labels" . | nindent 8 }} - component: {{ .Values.prometheus.component }} - annotations: - {{- if .Values.prometheus.restartPodsOnConfigMapChange }} - checksum/config: {{ include (print $.Template.BasePath "/prometheus-configmap.yaml") . | sha256sum }} - {{- end }} -{{ toYaml .Values.prometheus.annotations | indent 8 }} - spec: - {{- if .Values.prometheus.nodeSelector }} - nodeSelector: -{{ toYaml .Values.prometheus.nodeSelector | indent 8 }} - {{- end }} - {{- if .Values.prometheus.tolerations }} - tolerations: -{{ toYaml .Values.prometheus.tolerations | indent 8 }} - {{- end }} - {{- if or .Values.prometheus.rbac.enabled .Values.prometheus_rbac }} - serviceAccount: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}" - {{- end }} - terminationGracePeriodSeconds: {{ .Values.prometheus.gracePeriod }} - containers: - - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}" - image: "{{ .Values.images.prometheus.repository }}:{{ .Values.images.prometheus.tag }}" - imagePullPolicy: {{ .Values.images.prometheus.pullPolicy }} - {{- if .Values.prometheus.enableAdminApi }} - args: - - --web.enable-admin-api - {{- end }} - {{- if .Values.prometheus.resources }} - resources: -{{ toYaml .Values.prometheus.resources | indent 10 }} - {{- end }} - ports: - - name: server - containerPort: {{ .Values.prometheus.port }} - volumeMounts: - - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-config" - mountPath: /etc/prometheus - - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}" - mountPath: /prometheus - securityContext: - fsGroup: 65534 - runAsGroup: 65534 - runAsNonRoot: true - runAsUser: 65534 - volumes: - - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-config" - configMap: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}" - {{- if not (and (and .Values.persistence .Values.volumes.persistence) .Values.prometheus.volumes.persistence) }} - - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}" - emptyDir: {} - {{- end }} - {{- if and (and .Values.persistence .Values.volumes.persistence) .Values.prometheus.volumes.persistence }} - - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}" - persistentVolumeClaim: - claimName: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}" - {{- end }} - {{- include "pulsar.imagePullSecrets" . | nindent 6}} -{{- end }} diff --git a/charts/pulsar/templates/prometheus-pvc.yaml b/charts/pulsar/templates/prometheus-pvc.yaml deleted file mode 100644 index ff9bb92..0000000 --- a/charts/pulsar/templates/prometheus-pvc.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -{{- if or .Values.monitoring.prometheus .Values.extra.monitoring }} -{{- if and (and .Values.persistence .Values.volumes.persistence) .Values.prometheus.volumes.persistence }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}" - namespace: {{ template "pulsar.namespace" . }} -spec: - resources: - requests: - storage: {{ .Values.prometheus.volumes.data.size }} - accessModes: [ "ReadWriteOnce" ] -{{- if .Values.prometheus.volumes.data.storageClassName }} - storageClassName: "{{ .Values.prometheus.volumes.data.storageClassName }}" -{{- else if and (not (and .Values.volumes.local_storage .Values.prometheus.volumes.data.local_storage)) .Values.prometheus.volumes.data.storageClass }} - storageClassName: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}" -{{- else if and .Values.volumes.local_storage .Values.prometheus.volumes.data.local_storage }} - storageClassName: "local-storage" -{{- end }} -{{- end }} -{{- end }} diff --git a/charts/pulsar/templates/prometheus-rbac.yaml b/charts/pulsar/templates/prometheus-rbac.yaml deleted file mode 100644 index 8e3a166..0000000 --- a/charts/pulsar/templates/prometheus-rbac.yaml +++ /dev/null @@ -1,59 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -{{- if or .Values.monitoring.prometheus .Values.extra.monitoring }} -{{- if or .Values.prometheus.rbac.enabled .Values.prometheus_rbac }} -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}" -rules: -- apiGroups: [""] - resources: - - nodes - - nodes/proxy - - services - - endpoints - - pods - verbs: ["get", "list", "watch"] -- nonResourceURLs: ["/metrics"] - verbs: ["get"] ---- - -apiVersion: v1 -kind: ServiceAccount -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}" - namespace: {{ template "pulsar.namespace" . }} ---- - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}" -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}" -subjects: -- kind: ServiceAccount - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}" - namespace: {{ template "pulsar.namespace" . }} -{{- end }} -{{- end }} diff --git a/charts/pulsar/templates/prometheus-service.yaml b/charts/pulsar/templates/prometheus-service.yaml deleted file mode 100644 index 3001c25..0000000 --- a/charts/pulsar/templates/prometheus-service.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -{{- if or .Values.monitoring.prometheus .Values.extra.monitoring }} -apiVersion: v1 -kind: Service -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}" - namespace: {{ template "pulsar.namespace" . }} - labels: - {{- include "pulsar.standardLabels" . | nindent 4 }} - component: {{ .Values.prometheus.component }} - annotations: -{{ toYaml .Values.prometheus.service.annotations | indent 4 }} -spec: - clusterIP: None - ports: - - name: server - port: {{ .Values.prometheus.port }} - selector: - {{- include "pulsar.matchLabels" . | nindent 4 }} - component: {{ .Values.prometheus.component }} -{{- end }} diff --git a/charts/pulsar/templates/prometheus-storageclass.yaml b/charts/pulsar/templates/prometheus-storageclass.yaml deleted file mode 100644 index 8e2a5a3..0000000 --- a/charts/pulsar/templates/prometheus-storageclass.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -{{- if or .Values.monitoring.prometheus .Values.extra.monitoring }} -{{- if and (and .Values.persistence .Values.volumes.persistence) .Values.prometheus.volumes.persistence }} -{{- if .Values.prometheus.volumes.data.storageClass }} -apiVersion: storage.k8s.io/v1 -kind: StorageClass -metadata: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}" - namespace: {{ template "pulsar.namespace" . }} - labels: - {{- include "pulsar.standardLabels" . | nindent 4 }} - component: {{ .Values.prometheus.component }} -provisioner: {{ .Values.prometheus.volumes.data.storageClass.provisioner }} -parameters: - type: {{ .Values.prometheus.volumes.data.storageClass.type }} - fsType: {{ .Values.prometheus.volumes.data.storageClass.fsType }} -{{- end }} -{{- end }} -{{- end }} diff --git a/charts/pulsar/values.yaml b/charts/pulsar/values.yaml index 5d970e1..ff3e94f 100644 --- a/charts/pulsar/values.yaml +++ b/charts/pulsar/values.yaml @@ -127,19 +127,6 @@ components: # pulsar manager pulsar_manager: false -## Monitoring Components -## -## Control what components of the monitoring stack to deploy for the cluster -monitoring: - # monitoring - prometheus - prometheus: true - # monitoring - grafana - grafana: true - # monitoring - node_exporter - node_exporter: true - # alerting - alert-manager - alert_manager: true - ## which extra components to deploy (Deprecated) extra: # Pulsar proxy @@ -152,8 +139,6 @@ extra: dashboard: false # pulsar manager pulsar_manager: false - # Monitoring stack (prometheus and grafana) - monitoring: false # Configure Kubernetes runtime for Functions functionsAsPods: false @@ -194,14 +179,6 @@ images: repository: apachepulsar/pulsar-all # uses defaultPulsarImageTag when unspecified tag: - prometheus: - repository: prom/prometheus - tag: v2.17.2 - pullPolicy: IfNotPresent - grafana: - repository: streamnative/apache-pulsar-grafana-dashboard-k8s - tag: 0.0.16 - pullPolicy: IfNotPresent pulsar_manager: repository: apachepulsar/pulsar-manager tag: v0.3.0 @@ -304,14 +281,13 @@ zookeeper: # so the metrics are correctly rendered in grafana dashboard component: zookeeper # the number of zookeeper servers to run. it should be an odd number larger than or equal to 3. - replicaCount: 3 + replicaCount: 1 updateStrategy: type: RollingUpdate podManagementPolicy: Parallel - # If using Prometheus-Operator enable this PodMonitor to discover zookeeper scrape targets - # Prometheus-Operator does not add scrape targets based on k8s annotations + # This is how prometheus discovers this component podMonitor: - enabled: false + enabled: true interval: 10s scrapeTimeout: 10s # True includes annotation for statefulset that contains hash of corresponding configmap, which will cause pods to restart on configmap change @@ -349,9 +325,7 @@ zookeeper: # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee type: requiredDuringSchedulingIgnoredDuringExecution - annotations: - prometheus.io/scrape: "true" - prometheus.io/port: "8000" + annotations: {} tolerations: [] gracePeriod: 30 resources: @@ -447,10 +421,9 @@ bookkeeper: updateStrategy: type: RollingUpdate podManagementPolicy: Parallel - # If using Prometheus-Operator enable this PodMonitor to discover bookie scrape targets - # Prometheus-Operator does not add scrape targets based on k8s annotations + # This is how prometheus discovers this component podMonitor: - enabled: false + enabled: true interval: 10s scrapeTimeout: 10s # True includes annotation for statefulset that contains hash of corresponding configmap, which will cause pods to restart on configmap change @@ -620,10 +593,9 @@ autorecovery: # so the metrics are correctly rendered in grafana dashboard component: recovery replicaCount: 1 - # If using Prometheus-Operator enable this PodMonitor to discover autorecovery scrape targets - # # Prometheus-Operator does not add scrape targets based on k8s annotations + # This is how prometheus discovers this component podMonitor: - enabled: false + enabled: true interval: 10s scrapeTimeout: 10s # True includes annotation for statefulset that contains hash of corresponding configmap, which will cause pods to restart on configmap change @@ -696,10 +668,9 @@ broker: minReplicas: 1 maxReplicas: 3 metrics: ~ - # If using Prometheus-Operator enable this PodMonitor to discover broker scrape targets - # Prometheus-Operator does not add scrape targets based on k8s annotations + # This is how prometheus discovers this component podMonitor: - enabled: false + enabled: true interval: 10s scrapeTimeout: 10s # True includes annotation for statefulset that contains hash of corresponding configmap, which will cause pods to restart on configmap change @@ -783,9 +754,9 @@ broker: -XX:-ResizePLAB -XX:+ExitOnOutOfMemoryError -XX:+PerfDisableSharedMem - managedLedgerDefaultEnsembleSize: "2" - managedLedgerDefaultWriteQuorum: "2" - managedLedgerDefaultAckQuorum: "2" + managedLedgerDefaultEnsembleSize: "1" + managedLedgerDefaultWriteQuorum: "1" + managedLedgerDefaultAckQuorum: "1" ## Add a custom command to the start up process of the broker pods (e.g. update-ca-certificates, jvm commands, etc) additionalCommand: ## Broker service @@ -823,10 +794,9 @@ proxy: minReplicas: 1 maxReplicas: 3 metrics: ~ - # If using Prometheus-Operator enable this PodMonitor to discover proxy scrape targets - # Prometheus-Operator does not add scrape targets based on k8s annotations + # This is how prometheus discovers this component podMonitor: - enabled: false + enabled: true interval: 10s scrapeTimeout: 10s # True includes annotation for statefulset that contains hash of corresponding configmap, which will cause pods to restart on configmap change @@ -1026,109 +996,22 @@ toolset: additionalCommand: ############################################################# -### Monitoring Stack : Prometheus / Grafana +### Monitoring Stack : kube-prometheus-stack chart ############################################################# -## Monitoring Stack: Prometheus -## templates/prometheus-deployment.yaml -## - -## Deprecated in favor of using `prometheus.rbac.enabled` -prometheus_rbac: false -prometheus: - component: prometheus - rbac: +## Prometheus, Grafana, and the rest of the kube-prometheus-stack are managed by the dependent chart here: +## https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack +## For sample values, please see their documentation. +kube-prometheus-stack: + enabled: true + prometheus: enabled: true - replicaCount: 1 - # True includes annotation for statefulset that contains hash of corresponding configmap, which will cause pods to restart on configmap change - restartPodsOnConfigMapChange: false - # nodeSelector: - # cloud.google.com/gke-nodepool: default-pool - annotations: {} - tolerations: [] - gracePeriod: 5 - port: 9090 - enableAdminApi: false - resources: - requests: - memory: 256Mi - cpu: 0.1 - volumes: - # use a persistent volume or emptyDir - persistence: true - data: - name: data - size: 10Gi - local_storage: true - ## If you already have an existent storage class and want to reuse it, you can specify its name with the option below - ## - # storageClassName: existent-storage-class - # - ## Instead if you want to create a new storage class define it below - ## If left undefined no storage class will be defined along with PVC - ## - # storageClass: - # type: pd-standard - # fsType: xfs - # provisioner: kubernetes.io/gce-pd - ## Prometheus service - ## templates/prometheus-service.yaml - ## - service: - annotations: {} - -## Monitoring Stack: Grafana -## templates/grafana-deployment.yaml -## -grafana: - component: grafana - replicaCount: 1 - # True includes annotation for statefulset that contains hash of corresponding configmap, which will cause pods to restart on configmap change - restartPodsOnConfigMapChange: false - # nodeSelector: - # cloud.google.com/gke-nodepool: default-pool - annotations: {} - tolerations: [] - gracePeriod: 30 - resources: - requests: - memory: 250Mi - cpu: 0.1 - ## Grafana service - ## templates/grafana-service.yaml - ## - service: - type: LoadBalancer - port: 3000 - targetPort: 3000 - annotations: {} - plugins: [] - ## Grafana configMap - ## templates/grafana-configmap.yaml - ## - configData: {} - ## Grafana ingress - ## templates/grafana-ingress.yaml - ## - ingress: + grafana: + enabled: true + prometheus-node-exporter: + enabled: true + alertmanager: enabled: false - annotations: {} - labels: {} - - tls: [] - - ## Optional. Leave it blank if your Ingress Controller can provide a default certificate. - ## - secretName: "" - - ## Extra paths to prepend to every host configuration. This is useful when working with annotation based services. - extraPaths: [] - hostname: "" - protocol: http - path: /grafana - port: 80 - admin: - user: pulsar - password: pulsar ## Components Stack: pulsar_manager ## templates/pulsar-manager.yaml