Skip to content

Commit

Permalink
Explicit External IP check in Kubernetes Discovery Plugin [CN-296] (#211
Browse files Browse the repository at this point in the history
)

Import of #25324

**Original PR description:**

The problem is that it assumes the service has a type of LoadBalancer
first. If it cannot find ExternalIP there, it jumps into catch block,
assumes it has a NodePort kind, and determines ExternalIP according to
it.

The block needs to be improved in such way:
It needs to check the kind of the service, and use a specific method to
determine External IP.

Checklist:
- [x] Labels (`Team:`, `Type:`, `Source:`, `Module:`) and Milestone set
- [x] Label `Add to Release Notes` or `Not Release Notes content` set
- [x] Request reviewers if possible
- [ ] Send backports/forwardports if fix needs to be applied to
past/future releases

Imported changes:

- f63f7fa Explicit External IP check in
Kubernetes Discovery Plugin...

Closes #25324

Co-authored-by: semihbkgr <buyukgungorsemih@gmail.com>
GitOrigin-RevId: 2bb2877cfb1f876e9263616b64307ae3a1a386f8
  • Loading branch information
semihbkgr authored and actions-user committed Dec 20, 2023
1 parent d565f40 commit e74f78d
Show file tree
Hide file tree
Showing 4 changed files with 353 additions and 202 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ default Integer extractPort(JsonValue subsetJson) {
}
if (ports.size() == 1) {
JsonValue port = ports.get(0);
return port.asObject().get("port").asInt();
JsonValue servicePort = port.asObject().get("port");
if (servicePort != null && servicePort.isNumber()) {
return servicePort.asInt();
}
}
return null;
}
Expand Down
Loading

0 comments on commit e74f78d

Please sign in to comment.