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 1853599: Fixes bug attaching block storage PVC to deployments #6221
Bug 1853599: Fixes bug attaching block storage PVC to deployments #6221
Conversation
/assign cloudbehl |
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.
Add bugzilla id to the PR.
78a869b
to
7f748a2
Compare
@vbnrh: An error was encountered adding this pull request to the external tracker bugs for bug 1853599 on the Bugzilla server at https://bugzilla.redhat.com:
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. |
/bugzilla refresh |
@cloudbehl: This pull request references Bugzilla bug 1853599, 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. |
7f748a2
to
1f6124a
Compare
value={devicePath} | ||
required | ||
/> | ||
<p className="help-block" id="mount-path-help"> |
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.
<p className="help-block" id="mount-path-help"> | |
<p className="help-block" id="volume-device-help"> |
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.
fixed
const newVolumeName = volume ? volume.name : newClaimName; | ||
const newVolumeAlreadyMounted = !!volume; | ||
setVolumeName(newVolumeName); | ||
setVolumeAlreadyMounted(newVolumeAlreadyMounted); | ||
}, [newPVCObj, obj, claimName, showCreatePVC]); | ||
showCreatePVC === 'existing' && newClaimName.trim().length > 0 | ||
? k8sGet(PersistentVolumeClaimModel, newClaimName, namespace) |
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.
Don't we already have all the PVCs since we get them for the dropdown? It would be nice to use the object we already have instead of requesting it again.
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.
Currently the component only returns the name of the PVC and not the entire PVC object. We may have to change the entire component to return a list of objects for that to be possible.
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.
How hard is it to update the ListDropdown
onChange
prop to take a 3rd optional argument with the resource? Then we could skip this get, and it could be useful in other contexts.
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.
changed it to use obj from listdropdown. thanks for the input.
showCreatePVC === 'existing' && newClaimName.trim().length > 0 | ||
? k8sGet(PersistentVolumeClaimModel, newClaimName, namespace) | ||
.then((pvc) => { | ||
setClaimVolumeMode(pvc?.spec?.volumeMode); |
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.
The optional chaining here shouldn't be necessary.
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.
removed
.then((pvc) => { | ||
setClaimVolumeMode(pvc?.spec?.volumeMode); | ||
}) | ||
.catch((err) => setError(err)) |
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.
.catch((err) => setError(err)) | |
.catch(setError) |
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.
done
@@ -117,6 +125,27 @@ export const AttachStorageForm: React.FC<AttachStorageFormProps> = (props) => { | |||
validateMountPaths(event.currentTarget.value); | |||
}; | |||
|
|||
const getDevicePaths = (podTemplate: any): string[] => { | |||
const containers: ContainerSpec[] = _.get(podTemplate, 'spec.containers', []); |
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.
Use optional chaining instead of _.get
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.
done
@@ -117,6 +125,27 @@ export const AttachStorageForm: React.FC<AttachStorageFormProps> = (props) => { | |||
validateMountPaths(event.currentTarget.value); | |||
}; | |||
|
|||
const getDevicePaths = (podTemplate: any): 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.
We should have a TypeScript type for pod templates
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.
done
const err = existingDevicePaths.includes(path) ? 'Device path is already in use.' : ''; | ||
setError(err); |
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 this clear a different error that might have been previously set?
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.
Yes it will set the last occurred error and display it to the user
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.
But sometimes you call setError
with ''
as the value. It will clear any previous error in that case.
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.
Ahh.... i got your point now. The changes should be suffice now
return patch; | ||
}, []); | ||
}; | ||
const getVolumePatches = (pvClaimName: 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.
const getVolumePatches = (pvClaimName: string) => { | |
const getVolumePatches = (pvcName: 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.
done
name: volumeName, | ||
devicePath, | ||
}; | ||
const containers: ContainerSpec[] = _.get(obj, 'spec.template.spec.containers', []); |
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.
Prefer optional chaining for new code
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.
done
083861c
to
4f0a2a6
Compare
/retest |
const [newPVCObj, setNewPVCObj] = React.useState(null); | ||
const [pvcResource, setPVCResource] = React.useState(null); |
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 [pvcResource, setPVCResource] = React.useState(null); | |
const [selectedPVC, setSelectedPVC] = React.useState<PersistentVolumeClaimKind>(null); |
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.
done
const newVolumeName = volume ? volume.name : newClaimName; | ||
const newVolumeAlreadyMounted = !!volume; | ||
setVolumeName(newVolumeName); | ||
setVolumeAlreadyMounted(newVolumeAlreadyMounted); | ||
}, [newPVCObj, obj, claimName, showCreatePVC]); | ||
showCreatePVC === 'existing' && newClaimName.trim().length > 0 |
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.
Why check newClaimName
when it's an existing 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.
const
newClaimName =
showCreatePVC === 'existing' ? claimName : _.get(newPVCObj, 'metadata.name', '');`
newClaimName can represent both the exisiting and newer claim name.
@@ -135,16 +168,15 @@ export const AttachStorageForm: React.FC<AttachStorageFormProps> = (props) => { | |||
: Promise.resolve(claimName); | |||
}; | |||
|
|||
const getVolumePatches = (pvClaimName: string) => { | |||
const getVolumeMountPatches = (): any[] => { |
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.
Not specifying a type and letting TypeScript infer it would be better than any
, but we do have a Patch
type.
const getVolumeMountPatches = (): any[] => { | |
const getVolumeMountPatches = (): Patch[] => { |
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.
done
@@ -163,10 +195,41 @@ export const AttachStorageForm: React.FC<AttachStorageFormProps> = (props) => { | |||
} | |||
return patch; | |||
}, []); | |||
}; | |||
|
|||
const getVolumeDevicePatches = (): any[] => { |
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 getVolumeDevicePatches = (): any[] => { | |
const getVolumeDevicePatches = (): Patch[] => { |
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.
done
@@ -21,7 +22,7 @@ export const PVCDropdown: React.FC<PVCDropdownProps> = (props) => { | |||
export type PVCDropdownProps = { | |||
namespace: string; | |||
selectedKey: string; | |||
onChange: (string) => void; | |||
onChange: (claimName: string, kindlabel?: string, pvc?: PersistentVolumeClaimKind) => 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.
onChange: (claimName: string, kindlabel?: string, pvc?: PersistentVolumeClaimKind) => void; | |
onChange: (claimName: string, kindLabel?: string, pvc?: PersistentVolumeClaimKind) => 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.
done
…age page Using block storage provisioners with RWX access mode incorrectly attaches the path as volumeMount in PodSpec instead of volumeDevice. This caused the pods to be in a state of ContainerCreation indefinitely. This commit fixes this by sending the object with the right configuration for block storage. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1853599 Signed-off-by: Vineet Badrinath <vbadrina@redhat.com>
4f0a2a6
to
48f057e
Compare
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gnehapk, spadgett, vbnrh 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 |
@vbnrh: The following test failed, say
Full PR test history. Your PR dashboard. 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 understand the commands that are listed here. |
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest Please review the full test history for this PR and help us cut down flakes. |
@vbnrh: All pull requests linked via external trackers have merged: Bugzilla bug 1853599 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. |
/cherry-pick release-4.5 |
@vbnrh: #6221 failed to apply on top of branch "release-4.5":
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. |
Using block storage provisioners with RWX access mode incorrectly attaches the path as volumeMount in PodSpec instead of volumeDevice. This caused the pods to be in a state of ContainerCreation indefinitely. This commit fixes this by sending the object with the right configuration for block storage.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1853599
Signed-off-by: Vineet Badrinath vbadrina@redhat.com