Skip to content

Commit

Permalink
Replace resource prop with resourceType prop - shell change: rancher/…
Browse files Browse the repository at this point in the history
…dashboard#11971

Signed-off-by: Francesco Torchia <[email protected]>
  • Loading branch information
torchiaf committed Sep 30, 2024
1 parent 2179d49 commit c970cbb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pkg/harvester/mixins/harvester-vm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default {
required: true,
},

resource: {
resourceType: {
type: String,
default: ''
}
Expand Down Expand Up @@ -266,7 +266,7 @@ export default {

needNewSecret() {
// When creating a template it is always necessary to create a new secret.
return this.resource === HCI.VM_VERSION || this.isCreate;
return this.resourceType === HCI.VM_VERSION || this.isCreate;
},

defaultTerminationSetting() {
Expand Down Expand Up @@ -300,7 +300,7 @@ export default {
value, existUserData, fromTemplate = false, init = false
} = config;

const vm = this.resource === HCI.VM ? value : this.resource === HCI.BACKUP ? this.value.status?.source : value.spec.vm;
const vm = this.resourceType === HCI.VM ? value : this.resourceType === HCI.BACKUP ? this.value.status?.source : value.spec.vm;

const spec = vm?.spec;

Expand Down Expand Up @@ -341,7 +341,7 @@ export default {

let { userData = undefined, networkData = undefined } = this.getCloudInitNoCloud(spec);

if (this.resource === HCI.BACKUP) {
if (this.resourceType === HCI.BACKUP) {
const secretBackups = this.value.status?.secretBackups;

if (secretBackups) {
Expand Down Expand Up @@ -609,7 +609,7 @@ export default {
this.spec.template.spec.terminationGracePeriodSeconds = this.terminationGracePeriodSeconds;

// parse reserved memory
const vm = this.resource === HCI.VM ? this.value : this.value.spec.vm;
const vm = this.resourceType === HCI.VM ? this.value : this.value.spec.vm;

if (!this.reservedMemory) {
delete vm.metadata.annotations[HCI_ANNOTATIONS.VM_RESERVED_MEMORY];
Expand Down Expand Up @@ -724,7 +724,7 @@ export default {
delete spec.template.spec.volumes;
}

if (this.resource === HCI.VM) {
if (this.resourceType === HCI.VM) {
if (!this.isSingle) {
spec = this.multiVMScheduler(spec);
}
Expand All @@ -739,7 +739,7 @@ export default {

this.value['spec'] = spec;
this['spec'] = spec;
} else if (this.resource === HCI.VM_VERSION) {
} else if (this.resourceType === HCI.VM_VERSION) {
this.value.spec.vm['spec'] = spec;
this.value.spec.vm.metadata['annotations'] = {
...this.value.spec.vm.metadata.annotations,
Expand Down Expand Up @@ -1177,7 +1177,7 @@ export default {
getOwnerReferencesFromVM(resource) {
const name = resource.metadata.name;
const kind = resource.kind;
const apiVersion = this.resource === HCI.VM ? 'kubevirt.io/v1' : 'harvesterhci.io/v1beta1';
const apiVersion = this.resourceType === HCI.VM ? 'kubevirt.io/v1' : 'harvesterhci.io/v1beta1';
const uid = resource?.metadata?.uid;

return [{
Expand Down Expand Up @@ -1491,7 +1491,7 @@ export default {

secretRef: {
handler(secret) {
if (secret && this.resource !== HCI.BACKUP) {
if (secret && this.resourceType !== HCI.BACKUP) {
this.secretName = secret?.metadata.name;
}
},
Expand Down

0 comments on commit c970cbb

Please sign in to comment.