From d15adeb8cf9d23a52fe0435288c7061e528905aa Mon Sep 17 00:00:00 2001 From: Francesco Torchia Date: Thu, 24 Oct 2024 11:34:52 +0200 Subject: [PATCH] Move LABELS_TO_IGNORE_REGEX to harvester pkg and update imports Signed-off-by: Francesco Torchia --- pkg/harvester/config/labels-annotations.js | 8 ++++++++ .../harvesterhci.io.virtualmachinetemplateversion.js | 3 +-- pkg/harvester/models/kubevirt.io.virtualmachine.js | 3 +-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/harvester/config/labels-annotations.js b/pkg/harvester/config/labels-annotations.js index 64a27c53..5e8d561c 100644 --- a/pkg/harvester/config/labels-annotations.js +++ b/pkg/harvester/config/labels-annotations.js @@ -1,3 +1,11 @@ +const CATTLE_REGEX = /cattle\.io\//; +const VM_MAINTENANCE_MODE_STRATEGY = /harvesterhci\.io\/maintain-mode-strategy/; + +export const LABELS_TO_IGNORE_REGEX = [ + CATTLE_REGEX, + VM_MAINTENANCE_MODE_STRATEGY +]; + export const HCI = { CLOUD_INIT: 'harvesterhci.io/cloud-init-template', CURRENT_IP: 'rke2.io/internal-ip', diff --git a/pkg/harvester/models/harvesterhci.io.virtualmachinetemplateversion.js b/pkg/harvester/models/harvesterhci.io.virtualmachinetemplateversion.js index d89c6e91..87666a82 100644 --- a/pkg/harvester/models/harvesterhci.io.virtualmachinetemplateversion.js +++ b/pkg/harvester/models/harvesterhci.io.virtualmachinetemplateversion.js @@ -2,11 +2,10 @@ import { find, pickBy, omitBy } from 'lodash'; import { AS, MODE, _VIEW, _CONFIG, _UNFLAG, _EDIT } from '@shell/config/query-params'; -import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations'; +import { LABELS_TO_IGNORE_REGEX, HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations'; import { findBy } from '@shell/utils/array'; import { get, set } from '@shell/utils/object'; import { colorForState } from '@shell/plugins/dashboard-store/resource-class'; -import { LABELS_TO_IGNORE_REGEX } from '@shell/config/labels-annotations'; import { matchesSomeRegex } from '@shell/utils/string'; import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../config/harvester'; import { HCI } from '../types'; diff --git a/pkg/harvester/models/kubevirt.io.virtualmachine.js b/pkg/harvester/models/kubevirt.io.virtualmachine.js index 9d39163e..98516bf5 100644 --- a/pkg/harvester/models/kubevirt.io.virtualmachine.js +++ b/pkg/harvester/models/kubevirt.io.virtualmachine.js @@ -6,10 +6,9 @@ import { POD, NODE, PVC } from '@shell/config/types'; import { findBy } from '@shell/utils/array'; import { parseSi } from '@shell/utils/units'; import { get, set } from '@shell/utils/object'; -import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations'; +import { LABELS_TO_IGNORE_REGEX, HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations'; import { _CLONE } from '@shell/config/query-params'; import { matchesSomeRegex } from '@shell/utils/string'; -import { LABELS_TO_IGNORE_REGEX } from '@shell/config/labels-annotations'; import { parseVolumeClaimTemplates } from '@pkg/utils/vm'; import { BACKUP_TYPE } from '../config/types'; import { HCI } from '../types';