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

feat: add MTLS.permissiveMetrics to optionally enable Istio permissive mo… #889

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

sobotklp
Copy link
Contributor

…de on the metrics port

This fixes issue #888

Copy link
Owner

@alexandrevilain alexandrevilain left a comment

Choose a reason for hiding this comment

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

Great addition!
Thanks for your contribution!
Added a single comment :)

@@ -78,6 +78,14 @@ func (b *PeerAuthenticationBuilder) Update(object client.Object) error {
},
}

if b.instance.Spec.Metrics.IsEnabled() && b.instance.Spec.MTLS.PermitMetrics {
pa.Spec.PortLevelMtls = map[uint32]*istioapisecurityv1beta1.PeerAuthentication_MutualTLS{
uint32(*b.instance.Spec.Metrics.Prometheus.ListenPort): {
Copy link
Owner

Choose a reason for hiding this comment

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

Here both b.instance.Spec.Metrics.Prometheus and b.instance.Spec.Metrics.Prometheus.ListenPort can be nil.
So you have to test this before dereferencing the pointer.
(Even if defaulted by: https://github.com/alexandrevilain/temporal-operator/blob/main/api/v1beta1/temporalcluster_defaults.go#L247)
if b.instance.Spec.Metrics.Prometheus != nil && b.instance.Spec.Metrics.Prometheus.ListenPort != nil

Copy link
Contributor Author

@sobotklp sobotklp Jan 26, 2025

Choose a reason for hiding this comment

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

Thanks very much for explaining. I will update that.

(I was assuming that that https://github.com/alexandrevilain/temporal-operator/blob/main/api/v1beta1/temporalcluster_defaults.go#L247 would have initialized those pointers already but admittedly I didn't check.

@sobotklp sobotklp changed the title feat: add MTLS.permitMetrics to optionally enable Istio permissive mo… feat: add MTLS.permissiveMetrics to optionally enable Istio permissive mo… Jan 27, 2025
@alexandrevilain
Copy link
Owner

Before merging, could you plase squash your commits ? :)

@sobotklp
Copy link
Contributor Author

Thanks very much again. I've squashed my commits

@alexandrevilain alexandrevilain merged commit 6bc9167 into alexandrevilain:main Jan 28, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants