8000 pilot: use per revision leader for namespace controller by zirain · Pull Request #56595 · istio/istio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

pilot: use per revision leader for namespace controller #56595

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pilot/pkg/leaderelection/leaderelection.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ func NewPerRevisionLeaderElection(namespace, name, electionID, revision string,
return newLeaderElection(namespace, name, electionID, revision, true, false, true, client)
}

func NewLeaderElectionMulticluster(namespace, name, electionID, revision string, remote bool, client kube.Client) *LeaderElection {
return newLeaderElection(namespace, name, electionID, revision, false, remote, false, client)
func NewLeaderElectionMulticluster(namespace, name, electionID, revision string, perRevision, remote bool, client kube.Client) *LeaderElection {
return newLeaderElection(namespace, name, electionID, revision, perRevision, remote, false, client)
}

func newLeaderElection(namespace, name, electionID, revision string, perRevision bool, remote bool, leaseLock bool, client kube.Client) *LeaderElection {
Expand Down
14 changes: 11 additions & 3 deletions pilot/pkg/serviceregistry/kube/controller/multicluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (m *Multicluster) initializeCluster(cluster *multicluster.Cluster, kubeCont
log.Infof("joining leader-election for %s in %s on cluster %s",
leaderelection.ClusterTrustBundleController, options.SystemNamespace, options.ClusterID)
election := leaderelection.
NewLeaderElectionMulticluster(options.SystemNamespace, m.serverID, leaderelection.NamespaceController, m.revision, !configCluster, client).
NewLeaderElectionMulticluster(options.SystemNamespace, m.serverID, leaderelection.NamespaceController, m.revision, false, !configCluster, client).
AddRunFunction(func(leaderStop <-chan struct{}) {
log.Infof("starting clustertrustbundle controller for cluster %s", cluster.ID)
c := clustertrustbundle.NewController(client, m.caBundleWatcher)
Expand All @@ -206,8 +206,15 @@ func (m *Multicluster) initializeCluster(cluster *multicluster.Cluster, kubeCont
m.s.RunComponentAsyncAndWait("namespace controller", func(_ <-chan struct{}) error {
log.Infof("joining leader-election for %s in %s on cluster %s",
leaderelection.NamespaceController, options.SystemNamespace, options.ClusterID)
perRevision := false
// Use per revision namespace controller if we have discovery selectors,
// because they may watch with different selectors.
if len(options.MeshWatcher.Mesh().GetDiscoverySelectors()) > 0 {
perRevision = true
}
election := leaderelection.
NewLeaderElectionMulticluster(options.SystemNamespace, m.serverID, leaderelection.NamespaceController, m.revision, !configCluster, client).
NewLeaderElectionMulticluster(options.SystemNamespace, m.serverID, leaderelection.NamespaceController, m.revision,
perRevision, !configCluster, client).
AddRunFunction(func(leaderStop <-chan struct{}) {
log.Infof("starting namespace controller for cluster %s", cluster.ID)
nc := NewNamespaceController(client, m.caBundleWatcher)
Expand Down Expand Up @@ -251,7 +258,8 @@ func (m *Multicluster) initializeCluster(cluster *multicluster.Cluster, kubeCont
// Block server exit on graceful termination of the leader controller.
m.s.RunComponentAsyncAndWait("auto serviceexport controller", func(_ <-chan struct{}) error {
leaderelection.
NewLeaderElectionMulticluster(options.SystemNamespace, m.serverID, leaderelection.ServiceExportController, m.revision, !configCluster, client).
NewLeaderElectionMulticluster(options.SystemNamespace, m.serverID, leaderelection.ServiceExportController, m.revision,
false, !configCluster, client).
AddRunFunction(func(leaderStop <-chan struct{}) {
serviceExportController := newAutoServiceExportController(autoServiceExportOptions{
Client: client,
Expand Down
8 changes: 8 additions & 0 deletions releasenotes/notes/56595.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: release-notes/v2
kind: bug-fix
area: installation
issues:
- 56594
releaseNotes:
- |
**Fixed** an issue that namespace controller failed to start when both revision and discovery selector enabled at the same time.
0