Skip to content

Minor simplification in load balancer supplier#1579

Merged
ryanjbaxter merged 125 commits intospring-cloud:mainfrom
wind57:minor-improvements
Feb 17, 2024
Merged

Minor simplification in load balancer supplier#1579
ryanjbaxter merged 125 commits intospring-cloud:mainfrom
wind57:minor-improvements

Conversation

@wind57
Copy link
Copy Markdown
Contributor

@wind57 wind57 commented Feb 16, 2024

No description provided.

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

private String getNamespace() {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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