Repository navigation
[3- De-Rooting] Move serviceaccount of root shard #4494
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
Merged
kcp-ci-bot
merged 4 commits into
kcp-dev:main
from
mjudeikis:de.root.the.root.sa.accounts
Nov 3, 2026
+1,301
−173
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| /* | ||
| Copyright 2026 The kcp Authors. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| // Package indextest provides a test double for index.Index. | ||
| package indextest | ||
|
|
||
| import ( | ||
| "context" | ||
| "sync/atomic" | ||
|
|
||
| "github.com/kcp-dev/logicalcluster/v3" | ||
|
|
||
| "github.com/kcp-dev/kcp/pkg/index" | ||
| ) | ||
|
|
||
| var _ index.Index = &Index{} | ||
|
|
||
| // Index is a map-based index.Index: it maps logical clusters to shards and | ||
| // shards to base URLs. Lookups resolve logical cluster names only, not | ||
| // workspace paths. The maps must not be changed once the Index is in use. | ||
| type Index struct { | ||
| // Clusters maps a logical cluster to the name of the shard hosting it. | ||
| Clusters map[logicalcluster.Name]string | ||
| // Shards maps a shard name to its base URL. | ||
| Shards map[string]string | ||
| // RecentlyMigratedClusters are the clusters RecentlyMigrated reports. | ||
| RecentlyMigratedClusters map[logicalcluster.Name]bool | ||
|
|
||
| // Registered and Released count the ClusterContext calls and the | ||
| // calls of the cancel functions they returned. | ||
| Registered atomic.Int32 | ||
| Released atomic.Int32 | ||
| } | ||
|
|
||
| // Lookup returns the shard hosting the cluster, with the cluster's URL on | ||
| // that shard. | ||
| func (f *Index) Lookup(path logicalcluster.Path) (index.Result, bool) { | ||
| name, ok := path.Name() | ||
| if !ok { | ||
| return index.Result{}, false | ||
| } | ||
| shard, ok := f.Clusters[name] | ||
| if !ok { | ||
| return index.Result{}, false | ||
| } | ||
| return index.Result{ | ||
| Shard: shard, | ||
| Cluster: name, | ||
| URL: f.Shards[shard] + name.Path().RequestPath(), | ||
| }, true | ||
| } | ||
|
|
||
| // LookupURL is Lookup: the fake knows no mounts. | ||
| func (f *Index) LookupURL(path logicalcluster.Path) (index.Result, bool) { | ||
| return f.Lookup(path) | ||
| } | ||
|
|
||
| // BaseURL returns the base URL of the shard. | ||
| func (f *Index) BaseURL(shardName string) (string, bool) { | ||
| url, ok := f.Shards[shardName] | ||
| return url, ok | ||
| } | ||
|
|
||
| // RecentlyMigrated reports whether the cluster is in RecentlyMigratedClusters. | ||
| func (f *Index) RecentlyMigrated(cluster logicalcluster.Name) bool { | ||
| return f.RecentlyMigratedClusters[cluster] | ||
| } | ||
|
|
||
| // ClusterContext returns a cancellable child of parent and counts the | ||
| // registration and its release. | ||
| func (f *Index) ClusterContext(parent context.Context, cluster logicalcluster.Name) (context.Context, context.CancelFunc) { | ||
| f.Registered.Add(1) | ||
| ctx, cancel := context.WithCancel(parent) | ||
| return ctx, func() { | ||
| f.Released.Add(1) | ||
| cancel() | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What if a known shard is down?
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.
We should probably at least exclude shards that are marked for maintenance etcpp instead of taking all shards.