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

Postrenderer support resourcelists #1680

Merged

Conversation

absoludity
Copy link
Contributor

@absoludity absoludity commented Apr 21, 2020

Based on feedback from previous PR, this updates to handle both CronJobs and all resource list types.

Ref: #1617

@absoludity absoludity requested a review from andresmgot April 21, 2020 01:51
Copy link
Contributor

@andresmgot andresmgot left a comment

Choose a reason for hiding this comment

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

LGTM but I would just check if the resource has the key items to know if it's a list

"PodTemplateList": struct{}{},
"ReplicaSetList": struct{}{},
"ReplicationControllerList": struct{}{},
"StatefulSetList": struct{}{},
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK, just "List" is also a valid resource type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I know, this is only used for the top level which the renderer never sees, but I've added it anyway.

Comment on lines 85 to 86
if _, ok := resourceListTypes[kind]; ok {
if items, ok := resource["items"]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

can't we just check if the resource has the key "items" to know if it's a list? That may be a slightly slower (since we would be processing list for other than workloads) but safer and we would need to maintain less hard-coded types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, and it would work now. I thought it better to be explicit, since we don't control the API, but perhaps it would be simpler. Updating.

@absoludity absoludity merged commit 132318f into vmware-tanzu:master Apr 22, 2020
@absoludity absoludity deleted the postrenderer-support-resourcelists branch April 22, 2020 03:49
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