-
Notifications
You must be signed in to change notification settings - Fork 416
Particularize Initializers and Provide Sample Code #3412
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
base: main
Are you sure you want to change the base?
Particularize Initializers and Provide Sample Code #3412
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
14d5d6b
to
fe0fc0d
Compare
fe0fc0d
to
880a48d
Compare
Regarding (1): Maybe it makes sense to focus on the code parts that are relevant to building such a controller instead of a fully working example that includes standard stuff like setting up a manager, generating a rest config, etc? Regarding (2): I'm not quite sure, but I suspect the following is happening: When you patch the But @mjudeikis should comment on this too, it's just a hunch at this point. |
/ok-to-test |
On-behalf-of: SAP <simon.bein@sap.com> Signed-off-by: Simon Bein <simontheleg@gmail.com>
On-behalf-of: SAP <simon.bein@sap.com> Signed-off-by: Simon Bein <simontheleg@gmail.com>
On-behalf-of: SAP <simon.bein@sap.com> Signed-off-by: Simon Bein <simontheleg@gmail.com>
On-behalf-of: SAP <simon.bein@sap.com> Signed-off-by: Simon Bein <simontheleg@gmail.com>
On-behalf-of: SAP <simon.bein@sap.com> Signed-off-by: Simon Bein <simontheleg@gmail.com>
880a48d
to
da31636
Compare
|
/label kind/documentation |
@SimonTheLeg: The label(s) 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. |
/retest |
/retest |
I think we need to start collecting extensive examples somewhere in the repo (monorepo style), so we can point users to working e2e examples. We know we have edgecases and missing machinery for how to run this things in an easy way. Docs examples are tend to get out of date super fast so +1 to have them incode and link |
@embik @SimonTheLeg I would be huge +1 to move examples into code and link it from docs. Else they will be out of date as soon as next rebase. Otherwise - good to merge if we do this as follow-up |
We could directly link to https://github.com/kcp-dev/multicluster-provider/tree/main/examples/initializingworkspaces from the kcp docs and extend it with the changes (?) that @SimonTheLeg made in the example code in this PR. |
I dislike having examples in comments or doc files. IMHO they give a false sense of security that it is documented but in reality they never are tested on changes and quickly forgotten. I started executable examples in the contrib repo: https://github.com/kcp-dev/contrib/tree/main/examples If a build fails off of main the pipeline failure is reported. That can also work for Go code for e.g. controllers. In contrib it won't be build as part of the test suites but at least it will run at least every night and we will get notified if the examples break. Alternatively we could copy that workflow to this repository and then make parts of the documentation testable, e.g. for this case the code could be written to a file:
And to reiterate - I like more examples but the examples should be tested and regularly run. If we just plug that into docs somewhere it will be outdated. |
|
||
This is an example URL path for accessing logical cluster apis for a specific initializer in a `initializingworkspaces` virtual workspace. | ||
### Responsibilities Of Custom Intitialization Controllers |
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.
### Responsibilities Of Custom Intitialization Controllers | |
### Responsibilities Of Custom Initialization Controllers |
* We strongly recommend to use the kcp [initializingworkspace multicluster-provider](github.com/kcp-dev/multicluster-provider) to build your custom initializer | ||
* You need to update LogicalClusters using patches; They cannot be updated using the update api | ||
|
||
Keeping this in mind, you can use the following example as a starting point for your intitialization controller |
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.
Keeping this in mind, you can use the following example as a starting point for your intitialization controller | |
Keeping this in mind, you can use the following example as a starting point for your initialization controller |
return err | ||
} | ||
|
||
// since the initializers name is is the last part of the hostname, we can take it from there |
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.
// since the initializers name is is the last part of the hostname, we can take it from there | |
// since the initializers name is the last part of the hostname, we can take it from there |
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.
Overall LGTM, thanks for extending this doc
+1 for keeping example in a file
Summary
Before starting with a detailed review of the content: Two open questions from my side
For now I have put the code into mkdocs tabs to directly live in the documentation. As the example is rather complex, I am thinking it would be better to place this somewhere into our repo and link from to docs to it. Do you agree? If yes, where would be the best place to put the example?
The code works and initializes the workspaces correctly. However it still logs errors like this one. Do you have any ideas what this could be? Since it logs them constantly, I am not feeling quite happy with the code, but I cannot figure out how to fix it. I have tried setting
lc.Name = req.Name
, but this runs into the same issueWhat Type of PR Is This?
/kind documentation
Related Issue(s)
Fixes: making kcp docs a better place :)
Release Notes