-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Thirdpartyresources examples #29
Thirdpartyresources examples #29
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
ref: #8 |
|
||
## Use Cases | ||
|
||
ThirdPartyResources can be used to implement custom Resource types for your Kubernetes cluster. |
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.
Could you add a hyperlink for ThirdPartyResources?
Good suggestion. Will do tomorrow
|
## Use Cases | ||
|
||
ThirdPartyResources can be used to implement custom Resource types for your Kubernetes cluster. | ||
These act like most other Resources in Kubernetes, and may be `kubectl apply`'d, etc. |
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.
Do you mean you can kubectl apply
ThirdpartyResource, or instances of ThirdpartyResource? If it's the former case, I feel it doesn't need to be emphasized.
config.GroupVersion = &groupversion | ||
config.APIPath = "/apis" | ||
config.ContentType = runtime.ContentTypeJSON | ||
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} |
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.
Do we have to use the api.Codecs and api.Scheme, or can we create our own instances of them (e.g., code)? I'm not sure if adding a groupversion to the exisiting scheme will have any side effects.
|
||
// The code below is used only to work around a known problem with third-party | ||
// resources and ugorji. If/when these issues are resolved, the code below | ||
// should no longer be required. |
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.
Could you link to the issue: ugorji/go#178
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.
And could you say if the issue is resolved, you can just define the UnmarshalText(data []byte) error
for Example
and ExampleList
, and don't need to define ExampleListCopy
and ExampleCopy
.
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, just a few comments. Thank you @wfarr for contributing the example!
It's probably worth linking to the known gotchas: kubernetes/enhancements#95. Some of these issues are pretty bad. |
nit: the folder name shouldn't include dashes (see code convention), I think thirdpartyresources is clear enough. [edit]: Oops, we used "in-cluster" "out-cluster" in other two examples. I'll fix those. |
@wfarr I'll merge this example as it is. Please let me know if you plan working on the comments, otherwise I'll find time perhaps next week to improve it a little bit. Thanks again. |
I've opened #37 based on the feedback here. |
Adds a basic example for registering a ThirdPartyResource and interacting with a custom Resource type.
A follow-up PR will include a controller built on the same foundations, but a simple CRUD example will be useful for folks as well.
Tested against kubernetes 1.4.5 on GKE.
attn @caesarxuchao
cc @mkobetic @ibawt @lxfontes
This change is