feat(k8s/deploy): change default namespace behavior

This commit is contained in:
deviantony
2021-08-29 18:50:01 +12:00
parent f93adc4344
commit 2ce3b369dd
3 changed files with 9 additions and 3 deletions

View File

@@ -95,7 +95,9 @@ func (deployer *KubernetesDeployer) Deploy(request *http.Request, endpoint *port
args = append(args, "--server", endpoint.URL)
args = append(args, "--insecure-skip-tls-verify")
args = append(args, "--token", token)
args = append(args, "--namespace", namespace)
if namespace != "" {
args = append(args, "--namespace", namespace)
}
args = append(args, "apply", "-f", "-")
var stderr bytes.Buffer

View File

@@ -189,6 +189,10 @@ func (handler *Handler) deployKubernetesStack(r *http.Request, endpoint *portain
return "", errors.Wrap(err, "failed to add application labels")
}
if !composeFormat && namespace == "default" {
namespace = ""
}
return handler.KubernetesDeployer.Deploy(r, endpoint, string(manifest), namespace)
}

View File

@@ -83,7 +83,7 @@
placeholder="# Define or paste the content of your manifest file here"
>
<editor-description>
<span class="col-sm-12 text-muted small" ng-show="ctrl.state.DeployType === ctrl.ManifestDeployTypes.COMPOSE">
<span class="col-sm-12" ng-show="ctrl.state.DeployType === ctrl.ManifestDeployTypes.COMPOSE">
<p>
<i class="fa fa-exclamation-circle orange-icon" aria-hidden="true" style="margin-right: 2px;"></i>
Portainer uses <a href="https://kompose.io/" target="_blank">Kompose</a> to convert your Compose manifest to a Kubernetes compliant manifest. Be wary that
@@ -95,7 +95,7 @@
</p>
</span>
<span
class="col-sm-12 text-muted small"
class="col-sm-12"
ng-show="ctrl.state.DeployType === ctrl.ManifestDeployTypes.KUBERNETES && ctrl.state.BuildMethod === ctrl.BuildMethods.WEB_EDITOR"
>
<p>