Skip to content

Commit 26b5da0

Browse files
committed
DRA: include v1beta1 API references
As suggested in #48330 (comment), the front matter gets extended to reference the API types. To make this work, the necessary API reference files get created manually. They still need to be updated via the usual automatic API generation.
1 parent 977df6e commit 26b5da0

File tree

8 files changed

+3088
-6
lines changed

8 files changed

+3088
-6
lines changed

content/en/docs/concepts/scheduling-eviction/dynamic-resource-allocation.md

Lines changed: 81 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ reviewers:
55
title: Dynamic Resource Allocation
66
content_type: concept
77
weight: 65
8+
api_metadata:
9+
- apiVersion: "resource.k8s.io/v1beta1"
10+
kind: "ResourceClaim"
11+
- apiVersion: "resource.k8s.io/v1beta1"
12+
kind: "ResourceClaimTemplate"
13+
- apiVersion: "resource.k8s.io/v1beta1"
14+
kind: "DeviceClass"
15+
- apiVersion: "resource.k8s.io/v1beta1"
16+
kind: "ResourceSlice"
817
---
918

1019
<!-- overview -->
@@ -204,7 +213,8 @@ the `.spec.nodeName` field and to use a node selector instead.
204213

205214
{{< feature-state feature_gate_name="DRAAdminAccess" >}}
206215

207-
A ResourceClaim with admin access grants access to devices which are in use and
216+
You can mark a request in a ResourceClaim or ResourceClaimTemplate as having privileged features.
217+
A request with admin access grants access to devices which are in use and
208218
may enable additional permissions when making the device available in a
209219
container:
210220

@@ -227,9 +237,75 @@ automatically when creating such a ResourceClaim.
227237

228238
Admin access is a privileged mode which should not be made available to normal
229239
users in a multi-tenant cluster. Cluster administrators can restrict usage of
230-
this features by installing a validating admission policy similar to
231-
[the in-tree example](https://github.com/kubernetes/kubernetes/blob/33ea278/test/e2e/dra/test-driver/deploy/example/admin-access-policy.yaml)
232-
when enabling this feature.
240+
this feature by installing a validating admission policy similar to the following
241+
example. Cluster administrators need to adapt at least the names and replace
242+
"dra.example.com".
243+
244+
```yaml
245+
# Permission to use admin access is granted only in namespaces which have the
246+
# "admin-access.dra.example.com" label. Other ways of making that decision are
247+
# also possible.
248+
249+
apiVersion: admissionregistration.k8s.io/v1
250+
kind: ValidatingAdmissionPolicy
251+
metadata:
252+
name: resourceclaim-policy.dra.example.com
253+
spec:
254+
failurePolicy: Fail
255+
matchConstraints:
256+
resourceRules:
257+
- apiGroups: ["resource.k8s.io"]
258+
apiVersions: ["v1alpha3", "v1beta1"]
259+
operations: ["CREATE", "UPDATE"]
260+
resources: ["resourceclaims"]
261+
validations:
262+
- expression: '! object.spec.devices.requests.exists(e, has(e.adminAccess) && e.adminAccess)'
263+
reason: Forbidden
264+
messageExpression: '"admin access to devices not enabled"'
265+
---
266+
apiVersion: admissionregistration.k8s.io/v1
267+
kind: ValidatingAdmissionPolicyBinding
268+
metadata:
269+
name: resourceclaim-binding.dra.example.com
270+
spec:
271+
policyName: resourceclaim-policy.dra.example.com
272+
validationActions: [Deny]
273+
matchResources:
274+
namespaceSelector:
275+
matchExpressions:
276+
- key: admin-access.dra.example.com
277+
operator: DoesNotExist
278+
---
279+
apiVersion: admissionregistration.k8s.io/v1
280+
kind: ValidatingAdmissionPolicy
281+
metadata:
282+
name: resourceclaimtemplate-policy.dra.example.com
283+
spec:
284+
failurePolicy: Fail
285+
matchConstraints:
286+
resourceRules:
287+
- apiGroups: ["resource.k8s.io"]
288+
apiVersions: ["v1alpha3", "v1beta1"]
289+
operations: ["CREATE", "UPDATE"]
290+
resources: ["resourceclaimtemplates"]
291+
validations:
292+
- expression: '! object.spec.spec.devices.requests.exists(e, has(e.adminAccess) && e.adminAccess)'
293+
reason: Forbidden
294+
messageExpression: '"admin access to devices not enabled"'
295+
---
296+
apiVersion: admissionregistration.k8s.io/v1
297+
kind: ValidatingAdmissionPolicyBinding
298+
metadata:
299+
name: resourceclaimtemplate-binding.dra.example.com
300+
spec:
301+
policyName: resourceclaimtemplate-policy.dra.example.com
302+
validationActions: [Deny]
303+
matchResources:
304+
namespaceSelector:
305+
matchExpressions:
306+
- key: admin-access.dra.example.com
307+
operator: DoesNotExist
308+
```
233309

234310
## ResourceClaim Device Status
235311

@@ -291,7 +367,7 @@ be installed. Please refer to the driver's documentation for details.
291367

292368
### Enabling admin access
293369

294-
Admin access is an *alpha feature* and only enabled when the
370+
[Admin access](#admin-access) is an *alpha feature* and only enabled when the
295371
`DRAAdminAccess` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
296372
is enabled in the kube-apiserver and kube-scheduler.
297373

content/en/docs/reference/command-line-tools-reference/feature-gates/dra-admin-access.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ in a ResourceClaim. A ResourceClaim
1515
with admin access grants access to devices which are in use and may enable
1616
additional access permissions when making the device available in a container.
1717

18-
Has no effect unless DynamicResourceAllocation is also enabled.
18+
This feature gate has no effect unless you also enable the `DynamicResourceAllocation` feature gate.

content/en/docs/reference/command-line-tools-reference/feature-gates/dynamic-resource-allocation.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ stages:
1313
- stage: beta
1414
defaultValue: false
1515
fromVersion: "1.32"
16+
17+
# TODO: as soon as this is locked to "true" (= GA), comments about other DRA
18+
# feature gate(s) like "unless you also enable the `DynamicResourceAllocation` feature gate"
19+
# can be removed (for example, in dra-admin-access.md).
20+
1621
---
1722
Enables support for resources with custom parameters and a lifecycle
1823
that is independent of a Pod. Allocation of resources is handled

content/en/docs/reference/kubernetes-api/extend-resources/device-class-v1alpha3.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ To update the reference content, please follow the
1919
[Contributing upstream](/docs/contribute/generate-ref-docs/contribute-upstream/)
2020
guide. You can file document formatting bugs against the
2121
[reference-docs](https://github.com/kubernetes-sigs/reference-docs/) project.
22+
23+
TODO: this file should be under "workload-resources".
2224
-->
2325

2426
`apiVersion: resource.k8s.io/v1alpha3`

0 commit comments

Comments
 (0)