-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds (Prometheus) ServiceMonitor integration #16
Merged
codefromthecrypt
merged 7 commits into
openzipkin:master
from
mshivanna:enable-serviceMonitor
Mar 13, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
85d5b23
[zipkin-helm] option to enable serviceMonitor for zipkin
c40453d
readme, schema and test
76c78a6
use helmfile for continuous integration
89677c0
Ensure everything works in real life
adc4565
notes
ec7be1e
you saw nothing.. move along
46e3154
feedback
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,5 +58,11 @@ jobs: | |
uses: helm/kind-action@v1 | ||
if: steps.list-changed.outputs.changed == 'true' | ||
|
||
- name: Setup helmfile | ||
uses: mamezou-tech/[email protected] | ||
|
||
- name: Install prometheus | ||
run: helmfile -f charts/zipkin/ci/helmfile.yaml sync | ||
|
||
- name: Run chart-testing (install) | ||
run: ct install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
# install via `helmfile -f charts/zipkin/ci/helmfile.yaml sync` | ||
repositories: | ||
- name: prometheus-community | ||
url: https://prometheus-community.github.io/helm-charts | ||
|
||
# Prometheus requires the CRD servicemonitors.monitoring.coreos.com as well as | ||
# Prometheus, deployed as the service named "prometheus-operated" in our test | ||
# namespace "ci-monitoring". We set this up via helm prior to running tests, as | ||
# adding CRDs and multiple resources during a test is far more complicated. | ||
releases: | ||
- name: prometheus-stack | ||
namespace: ci-monitoring # arbitrary non-default name | ||
createNamespace: true | ||
chart: prometheus-community/kube-prometheus-stack | ||
values: | ||
- prometheusOperator: | ||
enabled: true | ||
prometheus: | ||
enabled: true | ||
# By default, the service monitor has namespace restrictions and must | ||
# match a label "release: kube-prometheus-stack". Relax for testing. | ||
# See https://prometheus-operator.dev/docs/operator/troubleshooting/#it-is-in-the-configuration-but-not-on-the-service-discovery-page | ||
prometheusSpec: | ||
serviceMonitorNamespaceSelector: | ||
any: true | ||
serviceMonitorSelector: | ||
any: true | ||
serviceMonitorSelectorNilUsesHelmValues: false | ||
# Disable anything else, like multi-container grafana pods. | ||
defaultRules: | ||
enabled: false | ||
alertmanager: | ||
enabled: false | ||
kubeApiServer: | ||
enabled: false | ||
kubelet: | ||
enabled: false | ||
kubeControllerManager: | ||
enabled: false | ||
coreDns: | ||
enabled: false | ||
kubeDns: | ||
enabled: false | ||
kubeEtcd: | ||
enabled: false | ||
kubeScheduler: | ||
enabled: false | ||
kubeProxy: | ||
enabled: false | ||
kubeStateMetrics: | ||
enabled: false | ||
nodeExporter: | ||
enabled: false | ||
grafana: | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
serviceMonitor: | ||
enabled: true | ||
interval: 1s | ||
scrapeTimeout: 1s | ||
namespace: ci-monitoring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{{- /* | ||
Copyright 2024 The OpenZipkin Authors | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: later we can switch everything to SPDX, so I didn't do it in this PR |
||
|
||
Licensed 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 .Values.serviceMonitor.enabled -}} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ include "zipkin.fullname" . }} | ||
{{- if .Values.serviceMonitor.namespace }} | ||
namespace: {{ .Values.serviceMonitor.namespace }} | ||
{{- else }} | ||
namespace: {{ include "zipkin.namespace" . }} | ||
{{- end }} | ||
labels: | ||
{{- include "zipkin.labels" . | nindent 4 }} | ||
{{- if .Values.serviceMonitor.labels }} | ||
{{- (toYaml .Values.serviceMonitor.labels | nindent 4) }} | ||
{{- end }} | ||
spec: | ||
jobLabel: {{ include "zipkin.fullname" . }} | ||
namespaceSelector: | ||
matchNames: | ||
- {{ include "zipkin.namespace" . }} | ||
endpoints: | ||
- port: http-query | ||
path: '/prometheus' | ||
scheme: http | ||
{{- with .Values.serviceMonitor.interval }} | ||
interval: {{ . }} | ||
{{- end }} | ||
{{- with .Values.serviceMonitor.scrapeTimeout }} | ||
scrapeTimeout: {{ . }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
{{- include "zipkin.selectorLabels" . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ps I don't know if this is normal in k8s, but if you make an invalid config, like scrapeTimeout > interval, the service monitor will be created, but just won't ever be processed. You end up having to look at prometheus-operator pod logs to figure it out. I don't know if this is a bug or a norm.. if someone thinks this is a bug, probably needs to be raised upstream as hours lost over this.