-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
internal/scaffold/olm-catalog: populate CSV customresourcedefinitions from Go type annotations #1162
internal/scaffold/olm-catalog: populate CSV customresourcedefinitions from Go type annotations #1162
Conversation
…ptors from *_types.go files
@estroz I noticed that when we updated our dependencies, we had to update Not sure if that's related to this, but it sounded similar. Can any of those updates be used to simplify this PR? |
Looks like there were changes made upstream in the CRD generator to add validation field descriptions. Unfortunately for |
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 have some concerns that users most of the time don't have detailed enough code comments to make this work all the time. Could we make this optional or warn that it's done on a best effort bases.
Agree about the logging vs overriding part, especially if the guess is not good enough for most use cases.
@lilic in the docs I'll address the fact that code comments will be used as descriptions. The |
@joelanford I think I'm going to switch to a parser like gengo instead of writing my own. I should still be able to get all the info I need from parsed data. |
…notations to get CSV field values
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.
Fantastic! 👍
All working now. It is /lgtm /approved for me.
/retest Please review the full test history for this PR and help us cut down flakes. |
New changes are detected. LGTM label has been removed. |
if len(name) == 0 { | ||
return true | ||
} |
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.
Does an embedded struct (that would otherwise be inlined) have a name?
For example:
type EmbeddedPublic struct {
Public string `json:"public"`
}
type embeddedPrivate struct {
Private string `json:"private"`
}
type Parent struct {
EmbeddedPublic
embeddedPrivate
}
In this case, the marshaled JSON would include both "public" and "private" fields in the output.
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 embedded struct name will always be its type name. We should include an embedded struct's fields regardless if that's how the JSON Marshaller does it:
if member.Embedded {
return inlinedTag, nil
}
if isNotExported(member.Name) {
return ignoredTag, nil
}
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 once sanity test failures are resolved.
075c236
to
241f71a
Compare
@@ -0,0 +1,195 @@ | |||
# Code Annotations for Cluster Service Versions |
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.
Hi @estroz,
We forget to add the changelog entry over this one.
Description of the change: use doc and code comments on CR types to populate
customresourcedefinitions.owned
fields except foractionDescriptors
, which will be persisted to the new CSV.Motivation for the change: see #1132
Closes #1132