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

feat(k8s/application): expose tolerations and affinities (#4063)

* feat(k8s/application): expose placement conditions

* feat(k8s/applications): minor UI update

* feat(k8s/application): update message for admin and non admin users

* feat(kubernetes/applications): minor UI update

Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
xAt0mZ 2020-07-30 00:25:59 +02:00 committed by GitHub
parent 63bf654d8d
commit 4431d748c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 635 additions and 112 deletions

View file

@ -1,50 +0,0 @@
import angular from 'angular';
import _ from 'lodash-es';
import PortainerError from 'Portainer/error';
import KubernetesNodeConverter from 'Kubernetes/converters/node';
import { KubernetesCommonParams } from 'Kubernetes/models/common/params';
class KubernetesNodeService {
/* @ngInject */
constructor($async, KubernetesNodes) {
this.$async = $async;
this.KubernetesNodes = KubernetesNodes;
this.getAsync = this.getAsync.bind(this);
this.getAllAsync = this.getAllAsync.bind(this);
}
/**
* GET
*/
async getAsync(name) {
try {
const params = new KubernetesCommonParams();
params.id = name;
const [details, yaml] = await Promise.all([this.KubernetesNodes().get(params).$promise, this.KubernetesNodes().getYaml(params).$promise]);
return KubernetesNodeConverter.apiToNodeDetails(details, yaml);
} catch (err) {
throw new PortainerError('Unable to retrieve node details', err);
}
}
async getAllAsync() {
try {
const data = await this.KubernetesNodes().get().$promise;
return _.map(data.items, (item) => KubernetesNodeConverter.apiToNode(item));
} catch (err) {
throw { msg: 'Unable to retrieve nodes', err: err };
}
}
get(name) {
if (name) {
return this.$async(this.getAsync, name);
}
return this.$async(this.getAllAsync);
}
}
export default KubernetesNodeService;
angular.module('portainer.kubernetes').service('KubernetesNodeService', KubernetesNodeService);