-
Notifications
You must be signed in to change notification settings - Fork 13
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
Use scrapeconfig instead of servicemonitor #607
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
aa08e77
Move from ServiceMonitor to ScrapeConfig
csibbitt 4756295
Clean up legacy servicemonitors
csibbitt 9f59209
Merge branch 'master' into csibbitt_STF-1776_ipv6-scraping
csibbitt d6ec624
Emulate servicemonitor-compatible labels
csibbitt 7105d22
Update roles/servicetelemetry/tasks/component_scrapeconfig.yml
csibbitt 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
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
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,87 @@ | ||
- name: Look up prometheus-stf SA to get auth secret name | ||
k8s_info: | ||
api_version: v1 | ||
kind: ServiceAccount | ||
namespace: '{{ ansible_operator_meta.namespace }}' | ||
name: prometheus-stf | ||
register: service_account | ||
|
||
- name: Look up auth secret to get token secret name | ||
k8s_info: | ||
api_version: v1 | ||
kind: Secret | ||
namespace: '{{ ansible_operator_meta.namespace }}' | ||
name: '{{ service_account.resources[0].secrets[0].name }}' | ||
register: auth_secret | ||
|
||
- name: Create SG-specific Service Monitor manifest | ||
csibbitt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
set_fact: | ||
sg_specific_scrapeconfig_manifest: | | ||
apiVersion: {{ prometheus_operator_api_string | replace("/v1","/v1alpha1") }} | ||
kind: ScrapeConfig | ||
metadata: | ||
labels: | ||
app: smart-gateway | ||
name: '{{ this_smartgateway }}' | ||
namespace: '{{ ansible_operator_meta.namespace }}' | ||
spec: | ||
authorization: | ||
type: bearer | ||
credentials: | ||
name: '{{ auth_secret.resources[0].metadata.annotations['openshift.io/token-secret.name'] }}' | ||
key: token | ||
metricRelabelings: | ||
- action: labeldrop | ||
regex: pod | ||
sourcelabels: [] | ||
- action: labeldrop | ||
regex: namespace | ||
sourcelabels: [] | ||
- action: labeldrop | ||
regex: instance | ||
sourcelabels: [] | ||
- action: labeldrop | ||
regex: job | ||
sourcelabels: [] | ||
- action: labeldrop | ||
regex: publisher | ||
sourcelabels: [] | ||
scheme: HTTPS | ||
scrapeInterval: {{ servicetelemetry_vars.backends.metrics.prometheus.scrape_interval }} | ||
staticConfigs: | ||
- targets: | ||
- '{{ this_smartgateway }}.{{ ansible_operator_meta.namespace }}.svc:8083' | ||
tlsConfig: | ||
ca: | ||
configMap: | ||
name: serving-certs-ca-bundle | ||
key: service-ca.crt | ||
serverName: '{{ this_smartgateway }}.{{ ansible_operator_meta.namespace }}.svc' | ||
|
||
- name: Create ScrapeConfig to scrape Smart Gateway | ||
k8s: | ||
state: '{{ "present" if servicetelemetry_vars.backends.metrics.prometheus.enabled else "absent" }}' | ||
definition: | ||
'{{ sg_specific_scrapeconfig_manifest }}' | ||
|
||
- name: Create additional ScrapeConfig if provided | ||
k8s: | ||
state: '{{ "present" if servicetelemetry_vars.backends.metrics.prometheus.enabled else "absent" }}' | ||
definition: | ||
'{{ scrapeconfig_manifest }}' | ||
when: scrapeconfig_manifest is defined | ||
|
||
- name: Create additional ServiceMonitor if provided (legacy) | ||
k8s: | ||
state: '{{ "present" if servicetelemetry_vars.backends.metrics.prometheus.enabled else "absent" }}' | ||
definition: | ||
'{{ servicemonitor_manifest }}' | ||
when: servicemonitor_manifest is defined | ||
|
||
- name: Remove (legacy) default ServiceMonitors | ||
k8s: | ||
state: absent | ||
api_version: '{{ prometheus_operator_api_string }}' | ||
kind: ServiceMonitor | ||
namespace: '{{ ansible_operator_meta.namespace }}' | ||
name: '{{ this_smartgateway }}' |
This file was deleted.
Oops, something went wrong.
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
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.
This was missing previously, and I'm not 100% sure the effects. My guess is it would affected garbage collection in the operator-sdk, preventing these servicemonitors from being cleaned up automatically when the servicetelemetry object is deleted.