Make kubelet client optional for cluster-scoped brokers#7142
Open
matheuscscp wants to merge 2 commits into
Open
Make kubelet client optional for cluster-scoped brokers#7142matheuscscp wants to merge 2 commits into
matheuscscp wants to merge 2 commits into
Conversation
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Kubernetes workload attestor’s Broker API pod resolution so that cluster-scoped broker references can succeed even when the kubelet client is not configured/available, falling back to the Kubernetes API server as needed. This supports Deployment-based SPIRE agents that serve only the Broker API over TCP (per #7116) where kubelet locality optimizations are not applicable.
Changes:
- Added
getPodListForReference(...)to make kubelet pod-list usage conditional onpod_reference_scope, allowing cluster-scope fallbacks when the kubelet client is missing or errors. - Expanded test coverage for cluster-scope fallback behavior (including kubelet failures and absent kubelet client) and for agent-node scope requiring a kubelet client.
- Updated documentation and the full agent config reference to reflect the new fallback/requirement behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pkg/agent/plugin/workloadattestor/k8s/k8s.go |
Makes kubelet pod-list lookup optional for pod_reference_scope="cluster" via a helper that gates kubelet usage and supports API server fallback. |
pkg/agent/plugin/workloadattestor/k8s/k8s_test.go |
Adds tests covering fallback to API server when kubelet fails or is not configured (cluster scope) and enforcing kubelet requirement (agent-node scope). |
doc/plugin_agent_workloadattestor_k8s.md |
Documents that cluster scope can resolve without kubelet and that agent-node scope requires kubelet. |
conf/agent/agent_full.conf |
Updates reference config comments to describe kubelet requirement vs fallback behavior by scope. |
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.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.
Part of: #7116
For a Deployment-based SPIRE agent serving only the Broker API via TCP, it makes no sense at all to configure the kubelet client. No Brokers should expect locality optimization from such a SPIRE agent deployment. This PR makes configuring the kubelet client optional for such deployments, by allowing Brokers with
pod_reference_scope = "cluster"to ignore the kubelet client if not configured and attempt using the API server client.