1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 21:35:23 +02:00

feature(kubeconfig): access to all kube environment contexts from within the Portainer UI [EE-1727] (#5966)

This commit is contained in:
Marcelo Rydel 2021-11-22 11:05:09 -07:00 committed by GitHub
parent c0a4727114
commit 6be1ff4d9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 404 additions and 434 deletions

View file

@ -1,45 +0,0 @@
export default class KubeConfigController {
/* @ngInject */
constructor($async, $window, KubernetesConfigService, SettingsService) {
this.$async = $async;
this.$window = $window;
this.KubernetesConfigService = KubernetesConfigService;
this.SettingsService = SettingsService;
}
async downloadKubeconfig() {
await this.KubernetesConfigService.downloadConfig();
}
async expiryHoverMessage() {
const settings = await this.SettingsService.publicSettings();
const expiryDays = settings.KubeconfigExpiry;
switch (expiryDays) {
case '0':
this.state.expiryDays = 'not expire';
break;
case '24h':
this.state.expiryDays = 'expire in 1 day';
break;
case '168h':
this.state.expiryDays = 'expire in 7 days';
break;
case '720h':
this.state.expiryDays = 'expire in 30 days';
break;
case '8640h':
this.state.expiryDays = 'expire in 1 year';
break;
}
}
$onInit() {
return this.$async(async () => {
this.state = {
isHTTPS: this.$window.location.protocol === 'https:',
expiryDays: '',
};
await this.expiryHoverMessage();
});
}
}

View file

@ -1,19 +0,0 @@
<span
class="interactive"
tooltip-append-to-body="true"
tooltip-placement="bottom"
tooltip-class="portainer-tooltip"
uib-tooltip="Kubeconfig file will {{ $ctrl.state.expiryDays }}"
>
<button
ng-if="$ctrl.state.isHTTPS"
type="button"
class="btn btn-xs btn-primary"
ng-click="$ctrl.downloadKubeconfig()"
analytics-on
analytics-category="kubernetes"
analytics-event="kubernetes-kubectl-kubeconfig"
>
Kubeconfig <i class="fas fa-download space-right"></i>
</button>
</span>

View file

@ -1,7 +0,0 @@
import angular from 'angular';
import controller from './kube-config-download-button.controller';
angular.module('portainer.kubernetes').component('kubeConfigDownloadButton', {
templateUrl: './kube-config-download-button.html',
controller,
});

View file

@ -11,8 +11,6 @@
<i class="fa fa-terminal space-right"></i> kubectl shell
</button>
<kube-config-download-button></kube-config-download-button>
<div ng-if="$ctrl.state.shell.connected" class="{{ $ctrl.state.css }}-kubectl-shell">
<div class="shell-container">
<div class="shell-item"><i class="fas fa-terminal" style="margin-right: 5px;"></i>kubectl shell</div>