Skip to content

Commit

Permalink
Merge pull request #1168 from openshift-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…1149-to-release-4.15-compatibility

Bug 2256566: [release-4.15-compatibility] Fix default RBD StorageClass option for external mode
  • Loading branch information
openshift-merge-bot[bot] authored Jan 10, 2024
2 parents e2b7ce5 + 43aadea commit d3c5d0f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export type CreatePayload<S = ExternalState> = (payloadOptions: {
namespace: string;
storageClassName?: string;
inTransitStatus?: boolean;
shouldSetCephRBDAsDefault?: boolean;
}) => Payload[];

export type Payload = { model: Model; payload: K8sResourceKind };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export const rhcsPayload: CreatePayload<RHCSState> = ({
model,
namespace,
inTransitStatus,
shouldSetCephRBDAsDefault,
}) => {
return [
{
Expand Down Expand Up @@ -204,6 +205,9 @@ export const rhcsPayload: CreatePayload<RHCSState> = ({
externalStorage: {
enable: true,
},
managedResources: {
cephBlockPools: { defaultStorageClass: shouldSetCephRBDAsDefault },
},
labelSelector: {
matchExpressions: [],
},
Expand Down
7 changes: 7 additions & 0 deletions packages/odf/components/create-storage-system/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { getExternalStorage, getTotalCpu, getTotalMemoryInGiB } from '../utils';
import {
createExternalSubSystem,
createNoobaaExternalPostgresResources,
setCephRBDAsDefault,
createStorageCluster,
createStorageSystem,
labelNodes,
Expand Down Expand Up @@ -187,6 +188,7 @@ const handleReviewAndCreateNext = async (
} = state;
const {
systemNamespace,
isRBDStorageClassDefault,
externalStorage,
deployment,
type,
Expand Down Expand Up @@ -278,13 +280,18 @@ const handleReviewAndCreateNext = async (
const subSystemState = isRhcs ? connectionDetails : createStorageClass;
const subSystemKind = getGVKLabel(model);

const shouldSetCephRBDAsDefault = setCephRBDAsDefault(
isRBDStorageClassDefault,
deployment
);
const subSystemPayloads = createPayload({
systemName: subSystemName,
state: subSystemState,
model,
namespace: systemNamespace,
storageClassName: storageClass.name,
inTransitStatus: inTransitChecked,
shouldSetCephRBDAsDefault: shouldSetCephRBDAsDefault,
});

await createStorageSystem(subSystemName, subSystemKind, systemNamespace);
Expand Down
11 changes: 9 additions & 2 deletions packages/odf/components/create-storage-system/payloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ export const createNoobaaExternalPostgresResources = (
return secretResources;
};

export const setCephRBDAsDefault = (
isRBDStorageClassDefault: boolean,
deployment: DeploymentType
): boolean => isRBDStorageClassDefault && deployment === DeploymentType.FULL;

export const createStorageCluster = async (
state: WizardState,
storageClusterNamespace: string,
Expand Down Expand Up @@ -195,8 +200,10 @@ export const createStorageCluster = async (
deployment === DeploymentType.FULL &&
type !== BackingStorageType.EXTERNAL;

const shouldSetCephRBDAsDefault =
isRBDStorageClassDefault && deployment === DeploymentType.FULL;
const shouldSetCephRBDAsDefault = setCephRBDAsDefault(
isRBDStorageClassDefault,
deployment
);

const payload = getOCSRequestData({
storageClass,
Expand Down

0 comments on commit d3c5d0f

Please sign in to comment.