fix(apiserver): allow queryserver egress to Linseed via guardian on managed clusters - #5240
Draft
tianfeng92 wants to merge 1 commit into
Draft
fix(apiserver): allow queryserver egress to Linseed via guardian on managed clusters#5240tianfeng92 wants to merge 1 commit into
tianfeng92 wants to merge 1 commit into
Conversation
…anaged clusters A managed cluster runs no local Linseed, so the queryserver reaches it through guardian. The apiserver-access policy only permitted the local Linseed pods, which select nothing on a managed cluster, so the request fell through to the trailing Pass and was denied by whatever the customer's tiers enforce. Branch the rule the same way LINSEED_URL is already branched in this file: guardian when a ManagementClusterConnection is present, local Linseed otherwise. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
A managed cluster runs no local Linseed, so the query server reaches it through guardian —
the URL
LinseedEndpointreturns asLINSEED_URL. Thecalico-system.apiserver-accesspolicy permitted only the local Linseed pods, whose selector matches nothing on a managed
cluster, so the connection fell through to the policy's trailing
Pass. Thecalico-systemtier's default-deny excludes
calico-apiserverby design, so the traffic is then evaluatedagainst the customer's tiers, where any default-deny drops it.
The Manager policy board renders empty and the API call fails:
This branches the egress rule on the same condition
LINSEED_URLalready uses in this file:render.GuardianEntityRulewhen aManagementClusterConnectionis present, local Linseedotherwise.
The inert local-Linseed rule stays in the base policy in
pkg/render/apiserver.go. It selectsno pods on a managed cluster, and
APIServerConfigurationcarries no cluster type to branchon. Moving it into the extension would correct the layering at the cost of churning the base
fixture, which is better done on master alone than in a change that cherry-picks to four
release branches.
insertEgressBeforePassis extracted rather than duplicated. The OIDC path already used thecapacity-capped
egress[:n-1:n-1]slice to avoid aliasing the backing array; both callers nowshare it. Behaviour is unchanged.
Introduced in #4571, which added the dependency, hardcoded the guardian URL for managed
clusters, and shipped an egress rule covering only the self-hosted destination. #4786 later
refactored the URL onto the
LinseedEndpointhelper and #4871 moved it intopkg/enterprise/apiserver/; neither added the missing rule. First shipped in operatorv1.42.0, sorelease-v1.42throughrelease-v1.44need cherry-picks.Addresses CI-2048.
Testing
Unit tests only; not yet verified on a live managed cluster.
Passwhen aManagementClusterConnectionis present, and a companion spec asserting its absenceotherwise. Reverting the production change while keeping the tests fails the
managed-cluster spec.
pkg/enterprise/apiserver51/51,pkg/controller/apiserver28/28,pkg/rendergreen.make format-checkclean,make static-checksreports 0 issues.Release Note
For PR author
make gen-filesmake gen-versionsFor PR reviewers
A note for code reviewers - all pull requests must have the following:
kind/bugif this is a bugfix.kind/enhancementif this is a a new feature.enterpriseif this PR applies to Calico Enterprise only.🤖 Generated with Claude Code