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

NH-70086 add init container for OTEL connection to node and event collectors #807

Merged
merged 10 commits into from
Dec 2, 2024

Conversation

jakub-racek-swi
Copy link
Contributor

@jakub-racek-swi jakub-racek-swi commented Nov 26, 2024

link: https://swicloud.atlassian.net/browse/NH-70086

modified values.yaml and moved 'otel.metrics.swi_endpoint_check' to 'otel.swi_endpoint_check' to be used for all the init containers

Signed-off-by: jakub-racek-swi <jakub.racek@solarwinds.com>
@jakub-racek-swi jakub-racek-swi requested a review from a team as a code owner November 26, 2024 12:40
@pstranak-sw
Copy link
Contributor

Is there a reason for not adding this also for the node collector for Windows?

@pstranak-sw
Copy link
Contributor

Please make sure there are unit tests for the otel.swi_endpoint_check.enabled and otel.metrics.swi_endpoint_check setting for all the Deployments/DaemonSets, not just the metric collector.

Copy link
Contributor

@gantrior gantrior left a comment

Choose a reason for hiding this comment

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

If the old value is deprecated we need to communicate it and we should remove it from values.yaml (but continue support it in templates).

I recommend to use following condition (haven't tested):

{{- if .Values.otel.swi_endpoint_check.enabled | default .Values.otel.metrics.swi_endpoint_check | default true }}

and we should also put to NOTES.txt deprecation warning, something like this:

{{- if and (not (hasKey .Values.otel "swi_endpoint_check")) (hasKey .Values.otel.metrics "swi_endpoint_check") }}
  {{- $warning := printf "Value 'otel.metrics.swi_endpoint_check' is deprecated and will be removed in a future release. Please use 'otel.swi_endpoint_check.enabled' instead." }}
  {{- warn $warning }}
{{- end }}

deploy/helm/templates/events-collector-deployment.yaml Outdated Show resolved Hide resolved
@pstranak-sw
Copy link
Contributor

If the old value is deprecated we need to communicate it and we should remove it from values.yaml (but continue support it in templates).

...

Good point. The condition check was adjusted, though using a different logic.

@@ -7,7 +7,7 @@ WARNING: Prometheus is no longer included in this chart. To scrape custom metric

{{- if and .Values.otel.metrics.extra_scrape_metrics (and .Values.otel.metrics.autodiscovery.prometheusEndpoints.enabled (not .Values.otel.metrics.force_extra_scrape_metrics)) -}}
WARNING: You have enabled autodiscovery of prometheus endpoints, so `extra_scrape_metrics` is ignored. If you are sure that those metrics won't be covered by autodiscovery set `otel.metrics.force_extra_scrape_metrics` to `true`.

{{- println -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Added to fix NOTES.txt unit tests.

Usage:
{{ isSwiEndpointCheckEnabled . }}
*/}}
{{- define "isSwiEndpointCheckEnabled" -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really like templates, but the condition was too complex and in too many places not to create a template for it.

@@ -60,11 +60,11 @@ spec:
values:
- linux
{{- end }}
{{- if or (and .Values.otel.metrics.prometheus_check .Values.otel.metrics.prometheus.url) .Values.otel.metrics.swi_endpoint_check }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why imagePullSecrets was under the init containers condition and not separate, as it is in other deployments.

@@ -51,6 +51,7 @@ func sendTestMessage(endpoint, apiToken, clusterUid string, insecure bool) {
record.SetTimestamp(time.Now())

logger.Emit(ctx, record)
log.Print("Connection check was successful")
Copy link
Contributor

Choose a reason for hiding this comment

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

Added so that the init container shows some success message instead of just ending. However, this change will actually be applied only after we release a new image.

Copy link
Contributor

@gantrior gantrior left a comment

Choose a reason for hiding this comment

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

LGTM

@pstranak-sw pstranak-sw merged commit b1fb274 into master Dec 2, 2024
19 checks passed
@pstranak-sw pstranak-sw deleted the NH-70086-add-init-container-to-nodes-and-events branch December 2, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants