Skip to content
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

resync status on apiservices for aggregator #55165

Merged
merged 1 commit into from
Nov 9, 2017

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Nov 6, 2017

Adds a fairly tight (30 second) resync on the apiservices to force redetection of status. The checks aren't very expensive and there are relatively few apiservices. Taking a little resync pain here is cheaper than the fallout for all clients.

@k8s-ci-robot
Copy link
Contributor

@deads2k: Adding do-not-merge/release-note-label-needed because the release note process has not been followed.

One of the following labels is required "release-note", "release-note-action-required", or "release-note-none".
Please see: https://github.com/kubernetes/community/blob/master/contributors/devel/pull-requests.md#write-release-notes-if-needed.

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.

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 6, 2017
UpdateFunc: c.updateAPIService,
DeleteFunc: c.deleteAPIService,
},
30*time.Second)
Copy link
Contributor

@sttts sttts Nov 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How many threads does the controller have? Each will be blocked for 30 seconds in the worst-case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How many threads does the controller have? Each will be blocked for 30 seconds in the worst-case.

Each will be blocked at most 6 seconds, right? We have a time.After block. I've updated the code to start 5.

We don't back up infinitely since the queue.Add is fair (first in, first out) and eliminates duplicates. I can make it more if you like.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good now. If we handle a handful external apiservers, it's ok.

@@ -259,9 +265,9 @@ func (c *AvailableConditionController) Run(stopCh <-chan struct{}) {
return
}

// only start one worker thread since its a slow moving API and the aggregation server adding bits
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment was copy/pasted from the controller that tickles the proxy handler. I didn't see any links out from here that looked dangerous.

@liggitt
Copy link
Member

liggitt commented Nov 6, 2017

should avoid constructing a new client for every sync check if we're going to do it this often. there's nothing service or request-specific, so we should share to take advantage of open keep-alive requests if the IP doesn't change and there's already an open and valid connection

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 8, 2017
@deads2k
Copy link
Contributor Author

deads2k commented Nov 8, 2017

now re-using one client.

@deads2k deads2k added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 9, 2017
@deads2k
Copy link
Contributor Author

deads2k commented Nov 9, 2017

/approve no-issue

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k

Associated issue requirement bypassed by: deads2k

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 9, 2017
@@ -248,7 +255,7 @@ func (c *AvailableConditionController) sync(key string) error {
return err
}

func (c *AvailableConditionController) Run(stopCh <-chan struct{}) {
func (c *AvailableConditionController) Run(workers int, stopCh <-chan struct{}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it's called threadiness elsewhere

@@ -221,7 +221,7 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
return nil
})
s.GenericAPIServer.AddPostStartHook("apiservice-status-available-controller", func(context genericapiserver.PostStartHookContext) error {
go availableController.Run(context.StopCh)
go availableController.Run(5, context.StopCh)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a comment why 5 is the perfect number here?

@sttts
Copy link
Contributor

sttts commented Nov 9, 2017

lgtm. Two nits. Tag when ready.

@deads2k deads2k added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 9, 2017
// construct an http client that will ignore TLS verification (if someone owns the network and messes with your status
// that's not so bad) and sets a very short timeout.
discoveryClient := &http.Client{
Transport: &http.Transport{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-existing, but call SetTransportDefaults on this?

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 55403, 54660, 55165). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit e873b36 into kubernetes:master Nov 9, 2017
@deads2k deads2k deleted the agg-01-resync branch July 3, 2018 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants