Skip to content

viz: make prom checks dynamic by using annotations#5680

Merged
Pothulapati merged 12 commits intomainfrom
tarun/dynamic-prom-grafana-checks
Feb 12, 2021
Merged

viz: make prom checks dynamic by using annotations#5680
Pothulapati merged 12 commits intomainfrom
tarun/dynamic-prom-grafana-checks

Conversation

@Pothulapati
Copy link
Contributor

@Pothulapati Pothulapati commented Feb 8, 2021

Fixes #5652

This PR adds new annotation that is added when a
external Prometheus is used. Based on that
annotations, The CLI can get to know if an external instance
is being used and if the annotation is absent, that the
the default instance is present.

This updates the viz Checks to skip some checkers if the default
Prometheus instances are absent.

This PR also removes the grafana checks as they are not useful
and add unnecessary complexity.

This also cleans up some grafanaUrl stuff from the core
control-plane chart.

Signed-off-by: Tarun Pothulapati tarunpothulapati@outlook.com

This commit adds new annotations that are added when a
external prometheus or grafana is used. Based on these
annotations, The CLI can get to know if a external instance
is being used and if the annotation is absent, that the
default instance is present.

This logic can be used by the CLi to perform checks, etc

This also cleans up some `grafanaUrl` stuff from the core
control-plane chart.

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
This updates the viz Checks to skip some checkers if default
 prometheus or grafana instances are absent.

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
@Pothulapati Pothulapati requested a review from a team as a code owner February 8, 2021 06:57
@Pothulapati Pothulapati changed the title tarun/dynamic prom grafana checks viz: make prom and grafana checks dynamic by using annotations Feb 8, 2021
Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
{{- if .Values.prometheusUrl }}
viz.linkerd.io/external-prometheus: {{.Values.prometheusUrl}}
{{- end }}
{{- if .Values.grafanaUrl }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This logic i.e assuming linkerd-grafana is presently based on the absence of this annotation does not really work with grafana because both being absent case is allowed here. Should we make disabled an explicit annotation then?

Copy link
Contributor

@dadjeibaah dadjeibaah left a comment

Choose a reason for hiding this comment

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

Changes look good. Tested with an external prometheus and works great. I left a couple of comments.

Warning().
WithCheck(func(ctx context.Context) error {
// TODO: Skip if prometheus is disabled
if _, ok := hc.vizNamespace.Annotations[labels.VizExternalPrometheus]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

For my own understanding, is this a temporary fix. I'd imagine that we would at least want to confirm that the external URL provided is reachable i.e. returning a valid Prometheus response.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do validate if the URL is working or not but that test is part of viz extension self-check where the metrics-api checks if the Prometheus actually works and fails if not whose output got changed a bit slightly in #5665

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
Copy link
Contributor

@dadjeibaah dadjeibaah left a comment

Choose a reason for hiding this comment

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

Thanks for making that change! LGTM! 📦 🚢

Copy link
Member

@alpeb alpeb left a comment

Choose a reason for hiding this comment

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

Does this change completely fix #5652 or is it just part of it? Wondering what was the conclusion about the external service.

VizExternalPrometheus = VizAnnotationsPrefix + "/external-prometheus"

// VizExternalGrafana is only set on the namespace by the install
// when az external Grafana is being used.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// when az external Grafana is being used.
// when an external Grafana is being used.

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
@Pothulapati
Copy link
Contributor Author

After further offline discussions, We settled to not include grafana checks as they are not that useful and add unnecessary complexity especially that there are no other components being dependent on grafana, like they do for prometheus.

@Pothulapati Pothulapati changed the title viz: make prom and grafana checks dynamic by using annotations viz: make prom checks dynamic by using annotations Feb 11, 2021
Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
Copy link
Contributor

@kleimkuhler kleimkuhler left a comment

Choose a reason for hiding this comment

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

I test this with an external Prometheus and works as expected. Left a nit about getting annotation values, but otherwise looks good.

@Pothulapati Pothulapati merged commit cb6c1fc into main Feb 12, 2021
@Pothulapati Pothulapati deleted the tarun/dynamic-prom-grafana-checks branch February 12, 2021 15:55
jijeesh pushed a commit to jijeesh/linkerd2 that referenced this pull request Mar 23, 2021
Fixes linkerd#5652 

This PR adds new annotation that is added when a
external Prometheus is used. Based on that
annotations, The CLI can get to know if an external instance
is being used and if the annotation is absent, that the
the default instance is present.

This updates the viz Checks to skip some checkers if the default
 Prometheus instances are absent.

This PR also removes the grafana checks as they are not useful
and add unnecessary complexity.

This also cleans up some `grafanaUrl` stuff from the core
control-plane chart.

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
Signed-off-by: Jijeesh <jijeesh.ka@gmail.com>
jijeesh pushed a commit to jijeesh/linkerd2 that referenced this pull request Apr 21, 2021
Fixes linkerd#5652 

This PR adds new annotation that is added when a
external Prometheus is used. Based on that
annotations, The CLI can get to know if an external instance
is being used and if the annotation is absent, that the
the default instance is present.

This updates the viz Checks to skip some checkers if the default
 Prometheus instances are absent.

This PR also removes the grafana checks as they are not useful
and add unnecessary complexity.

This also cleans up some `grafanaUrl` stuff from the core
control-plane chart.

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
Signed-off-by: Jijeesh <jijeesh.ka@gmail.com>
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.

cli: Handle disabled prometheus and grafana use-case.

4 participants