mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
feat(kubernetes): add ingress details (#4013)
* feat(kubernetes): add ingress details * fix(kubernetes): fix broken ingress generated links + ignore IP retrieval/display info on missing LB ingress ip * refactor(kubernetes): each ingress rule in apps port mappings has now its own row * feat(kubernetes): remove protocol column and concat it to container port * feat(kubernetes): edit display of ingress rules in application details * feat(kubernetes): minor UI update Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
parent
b09b1b1691
commit
1b3e2c8f69
19 changed files with 450 additions and 137 deletions
54
app/kubernetes/ingress/service.js
Normal file
54
app/kubernetes/ingress/service.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
import * as _ from 'lodash-es';
|
||||
import angular from 'angular';
|
||||
import PortainerError from 'Portainer/error';
|
||||
import { KubernetesCommonParams } from 'Kubernetes/models/common/params';
|
||||
import { KubernetesIngressConverter } from './converter';
|
||||
|
||||
class KubernetesIngressService {
|
||||
/* @ngInject */
|
||||
constructor($async, KubernetesIngresses) {
|
||||
this.$async = $async;
|
||||
this.KubernetesIngresses = KubernetesIngresses;
|
||||
|
||||
this.getAsync = this.getAsync.bind(this);
|
||||
this.getAllAsync = this.getAllAsync.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET
|
||||
*/
|
||||
async getAsync(namespace, name) {
|
||||
try {
|
||||
const params = new KubernetesCommonParams();
|
||||
params.id = name;
|
||||
const [raw, yaml] = await Promise.all([this.KubernetesIngresses(namespace).get(params).$promise, this.KubernetesIngresses(namespace).getYaml(params).$promise]);
|
||||
const res = {
|
||||
Raw: KubernetesIngressConverter.apiToModel(raw),
|
||||
Yaml: yaml.data,
|
||||
};
|
||||
return res;
|
||||
} catch (err) {
|
||||
throw new PortainerError('Unable to retrieve Ingress', err);
|
||||
}
|
||||
}
|
||||
|
||||
async getAllAsync(namespace) {
|
||||
try {
|
||||
const data = await this.KubernetesIngresses(namespace).get().$promise;
|
||||
const res = _.reduce(data.items, (arr, item) => _.concat(arr, KubernetesIngressConverter.apiToModel(item)), []);
|
||||
return res;
|
||||
} catch (err) {
|
||||
throw new PortainerError('Unable to retrieve Ingresses', err);
|
||||
}
|
||||
}
|
||||
|
||||
get(namespace, name) {
|
||||
if (name) {
|
||||
return this.$async(this.getAsync, namespace, name);
|
||||
}
|
||||
return this.$async(this.getAllAsync, namespace);
|
||||
}
|
||||
}
|
||||
|
||||
export default KubernetesIngressService;
|
||||
angular.module('portainer.kubernetes').service('KubernetesIngressService', KubernetesIngressService);
|
Loading…
Add table
Add a link
Reference in a new issue