Repository navigation
[3- De-Rooting] Move serviceaccount of root shard - #4494
Conversation
8e0e22c to
ce14f56
Compare
|
@mjudeikis-bot review this |
mjudeikis-bot
left a comment
There was a problem hiding this comment.
Two verified Warnings and two Notes; no Critical found. The routing itself (index lookup, then shards credential, then the hosting shard) matches how the other proxy clients are built and is scoped per logical cluster.
Not anchored
- Warning: no test covers service account authentication through the front proxy.
pkg/proxy/serviceaccounts_test.gocovers only the lookup type against a fake shard. Nothing buildsAuthentication.ApplyTowith aServiceAccountLookup, andcmd/sharded-test-server/frontproxy.gonever passes--service-account-key-file, so no e2e reaches this path. The wiring ofServiceAccountTokenGetterandSecretsWriteris therefore unexercised. A test that sends a signed legacy token or bound token through the authenticator against two fake shards would pin it.
Checked
- Read beyond the diff:
pkg/proxy/index/index_controller.go(Lookup,BaseURL,Start),pkg/proxy/server.go(NewServer,Run, readyz wiring,/metricsmux),pkg/proxy/metrics_authorizer.go,pkg/proxy/config.go, the kcp-dev/kubernetesserviceaccount.NewClusterGetterFromClient(the old path),cmd/sharded-test-server/frontproxy.go, anddocs/content/setup/production/metrics.md. - Correctness: the old informer factory in
authentication.gowas never started, so its listers were always empty and every lookup was already a live GET. The new code adds no extra round trips. Findings are below. An unknown cluster maps to NotFound and a missing index to ServiceUnavailable (see Note on 401). - Concurrency:
clientForguardsindexandclientswithmu; no lock-order issue. Findings: theclientsmap is never pruned (Note). - kcp specifics: every call goes through
client.Cluster(cluster.Path())afterindex.Lookup. A wildcard or path-form cluster is rejected inroutedSecrets.Cluster. The shards credential and the identity round tripper are preserved throughrest.CopyConfig. No cross-workspace read without a lookup. - API and storage: no CRD or stored-format change.
--root-kubeconfigstays as a deprecated flag; see the Warning on startup. - Security: the
:rootdelegated SubjectAccessReview for the front-proxy/metricsis removed. This matches the group-based text inmetrics.md, but the PR carriesrelease-note NONE(Note). No credential reaches an error string. - Tests: the new unit test covers index-missing, known cluster, unknown cluster, patch and list-unsupported. The Authentication wiring and
Validatechange have no test (Warning above). - Build/test:
go build ./pkg/proxy/... ./cmd/...OK;go vet ./pkg/proxy/...OK;go test ./pkg/proxy/ ./pkg/proxy/options/...OK. I did not run the linter or any e2e: the sharded e2e needs a full multi-shard setup and no existing e2e enables proxy SA auth.
|
/retest |
a8652cc to
8625ed9
Compare
8625ed9 to
57c7c88
Compare
|
/retest |
| type ShardRoutedServiceAccounts struct { | ||
| shardsConfig *rest.Config | ||
|
|
||
| mu sync.Mutex | ||
| index shardIndex // nil until the index controller exists | ||
| clients map[string]shardClient // by shard name | ||
| } |
There was a problem hiding this comment.
I don't see any caching at all? Wouldn't that mean that every SA request would be multiple GETs to the shard behind it?
There was a problem hiding this comment.
The clients are cached but not the results. I think that would be a usecase for the shardlookup package.
| // fakeIndex maps logical clusters to shards and shards to base URLs. | ||
| type fakeIndex struct { | ||
| shards map[logicalcluster.Name]string | ||
| urls map[string]string | ||
| } |
There was a problem hiding this comment.
Don't we already have a fake index for the front-proxy? I think its private in another package?
I'd rather extract that/make that available then reimplementing everywhere where we use an fake index for testing.
| synced, found := c.shardInformersSynced[shard.Name] | ||
| if !found { | ||
| return fmt.Errorf("informers for shard %q are not started", shard.Name) | ||
| } |
There was a problem hiding this comment.
We should probably at least exclude shards that are marked for maintenance etcpp instead of taking all shards.
2adb559 to
b9d45e5
Compare
|
LGTM label has been added. DetailsGit tree hash: c91249d197785dd4d8d3f733734f1e2460fc5bf0 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ntnn The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
Must merge after #4493
Moves root shards off root shard so making root shard "just another shard"
What Type of PR Is This?
Related Issue(s)
Fixes #
Release Notes