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
Bug 1871742: can't delete a PVC created using a data upload #6407
Conversation
@glekner: This pull request references Bugzilla bug 1871742, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@glekner: This pull request references Bugzilla bug 1871742, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I like it! |
|
||
export interface PVCDelete<T> { | ||
/** predicate that tells if to use the extension or not */ | ||
predicate: (pvc: K8sResourceCommon) => boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
predicate: (pvc: K8sResourceCommon) => boolean; | |
predicate: (pvc: PersistentVolumeClaimKind) => boolean; |
/** predicate that tells if to use the extension or not */ | ||
predicate: (pvc: K8sResourceCommon) => boolean; | ||
/** method for the pvc delete operation */ | ||
onPVCKill: (pvc: K8sResourceCommon) => Promise<void>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onPVCKill: (pvc: K8sResourceCommon) => Promise<void>; | |
onPVCKill: (pvc: PersistentVolumeClaimKind) => Promise<void>; |
/** method for the pvc delete operation */ | ||
onPVCKill: (pvc: K8sResourceCommon) => Promise<void>; | ||
/** alert for additional info */ | ||
alertLoader?: LazyLoader<T>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for generics. We know we always pass pvc object
alertLoader?: LazyLoader<T>; | |
alertLoader?: LazyLoader<{pvc: PersistentVolumeClaimKind}>; |
maybe extract the type and export it so the extension consumers can reuse it
</Alert> | ||
); | ||
|
||
type PVCDeleteAlertExtension = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you wont have to define your own type once you remove the generics as I mentioned above
import { PersistentVolumeClaimModel } from '../../models'; | ||
import { isPVCDelete, PVCDelete, useExtensions } from '@console/plugin-sdk'; | ||
|
||
const DeletePVCModal = withHandlePromise((props: DeletePVCModalProps) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const DeletePVCModal = withHandlePromise((props: DeletePVCModalProps) => { | |
const DeletePVCModal = withHandlePromise<DeletePVCModalProps>((props) => { |
}; | ||
|
||
const alertComponents = pvcDeleteExtensions.map( | ||
({ properties: { predicate, alertLoader } }, i) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have uid
available now
({ properties: { predicate, alertLoader } }, i) => | |
({ properties: { predicate, alertLoader }, uid }) => | |
predicate(pvc) && <StackItem key={uid}><AsyncComponent loader={alertLoader} pvc={pvc} /></StackItem>, |
}); | ||
|
||
export type DeletePVCModalProps = { | ||
pvc: K8sResourceCommon; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pvc: K8sResourceCommon; | |
pvc: PersistentVolumeClaim; |
</ModalTitle> | ||
<ModalBody> | ||
<Stack hasGutter> | ||
{alertComponents.map((alert, i) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{alertComponents.map((alert, i) => ( | |
{alertComponents} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to render a margin between every alert <StackItem>
, so I need this map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment #6407 (comment)
|
||
export const killCDIBoundPVC = (pvc: K8sResourceKind) => k8sKill(DataVolumeModel, pvc); | ||
|
||
export const PVCDeleteAlertExtension: React.FC<PVCDeleteAlertExtension> = ({ pvc }) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should also consider that the extension would define alertTitle: string
, alertBody: LazyLoader<{pvc: PersistentVolumeClaimKind}>
, alertType: AlertVariant
.
It makes the extension less error prone, you dont have to specify className, isInline etc..all would be handled by pvc delete modal
We need to ensure that if the PVC is used to back any OS then we highlight that here. It's possible that a user could delete this without knowing that's being cloned as an OS source somewhere else right? |
/retest |
fixed suggestions @rawagner |
Ya that's what I was thinking. If it's that important we shouldn't assume the user is thinking about it that way. It would be a nice addition to alert them that is being used to support and OS as a backing source. |
@matthewcarleton can you approve the text here? |
/retest |
@glekner I dont think it will cause any malfunction. We clone the image. It will cause that the other VMs will not be able to use it but the ones which have already been deployed will be fine. Or am I missing something? |
const alertComponents = pvcDeleteExtensions.map( | ||
({ properties: { predicate, alert }, uid }) => | ||
predicate(pvc) && ( | ||
<Alert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you wrap the alert in StackItem
you wont need to map
again later.
<Alert | |
<StackItem key={uid}> | |
<Alert |
you can also move key from Alert
to StackItem
. There's also no need to make key
more complicated than just uid. Doing pvc-alert-${uid}
doesnt bring any value
}, | ||
}); | ||
|
||
export const PVCDeleteAlertExtension = ({ pvc }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const PVCDeleteAlertExtension = ({ pvc }) => { | |
export const PVCDeleteAlertExtension: React.FC<{ pvc: PersistentVolumeClaimKind }> = ({ pvc }) => { |
/** alert for additional info */ | ||
alert?: { | ||
/** alert title */ | ||
alertTitle: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be just title
, 'type', 'Body'. Not a blocker though :)
/retest |
/lgtm |
/retest Please review the full test history for this PR and help us cut down flakes. |
14 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/hold needs rebase |
/retest |
/hold cancel |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: glekner, rawagner 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 |
@glekner: All pull requests linked via external trackers have merged: Bugzilla bug 1871742 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
For Normal PVCs the modal is the same:
For CDI Bound PVCs the modal is:
@matthewcarleton how do we want this to look?