Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host local storage support #1076

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkg/harvester/components/settings/csi-driver-config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import LabeledSelect from '@shell/components/form/LabeledSelect';
import InfoBox from '@shell/components/InfoBox';
import { CSI_DRIVER, VOLUME_SNAPSHOT_CLASS } from '../../types';
import { allHash } from '@shell/utils/promise';

const LONGHORN_DRIVER = 'driver.longhorn.io';
import { LONGHORN_DRIVER } from '@shell/models/persistentvolume';

export default {
name: 'HarvesterCsiDriver',
Expand Down
1 change: 1 addition & 0 deletions pkg/harvester/config/harvester-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ export const ADD_ONS = {
RANCHER_LOGGING: 'rancher-logging',
RANCHER_MONITORING: 'rancher-monitoring',
VM_IMPORT_CONTROLLER: 'vm-import-controller',
HARVESTER_CSI_DRIVER_LVM: 'harvester-csi-driver-lvm'
};
10 changes: 10 additions & 0 deletions pkg/harvester/detail/harvesterhci.io.host/HarvesterHostDisk.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export default {
return '';
}
},

provisioner() {
return 'todo_provisioner';
}
},
methods: {
update() {
Expand Down Expand Up @@ -178,6 +182,12 @@ export default {
:value="value.path"
/>
</div>
<div class="col span-4">
<LabelValue
:name="t('harvester.host.disk.provisioner')"
:value="provisioner"
/>
</div>
</div>
</div>
</template>
Expand Down
60 changes: 58 additions & 2 deletions pkg/harvester/edit/harvesterhci.io.host/HarvesterDisk.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
<script>
import { allHash } from '@shell/utils/promise';
import { CSI_DRIVER, LONGHORN } from '@shell/config/types';
import { LabeledInput } from '@components/Form/LabeledInput';
import LabelValue from '@shell/components/LabelValue';
import { BadgeState } from '@components/BadgeState';
import { Banner } from '@components/Banner';
import LabeledSelect from '@shell/components/form/LabeledSelect';
import { RadioGroup, RadioButton } from '@components/Form/Radio';
import HarvesterDisk from '../../mixins/harvester-disk';
import Tags from '../../components/DiskTags';
import { HCI } from '../../types';
import { LONGHORN_SYSTEM } from './index';
import { LONGHORN_DRIVER } from '@shell/models/persistentvolume';

const LONGHORN_V2_DATA_ENGINE = 'longhorn-system/v2-data-engine';

export default {
components: {
LabeledInput,
LabeledSelect,
LabelValue,
BadgeState,
Banner,
Expand Down Expand Up @@ -40,10 +47,47 @@ export default {
default: 'edit',
},
},

async fetch() {
const inStore = this.$store.getters['currentProduct'].inStore;

const hash = {
csiDrivers: this.$store.dispatch(`${ inStore }/findAll`, { type: CSI_DRIVER }),
longhornSettings: this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE }),
};

await allHash(hash);
},

data() {
return {};
const provisionerFormat = { [LONGHORN_DRIVER]: 'harvester.storage.storageClass.longhornV1.label' };

return {
// TODO add provisioner to Disk
provisioner: {
label: provisionerFormat[LONGHORN_DRIVER],
value: LONGHORN_DRIVER,
},
provisionerFormat
};
},

computed: {
provisioners() {
const inStore = this.$store.getters['currentProduct'].inStore;
const csiDrivers = this.$store.getters[`${ inStore }/all`](CSI_DRIVER) || [];

// TODO to check if longhornV2 to be added in the list
// const longhornV2 = this.$store.getters[`${ inStore }/byId`](LONGHORN.SETTINGS, LONGHORN_V2_DATA_ENGINE);

return csiDrivers.map((provisioner) => {
return {
label: this.provisionerFormat[provisioner.name] || provisioner.name,
value: provisioner.name,
};
});
},

allowSchedulingOptions() {
return [{
label: this.t('generic.enabled'),
Expand Down Expand Up @@ -142,6 +186,7 @@ export default {
return this.blockDevice.isFormatting;
},
},

methods: {
update() {
this.$emit('input', this.value);
Expand Down Expand Up @@ -226,13 +271,24 @@ export default {
<hr class="mt-10" />
</div>
<div class="row mt-10">
<div class="col span-12">
<div class="col span-6">
<LabeledInput
v-model="value.displayName"
:label="t('generic.name')"
:disabled="true"
/>
</div>
<div class="col span-6">
<LabeledSelect
v-model="provisioner"
:mode="mode"
label-key="harvester.host.disk.provisioner"
:localized-label="true"
:searchable="true"
:options="provisioners"
@keydown.native.enter.prevent="()=>{}"
/>
</div>
</div>
<div v-if="(value.isNew && !isFormatted) || isCorrupted" class="row mt-10">
<div class="col span-6">
Expand Down
5 changes: 2 additions & 3 deletions pkg/harvester/edit/harvesterhci.io.storage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import { STORAGE_CLASS, LONGHORN } from '@shell/config/types';
import { CSI_DRIVER } from '../../types';
import { allHash } from '@shell/utils/promise';
import { clone } from '@shell/utils/object';

const LONGHORN_DRIVER = 'driver.longhorn.io';
import { LONGHORN_DRIVER } from '@shell/models/persistentvolume';

export default {
name: 'HarvesterStorage',
Expand Down Expand Up @@ -122,7 +121,7 @@ export default {

provisioners() {
const csiDrivers = this.$store.getters[`${ this.inStore }/all`](CSI_DRIVER) || [];
const format = { [LONGHORN_DRIVER]: 'storageClass.longhorn.title' };
const format = { [LONGHORN_DRIVER]: 'harvester.storage.storageClass.longhornV1.label' };

return csiDrivers.map((provisioner) => {
return {
Expand Down
32 changes: 32 additions & 0 deletions pkg/harvester/edit/harvesterhci.io.storage/provisioners/lvm.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<script>

export default {
components: {},

props: {
value: {
type: Object,
required: true
},
mode: {
type: String,
required: true
},
realMode: {
type: String,
required: true
},
},

data() {
return {};
},

computed: {},
};
</script>
<template>
<div>
LVM settings TODO
</div>
</template>
7 changes: 7 additions & 0 deletions pkg/harvester/l10n/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ harvester:
label: Storage Scheduled
storageMaximum:
label: Storage Maximum
provisioner: Provisioner
tags:
label: Host Tags
addLabel: Add Host Tag
Expand Down Expand Up @@ -1038,6 +1039,12 @@ harvester:
label: Disk Selector
storageClass:
label: Storage Class
longhornV1:
label: LonghornV1 (CSI)
longhornV2:
label: LonghornV2 (CSI)
lvm:
label: LVM
title: Storage Classes
customize:
volumeBindingMode:
Expand Down
Loading