Skip to content

Commit 4ed2b85

Browse files
Merge pull request #1519 from SanjalKatiyar/nodes_label
Fix nodes' label for ROSA clusters
2 parents f0bbbaa + d1c7089 commit 4ed2b85

File tree

8 files changed

+23
-16
lines changed

8 files changed

+23
-16
lines changed

packages/ocs/dashboards/persistent-internal/inventory-card.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ const InventoryCard: React.FC = () => {
6767
const pvsData = (resources?.pvs?.data ?? []) as K8sResourceKind[];
6868

6969
const scData = (resources?.sc?.data ?? []) as StorageClassResourceKind[];
70-
const ocsNodesHref = `/search?kind=${NodeModel.kind}&q=${cephStorageLabel}`;
70+
const ocsNodesHref = `/search?kind=${NodeModel.kind}&q=${cephStorageLabel(
71+
clusterNs
72+
)}`;
7173

7274
return (
7375
<Card>

packages/odf/components/alerts/alert-action-path.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getStorageClusterInNs } from '@odf/core/utils';
2-
import { CEPH_STORAGE_NAMESPACE } from '@odf/shared/constants';
2+
import { DEFAULT_STORAGE_NAMESPACE } from '@odf/shared/constants';
33
import { StorageClusterModel } from '@odf/shared/models';
44
import { StorageClusterKind } from '@odf/shared/types';
55
import { k8sList } from '@openshift-console/dynamic-plugin-sdk';
@@ -21,13 +21,13 @@ export const launchClusterExpansionModal = async (alert, launchModal) => {
2121
*/
2222
const storageCluster = (await k8sList({
2323
model: StorageClusterModel,
24-
queryParams: { ns: CEPH_STORAGE_NAMESPACE },
24+
queryParams: { ns: DEFAULT_STORAGE_NAMESPACE },
2525
})) as StorageClusterKind[];
2626
launchModal(AddCapacityModal, {
2727
isOpen: true,
2828
storageCluster: getStorageClusterInNs(
2929
storageCluster,
30-
CEPH_STORAGE_NAMESPACE
30+
DEFAULT_STORAGE_NAMESPACE
3131
),
3232
});
3333
} catch (e) {

packages/odf/components/create-storage-system/create-storage-system-steps/capacity-and-nodes-step/capacity-and-nodes-step.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
getDeviceSetCount,
3838
getOsdAmount,
3939
} from '@odf/core/utils';
40+
import { DEFAULT_STORAGE_NAMESPACE } from '@odf/shared/constants';
4041
import { FieldLevelHelp } from '@odf/shared/generic/FieldLevelHelp';
4142
import { K8sResourceKind } from '@odf/shared/types';
4243
import { useCustomTranslation } from '@odf/shared/useCustomTranslationHook';
@@ -79,10 +80,11 @@ const onResourceProfileChange = _.curry(
7980
);
8081

8182
const SelectNodesText: React.FC<SelectNodesTextProps> = React.memo(
82-
({ text, systemNamespace }) => {
83+
({ text }) => {
8384
const { t } = useCustomTranslation();
8485

85-
const label = `cluster.ocs.openshift.io/${systemNamespace}=""`;
86+
// ToDo (epic 4422): Use StorageSystem namespace once we support multiple internal clusters
87+
const label = `cluster.ocs.openshift.io/${DEFAULT_STORAGE_NAMESPACE}=""`;
8688
return (
8789
<TextContent>
8890
<Text>{text}</Text>

packages/odf/components/create-storage-system/payloads.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
NOOBAA_EXTERNAL_PG_TLS_SECRET_NAME,
88
NOOBA_EXTERNAL_PG_SECRET_NAME,
99
} from '@odf/shared/constants';
10+
import { DEFAULT_STORAGE_NAMESPACE } from '@odf/shared/constants';
1011
import {
1112
StorageClusterModel,
1213
ODFStorageSystem,
@@ -221,7 +222,8 @@ export const labelNodes = async (
221222
nodes: WizardNodeState[],
222223
namespace: string
223224
) => {
224-
const labelPath = `/metadata/labels/cluster.ocs.openshift.io~1${namespace}`;
225+
// ToDo (epic 4422): Use StorageSystem namespace once we support multiple internal clusters
226+
const labelPath = `/metadata/labels/cluster.ocs.openshift.io~1${DEFAULT_STORAGE_NAMESPACE}`;
225227
const storageLabel = cephStorageLabel(namespace);
226228
const patch: Patch[] = [
227229
{

packages/odf/constants/common.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
ResourceProfile,
33
ResourceProfileRequirementsMap,
44
} from '@odf/core/types';
5+
import { DEFAULT_STORAGE_NAMESPACE } from '@odf/shared/constants';
56
import { Toleration, Taint } from '@odf/shared/types';
67
import { TFunction } from 'i18next';
78

@@ -18,8 +19,9 @@ export const OCS_DEVICE_SET_MINIMUM_REPLICAS = 3;
1819
export const MINIMUM_NODES = 3;
1920
export const SECOND = 1000;
2021

21-
export const cephStorageLabel = (ns: string) =>
22-
`cluster.ocs.openshift.io/${ns}`;
22+
// ToDo (epic 4422): Use StorageSystem namespace once we support multiple internal clusters
23+
export const cephStorageLabel = (_ns: string) =>
24+
`cluster.ocs.openshift.io/${DEFAULT_STORAGE_NAMESPACE}`;
2325

2426
/**
2527
* Map between resource profiles and the minimum cpu's and memory (expressed in GiB) required

packages/odf/modals/add-capacity/add-capacity-modal.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as React from 'react';
22
import NamespaceSafetyBox from '@odf/core/components/utils/safety-box';
33
import { useNodesData } from '@odf/core/hooks';
4-
import { useODFNamespaceSelector } from '@odf/core/redux';
54
import { NodeData } from '@odf/core/types';
65
import { getStorageClassDescription } from '@odf/core/utils';
76
import { getCephNodes } from '@odf/ocs/utils/common';
@@ -17,7 +16,7 @@ import { CommonModalProps } from '@odf/shared/modals/common';
1716
import { ModalBody, ModalFooter, ModalHeader } from '@odf/shared/modals/Modal';
1817
import { StorageClusterModel } from '@odf/shared/models';
1918
import { PersistentVolumeModel, StorageClassModel } from '@odf/shared/models';
20-
import { getName } from '@odf/shared/selectors';
19+
import { getName, getNamespace } from '@odf/shared/selectors';
2120
import {
2221
StorageClassResourceKind,
2322
StorageClusterKind,
@@ -199,9 +198,9 @@ export const AddCapacityModal: React.FC<AddCapacityModalProps> = ({
199198
}) => {
200199
const { t } = useCustomTranslation();
201200

202-
const { odfNamespace } = useODFNamespaceSelector();
203-
201+
const ocsClusterNs = getNamespace(ocsConfig);
204202
const ocsClusterName = getName(ocsConfig);
203+
205204
const [cephTotal, totalError, totalLoading] = useCustomPrometheusPoll({
206205
endpoint: 'api/v1/query' as PrometheusEndpoint,
207206
query:
@@ -251,7 +250,7 @@ export const AddCapacityModal: React.FC<AddCapacityModalProps> = ({
251250
const replica = getDeviceSetReplica(
252251
isArbiterEnabled,
253252
hasFlexibleScaling,
254-
createWizardNodeState(getCephNodes(nodesData, odfNamespace) as NodeData[])
253+
createWizardNodeState(getCephNodes(nodesData, ocsClusterNs) as NodeData[])
255254
);
256255

257256
const totalCapacityMetric = values?.[0];

packages/odf/redux/provider-hooks/useODFNamespace.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react';
2+
import { DEFAULT_STORAGE_NAMESPACE as FALLBACK_NAMESPACE } from '@odf/shared/constants';
23
import {
34
SubscriptionModel,
45
ClusterServiceVersionModel,
@@ -13,7 +14,6 @@ import {
1314
} from '@openshift-console/dynamic-plugin-sdk';
1415
import { useODFNamespaceDispatch } from '../dispatchers';
1516

16-
const FALLBACK_NAMESPACE = 'openshift-storage';
1717
const ODF_SUBSCRIPTION_NAME = 'odf-operator';
1818
const CLIENT_SUBSCRIPTION_NAME = 'ocs-client-operator';
1919

packages/shared/src/constants/common.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const DASH = '-';
22
export const AVAILABLE = 'Available';
3-
export const CEPH_STORAGE_NAMESPACE = 'openshift-storage';
3+
export const DEFAULT_STORAGE_NAMESPACE = 'openshift-storage'; // This hardcoded namespace is only for specific cases, do not use it otherwise.
44
export const ODF_OPERATOR = 'odf-operator';
55
export const OCS_OPERATOR = 'ocs-operator';
66
export const ROOK_CEPH_OPERATOR = 'rook-ceph-operator';

0 commit comments

Comments
 (0)