change the namespace selector behavior (#5768)

pull/6116/head
Richard Wei 2021-11-23 09:51:02 +13:00 committed by GitHub
parent 6be1ff4d9c
commit a598b2d72d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -54,9 +54,6 @@ func (payload *kubernetesStringDeploymentPayload) Validate(r *http.Request) erro
if govalidator.IsNull(payload.StackFileContent) { if govalidator.IsNull(payload.StackFileContent) {
return errors.New("Invalid stack file content") return errors.New("Invalid stack file content")
} }
if govalidator.IsNull(payload.Namespace) {
return errors.New("Invalid namespace")
}
if govalidator.IsNull(payload.StackName) { if govalidator.IsNull(payload.StackName) {
return errors.New("Invalid stack name") return errors.New("Invalid stack name")
} }
@ -64,9 +61,6 @@ func (payload *kubernetesStringDeploymentPayload) Validate(r *http.Request) erro
} }
func (payload *kubernetesGitDeploymentPayload) Validate(r *http.Request) error { func (payload *kubernetesGitDeploymentPayload) Validate(r *http.Request) error {
if govalidator.IsNull(payload.Namespace) {
return errors.New("Invalid namespace")
}
if govalidator.IsNull(payload.RepositoryURL) || !govalidator.IsURL(payload.RepositoryURL) { if govalidator.IsNull(payload.RepositoryURL) || !govalidator.IsURL(payload.RepositoryURL) {
return errors.New("Invalid repository URL. Must correspond to a valid URL format") return errors.New("Invalid repository URL. Must correspond to a valid URL format")
} }

View File

@ -70,6 +70,7 @@ class KubernetesDeployController {
RepositoryFetchInterval: '5m', RepositoryFetchInterval: '5m',
RepositoryWebhookURL: this.WebhookHelper.returnStackWebhookUrl(uuidv4()), RepositoryWebhookURL: this.WebhookHelper.returnStackWebhookUrl(uuidv4()),
}; };
this.ManifestDeployTypes = KubernetesDeployManifestTypes; this.ManifestDeployTypes = KubernetesDeployManifestTypes;
this.BuildMethods = KubernetesDeployBuildMethods; this.BuildMethods = KubernetesDeployBuildMethods;
this.endpointId = this.EndpointProvider.endpointID(); this.endpointId = this.EndpointProvider.endpointID();
@ -209,9 +210,15 @@ class KubernetesDeployController {
throw new PortainerError('Unable to determine build method'); throw new PortainerError('Unable to determine build method');
} }
let deployNamespace = '';
if (this.formValues.Namespace !== 'default') {
deployNamespace = this.formValues.Namespace;
}
const payload = { const payload = {
ComposeFormat: composeFormat, ComposeFormat: composeFormat,
Namespace: this.formValues.Namespace, Namespace: deployNamespace,
StackName: this.formValues.StackName, StackName: this.formValues.StackName,
}; };