Skip to content

Commit

Permalink
Merge pull request #1015 from harvester/mergify/bp/release-harvester-…
Browse files Browse the repository at this point in the history
…v1.2/pr-892

filter storageClass by provisioner (backport #892)
  • Loading branch information
torchiaf committed May 8, 2024
2 parents 3f1d03a + aabd429 commit 28d0b4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/harvester/config/labels-annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const HCI = {
DYNAMIC_SSHKEYS_USERS: 'harvesterhci.io/dynamic-ssh-key-users',
IMAGE_SUFFIX: 'harvesterhci.io/image-type',
OS_TYPE: 'harvesterhci.io/os-type',
STORAGE_PROVISIONER: 'harvesterhci.io/storageProvisioner',
HOST_REQUEST: 'management.cattle.io/pod-requests',
STORAGE_CLASS: 'harvesterhci.io/storageClassName',
STORAGE_NETWORK: 'storage-network.settings.harvesterhci.io',
Expand Down
9 changes: 7 additions & 2 deletions pkg/harvester/dialog/RestoreSnapshotDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Banner } from '@components/Banner';
import AsyncButton from '@shell/components/AsyncButton';
import { LabeledInput } from '@components/Form/LabeledInput';
import LabeledSelect from '@shell/components/form/LabeledSelect';
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
import { allHash } from '@shell/utils/promise';
import { STORAGE_CLASS } from '@shell/config/types';
Expand Down Expand Up @@ -43,7 +44,9 @@ export default {
if (this.showStorageClass) {
const defaultStorage = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS).find(s => s.isDefault);
this.$set(this, 'storageClassName', defaultStorage?.metadata?.name || 'longhorn');
const currentStorageName = this.resources[0].metadata?.annotations[HCI_ANNOTATIONS.STORAGE_CLASS];
this.$set(this, 'storageClassName', currentStorageName || defaultStorage?.metadata?.name || 'longhorn');
}
},
Expand All @@ -60,7 +63,9 @@ export default {
const inStore = this.$store.getters['currentProduct'].inStore;
const storages = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS);
const out = storages.filter(s => !s.parameters?.backingImage).map((s) => {
const out = storages.filter(s => !s.parameters?.backingImage).filter((s) => {
return s.provisioner === this.actionResource.metadata?.annotations[HCI_ANNOTATIONS.STORAGE_PROVISIONER];
}).map((s) => {
const label = s.isDefault ? `${ s.name } (${ this.t('generic.default') })` : s.name;
return {
Expand Down

0 comments on commit 28d0b4c

Please sign in to comment.