[release-v1.43-2] fix(apiserver): allow queryserver egress to Linseed via guardian on managed clusters - #5262
Merged
rene-dekker merged 2 commits intoAug 28, 2026
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 on ManagementClusterConnection, the same condition LINSEED_URL already uses. The calico-system policy table already had managed entries, but SelectPolicyByProvider only switches on the provider, so both managed cases were asserting the unmanaged fixture and could not have caught this. Switch to SelectPolicyByClusterTypeAndProvider and add the managed fixtures. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
5 tasks
make gen-versions produces changes against the committed CRDs on this branch, so validate-gen-versions fails dirty-check for every PR opened against it. Commit the regenerated output. The drift is upstream CRD movement, not a change of ours: IPPool gains the L2Workload allowed use, Network gains fields, and the ECK bundle is updated. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Calico Enterprise API server egress policy rendering on managed clusters so the query server can reach Linseed via Guardian (matching the managed-cluster LINSEED_URL), preventing customer-tier default-deny policies from inadvertently blocking the traffic after the calico-system tier’s trailing Pass.
Changes:
- Add a managed-cluster-specific egress
Allowto Guardian incalico-system.apiserver-accesswhencfg.ManagementClusterConnectionis set. - Extend render tests and fixtures to cover managed vs unmanaged + OpenShift vs non-OpenShift variants using new managed policy fixtures.
- Regenerate/import updated Enterprise CRDs (including ECK bundle and schema updates) to address branch drift and keep validation jobs green.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/render/apiserver.go | Adds conditional Guardian egress rule for managed clusters before the trailing Pass. |
| pkg/render/apiserver_test.go | Adds managed-cluster egress assertions and switches fixture selection to include managed variants. |
| pkg/render/testutils/expected_policies/apiserver_managed.json | New expected policy fixture for managed, non-OpenShift scenario (includes Guardian egress allow). |
| pkg/render/testutils/expected_policies/apiserver_managed_ocp.json | New expected policy fixture for managed OpenShift scenario (includes Guardian egress allow). |
| pkg/imports/crds/enterprise/v3.projectcalico.org/projectcalico.org_networks.yaml | CRD import regeneration (schema expanded, validations added). |
| pkg/imports/crds/enterprise/v3.projectcalico.org/projectcalico.org_ippools.yaml | CRD import regeneration (allowedUses expanded, CEL validations added). |
| pkg/imports/crds/enterprise/v1.crd.projectcalico.org/crd.projectcalico.org_networks.yaml | CRD import regeneration mirroring the v3 schema updates. |
| pkg/imports/crds/enterprise/v1.crd.projectcalico.org/crd.projectcalico.org_ippools.yaml | CRD import regeneration mirroring the v3 schema updates. |
| pkg/imports/crds/enterprise/01-crd-eck-bundle.yaml | Regenerated ECK CRD bundle (metadata/version updates plus schema additions). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Brian-McM
approved these changes
Aug 28, 2026
rene-dekker
approved these changes
Aug 28, 2026
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
Cherry-pick of #5240.
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 policy activity requests return 500.
This branch predates the
pkg/enterprise/apiserverextension mechanism (#4871), so the ruleis branched directly in
calicoSystemAPIServerPolicyoncfg.ManagementClusterConnection—the same condition
LINSEED_URLalready uses a few hundred lines away in the same file.The
calico-systempolicy table already hadfor managedentries, butSelectPolicyByProvideronly switches on the provider, so both managed cases were assertingthe unmanaged fixture and could not have caught this. The table now uses
SelectPolicyByClusterTypeAndProvideragainst newapiserver_managed.jsonandapiserver_managed_ocp.jsonfixtures.The inert local-Linseed rule is left in place. It selects no pods on a managed cluster, so it
is harmless, and removing it would churn the base fixtures across every backport branch.
release-v1.41(CE v3.23.0-1.0) carries neither the egress rule norLINSEED_URL, so theaffected range starts here.
Addresses CI-2048.
Testing
Verified on a live managed cluster on the master change (#5240): with the customer's
default-deny in a tier after
calico-system, the original operator returned the reported 500on
GET /policiesafter a 19.5s guardian timeout, and the fixed operator returned 200 in0.58s with the
calico-systemtier present. The deny stayed applied across both runs and onlythe operator image changed.
On this branch: full
pkg/rendersuite green,make static-checksreports 0 issues, and newspecs cover the rule being rendered ahead of the trailing
Passon a managed cluster andabsent otherwise.
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
Second commit — CRD regeneration. This branch fails
validate-gen-versionsfor everyPR opened against it, because
make gen-versionsproduces changes against the committed CRDs.It is unrelated to the policy fix and predates it. A separate
chore(crds)commit carries theregenerated output so this PR can go green; it is isolated so it can be reviewed or dropped on
its own. The drift is upstream CRD movement only.
make test-crdsand thepkg/imports/crdssuite pass.