mirror of https://github.com/portainer/portainer
fix(k8s) deploying manifest using default namespace EE-2104 (#6385)
* fix(k8s) deploying manifest using default namespace EE-2104pull/6697/head
parent
4377aec72b
commit
3579b11a8b
|
@ -3,6 +3,7 @@ package exec
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"runtime"
|
||||
|
@ -123,6 +124,8 @@ func (deployer *KubernetesDeployer) command(operation string, userID portainer.U
|
|||
|
||||
var stderr bytes.Buffer
|
||||
cmd := exec.Command(command, args...)
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, "POD_NAMESPACE=default")
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
output, err := cmd.Output()
|
||||
|
|
|
@ -12,12 +12,28 @@
|
|||
<uib-tabset active="ctrl.state.activeTab" justified="true" type="pills">
|
||||
<uib-tab index="0">
|
||||
<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">
|
||||
<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>
|
||||
<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 class="form-group" ng-if="!ctrl.formValues.Namespace">
|
||||
|
|
|
@ -213,7 +213,9 @@ class KubernetesDeployController {
|
|||
|
||||
let deployNamespace = '';
|
||||
|
||||
if (this.formValues.Namespace !== 'default') {
|
||||
if (this.formValues.namespace_toggle) {
|
||||
deployNamespace = '';
|
||||
} else {
|
||||
deployNamespace = this.formValues.Namespace;
|
||||
}
|
||||
|
||||
|
@ -298,6 +300,7 @@ class KubernetesDeployController {
|
|||
|
||||
$onInit() {
|
||||
return this.$async(async () => {
|
||||
this.formValues.namespace_toggle = false;
|
||||
await this.getNamespaces();
|
||||
|
||||
if (this.$state.params.templateId) {
|
||||
|
|
Loading…
Reference in New Issue