mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 13:11:43 +00:00
* fix: create new secret on vm creation * fix: ensure parseVM result is immutable --------- (cherry picked from commit 0b37467f7637639209c27570bfe5633a41b96ac0) Signed-off-by: Caio Torres <caio.torres@suse.com> Co-authored-by: Caio Torres <caio.torres@suse.com>
This commit is contained in:
parent
4b2e92ea15
commit
f391f018de
@ -490,6 +490,7 @@ export default {
|
||||
if (this.isSingle) {
|
||||
if (!this.value.spec.template.spec.hostname) {
|
||||
this.value.spec.template.spec['hostname'] = this.value.metadata.name;
|
||||
this.spec.template.spec['hostname'] = this.value.metadata.name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -273,7 +273,7 @@ export default {
|
||||
|
||||
needNewSecret() {
|
||||
// When creating a template it is always necessary to create a new secret.
|
||||
return this.isCreate ? true : this.showYaml ? false : this.resourceType === HCI.VM_VERSION;
|
||||
return this.showYaml ? false : this.resourceType === HCI.VM_VERSION || this.isCreate;
|
||||
},
|
||||
|
||||
defaultTerminationSetting() {
|
||||
@ -708,17 +708,7 @@ export default {
|
||||
const volumeClaimTemplates = [];
|
||||
|
||||
disk.forEach( (R, index) => {
|
||||
const prefixName = this.value.metadata?.name || '';
|
||||
|
||||
let dataVolumeName = '';
|
||||
|
||||
if (R.source === SOURCE_TYPE.ATTACH_VOLUME) {
|
||||
dataVolumeName = R.volumeName;
|
||||
} else if (this.isClone || !this.hasCreateVolumes.includes(R.realName)) {
|
||||
dataVolumeName = `${ prefixName }-${ R.name }-${ randomStr(5).toLowerCase() }`;
|
||||
} else {
|
||||
dataVolumeName = R.realName;
|
||||
}
|
||||
const dataVolumeName = this.parseDataVolumeName(R);
|
||||
|
||||
const _disk = this.parseDisk(R, index);
|
||||
const _volume = this.parseVolume(R, dataVolumeName);
|
||||
@ -1013,6 +1003,25 @@ export default {
|
||||
this['cpuMemoryHotplugEnabled'] = cpuMemoryHotplugEnabled;
|
||||
},
|
||||
|
||||
parseDataVolumeName(R) {
|
||||
const prefixName = this.value.metadata?.name || '';
|
||||
let dataVolumeName = '';
|
||||
|
||||
if (!R.dataVolumeName) {
|
||||
if (R.source === SOURCE_TYPE.ATTACH_VOLUME) {
|
||||
dataVolumeName = R.volumeName;
|
||||
} else if (this.isClone || !this.hasCreateVolumes.includes(R.realName)) {
|
||||
dataVolumeName = `${ prefixName }-${ R.name }-${ randomStr(5).toLowerCase() }`;
|
||||
} else {
|
||||
dataVolumeName = R.realName;
|
||||
}
|
||||
|
||||
R.dataVolumeName = dataVolumeName;
|
||||
}
|
||||
|
||||
return R.dataVolumeName;
|
||||
},
|
||||
|
||||
parseDisk(R, index) {
|
||||
const out = { name: R.name };
|
||||
|
||||
@ -1638,7 +1647,7 @@ export default {
|
||||
|
||||
secretRef: {
|
||||
handler(secret) {
|
||||
if (secret && this.resourceType !== HCI.BACKUP) {
|
||||
if (secret && this.resourceType !== HCI.BACKUP && this.resourceType !== HCI.VM) {
|
||||
this.secretName = secret?.metadata.name;
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user