[improve][broker] Add parameter check for create/update cluster. - #19151
Conversation
|
@codelipenghui @eolivelli @Jason918 @congbobo184 @nicoloboschi |
Codecov Report
@@ Coverage Diff @@
## master #19151 +/- ##
============================================
- Coverage 47.46% 44.29% -3.17%
+ Complexity 10727 10057 -670
============================================
Files 711 713 +2
Lines 69456 69683 +227
Branches 7452 7483 +31
============================================
- Hits 32964 30865 -2099
- Misses 32810 35206 +2396
+ Partials 3682 3612 -70
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…ce/LinuxInfoUtils.java
| .allowedClusters(Collections.singleton(cluster)) | ||
| .build(); | ||
| ClusterDataImpl clusterData = ClusterDataImpl.builder().serviceUrl(cluster).build(); | ||
| ClusterDataImpl clusterData = ClusterDataImpl.builder().serviceUrl("http://example.pulsar").build(); |
There was a problem hiding this comment.
Is this a breaking change? I haven't reviewed the details.
There was a problem hiding this comment.
It's not a breaking change; we just didn't have data validation.
|
@mattisonchao Is this PR a potential breaking change? Please check #19212 . |
|
@mattisonchao I wonder if a "https" url would need to be accepted in the serviceUrl just because of backwards compatibility reasons? |
| public void checkPropertiesIfPresent() throws IllegalArgumentException { | ||
| URIPreconditions.checkURIIfPresent(getServiceUrl(), | ||
| uri -> Objects.equals(uri.getScheme(), "http"), | ||
| "Illegal service url, example: http://pulsar.example.com:8080"); | ||
| URIPreconditions.checkURIIfPresent(getServiceUrlTls(), | ||
| uri -> Objects.equals(uri.getScheme(), "https"), | ||
| "Illegal service tls url, example: https://pulsar.example.com:8443"); | ||
| URIPreconditions.checkURIIfPresent(getBrokerServiceUrl(), | ||
| uri -> Objects.equals(uri.getScheme(), "pulsar"), | ||
| "Illegal broker service url, example: pulsar://pulsar.example.com:6650"); | ||
| URIPreconditions.checkURIIfPresent(getBrokerServiceUrlTls(), | ||
| uri -> Objects.equals(uri.getScheme(), "pulsar+ssl"), | ||
| "Illegal broker service tls url, example: pulsar+ssl://pulsar.example.com:6651"); | ||
| URIPreconditions.checkURIIfPresent(getProxyServiceUrl(), | ||
| uri -> Objects.equals(uri.getScheme(), "pulsar") | ||
| || Objects.equals(uri.getScheme(), "pulsar+ssl"), | ||
| "Illegal proxy service url, example: pulsar+ssl://ats-proxy.example.com:4443 " | ||
| + "or pulsar://ats-proxy.example.com:4080"); | ||
| } |
There was a problem hiding this comment.
Do we document these requirements? Also, what would happen if a user had already created a cluster in a bad state?
Motivation
In the current implementation, we didn't have any cluster data check for
create/updatecluster. it may cause some problems when the user sets the wrong URL.Modifications
Verifying this change
Does this pull request potentially affect one of the following parts:
Documentation
doc-not-needed