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

Fix custom resources not having a fallback details component #3542

Merged
merged 3 commits into from
Aug 3, 2021

Conversation

Nokel81
Copy link
Collaborator

@Nokel81 Nokel81 commented Jul 30, 2021

Signed-off-by: Sebastian Malton [email protected]

fixes #3541

@Nokel81 Nokel81 added bug Something isn't working blocker labels Jul 30, 2021
@Nokel81 Nokel81 added this to the 5.2.0 milestone Jul 30, 2021
@Nokel81 Nokel81 self-assigned this Jul 30, 2021
@Nokel81 Nokel81 requested a review from a team as a code owner July 30, 2021 14:48
@Nokel81 Nokel81 requested review from aleksfront, jim-docker and jakolehm and removed request for a team July 30, 2021 14:48
Comment on lines 89 to 97
export interface KubeObjectStatus {
conditions: {
lastTransitionTime: string;
message: string;
reason: string;
status: string;
type?: string;
}[];
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the starting of a similar type to KubeObjectMetadata. In the future we should be able to use it everywhere because kube uses this type for object (even custom objects) it seems.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure all kubernetes objects have these?

Copy link
Contributor

@jakolehm jakolehm Aug 3, 2021

Choose a reason for hiding this comment

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

Also I think this interface does not match actual implementation, conditions seems to be an array of objects.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So I am not sure if all kube controllers do use this (or something like this...)

After reading:

and https://maelvls.dev/kubernetes-conditions/

It seems clear that not everything does use this type (or at least MUST use something like this). But that it is still the recommended way of displaying the history of data.

Comment on lines +37 to +38
interface Props extends KubeObjectDetailsProps<KubeObject> {
crd: CustomResourceDefinition;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed to passing in the crd (which should be the parent crd of object) because the single use of this component already needs to have it.

}

renderAdditionalColumns(crd: CustomResourceDefinition, columns: AdditionalPrinterColumnsV1[]) {
renderAdditionalColumns(resource: KubeObject, columns: AdditionalPrinterColumnsV1[]) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This component was incorrect because it said it was dealing with CustomResourceDefenition's as its main type. It is not, it is dealing with custom resources (which are from Lens' perspective, just KubeObject's).

</DrawerItem>
));
}

renderStatus(crd: CustomResourceDefinition, columns: AdditionalPrinterColumnsV1[]) {
renderStatus(crd: KubeObject<KubeObjectMetadata, KubeObjectStatus, any>, columns: AdditionalPrinterColumnsV1[]) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hopefully in the future, we won't need to specify KubeObjectStatus and we can just specify KubeObject but we are not there yet.

Comment on lines +176 to +179
if (crd) {
details.push(<CrdResourceDetails key={object.getId()} object={object} crd={crd} />);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

By fixing the typing on CrdResourceDetails (to not saying we want a CustomResourceDefenition as object, because we don't) it is no longer necessary to use a type cast.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2021

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@Nokel81 Nokel81 added the p0 label Aug 3, 2021
@Nokel81 Nokel81 assigned Nokel81 and unassigned Nokel81 Aug 3, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2021

Conflicts have been resolved. A maintainer will review the pull request shortly.

Signed-off-by: Sebastian Malton <[email protected]>
Copy link
Contributor

@jakolehm jakolehm left a comment

Choose a reason for hiding this comment

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

LGTM

@Nokel81 Nokel81 merged commit 77077ef into master Aug 3, 2021
@Nokel81 Nokel81 deleted the issue-3541 branch August 3, 2021 16:31
@Nokel81 Nokel81 mentioned this pull request Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker bug Something isn't working p0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generic CRD details are empty
2 participants