mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
fix(k8s) deploying manifest using default namespace EE-2104 (#6385)
* fix(k8s) deploying manifest using default namespace EE-2104
This commit is contained in:
parent
4377aec72b
commit
3579b11a8b
3 changed files with 25 additions and 3 deletions
|
@ -3,6 +3,7 @@ package exec
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
@ -123,6 +124,8 @@ func (deployer *KubernetesDeployer) command(operation string, userID portainer.U
|
||||||
|
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
cmd := exec.Command(command, args...)
|
cmd := exec.Command(command, args...)
|
||||||
|
cmd.Env = os.Environ()
|
||||||
|
cmd.Env = append(cmd.Env, "POD_NAMESPACE=default")
|
||||||
cmd.Stderr = &stderr
|
cmd.Stderr = &stderr
|
||||||
|
|
||||||
output, err := cmd.Output()
|
output, err := cmd.Output()
|
||||||
|
|
|
@ -12,12 +12,28 @@
|
||||||
<uib-tabset active="ctrl.state.activeTab" justified="true" type="pills">
|
<uib-tabset active="ctrl.state.activeTab" justified="true" type="pills">
|
||||||
<uib-tab index="0">
|
<uib-tab index="0">
|
||||||
<uib-tab-heading> <i class="fa fa-code space-right" aria-hidden="true"></i> Deploy </uib-tab-heading>
|
<uib-tab-heading> <i class="fa fa-code space-right" aria-hidden="true"></i> Deploy </uib-tab-heading>
|
||||||
|
<div class="col-sm-12 form-section-title"> Namespace </div>
|
||||||
<form class="form-horizontal" style="margin-top: 20px">
|
<form class="form-horizontal" style="margin-top: 20px">
|
||||||
<div class="form-group" ng-if="ctrl.formValues.Namespace">
|
<div class="form-group" ng-if="ctrl.formValues.Namespace">
|
||||||
<label for="target_node" class="col-lg-1 col-sm-2 control-label text-left">Namespace</label>
|
<label for="target_node" class="col-lg-1 col-sm-2 control-label text-left">Namespace</label>
|
||||||
<div class="col-lg-11 col-sm-10">
|
<div class="col-lg-11 col-sm-10">
|
||||||
<select class="form-control" ng-model="ctrl.formValues.Namespace" ng-options="namespace.Name as namespace.Name for namespace in ctrl.namespaces"></select>
|
<select
|
||||||
|
ng-disabled="ctrl.formValues.namespace_toggle"
|
||||||
|
class="form-control"
|
||||||
|
ng-model="ctrl.formValues.Namespace"
|
||||||
|
ng-options="namespace.Name as namespace.Name for namespace in ctrl.namespaces"
|
||||||
|
></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" ng-if="ctrl.formValues.Namespace">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<label for="toggle_logo" class="control-label text-left"> Use namespace(s) specificed from manifest </label>
|
||||||
|
<portainer-tooltip
|
||||||
|
position="bottom"
|
||||||
|
message="If you have defined namespaces in your deployment file turning this on will enforce the use of those only in the deployment"
|
||||||
|
>
|
||||||
|
</portainer-tooltip>
|
||||||
|
<label class="switch" style="margin-left: 20px"> <input type="checkbox" name="toggle_logo" ng-model="ctrl.formValues.namespace_toggle" /><i></i> </label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" ng-if="!ctrl.formValues.Namespace">
|
<div class="form-group" ng-if="!ctrl.formValues.Namespace">
|
||||||
|
|
|
@ -213,7 +213,9 @@ class KubernetesDeployController {
|
||||||
|
|
||||||
let deployNamespace = '';
|
let deployNamespace = '';
|
||||||
|
|
||||||
if (this.formValues.Namespace !== 'default') {
|
if (this.formValues.namespace_toggle) {
|
||||||
|
deployNamespace = '';
|
||||||
|
} else {
|
||||||
deployNamespace = this.formValues.Namespace;
|
deployNamespace = this.formValues.Namespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,6 +300,7 @@ class KubernetesDeployController {
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
return this.$async(async () => {
|
return this.$async(async () => {
|
||||||
|
this.formValues.namespace_toggle = false;
|
||||||
await this.getNamespaces();
|
await this.getNamespaces();
|
||||||
|
|
||||||
if (this.$state.params.templateId) {
|
if (this.$state.params.templateId) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue