Skip to content
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

Move rancherServiceMetrics into main chart #1786

Conversation

aiyengar2
Copy link
Contributor

@aiyengar2 aiyengar2 commented Mar 5, 2022

How is this related to the original issue?

The issue filed calls out that there is a discrepancy in that the ServiceMonitor is only deployed if the chartLabel is set whereas the dashboard is deployed only when rancherServiceMetrics is enabled; what was seen is that if the chartLabel is found but rancherServiceMetrics is not enabled, the servicemonitor is deployed (due to the issue called out inhttps://github.com/rancher/charts-build-scripts/issues/68, where the enabled flag is ignored for local charts) but the dashboard is not.

To keep things consistent and to avoid having a whole dependency chart just for one resource (when the other resource is in the main chart anyways), this PR merges the subchart into the main chart and makes various enhancements w.r.t. what values the user can provide to configure the chart).

Breaking changes are not a concern since this chart has never been released.

Related Issue: rancher/rancher#36770

@aiyengar2 aiyengar2 force-pushed the move_rancher_service_metrics_to_main_chart branch 3 times, most recently from f60ad33 to 1b17051 Compare March 5, 2022 02:04
@aiyengar2 aiyengar2 requested a review from rmweir March 5, 2022 02:13
Comment on lines 118 to 125
{{- define "rancher.serviceMonitor.namespaceSelector" -}}
{{- if .Values.rancherMonitoring.namespaceSelector }}
{{ .Values.rancherMonitoring.namespaceSelector | toYaml }}
{{- else }}
matchNames:
- cattle-system
{{- end }}
{{- end }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Uses the provided selector
  2. If nil, returns default

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think rancher service will ever not be in cattle-system or it's reasonable to assume it won't be but I suppose this doesn't hurt anything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, why not just set cattle-system as the default in values.yaml?

Copy link
Contributor Author

@aiyengar2 aiyengar2 Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a choice of preference. I wanted to keep both fields in the helpers.tpl and set them the same way to be consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d prefer to leave it this way unless there’s a strong reason to have it in the values.yaml instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified the chart to put the default in the values.yaml and drop the helper template for this.

charts/rancher-monitoring/100.1.1+up19.0.3/values.yaml Outdated Show resolved Hide resolved
@aiyengar2
Copy link
Contributor Author

Tested deploying this chart on a management and downstream cluster and, as expected, it only deploys performance metrics when Rancher is seen.

I also tested modifying the namespaceSelector and selector on a helm template and it seems to work as expected too.

Comment on lines 118 to 125
{{- define "rancher.serviceMonitor.namespaceSelector" -}}
{{- if .Values.rancherMonitoring.namespaceSelector }}
{{ .Values.rancherMonitoring.namespaceSelector | toYaml }}
{{- else }}
matchNames:
- cattle-system
{{- end }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think rancher service will ever not be in cattle-system or it's reasonable to assume it won't be but I suppose this doesn't hurt anything.

Comment on lines 118 to 125
{{- define "rancher.serviceMonitor.namespaceSelector" -}}
{{- if .Values.rancherMonitoring.namespaceSelector }}
{{ .Values.rancherMonitoring.namespaceSelector | toYaml }}
{{- else }}
matchNames:
- cattle-system
{{- end }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, why not just set cattle-system as the default in values.yaml?

@aiyengar2 aiyengar2 requested a review from rmweir March 8, 2022 20:53
@aiyengar2 aiyengar2 force-pushed the move_rancher_service_metrics_to_main_chart branch from 1b17051 to fd6aee7 Compare March 8, 2022 23:43
@aiyengar2 aiyengar2 merged commit 792b58b into rancher:dev-v2.6 Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants