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

KMS flow for storage class creation #7330

Merged
merged 1 commit into from Dec 5, 2020

Conversation

a2batic
Copy link
Contributor

@a2batic a2batic commented Nov 25, 2020

Merge after: #7153
Screenshot from 2020-12-03 21-12-30
Screenshot from 2020-12-03 21-12-18

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 25, 2020
@openshift-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 25, 2020
@openshift-ci-robot openshift-ci-robot added component/sdk Related to console-plugin-sdk and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 1, 2020
@a2batic a2batic mentioned this pull request Dec 1, 2020
@a2batic a2batic force-pushed the storage-class-kms branch 2 times, most recently from d2cd237 to 5cc7407 Compare December 3, 2020 11:38
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 3, 2020
@a2batic a2batic changed the title [WIP] KMS flow for storage class creation KMS flow for storage class creation Dec 3, 2020
@a2batic a2batic marked this pull request as ready for review December 3, 2020 11:42
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 3, 2020
Copy link
Contributor

@cloudbehl cloudbehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Comment on lines 144 to 154
// const updateCsiConfigObj: ConfigMapKind = {
// apiVersion: ConfigMapModel.apiVersion,
// kind: ConfigMapModel.kind,
// data: {
// [kms.name.value]: JSON.stringify(csiConfigData),
// },
// metadata: {
// name: KMSConfigMapCSIName,
// namespace: CEPH_STORAGE_NAMESPACE,
// },
// };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove this or put a comment why this is required?

<Button
variant="plain"
onClick={() => {
if (editKMS) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to a function

@a2batic a2batic force-pushed the storage-class-kms branch 2 times, most recently from 91088c2 to dc41d5a Compare December 3, 2020 15:41
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 4, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 4, 2020
Comment on lines 289 to 301
const updateKMS = async () => {
const allServiceNames = csiConfigMap ? Object.keys(csiConfigMap?.data) : [];
if (
(allServiceNames.length && allServiceNames.indexOf(state.kms.name.value) === -1) ||
!csiConfigMap
) {
try {
const promises: Promise<K8sResourceKind>[] = createKmsResources(
state.kms,
editKMS,
csiConfigMap?.data,
);
await Promise.all(promises).then(() => setEditKMS(false));
setErrorMessage('');
} catch (error) {
setErrorMessage(error.message);
} finally {
setInProgress(false);
}
} else {
setErrorMessage(`KMS service ${state.kms.name.value} already exist`);
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you also need to setInProgress initially ?
And make it false later.

Comment on lines 273 to 287
const StorageClassEncryptionLabel: React.FC = () => (
<div className="ocs-storageClass-encryption__pv-title">
<span className="ocs-storageClass-encryption__pv-title--padding">Enable Encryption</span>
<TechPreviewBadge />
</div>
);

const EncryptionCardLoading: React.FC = () => (
<Grid className="skeleton-box">
<GridItem span={12} className="skeleton-activity" />
<GridItem span={12} className="skeleton-activity" />
<GridItem span={12} className="skeleton-activity" />
<GridItem span={12} className="skeleton-activity" />
</Grid>
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Components dont need to be inside existing component.
These should be moved out

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [csiConfigMap]);

return <></>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot understand the use of this component, if this returns nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because we need to send a value without rendering anything....since plugin accepts a component only, its like this.

providerNamespace: kmsData.VAULT_NAMESPACE,
hasHandled: true,
};
setEncryptionDispatch(SCActionType.SET_KMS_ENCRYPTION, '', dispatch, kmsObj);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should be dispatching on click of an action ideally .
This will set the state whenever map is not empty -> which does not seems like ideal condition

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for doing this is to set initial state of component with respect to value of configMap, so as config map loads, we have to set the state.

Comment on lines 268 to 271
React.useEffect(() => {
onParamChange(checked.toString());
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [checked]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be just inside if

Signed-off-by: Kanika Murarka <kmurarka@redhat.com>
@a2batic
Copy link
Contributor Author

a2batic commented Dec 4, 2020

/test backend

@a2batic
Copy link
Contributor Author

a2batic commented Dec 4, 2020

/test analyze

1 similar comment
@a2batic
Copy link
Contributor Author

a2batic commented Dec 4, 2020

/test analyze

@cloudbehl
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 4, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a2batic, cloudbehl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@a2batic
Copy link
Contributor Author

a2batic commented Dec 4, 2020

/test backend

@a2batic
Copy link
Contributor Author

a2batic commented Dec 4, 2020

/test e2e-gcp-console

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 21f8c8d into openshift:master Dec 5, 2020
@spadgett spadgett added this to the v4.7 milestone Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/ceph Related to ceph-storage-plugin component/sdk Related to console-plugin-sdk lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants