Closed EronWright closed 1 month ago
Attention: Patch coverage is 38.57868%
with 121 lines
in your changes missing coverage. Please review.
Project coverage is 53.00%. Comparing base (
a4c8810
) to head (c6b5ca3
). Report is 1 commits behind head on v2.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Note that the chart tests are failing for unrelated reasons - the job doesn't build the docker image and uses the wrong image name.
Overview
This PR implements an authentication and authorization layer for the agent's RPC endpoint.
Authentication is performed by authenticating a bearer token via the TokenReview API. The operator uses its built-in service account token. Authorization is performed via the SubjectAccessReview API, which checks for following RBAC permission:
The workspace pod's service account must be granted the
system:auth-delegator
role using aClusterRoleBinding
. For. convenience, the installer creates a service account namedpulumi
into thedefault
namespace, with an associated binding.The operator itself is granted the necessary permission to access the RPC endpoint.
Proposed changes
--auth-mode=kube
,--kube-workspace-name=random-yaml
)system:auth-delegator
)~Future Enhancement
This implementation uses the operator's default service account token, but to further improve security it should use an audience-scoped token, where the audience is the agent service address as opposed to the API server. Such tokens may be created by the operator with a call to TokenRequest, and checked with TokenReview by adding the expected audience to the context (
authenticator.WithAudience
).Related issues (optional)
Closes #609
Examples
Some example requests: