1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-21 06:19:41 +02:00

feat(node): Show which IP address / port the cluster API is listening on (#4134)

* feat(cluster): add kubernetes endpoint resource

* feat(cluster): add kubernetes endpoint service

* feat(node): Show which IP address / port the cluster API is listening on

* fix(cluster): support multi-master clusters

* fix(cluster): support multi-master clusters

* feat(k8s/cluster): minor UI update

* refactor(k8s/cluster): rename variable

* refactor(k8s/endpoints): refactor KubernetesEndpointsFactory

Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
Maxime Bajeux 2020-08-05 02:15:17 +02:00 committed by GitHub
parent 6756b04b67
commit 148ccd1bc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 110 additions and 8 deletions

View file

@ -51,8 +51,17 @@ class KubernetesClusterController {
async getEndpointsAsync() {
try {
const endpoints = await this.KubernetesEndpointService.get('kube-system');
this.endpoints = _.filter(endpoints, (ep) => ep.HolderIdentity);
const endpoints = await this.KubernetesEndpointService.get();
const systemEndpoints = _.filter(endpoints, { Namespace: 'kube-system' });
this.systemEndpoints = _.filter(systemEndpoints, (ep) => ep.HolderIdentity);
const kubernetesEndpoint = _.find(endpoints, { Name: 'kubernetes' });
if (kubernetesEndpoint && kubernetesEndpoint.Subsets) {
const ips = _.flatten(_.map(kubernetesEndpoint.Subsets, 'Ips'));
_.forEach(this.nodes, (node) => {
node.Api = _.includes(ips, node.IPAddress);
});
}
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve endpoints');
}