AccessPolicy
TOC
OverviewAvailabilityUnderstanding AccessPolicyWhat "Use a Connector" MeansHow AccessPolicy WorksTwo Access ModelsGranting Default Proxy AccessExampleGranting Access After ApprovalExampleCommon Configuration PatternsSelecting the Connectors to ProtectExampleChoosing Which ServiceAccounts Get Default AccessExampleStatusWhat's NextOverview
AccessPolicy is a namespace-scoped resource that controls who can use Connectors through Connectors Proxy.
It defines three things:
- which Connectors are covered by the policy
- whether proxy access is granted by default or granted only after checks pass
- which subjects are covered by that access model
In the Connectors Approval model, AccessPolicy is the policy definition, while the actual runtime request is tracked separately by AccessRequest.
Read this document after Connectors Approval & Permission Gating.
This document focuses on the long-lived rule that administrators design:
- which Connectors are covered
- who should get default proxy access
- which checks must pass before temporary proxy access is granted
It does not repeat the full runtime lifecycle of one workload. For that, continue with AccessRequest.
In this model, use a connector means using the connector's secretless access path through Connectors Proxy, either directly or through Connectors CSI Driver.
AccessPolicy does not control Connectors API access. Connectors API uses separate connectors/apis permissions, which are typically used for UI resource discovery or other API-based integrations.
Availability
AccessPolicy is part of the Connectors Approval capability.
Before using it, enable:
enable-connectors-approvalenable-connector-proxy-permissions
For more information, see Feature Flags.
Understanding AccessPolicy
What "Use a Connector" Means
AccessPolicy is focused on proxy access, not on reading Connector objects or browsing resources through Connectors API.
Typical examples of using a connector include:
- a workload sends requests to the Connector's proxy address
- a Pod mounts Connector configuration through Connectors CSI Driver, and then uses the target tool through the proxy
- a pipeline workload gets temporary permission to use a sensitive Connector only after approval
Typical examples that are outside AccessPolicy scope include:
- reading the
Connectorobject itself - browsing branches, tags, or other UI-oriented resources through Connectors API
- granting
Connectors APIspermissions to platform users
How AccessPolicy Works
AccessPolicy sits between Connector definitions and runtime access:
Connector: defines how to reach a target tool and how to authenticate to itAccessPolicy: selects Connectors and defines who may access the target tools through the Connectors Proxy provided by those ConnectorsAccessRequest: records one runtime access attempt that needs approval-oriented evaluation- generated
RoleandRoleBinding: materialized RBAC objects created by the system from the policy templates
If you first need the end-to-end picture of how these pieces fit together, see Connectors Approval & Permission Gating. This document stays focused on policy design and policy matching.
At a high level, the flow is:
- A workload tries to use a Connector through
Connectors Proxyor through Connectors CSI Driver. - The system evaluates the matched
AccessPolicy. - If the policy uses
defaultPermissionand the workload's ServiceAccount is covered, access is allowed. - If the policy uses
checkGrantedPermission, the system tracks the runtime attempt inAccessRequestand grants the configured proxy permission only after the checks pass.
For the resource schema of runtime requests, see AccessRequest API Reference.
Two Access Models
For one Connector, AccessPolicy usually uses one of these two proxy access models:
Granting Default Proxy AccesswithdefaultPermission: the matched ServiceAccounts can access the target tool through the Connector proxy immediatelyGranting Access After ApprovalwithcheckGrantedPermission: the runtime request must pass checks before proxy permission is granted
In practice, this means access through one Connector is usually either always allowed within a known scope or approval-gated for sensitive usage. The next two sections explain these two models first, and the later Common Configuration Patterns section shows how to scope them to Connectors and ServiceAccounts.
Granting Default Proxy Access
spec.defaultPermission is the part of the policy that grants proxy access immediately, without any approval check.
This is the usual choice when:
- the Connector is low-risk inside a namespace or project
- all workloads in one scope should access the target tool through the Connector proxy directly
- you want a stable, non-temporary permission model
In most cases, the built-in connectors-use-connectors-proxy template is the right starting point. It is a role template installed by the core Connectors component and grants connectors/proxy permission for the matched Connector.
When a Connector should always be usable inside a namespace, project, or cluster scope, this is usually the only permission section you need in the policy.
To shape which Connectors and ServiceAccounts this model covers, see Common Configuration Patterns.
Example
The following policy gives builder and deployer immediate proxy access to all OCI Connectors in devops:
Granting Access After Approval
spec.checkGrantedPermission grants proxy permission only after all configured checks pass.
This is the usual choice when:
- the Connector is sensitive
- access should be granted only for one runtime activity
- approval is part of a delivery or promotion workflow
The most common built-in combination is:
checks[].ref.configMap.name: connectors-approvals-in-pipelineroleTemplate.ref.configMap.name: connectors-use-connectors-proxy-in-pod
That combination means:
- find the approval resource associated with the runtime object
- wait until the approval result is positive
- grant pod-bound proxy permission only to that specific runtime context
connectors-approvals-in-pipeline is a built-in check template installed by the core Connectors component. In a pipeline scenario, it uses the runtime Pod context to locate the related Tekton ApprovalTask by tekton.dev/pipelineRun.
connectors-use-connectors-proxy-in-pod is a built-in role template installed by the core Connectors component. It grants connectors/proxy/v1/pod/{.object.metadata.namespace}/{.object.metadata.name}, which binds the permission to one specific Pod context recorded at runtime.
You still use the same Connector selection patterns from Common Configuration Patterns; the difference is that access is granted per runtime context after checks succeed.
Example
The following policy applies to the prod-harbor Connector. It gives no default access. Instead, it waits for the built-in pipeline approval check and then grants pod-bound proxy permission.
Common Configuration Patterns
Selecting the Connectors to Protect
An AccessPolicy only matches Connectors in the same namespace as the policy itself.
The target Connectors are defined in spec.connector:
- leave it empty to match all Connectors in the namespace
- use
namesto target specific Connectors - use
matchLabelsormatchExpressionsto target groups of Connectors
This is the main mechanism for mapping one policy to one Connector, a subset of Connectors, or all Connectors in one scope.
Example
-
Match all Connectors in current namespace.
-
Match one specific Connector by name.
-
Match several explicitly named Connectors in one namespace.
-
Match every Connector of one ConnectorClass in the namespace.
-
Match a subset of Connectors by custom labels such as environment or usage.
Choosing Which ServiceAccounts Get Default Access
When you use defaultPermission, bindingTemplate.serviceAccounts defines which ServiceAccounts can use the matched Connector through Connectors Proxy.
Each item combines:
names: the ServiceAccount names to bindnamespaceSelector: which namespaces those ServiceAccounts come from
Use an empty names list when you want all ServiceAccounts from the selected namespaces.
Example
-
Allow all ServiceAccounts in the current namespace. This is the common pattern for a namespace-level Connector.
-
Allow only selected ServiceAccounts in one namespace, such as
builderanddeployerindevops. -
Allow all ServiceAccounts in one project. This is useful when the Connector is shared at the project level and project namespaces are labeled with
cpaas.io/project. -
Allow one named ServiceAccount across all namespaces in one project, for example
builderin thedevopsproject. -
Allow all ServiceAccounts in the cluster. This is useful for a cluster-shared Connector. In that case, the
AccessPolicymust be created in the same namespace as the shared Connector.
Status
AccessPolicy.status helps operators confirm that the policy has been applied as intended.
Important status fields include:
matchedConnectors: the Connectors currently matched byspec.connectorconditions: reconciliation status for the policy
This status is useful for checking whether the expected Connectors were selected before investigating runtime access behavior.
What's Next
- Learn how one runtime request is evaluated in AccessRequest
- Learn the schema in AccessPolicy API Reference
- Revisit the overall flow in Connectors Approval & Permission Gating
- Learn how proxy traffic works in Connectors Proxy
- Learn how workloads consume Connectors through Connectors CSI Driver
- Learn the separate API access model in Connector API