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 api-resources table parsing #605

Merged

Conversation

simonswine
Copy link
Contributor

For sometime tk pruning fails, as my cluster has overlapping CRD names/mismatching Kind and Name fields . Errors persisted like this:

$ tk prune environments/default
fetching UID's .. done 555.50452ms
fetching previously created resources .. Error: error: the server doesn't have a resource type "NetworkAttachmentDefinition"

The reason why this was happing was a failed parsing of the -o wide table of kubectl api-resources: The field APIGROUP no longer exists and is now part of APIVERSION.

@stale
Copy link

stale bot commented Sep 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 21, 2021
@julienduchesne
Copy link
Member

@simonswine. I think this could maybe cause issues with people running older kubectl versions. For example,kubectl 1.18 will still return the APIGROUP column. Could this be done in a way where both are supported? Check APIVERSION and then APIGROUP if it's not set?

@stale stale bot removed the stale label Oct 1, 2021
For sometime `tk pruning` fails, as my cluster has overlapping CRD
names. Errors persisted like this:

```
$ tk prune environments/default
fetching UID's .. done 555.50452ms
fetching previously created resources .. Error: error: the server doesn't have a resource type "NetworkAttachmentDefinition"
```

The reason why this was happing was a failed parsing of the `-o wide`
table of `kubectl api-resources`: The field `APIGROUP` no longer exists
and is now part of `APIVERSION`.
@simonswine simonswine force-pushed the 20210821_fix-bug-api-resources-parsing branch from 3597a04 to 4cc9e29 Compare October 1, 2021 17:18
@simonswine
Copy link
Contributor Author

@julienduchesne very good point. I have fixed this for both versions.

I also noticed the test data was not fully accurate, so I replaced it with real one that I retrieved locally.

@simonswine simonswine force-pushed the 20210821_fix-bug-api-resources-parsing branch from 4cc9e29 to 0018b22 Compare October 1, 2021 17:23
Copy link
Member

@julienduchesne julienduchesne left a comment

Choose a reason for hiding this comment

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

LGTM!

@julienduchesne julienduchesne merged commit 4eb306f into grafana:main Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants