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

Add appProtocol for OpenShift #1487

Merged
merged 3 commits into from
Aug 26, 2024
Merged

Add appProtocol for OpenShift #1487

merged 3 commits into from
Aug 26, 2024

Conversation

clementduveau
Copy link
Contributor

PR Description

On OpenShift, to expose Alloy gRPC to receive OTLP from other ressources, by default, you need to specifiy appProtocol = h2c on the service. It actually depends on your setup but the default Ingress HAProxy requires it, so probably 80% of RedHat customers needs it.

This PR just add the appProtocol as a possibility in the values.yaml. If not set, it outputs nothing. No default value because Kubernetes uses it as a "hint", therefore it's not mandatory.

Which issue(s) this PR fixes

Fixes #1405

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated --> I don't have an environment to test it, it should have no effect on vanilla K8s. We can ask @benoitschipper for tests on OpenShift

@benoitschipper
Copy link

@clementduveau Looking great! LGTM! =D

Copy link
Collaborator

@mattdurham mattdurham left a comment

Choose a reason for hiding this comment

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

This looks reasonable to me, will defer to @petewall for final confirmation.

@@ -29,5 +29,9 @@ spec:
port: {{ $portMap.port }}
targetPort: {{ $portMap.targetPort }}
protocol: {{ coalesce $portMap.protocol "TCP" }}
{{- if not (empty $portMap.appProtocol) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be simplified to:

Suggested change
{{- if not (empty $portMap.appProtocol) }}
{{- if $portMap.appProtocol }}

Choose a reason for hiding this comment

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

Would make it easier to read. But isn't {{- if not (empty $portMap.appProtocol) }} better if you want to ensure that $portMap.appProtocol is not only present but also non-empty?

If $portMap.appProtocol is undefined or empty, the first version (empty) will prevent any unexpected issues by skipping the block, while the second version ($portMap.appProtocol) might run into problems if the variable is not properly initialized.

Chances are slim, so I am (in the end) happy with both ❤️

@mattdurham mattdurham merged commit 6097e59 into grafana:main Aug 26, 2024
15 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add variable appProtocol Option to Helm Chart for your Alloy Service for h2c/http2
4 participants