mirror of
https://github.com/portainer/portainer.git
synced 2025-08-03 04:45:21 +02:00
feat(edge/stacks): use namespace in manifest [EE-4507] (#8145)
This commit is contained in:
parent
8936ae9b7a
commit
930d9e5628
14 changed files with 112 additions and 47 deletions
|
@ -16,6 +16,7 @@ export default class CreateEdgeStackViewController {
|
|||
ComposeFilePathInRepository: '',
|
||||
Groups: [],
|
||||
DeploymentType: 0,
|
||||
UseManifestNamespaces: false,
|
||||
};
|
||||
|
||||
this.state = {
|
||||
|
@ -166,30 +167,32 @@ export default class CreateEdgeStackViewController {
|
|||
}
|
||||
|
||||
createStackFromFileContent(name) {
|
||||
const { StackFileContent, Groups, DeploymentType } = this.formValues;
|
||||
const { StackFileContent, Groups, DeploymentType, UseManifestNamespaces } = this.formValues;
|
||||
|
||||
return this.EdgeStackService.createStackFromFileContent({
|
||||
name,
|
||||
StackFileContent,
|
||||
EdgeGroups: Groups,
|
||||
DeploymentType,
|
||||
UseManifestNamespaces,
|
||||
});
|
||||
}
|
||||
|
||||
createStackFromFileUpload(name) {
|
||||
const { StackFile, Groups, DeploymentType } = this.formValues;
|
||||
const { StackFile, Groups, DeploymentType, UseManifestNamespaces } = this.formValues;
|
||||
return this.EdgeStackService.createStackFromFileUpload(
|
||||
{
|
||||
Name: name,
|
||||
EdgeGroups: Groups,
|
||||
DeploymentType,
|
||||
UseManifestNamespaces,
|
||||
},
|
||||
StackFile
|
||||
);
|
||||
}
|
||||
|
||||
createStackFromGitRepository(name) {
|
||||
const { Groups, DeploymentType } = this.formValues;
|
||||
const { Groups, DeploymentType, UseManifestNamespaces } = this.formValues;
|
||||
const repositoryOptions = {
|
||||
RepositoryURL: this.formValues.RepositoryURL,
|
||||
RepositoryReferenceName: this.formValues.RepositoryReferenceName,
|
||||
|
@ -203,6 +206,7 @@ export default class CreateEdgeStackViewController {
|
|||
name,
|
||||
EdgeGroups: Groups,
|
||||
DeploymentType,
|
||||
UseManifestNamespaces,
|
||||
},
|
||||
repositoryOptions
|
||||
);
|
||||
|
|
|
@ -11,10 +11,20 @@ class KubeManifestFormController {
|
|||
this.onChangeFormValues = this.onChangeFormValues.bind(this);
|
||||
this.onChangeFile = this.onChangeFile.bind(this);
|
||||
this.onChangeMethod = this.onChangeMethod.bind(this);
|
||||
this.onChangeUseManifestNamespaces = this.onChangeUseManifestNamespaces.bind(this);
|
||||
}
|
||||
|
||||
onChangeFormValues(values) {
|
||||
this.formValues = values;
|
||||
onChangeFormValues(newValues) {
|
||||
return this.$async(async () => {
|
||||
this.formValues = {
|
||||
...this.formValues,
|
||||
...newValues,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
onChangeUseManifestNamespaces(value) {
|
||||
this.onChangeFormValues({ UseManifestNamespaces: value });
|
||||
}
|
||||
|
||||
onChangeFileContent(value) {
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<por-switch-field
|
||||
label="'Use namespace(s) specified from manifest'"
|
||||
tooltip="'If you have defined namespaces in your deployment file turning this on will enforce the use of those only in the deployment'"
|
||||
checked="$ctrl.formValues.UseManifestNamespaces"
|
||||
on-change="($ctrl.onChangeUseManifestNamespaces)"
|
||||
></por-switch-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 form-section-title"> Build method </div>
|
||||
<box-selector radio-name="'method'" value="$ctrl.state.Method" options="$ctrl.methodOptions" on-change="($ctrl.onChangeMethod)"></box-selector>
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ export class EditEdgeStackViewController {
|
|||
this.formValues = {
|
||||
StackFileContent: file,
|
||||
EdgeGroups: this.stack.EdgeGroups,
|
||||
UseManifestNamespaces: this.stack.UseManifestNamespaces,
|
||||
DeploymentType: this.stack.DeploymentType,
|
||||
};
|
||||
this.oldFileContent = this.formValues.StackFileContent;
|
||||
|
@ -79,7 +80,7 @@ export class EditEdgeStackViewController {
|
|||
async deployStackAsync() {
|
||||
this.state.actionInProgress = true;
|
||||
try {
|
||||
if (this.originalFileContent != this.formValues.StackFileContent) {
|
||||
if (this.originalFileContent != this.formValues.StackFileContent || this.formValues.UseManifestNamespaces !== this.stack.UseManifestNamespaces) {
|
||||
this.formValues.Version = this.stack.Version + 1;
|
||||
}
|
||||
await this.EdgeStackService.updateStack(this.stack.Id, this.formValues);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue