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

federation service controller: fixing a bug so that existing services are created in newly registered clusters #27028

Merged
merged 1 commit into from
Jun 11, 2016

Conversation

mfanjie
Copy link

@mfanjie mfanjie commented Jun 8, 2016

A defect on federation service controller.
Steps to recreate:

  1. boot federation control plane
  2. create a service and then register a new cluster

Root cause:
the right sequence should be

servicesToUpdate = s.serviceCache.allServices()

then

s.updateAllServicesToCluster(servicesToUpdate, newCluster) 

then

servicesToUpdate = s.updateDNSRecords(servicesToUpdate, newClusters)

Now the first two lines' sequence is on the contrary, so when updateDNSRecords return no error, the service will be removed from servicesToUpdate, and updateAllServicesToCluster get nothing to update.

This PR make the call sequence correct.

Analytics

@k8s-bot
Copy link

k8s-bot commented Jun 8, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

2 similar comments
@k8s-bot
Copy link

k8s-bot commented Jun 8, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-bot
Copy link

k8s-bot commented Jun 8, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@mfanjie
Copy link
Author

mfanjie commented Jun 8, 2016

@quinton-hoole please review if this should be put to 1.3, thanks.

@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-label-needed labels Jun 8, 2016
@mfanjie mfanjie force-pushed the fix_cluster_sync_loop branch 2 times, most recently from 5e1e5a8 to 41bfd46 Compare June 8, 2016 07:52
@mfanjie mfanjie force-pushed the fix_cluster_sync_loop branch from dc231ca to 640d7dc Compare June 8, 2016 07:54
@mfanjie
Copy link
Author

mfanjie commented Jun 8, 2016

@nikhiljindal I know it is in critical time, but I think this PR is worthy and safe to merge. Without this fix, the existing services cannot be created in new registered clusters.

@@ -638,7 +638,7 @@ func (s *ServiceController) updateAllServicesToCluster(services []*cachedService
cluster, ok := s.clusterCache.clientMap[clusterName]
if ok {
for _, cachedService := range services {
appliedState := cachedService.appliedState
appliedState := cachedService.lastState
Copy link
Contributor

Choose a reason for hiding this comment

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

same. can you explain why this change?
Will also be good to add a comment here in code explaining why we are using lastState and not appliedState.

@nikhiljindal
Copy link
Contributor

ok to test

@nikhiljindal
Copy link
Contributor

cc @kubernetes/sig-cluster-federation

Also cc @madhusudancs since he is writing services e2e. Will be good to include this case there.

@k8s-bot
Copy link

k8s-bot commented Jun 9, 2016

GCE e2e build/test passed for commit 640d7dc.

@nikhiljindal nikhiljindal added this to the v1.3 milestone Jun 9, 2016
@nikhiljindal
Copy link
Contributor

Added to 1.3 milestone

@mfanjie
Copy link
Author

mfanjie commented Jun 9, 2016

The lastState is assigned when service controller catch the service event, the appliedState is assigned after service controller process the event. When a new cluster added, a service that just be created but not be processed by service controller should also be applied to that cluster. So lastState should be used.

clusterSyncPeriod to second before the cluster sync loop interval is 10 minutes which is too long for users to wait for all services to apply to this cluster it should be 1 second interval like other loops.

@ghost ghost added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 10, 2016
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 10, 2016
@nikhiljindal
Copy link
Contributor

thanks for the explanation @mfanjie
Updating the title and correcting the release note label and readding the LGTM tag

@nikhiljindal nikhiljindal changed the title fix clusterSyncLoop to always update services from latest cache federation service controller: fixing a bug so that existing services are created in newly registered clusters Jun 10, 2016
@nikhiljindal nikhiljindal added lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed release-note-label-needed labels Jun 10, 2016
@piosz
Copy link
Member

piosz commented Jun 10, 2016

@nikhiljindal why this is P1?

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Jun 11, 2016

GCE e2e build/test passed for commit 640d7dc.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 3cc43eb into kubernetes:master Jun 11, 2016
@ghost ghost mentioned this pull request Jun 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants