-
Notifications
You must be signed in to change notification settings - Fork 40.4k
add controller to autoregister APIServices #42732
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
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED The following people have approved this PR: deads2k Needs approval from an approver in each of these OWNERS Files: We suggest the following people: |
1cc35df
to
824a826
Compare
|
// AutoAPIServiceRegistration is an interface which callers can re-declare locally and properly cast to for | ||
// adding and removing APIServices | ||
type AutoAPIServiceRegistration interface { | ||
AddAPIServiceToSync(in *apiregistration.APIService) |
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.
godoc on these 2 definitions
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.
doing
} | ||
|
||
// AutoRegisterController is used to keep a particular set of APIServices present in the API. It is useful | ||
// for cases where you want to auto-register APIs like TPRs or core API server |
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.
"or core API server" ... ?
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.
"or core API server" ... ?
clarifying. "or groups from the core kube-apiserver"
apiServiceSynced cache.InformerSynced | ||
apiServiceClient apiregistrationclient.APIServicesGetter | ||
|
||
apiServiceToSyncLock sync.RWMutex |
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.
Pluralize services? apiServicesToSyncLock
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.
sure
queue workqueue.RateLimitingInterface | ||
} | ||
|
||
func NewAutoRegisterAutoRegisterController(apiServiceInformer informers.APIServiceInformer, apiServiceClient apiregistrationclient.APIServicesGetter) *AutoRegisterController { |
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.
Did you mean to have AutoRegister duplicated in the function name?
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.
fixing
|
||
// AutoRegisterController is used to keep a particular set of APIServices present in the API. It is useful | ||
// for cases where you want to auto-register APIs like TPRs or core API server | ||
type AutoRegisterController struct { |
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 need this type exported?
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 need this type exported?
I can make it private to start. I suspect that most callers will use the interface and call the run method.
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.
doing
824a826
to
8a3b57b
Compare
comments so far addressed. |
} | ||
cast, ok = tombstone.Obj.(*apiregistration.APIService) | ||
if !ok { | ||
glog.V(2).Infof("Tombstone contained object that is not a CSR: %#v", obj) |
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.
CSR? 😄
case desired == nil: | ||
return c.apiServiceClient.APIServices().Delete(curr.Name, nil) | ||
|
||
// if the spec's already match, nothing for us to do |
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/spec's/specs/
indentation off
return c.apiServiceClient.APIServices().Delete(curr.Name, nil) | ||
|
||
// if the spec's already match, nothing for us to do | ||
case reflect.DeepEqual(curr.Spec, desired.Spec): |
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.
is reflect ok or do we need semantic?
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.
is reflect ok or do we need semantic?
Semantic isn't cleanly divorced from a global scheme yet. Reflect works for now.
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.
is reflect ok or do we need semantic?
Semantic isn't cleanly divorced from a global scheme yet. Reflect works for now.
@k8s-bot gce etcd3 e2e test this |
/release-note-none |
@ncdc did you make it through? |
8a3b57b
to
c7318e0
Compare
func(c AutoAPIServiceRegistration, fakeWatch *watch.FakeWatcher, client internalclientset.Interface) { | ||
c.AddAPIServiceToSync(&apiregistration.APIService{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) | ||
}, | ||
// adding an API service which claims to be managed but isn't should be deleted |
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.
fix comment, then lgtm
c7318e0
to
55adc4d
Compare
LGTM |
@k8s-bot gce etcd3 e2e test this |
@deads2k PR needs rebase |
Automatic merge from submit-queue (batch tested with PRs 43429, 43416, 43312, 43141, 43421) Create controller to auto register TPRs with the aggregator Builds on #42732 (already lgtmed) Creates a simple controller to wire TPRs with the API Service autoregistration controller. @kubernetes/sig-api-machinery-misc @ncdc
55adc4d
to
e38c575
Compare
Automatic merge from submit-queue (batch tested with PRs 43694, 41262, 42911) combine kube-apiserver and kube-aggregator This combines several pulls currently in progress and wires them together. The aggregator sits in front of the normal kube-apiserver and allows local fallthrough instead of proxying. @kubernetes/sig-api-machinery-misc @DirectXMan12 since you seem invested, your life will get easier @luxas FYI since you've started trying to wire something together. Dependent Pulls LGTM: - [x] #42801 - [x] #42886 - [x] #42900 - [x] #42732 - [x] #42672 - [x] #43141 - [x] #43076 - [x] #43149 - [x] #43226 - [x] #43144
We found that the APIServer was not fully up when it logged "Serving (in)securely on ...". We tried to find a different log line we can wait for to know when the APIServer is fully up. The autoregister controller came in with kubernetes/kubernetes#42732. It seems to be the last thing to come up before the server is ready to go.
As we look to combine the aggregator and the core kube-apiserver which includes things like TPRs, we need a way to reliably auto-manage APIServices for the aggregator so that discovery works as expected and so that users don't have to maintain particular resources that they shouldn't have to.
This controller deals with a dynamic set of APIServices which are synchronized. The mutation of that set is exposed via threadsafe methods. If a user wants to take control, he can remove our label and do whatever he wants.
The controller approach provides the functionality we need while preserving the independence of various layers.
@kubernetes/sig-api-machinery-pr-reviews @ncdc