sample-controller | Complements sample | Model View Controller library
kandi X-RAY | sample-controller Summary
kandi X-RAY | sample-controller Summary
This repository implements a simple controller for watching Foo resources as defined with a CustomResourceDefinition (CRD). Note: go-get or vendor this package as k8s.io/sample-controller.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of sample-controller
sample-controller Key Features
sample-controller Examples and Code Snippets
Community Discussions
Trending Discussions on sample-controller
QUESTION
I'm building a little k8s controller based on the sample-controller.
I'm listening for ServiceAccount events with the following event handler:
...ANSWER
Answered 2021-May-27 at 17:35SampleController is not the most easy code to deal with. They have example on how they cast objects to a known resource type. And they also have example on how they lookup the resource from a lister.
Unless you have specific needs, I would recommend to also consider using kubebuilder and follow the kubebuilder book that has intuitive explanations of making controllers.
QUESTION
I was following @ymmt2005 excellent dynamic client guide. All is good until the final step when I make the actual PATCH call, and I get a the server could not find the requested resource
error. Just about everything seems right, except I'm unsure about the 'FieldManager' field in the PathOptions struct. I'm not sure what "the actor or entity that is making these changes" refers to. Does this need to match something in my code or system? Any other ideas?
ANSWER
Answered 2021-Jan-01 at 17:21The answer is really trivial. The original code assumes that namespace
is provided in the manifest. The deployment endpoint does not automatically set namespace to default
if the provided namespace is "", and errors out because "" is not a valid namespace. Therefore, I added logic to set namespace to default
if not provided and presto, the server side apply will create the resource if it doesn't exist and update if it does exist. Thanks again @ymmt2005 .
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sample-controller
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page