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 (#614)
* fix: create new secret on vm creation Signed-off-by: Caio Torres <caio.torres@suse.com> * fix: ensure parseVM result is immutable Signed-off-by: Caio Torres <caio.torres@suse.com> --------- Signed-off-by: Caio Torres <caio.torres@suse.com>
This commit is contained in:
parent
fab7fbec5e
commit
0b37467f76
@ -490,6 +490,7 @@ export default {
|
|||||||
if (this.isSingle) {
|
if (this.isSingle) {
|
||||||
if (!this.value.spec.template.spec.hostname) {
|
if (!this.value.spec.template.spec.hostname) {
|
||||||
this.value.spec.template.spec['hostname'] = this.value.metadata.name;
|
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() {
|
needNewSecret() {
|
||||||
// When creating a template it is always necessary to create a new secret.
|
// 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() {
|
defaultTerminationSetting() {
|
||||||
@ -708,17 +708,7 @@ export default {
|
|||||||
const volumeClaimTemplates = [];
|
const volumeClaimTemplates = [];
|
||||||
|
|
||||||
disk.forEach( (R, index) => {
|
disk.forEach( (R, index) => {
|
||||||
const prefixName = this.value.metadata?.name || '';
|
const dataVolumeName = this.parseDataVolumeName(R);
|
||||||
|
|
||||||
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 _disk = this.parseDisk(R, index);
|
const _disk = this.parseDisk(R, index);
|
||||||
const _volume = this.parseVolume(R, dataVolumeName);
|
const _volume = this.parseVolume(R, dataVolumeName);
|
||||||
@ -1013,6 +1003,25 @@ export default {
|
|||||||
this['cpuMemoryHotplugEnabled'] = cpuMemoryHotplugEnabled;
|
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) {
|
parseDisk(R, index) {
|
||||||
const out = { name: R.name };
|
const out = { name: R.name };
|
||||||
|
|
||||||
@ -1638,7 +1647,7 @@ export default {
|
|||||||
|
|
||||||
secretRef: {
|
secretRef: {
|
||||||
handler(secret) {
|
handler(secret) {
|
||||||
if (secret && this.resourceType !== HCI.BACKUP) {
|
if (secret && this.resourceType !== HCI.BACKUP && this.resourceType !== HCI.VM) {
|
||||||
this.secretName = secret?.metadata.name;
|
this.secretName = secret?.metadata.name;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user