-
Notifications
You must be signed in to change notification settings - Fork 419
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
⚠️ Marker Parsing and Structure #190
⚠️ Marker Parsing and Structure #190
Conversation
cc @mengqiy this has both the comment extraction and marker parsing. |
133bc92
to
536a72d
Compare
Don't accidentally check in ViM swap files, etc.
17c6907
to
502deab
Compare
@redborian FYI |
return err | ||
} | ||
|
||
return 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.
RBAC Parser Reviewed. Looks good.
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.
Reviewing commit-by-commit.
Reviewed the marker collector/parsing, looks good, have couple of nits.
// | ||
// Markers can be collected from a loader.Package using a Collector. The | ||
// Collector will read from a given Registry, collecting comments that look | ||
// like markers and parsing them if they match some definition on the registry. |
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.
This is the most important part which helped me understand how all these fit together.
// associated. | ||
// | ||
// PackageMarkers can be used to fetch just package-level markers. | ||
package markers |
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.
Excellent description.
502deab
to
3518635
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.
Reviewed genall and looks good to me.
} | ||
|
||
p.CustomResourceDefinitions[groupKind] = crd | ||
} |
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.
Reviewed crd parsing. This is bulk of the code I guess, looks pretty good on a high level.
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.
Reviewed the controller-gen changes, looks good overall.
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.
reviewed dep update, have one comment about controller-runtime deps.
Have reviewed all the changes (except deepcopy-gen) and looks good overall, have minor comments. You can probably submit deepcopy-gen in a separate PR if you would like to get the other changes in. |
00aaaa9
to
8a2a6fe
Compare
Forgot webhook-gen. We'll need to make sure webhook gen works with our new plans before release -- I stripped out the parts I thought we no longer needed, but I just want to make sure. |
Added better tests for the low-level stuff. High-level stuff and schema operations need tests. We can follow up with those before release. Let's try and get this part merged tomorrow after I make sure all the ancillary tests pass (e.g. test project stuff), etc. |
8a2a6fe
to
e5fba3a
Compare
This introduces utilities for incremental/filtered package loading, based on go/packages (the new replacement for go/build and friends when importing). It'll work with modules properly, too.
e6adb51
to
1a9e63e
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.
reviewed webhook generation commit, looks reasonable to me.
pkg/webhook/parser.go
Outdated
// | ||
// The markers take the form: | ||
// | ||
// +kubebuilder:rbac:failurePolicy=<string>,groups=<[]string>,resources=<[]string>,verbs=<[]string>,versions=<[]string>,name=<string>,path=<string>,mutating=<bool> |
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.
typo: s/rbac/webhook ?
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.
s/rbac/webhook
@DirectXMan12 Please fix this.
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.
Reviewed testData import path commit, looks good.
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.
Looks good to me.
pkg/webhook/parser.go
Outdated
// | ||
// The markers take the form: | ||
// | ||
// +kubebuilder:rbac:failurePolicy=<string>,groups=<[]string>,resources=<[]string>,verbs=<[]string>,versions=<[]string>,name=<string>,path=<string>,mutating=<bool> |
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.
s/rbac/webhook
@DirectXMan12 Please fix this.
pkg/webhook/parser.go
Outdated
// | ||
// The markers take the form: | ||
// | ||
// +kubebuilder:rbac:failurePolicy=<string>,groups=<[]string>,resources=<[]string>,verbs=<[]string>,versions=<[]string>,name=<string>,path=<string>,mutating=<bool> |
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.
It seems it now requires all arguments to be in the same line. We need to remember to update the book.
This introduces a framework for collecting and parsing "marker" comments into structured Go data, much like the "json" package.
This removed the generation and parsing logic that's being superseded by loader, markers, etc.
This adds a generator framework that ties together running multiple generators from the same marker data, and describe how they can read and write artifacts.
This adds RBAC generation (as per our existing RBAC markers) on top of the new generator framework.
This defines the framework for CRD generation, and uses markers with that implement interfaces to modify the schema and CRD.
This implements deepcopy generation, mostly copying from deepcopy-gen but using the generator framework. It slightly scopes down things to only implement parts we care about for custom types that represent CRDs.
This updates controller-gen to make use of the new generator framework. Generators and ouput rules are treated as markers to parse commandline options.
This adds WebhookConfig generation (as per our existing webhook markers, with slight modifications) on top of the new generator framework.
It had an old import path pointing to the wrong place, which causes all sorts of build failures.
Update deps to required versions.
It's no longer used by any tests. We can always add it back in if we need to.
Some of the enabled checkers were deprecated, had known issues, or returned erroneous results. They've been commented out, with comments as to why they're not run.
1a9e63e
to
0fb1204
Compare
discussed with @mengqiy in person, will merge as per previous approval, then to master |
/lgtm |
@DirectXMan12: you cannot LGTM your own PR. 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. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: DirectXMan12 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 |
/lgtm |
This re-implements our parsing and generation logic in a more structured form.
I've tried to write up extended guides in the godoc for each new package, so check that
out until I put together a cohesive guide.
TODO: