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

Minor simplification in load balancer supplier #1579

Merged
merged 125 commits into from
Feb 17, 2024

Conversation

wind57
Copy link
Contributor

@wind57 wind57 commented Feb 16, 2024

No description provided.

wind57 and others added 30 commits December 4, 2021 07:59
@wind57 wind57 changed the title Minor improvements Minor simplification in load balancer supplier Feb 16, 2024
this.kubernetesNamespaceProvider = kubernetesNamespaceProvider;
}

private String getNamespace() {
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 one is a little tricky, but not much.

we used to have it as:

return kubernetesNamespaceProvider != null ? kubernetesNamespaceProvider.getNamespace()
				: kubernetesClientProperties.namespace();

let's asume kubernetesNamespaceProvider == null, which means kubernetesClientProperties.namespace() will be called. But there is no code that would provide kubernetesClientProperties, which means it was always null.

So if ever kubernetesNamespaceProvider == null, we would have got a NPE from kubernetesClientProperties.namespace(). So let's get rid of KubernetesClientProperties kubernetesClientProperties and only use KubernetesNamespaceProvider.

But even by doing that, we still keep the initial "intention", which I assume was that the KubernetesNamespaceProvider at the time of writing the code, did not have support for spring.cloud.kubernetes.client.namespace reading, that is why it was reading it from KubernetesClientProperties. Now this supports exists there, so I think the code works now as the initial intention.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that is very weird, makes sense.

@wind57 wind57 marked this pull request as ready for review February 17, 2024 06:26
@wind57
Copy link
Contributor Author

wind57 commented Feb 17, 2024

@ryanjbaxter ready to be looked at. thank you.

@ryanjbaxter ryanjbaxter added this to the 3.1.1 milestone Feb 17, 2024
@ryanjbaxter ryanjbaxter merged commit 523971a into spring-cloud:main Feb 17, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants