mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
Enable the ability to cordon/uncordon/drain nodes (#4723)
* feat(node): Enable the ability to cordon/uncordon/drain nodes * feat(cluster): check if there is a drain operation somewhere * feat(kubernetes): allow to cordon, uncordon, drain nodes * refacto(kubernetes): set a constant for drain label name * fix(node): Relocate the warning message next to the dropdown and change the information message
This commit is contained in:
parent
660bc2dadf
commit
32a9a2e46b
10 changed files with 182 additions and 13 deletions
|
@ -2,7 +2,7 @@ import angular from 'angular';
|
|||
import PortainerError from 'Portainer/error';
|
||||
|
||||
import { KubernetesCommonParams } from 'Kubernetes/models/common/params';
|
||||
import KubernetesPodConverter from './converter';
|
||||
import KubernetesPodConverter from 'Kubernetes/pod/converter';
|
||||
|
||||
class KubernetesPodService {
|
||||
/* @ngInject */
|
||||
|
@ -15,6 +15,7 @@ class KubernetesPodService {
|
|||
this.logsAsync = this.logsAsync.bind(this);
|
||||
this.deleteAsync = this.deleteAsync.bind(this);
|
||||
this.patchAsync = this.patchAsync.bind(this);
|
||||
this.evictionAsync = this.evictionAsync.bind(this);
|
||||
}
|
||||
|
||||
async getAsync(namespace, name) {
|
||||
|
@ -116,6 +117,26 @@ class KubernetesPodService {
|
|||
delete(pod) {
|
||||
return this.$async(this.deleteAsync, pod);
|
||||
}
|
||||
|
||||
/**
|
||||
* EVICT
|
||||
*/
|
||||
async evictionAsync(pod) {
|
||||
try {
|
||||
const params = new KubernetesCommonParams();
|
||||
params.id = pod.Name;
|
||||
params.action = 'eviction';
|
||||
const namespace = pod.Namespace;
|
||||
const podEvictionPayload = KubernetesPodConverter.evictionPayload(pod);
|
||||
await this.KubernetesPods(namespace).evict(params, podEvictionPayload).$promise;
|
||||
} catch (err) {
|
||||
throw new PortainerError('Unable to evict pod', err);
|
||||
}
|
||||
}
|
||||
|
||||
eviction(pod) {
|
||||
return this.$async(this.evictionAsync, pod);
|
||||
}
|
||||
}
|
||||
|
||||
export default KubernetesPodService;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue