Compare commits

...

130 Commits

Author SHA1 Message Date
Kubernetes Publisher
877f535934 Update dependencies to v0.36.2 tag 2026-06-12 13:09:41 +00:00
Kubernetes Publisher
f22a53e627 Merge remote-tracking branch 'origin/master' into release-1.36
Kubernetes-commit: f52d1f45d35130c79cd7f1a2596b36325260efe4
2026-04-14 15:32:10 +00:00
Davanum Srinivas
a948641f81 Update github.com/moby/spdystream from v0.5.0 to v0.5.1
Kubernetes-commit: 7e9c2c8eef26f99aa2f94d8e09d6d32de86c7769

Kubernetes-commit: f6209104d25a6c0ea7605a73b9ec4085aacbca03
2026-04-13 13:57:52 -04:00
Antoni Zawodny
7e44ffcaa9 Add Workload-Aware Preemption fields to Workload and PodGroup APIs
Co-authored-by: Omar Sayed <omarsayed@google.com>

Kubernetes-commit: 59c9f75133f22ed24e944cf0b8a1a68e1c49af32
2026-04-09 18:50:07 +00:00
Kubernetes Publisher
df2d882697 Merge pull request #136989 from nojnhuh/podgroup-resourceclaim
KEP-5729: DRA: ResourceClaim Support for Workloads

Kubernetes-commit: b5a943f629904bda73a8f6784ad3cd8325ead57c
2026-03-23 19:02:58 +00:00
Jon Huhn
4eece5291a Workload API: PodGroup ResourceClaims (KEP-5729)
Kubernetes-commit: d80f384b702e4c6630e6f46b2926ab5e45553c97
2026-02-10 14:42:04 -06:00
Kubernetes Publisher
3d35c51207 Merge pull request #137190 from everpeace/KEP-5491-alpha
KEP-5491: DRA: List Types for Attributes [Alpha]

Kubernetes-commit: ef247770b50e7105eb7453c8bfd5279b5a3656ae
2026-03-21 11:02:46 +00:00
Kubernetes Publisher
0434117726 Merge pull request #137028 from nmn3m/feature/dra-resource-pool-status
KEP-5677: Add ResourcePoolStatusRequest API for DRA resource availability visibility

Kubernetes-commit: 15eaed180f8f4d1a6188922a8258392896f7dc4c
2026-03-21 03:02:38 +00:00
Nour
ba785be0ac Drop CSR analogy, mark ObjectMeta +required,reduce limits (maxItems=500, maxLength=128) for etcd safety, add Errors printer column
Signed-off-by: Nour <nurmn3m@gmail.com>

Kubernetes-commit: 8b9159baa41418bcc62592e9da3b878e7cd138ca
2026-03-18 05:17:28 +02:00
Nour
4a9c8783a9 Add ResourcePoolStatusRequest API types and generated code
Introduce the ResourcePoolStatusRequest resource type in the
resource.k8s.io/v1alpha3 API group, gated behind the
DRAResourcePoolStatus feature gate. This includes external and internal
type definitions, protobuf/OpenAPI generated code, client-go typed
clients, informers, listers, apply configurations, deepcopy, defaults,
conversion, fuzzer, declarative validation tags, and API discovery
metadata.

Kubernetes-commit: 29601b8628ac8ea512960bc373511ae46888e502
2026-03-17 14:25:06 +02:00
Kubernetes Publisher
0131054016 Merge pull request #137753 from adamkasztenny/fix-lease-optimistic-update-log-level-v2
Reduce log level for optimistic lease update fallback

Kubernetes-commit: 158b69d2234f2b07ba7b6c5e182fa9df417bdf73
2026-03-19 04:26:11 +00:00
Kubernetes Publisher
9b29e67df1 Merge pull request #136355 from enj/enj/i/tls_cache_gc
Add GC to client-go TLS cache

Kubernetes-commit: bf1abbf2e987883ffacaaf6f84218bcbfd444876
2026-03-19 04:26:09 +00:00
Kubernetes Publisher
4c2ee9a3e2 Merge pull request #136725 from pravk03/native-dra-2
Introduce support of DRA for Native Resources

Kubernetes-commit: 7a3a6cf4be719a2eaed14e48a701cbdd2f0e8400
2026-03-19 00:05:16 +00:00
Kubernetes Publisher
2fb6b9cac0 Merge pull request #137849 from bryantbiggs/deps/update-kube-openapi
deps: Update `kube-openapi` to drop `ginkgo/gomega` indirect deps

Kubernetes-commit: ec68099e62c85901c8d225705d55adfac26cf69d
2026-03-18 20:05:15 +00:00
Praveen Krishna
b2267f3d75 make update
Kubernetes-commit: f266fe4118e52605ba9cf02e1ab2ed68988d56e9
2026-03-18 14:18:22 +00:00
Bryant Biggs
382d307f87 dependencies: bump kube-openapi to drop ginkgo/gomega indirect deps
Bump k8s.io/kube-openapi to pick up kubernetes/kube-openapi#579 which
moved the last ginkgo/gomega tests to stdlib testing and ran go mod
tidy, removing ginkgo/gomega from kube-openapi's go.mod.

This drops ginkgo/gomega as indirect deps from apimachinery. It also
prunes Masterminds/semver, google/pprof, and golang.org/x/tools from
client-go and other staging modules where they were only needed
through kube-openapi's ginkgo/gomega chain.

Contributes to kubernetes/kubernetes#127888

Kubernetes-commit: 56cd74d879f1ba11aadcff95326f17a1cc2c82ef
2026-03-18 09:09:11 -05:00
Kubernetes Publisher
6c21384776 Merge pull request #137795 from ttsuuubasa/dra-binding-conditions-beta
DRA Device Binding Conditions: graduate to beta

Kubernetes-commit: 0d28578de14fce641a39d6415d2068e1f39283a4
2026-03-18 16:07:10 +00:00
Tsubasa Watanabe
69d2e66589 DRA Device Binding Conditions: run make update
Signed-off-by: Tsubasa Watanabe <w.tsubasa@fujitsu.com>

Kubernetes-commit: 6bf9cd5053cf9b2b2b9ef7045a6705f928c949c6
2026-03-17 21:31:32 +09:00
Kubernetes Publisher
bb93391625 Merge pull request #137836 from BenTheElder/fix-api
Fix API serialization compatibility regression in VolumeMountStatus

Kubernetes-commit: a1293fe6b1e423869a28e35b5b8c297e2a6f3b5f
2026-03-18 04:04:24 +00:00
Kubernetes Publisher
828813ca69 Merge pull request #137271 from brejman/tas-constraints
KEP-5732: Add SchedulingConstraints to PodGroup API and use them in TopologyPlacement plugin

Kubernetes-commit: 299ab0d68a9d70b3c39d63210de47ac01d18e74b
2026-03-18 00:05:16 +00:00
Benjamin Elder
27bd9ce449 hack/update-codegen.sh
Kubernetes-commit: 9f60cc3c4e8ddb373b1816a7e28b159db08f6a30
2026-03-17 16:23:57 -07:00
Shingo Omura
15a9dffb52 KEP-5491: generated code for list attribute fields in DeviceAttribute API ("make update"-ed)
Kubernetes-commit: 3902f5611f29a80dad6c43618c1d87af7baa9637
2026-03-16 19:03:01 +09:00
Adam Kasztenny
ea7a7e7cf9 Reduce log level for optimistic lease update fallback
The "Failed to update lease optimistically, falling back to slow path"
message was logged at Error level, but this is expected behavior during
normal leader election when the optimistic update encounters a conflict.
The system gracefully falls back to the slow path (Get + Update), so
this is not a real error. Downgrade to V(2) Info to reduce log noise.

Kubernetes-commit: 04977a0ea4592bfaa70d5095a4cfe99dd4b847e1
2026-03-14 16:51:49 -04:00
Bartosz
61a40f5111 Add scheduling constraints to v1alpha2 pod group api
Add plugin to generate placements based on scheduling constraints

Co-authored-by: Antoni Zawodny <zawodny@google.com>

Kubernetes-commit: d9da8c7c4a25cee553720737fdec07006e063da1
2026-02-25 16:36:07 +00:00
Kubernetes Publisher
39f55294aa Merge pull request #137454 from haircommander/proc-mount-ga
KEP-4265: feature: promote ProcMountType to GA

Kubernetes-commit: 040ca59611d5bb5976ad4cb47f1e80f8c877d0d8
2026-03-17 08:00:09 +00:00
Peter Hunt
c73e37f377 proc mount: drop featuregate note on API
Signed-off-by: Peter Hunt <pehunt@redhat.com>

Kubernetes-commit: 389825754c8d3fe4292c38facc0bbb80ec8efdfd
2026-03-13 15:20:49 -04:00
Kubernetes Publisher
9dc763689d Merge pull request #137298 from dims/dsri/cri-streaming-option-a-hardcut
cri streaming option a hardcut - add new staging repositories `streaming` and `cri-streaming`

Kubernetes-commit: 2bd6c7fe3cb8663804dc6e7672ff01aeebc97274
2026-03-17 07:59:59 +00:00
Kubernetes Publisher
c07c271a94 Merge pull request #137398 from Rajneesh180/fix-client-go-nil-event-key-v4
client-go: fix goroutine hot-loop in StartEventWatcher on broadcaster shutdown

Kubernetes-commit: 8ebee69b1587a71efb23144300dcf34bdbf2d3b3
2026-03-12 20:51:03 +00:00
Kubernetes Publisher
2517e8773a Merge pull request #137170 from pohly/dra-device-taints-beta
DRA device taints: graduate to beta

Kubernetes-commit: 4e2bbc78bf097afa70b67cb2814623558ab5f0b4
2026-03-12 20:51:02 +00:00
Kubernetes Publisher
3505da0deb Merge pull request #136792 from rata/userns-goes-ga
feature: Migrate UserNamespacesSupport to GA

Kubernetes-commit: f7f694e5e066149a41a7f94394f84977fc6d0ea6
2026-03-12 20:51:00 +00:00
Kubernetes Publisher
97ac09639d Merge pull request #137419 from michaelasp/rvInformerMetrics
Add metric tracking the latest cached rv of informers

Kubernetes-commit: fdbea745459cc570d8fc975c5fcbe42511472aea
2026-03-11 00:39:29 +00:00
Kubernetes Publisher
9cdd63fee2 Merge pull request #137343 from gnufied/prevent-podscheduling-optin
Add API changes to prevent pod scheduling via CSIDriver object

Kubernetes-commit: d47f3f253bcd462a5bfe40625de09fb3a4bc5f2b
2026-03-11 00:39:28 +00:00
Kubernetes Publisher
32a3ac47cf Merge pull request #137495 from pohly/klog-update
dependencies: klog v2.140.0

Kubernetes-commit: 9d0495ec93f7942b9fd6482df79820376a447eee
2026-03-10 16:39:19 +00:00
Kubernetes Publisher
e807f52104 Merge pull request #136435 from Jefftree/leaderelection-client-efficiency
Update leasecandidate client to read from cache

Kubernetes-commit: 4e3e58ffbe28674a5125cff183e8dacf97b07775
2026-03-10 16:39:14 +00:00
Antoni Zawodny
a179e3b9fb Create Workload API v1alpha2 (#136976)
* Drop WorkloadRef field and introduce SchedulingGroup field in Pod API

* Introduce v1alpha2 Workload and PodGroup APIs, drop v1alpha1 Workload API

Co-authored-by: yongruilin <yongrlin@outlook.com>

* Run hack/update-codegen.sh

* Adjust kube-scheduler code and integration tests to v1alpha2 API

* Drop v1alpha1 scheduling API group and run make update

---------

Co-authored-by: yongruilin <yongrlin@outlook.com>

Kubernetes-commit: 3f094dc228318b89f1fef313543b960e35ca6e3e
2026-03-10 04:41:24 +00:00
Kubernetes Publisher
4bf554630d Merge pull request #132922 from yt2985/client-fix
Fix the client-go issue of reloading trust root CAs.

Kubernetes-commit: a01d2e6cd45f7a299b56cacdd8a2d35078bef9b6
2026-03-10 04:41:20 +00:00
Hemant Kumar
2e882c6ea6 Update comment and regenerate API docs
Kubernetes-commit: dede11365be89384facd8226bb547f186446bee5
2026-03-09 12:01:46 -04:00
Kubernetes Publisher
6f2c112d22 Merge pull request #137497 from atombrella/feature/modernize_activate_forvar
Lint: Activate modernize/forvar rule in golangci-lint.

Kubernetes-commit: 090693bd79c405df9122179f5e399adf77b8c023
2026-03-09 12:38:51 +00:00
Kubernetes Publisher
2f31bfec5d Merge pull request #135048 from yliaog/beta_promo
DRA Extended Resource: promote to Beta in 1.36

Kubernetes-commit: f5bafe93ac3edd34de7eb9d59bde9043201c43e5
2026-03-06 20:26:31 +00:00
Patrick Ohly
88da827ca3 dependencies: klog v2.140.0
klog hasn't been updated in Kubernetes for a few releases. Several
enhancements have accumulated that are worth having.

Kubernetes-commit: 56e0565c113107bdea398b075aba5bdef43489ed
2026-03-06 17:43:11 +01:00
Kubernetes Publisher
c826020ed9 Merge pull request #137358 from xigang/processlister_log
client-go/cache: add slow-handler tracing in processorListener

Kubernetes-commit: 1f5701a46d6edeb396531968dc8ed332bf69e5f4
2026-03-06 08:24:26 +00:00
Kubernetes Publisher
c3a1049f7e Merge pull request #137456 from liggitt/go126
Update go.mod to go 1.26, fix 1.26 vet errors

Kubernetes-commit: 800a58b7c515b3d5e2677f6af37f9ece186b67c0
2026-03-06 08:24:25 +00:00
Kubernetes Publisher
989fb5d38c Merge pull request #137473 from jpbetz/fix-set-transform
Fix SetTransform to correctly override per-informer transforms

Kubernetes-commit: 3dceb579f797c88564d03a7bdf91ba8108ffd820
2026-03-06 08:24:22 +00:00
Kubernetes Publisher
294ecb1d8c Merge pull request #137304 from aaron-prindle/fieldsv1-encapsulation
refactor: fieldsv1 encapsulation via accessors and deprecation of direct "Raw" field usage

Kubernetes-commit: 4915f3f8b38318826654199003775d348d3cdafb
2026-03-06 04:24:12 +00:00
Joe Betz
c7f8506da0 Fix informer factory generation and add test
Kubernetes-commit: c0addb352e284feda34667f0a36c06da9f1cf2a6
2026-03-05 20:06:01 -05:00
Kubernetes Publisher
78536fe27c Merge pull request #137451 from dims/update-google-protobuf-deadcode-fix
Update google.golang.org/protobuf to v1.36.12-0.20260120151049-f2248ac996af to prevent file size explosion in go 1.26

Kubernetes-commit: 77c013637cb40e1b5d2b26664dc7b297f1ff2693
2026-03-05 20:24:49 +00:00
Rita Zhang
06163fb266 Move DRAAdminAccess feature to GA (#137373)
* Move DRAAdminAccess feature to GA

Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>

* address comments

Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>

---------

Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>

Kubernetes-commit: c4f88de33e02882e758da8667cfcaf939ed7bc1a
2026-03-05 20:24:46 +00:00
Davanum Srinivas
388997a877 Update google.golang.org/protobuf to v1.36.12-0.20260120151049-f2248ac996af
Pins google.golang.org/protobuf to HEAD commit f2248ac996afc39b3df0777cdcc269f6ade50b07
(v1.36.12-0.20260120151049-f2248ac996af) which includes fixes for dead code
elimination issues surfaced by Go 1.26's reflect changes.

Xref: https://github.com/golang/protobuf/issues/1704
Xref: https://github.com/kubernetes/kubernetes/issues/137445
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: c8826e0d235fde75d02643bd700179ed79897ad6
2026-03-05 09:36:13 -05:00
Kubernetes Publisher
a72ad3ccbc Merge pull request #137349 from Jefftree/fix-model-name-bounding-dirs
Pass --readonly-pkg to openapi-gen in kube_codegen.sh

Kubernetes-commit: ef8a14f679491f858968f49a847c393a3a3fc5e2
2026-03-05 04:26:03 +00:00
Kubernetes Publisher
9f41e94324 Merge pull request #137066 from cnuss/fix/issues/136823
client-go/cache: fix logging

Kubernetes-commit: 8020ce8511aab076f939b104c973b84cb7a1afc3
2026-03-05 00:25:36 +00:00
Mads Jensen
d91024383a Lint: Activate modernize/forvar rule in golangci-lint.
Kubernetes-commit: dd32d7c324b97d259b99c1464802d9e3ca706a94
2026-03-05 00:11:40 +01:00
Michael Aspinwall
aae801378e Add metric tracking the latest cached rv of informers
Kubernetes-commit: 9fb9e933b2ebae2d94edd29b7dec2c1df9e625a6
2026-03-04 22:13:54 +00:00
Aaron Prindle
3e4de9e6b4 refactor: update in-tree FieldsV1 consumers to use format-specific accessors
Kubernetes-commit: e57b3a74f37754c9455a3debafd25c88d434e69d
2026-03-04 21:44:21 +00:00
Jefftree
e45d8623ff update kube-openapi
Kubernetes-commit: 721eea74e75dc95bafbfa450bb2309e494abf45c
2026-03-04 15:33:47 -05:00
Rajneesh180
187c42c884 client-go: guard ResultChan() close in StartEventWatcher
When watch.Broadcaster.Shutdown() is called it drains all queued events
then calls closeAll(), which closes every watcher's result channel.
eventBroadcasterImpl.Shutdown() calls Broadcaster.Shutdown() first,
then calls the cancellation context's cancel() function.  Between those
two steps there is a window in which the result channel is closed while
the cancellation context is still live.

Without the two-value channel receive the goroutine in StartEventWatcher
would spin on the already-closed channel: each select iteration
immediately receives the zero-value watch.Event, the type assertion
fails (nil interface, ok == false), and the loop continues burning CPU
until the select scheduler eventually picks the cancelationCtx.Done()
case.

Guard against this by reading the ok boolean from the channel receive:

  case watchEvent, ok := <-watcher.ResultChan():
    if !ok {
      return
    }

This is the correct and idiomatic Go pattern for a channel that may be
closed by its producer.  Note that when this return path is taken the
broadcaster has already delivered every queued event (Broadcaster.Shutdown
blocks until the distribute loop exits before closeAll runs), so no
events are silently dropped.

Add a regression test (TestStartEventWatcherExitsOnDirectShutdown) that
creates a broadcaster without an external context so Shutdown() is
fully synchronous, starts a watcher, and verifies the goroutine exits
cleanly via goleak.VerifyNone.

Signed-off-by: Rajneesh180 <rajneeshrehsaan48@gmail.com>

Kubernetes-commit: 95c15b54069922b0a66c198a064577ea0a160694
2026-03-04 16:05:26 +05:30
Kubernetes Publisher
2dd466fcfe Merge pull request #137291 from everettraven/upstream/dv/maxLength-fixup
[Declarative Validation] Bring `k8s:maxLength` tag in line with OpenAPI `maxLength` validation semantics

Kubernetes-commit: e08e598df07bc929679ef046418992a8205da18f
2026-03-04 00:25:37 +00:00
Kubernetes Publisher
486be0fbf9 Merge pull request #135196 from harche/i133202
KEP-4680: Add message field support to DRA device health reporting

Kubernetes-commit: be6162afb876e60ded92780786519c976fc0be08
2026-03-03 20:25:21 +00:00
Kubernetes Publisher
e243a98fa8 Merge pull request #137167 from pohly/dra-device-taints-update-timestamp
DRA device taints: automatically bump TimeAdded when changing effect

Kubernetes-commit: 13010f06b270df96c4f558bdadcad93970000a53
2026-03-03 20:25:19 +00:00
xigang
f6c2d7ca65 client-go/cache: add slow-handler tracing in processorListener
Signed-off-by: xigang <wangxigang2014@gmail.com>

Kubernetes-commit: ac1eb12281bdc7fb7e0269fb4bb914369b92bb64
2026-03-03 13:07:08 +08:00
Kubernetes Publisher
55e741a004 Merge pull request #137296 from michaelasp/fixListenerDeadlock
Fix listener deadlock in shared informer

Kubernetes-commit: 1879769b9354b6e47a13dac831aec6fe3e0368b6
2026-03-03 00:24:45 +00:00
Hemant Kumar
27966b2574 Update generated code
Kubernetes-commit: 143c56ddeb8ba470102d5145bbfafca898999763
2026-03-02 17:00:43 -05:00
tinatingyu
8776b282cc client-go CA rotation
Kubernetes-commit: b806a3207beb1afabc3d3d93fbadba38ffb8a110
2026-03-02 20:40:00 +00:00
Davanum Srinivas
9926c67348 staging: extract CRI streaming modules with client-go compatibility
Extract streaming code into dedicated staging modules while keeping stable
compatibility APIs for external client-go consumers.

This commit:
- adds `k8s.io/cri-streaming` for CRI exec/attach/portforward server code
- adds `k8s.io/streaming` as the canonical home for shared transport
  primitives (`httpstream`, `spdy`, `wsstream`, runtime helpers)
- switches in-tree transport consumers to `k8s.io/streaming`
- removes in-tree kubelet CRI streaming package
- preserves NO_PROXY/no_proxy CIDR handling in extracted SPDY proxier logic
- adds deprecated `k8s.io/apimachinery/pkg/util/httpstream` compatibility
  wrappers (`httpstream`, `spdy`, `wsstream`) backed by `k8s.io/streaming`
- restores exported client-go SPDY/portforward API signatures to
  apimachinery `httpstream` types for downstream compatibility
- adds streaming-native client-go adapters/constructors so in-tree callers
  can use `k8s.io/streaming` without changing external compatibility APIs
- deduplicates SPDY-over-websocket dial negotiation shared by compat and
  streaming tunneling dialers
- logs dropped unknown stream types in `RemoveStreams` adapter fallbacks to
  improve compatibility-path debuggability
- adds integration coverage for the streaming-upgrader-to-client-go-compat
  adapter path against a real cri-streaming exec endpoint
- clarifies kubectl streaming import aliasing to avoid `httpstream` package
  ambiguity
- updates tests, import restrictions, publishing metadata, and vendor/module
  metadata for the new staging modules

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 1ee1ff97fb7f9755a44d29bee0c80d2ccbed68dc
2026-02-28 19:40:07 -05:00
Eddie
c86837f7ed Promote sig-storage feature MutableCSINodeAllocatableCount to GA (#136230)
* Promote MutableCSINodeAllocatableCount to GA

Signed-off-by: Eddie Torres <torredil@amazon.com>

* Lock MutableCSINodeAllocatableCount feature gate to default

Signed-off-by: Eddie Torres <torredil@amazon.com>

---------

Signed-off-by: Eddie Torres <torredil@amazon.com>

Kubernetes-commit: 41bb4b6a8b4e0f15ab7ffcc6369c68bc599fb957
2026-02-28 08:42:18 +00:00
Kubernetes Publisher
2f21ae3478 Merge pull request #137272 from pmengelbert/pmengelbert/kuberc_name_to_command/1
Rename `name` to `command` in kuberc credentialPluginAllowlist entries

Kubernetes-commit: cf876463cdf5571d2051096859779d9d210074b3
2026-02-27 20:42:02 +00:00
Bryce Palmer
b59431fbc5 update-codegen: regenerate generated files
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>

Kubernetes-commit: 729792e8700780f9cfbb4a14e74621ef219444c1
2026-02-27 15:23:12 -05:00
Michael Aspinwall
54ee8fecae Fix deadlock when listeners get added before processing starts
Kubernetes-commit: 0ce498ff21296f44dfa980d8679c0b7697e2d6b8
2026-02-27 18:55:39 +00:00
Kubernetes Publisher
f037d681ac Merge pull request #137286 from humblec/update-vendored-dependencies
Update vendored dependencies ( gomega/cadvisor)

Kubernetes-commit: 3f2ebc50eecfaeda23df4435dc82422fa65425ed
2026-02-27 16:41:07 +00:00
Humble Devassy Chirammal
99791c7452 dependencies: bump gomega to v1.39.1 and ginkgo to v2.28.1
Kubernetes-commit: 600d188f2b02eea974509062c04186309065ff16
2026-02-27 15:48:21 +05:30
Kubernetes Publisher
1f07d6645b Merge pull request #137189 from dhruv7539/codex/getlogs-reactor-support
client-go: make fake Pods.GetLogs honor reactors

Kubernetes-commit: 44b486f43c9792e812f849d9509449ac69edf55c
2026-02-27 03:58:18 +00:00
Kubernetes Publisher
efbad1b7ed Merge pull request #135775 from bitoku/no-noexec
Update OCI image volume type description to remove "noexec" attribute

Kubernetes-commit: 7d70fe491d50ebbc14a0495ee09fa0e922a2ff82
2026-02-27 03:58:16 +00:00
Hemant Kumar
73f4fa85e7 Update generated fields
Kubernetes-commit: 7d9e61be7ef21576e42ed533a233d7e985358b84
2026-02-26 15:49:52 -05:00
Kubernetes Publisher
f66040b9dc Merge pull request #137261 from tchap/kcm-le-check-context-canceled
client-go/leaderelection: Short-circuit on context canceled

Kubernetes-commit: 0a68f9849435bc5015e4e0ae5b4b661bb927b6db
2026-02-26 19:36:48 +00:00
Peter Engelbert
b840391f92 Rename AllowlistEntry clientcmd.Name to Command
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

Kubernetes-commit: 505b937babc9ab0061ed346ec0278a3a605664ac
2026-02-26 13:27:46 -05:00
dhruv7539
1349319d7c client-go: error on invalid fake pod logs reactor object
Kubernetes-commit: 3ed316397734e59e9a39c662f70de1b86192db17
2026-02-26 09:58:23 -08:00
Ondra Kupka
8a32b4087c client-go/leaderelection: Check context canceled
The change introduced in 59cd1d0b3bb378f40a639e21b615f4df1d4a5a14
causes PollUntilContextTimeout to call the condition function even when
the context is canceled already. This is unnecessary in our case and
only leads to one extra loop of processing and extra error messages.
This change makes the renew loop behave like it did before the change.

Kubernetes-commit: aa494f8174d745c3d9842f3d48272a3c2d6dcbcc
2026-02-26 12:04:01 +01:00
Kubernetes Publisher
764b57d771 Merge pull request #129339 from pohly/log-client-go-features
client-go features: ignore contextual logging

Kubernetes-commit: 31d35e649098be997d31a6bbf9f6a982c486b0ab
2026-02-25 11:35:15 +00:00
dhruv7539
f1d9ba91c7 client-go: keep fake pod log action compatible
Kubernetes-commit: 60c697419d2695108a054d704334778e3d945a6c
2026-02-23 10:35:50 -08:00
Kubernetes Publisher
62f2159da2 Merge pull request #136937 from p0lyn0mial/upstream-reflector-list-unsupported-table
client-go/reflector: reject Table format resources in List and Watch paths

Kubernetes-commit: 3bc0b290e9c1cd81db1ed5119b242b5dfce931af
2026-02-23 18:10:18 +00:00
Kubernetes Publisher
00e45797cb Merge pull request #136923 from jpbetz/mock-limitations-docs
Explain limitations and maintenance policy of fake client

Kubernetes-commit: 21d8cca01dbec9e5e584d5684b2b3a8e8cd9364c
2026-02-23 10:10:45 +00:00
dhruv7539
e8eab37058 client-go: make fake Pods.GetLogs honor reactors
Kubernetes-commit: 3d41b434c0e88e9f74e38fe654d7b5bfd77090d0
2026-02-22 14:47:29 -08:00
Kubernetes Publisher
efc4692504 Merge pull request #135313 from oduludo/enable-commentstart-apiserverinternal
commentstart lint fixes for apiserverinternal API group

Kubernetes-commit: 8bfda5d315977489bd8a2fb1cfceaebd1ee7db8d
2026-02-21 22:09:34 +00:00
Ludo van Orden
648a945fad updated generated code
Kubernetes-commit: 156fc7981c8b8b0f4253420f47e3ad561e389ab9
2026-02-20 23:59:35 +01:00
Kubernetes Publisher
6b803d4e11 Merge pull request #136392 from skitt/unsupported-typo
Align IsWatchListSemanticsUnSupported comment

Kubernetes-commit: 15a2107890558876c35db3e44420575d657ac3a0
2026-02-20 18:10:21 +00:00
Patrick Ohly
f6cd0c0583 DRA device taints: generated files
Kubernetes-commit: 7d2781a0c3c02e2ad47714698f86175cd8b6ec72
2026-02-20 13:19:38 +01:00
Patrick Ohly
67f0d98034 DRA device taints: automatically bump TimeAdded when changing effect
In practice, TimeAdded is managed by the API server. When admins used
DeviceTaintRule to simulate eviction, then change the effect to really evict,
it is useful to calculate tolerations based on the time when that second
update happened. Therefore the TimeAdded field gets bumped automatically
when changing the effect.

Kubernetes-commit: f28dc4139208e64fe2882cd44d548c25020f2e3a
2026-02-20 12:35:40 +01:00
Kubernetes Publisher
100af76fc5 Merge pull request #137101 from richabanker/informer-metric-latency
Add processing latency metric for RealFIFO

Kubernetes-commit: 7336e04752a3ce946697c3524ed40104d6086b73
2026-02-20 02:13:22 +00:00
Jordan Liggitt
97646e5606 Fix vet error
Kubernetes-commit: 45900a1debee388738f299c0a001ed01e8b25208
2026-02-17 16:42:55 -05:00
Jordan Liggitt
103162f118 Bump to go 1.26
Kubernetes-commit: f291ae40b03afaaf49cca43b650bfbd05f4babee
2026-02-17 16:05:07 -05:00
Copilot
78fb6ed2e1 client-go/cache: Remove reflector context cancellation logging
The error returned from Until() is solely from context cancellation
which is expected behavior when the reflector is stopped. Logging
this as an error (or even at V(4)) creates unnecessary noise.

Kubernetes-commit: cc483208aa306b8c4078d4118cf78a10e58481ec
2026-02-16 22:04:52 -05:00
Richa Banker
59f55827e6 Add processing latency metric for RealFIFO
Kubernetes-commit: d049bd123391f4c1a86e493888560d8549a52dc2
2026-02-16 15:15:47 -08:00
Kubernetes Publisher
70ab833f66 Merge pull request #136039 from lalitc375/map-graduation
Promote MutatingAdmissionPolicy to v1 (GA)

Kubernetes-commit: b08fa0cdf18610be74d9741cf361446a5f42ff76
2026-02-18 22:09:27 +00:00
Rodrigo Campos
1d4002e88b Remove references to UserNamespacesSupport feature gate from core types
It's GA now. To regenerate the files I did:
        make WHAT=cmd/kube-apiserver
        make update

While we are there, remove the reference that the field is alpha.

Signed-off-by: Rodrigo Campos <rodrigo@amutable.com>

Kubernetes-commit: 8db51091e82490bccc0018763ba7e05ffb8ab458
2026-02-12 11:14:43 +01:00
Rodrigo Campos
a63d33951d staging/testdata: Remove UserNamespacesSupport reference
This is just a sed to remove the old data from the text fixtures too.

While two files are clearly test data given that they include testdata
in their name, these two is not so obvious but are also test data:

	* openapi/swagger-with-shared-parameters.json: is referenced in "staging/src/k8s.io/cli-runtime/pkg/resource/query_param_verifier_test.go",
          in particular in this part: ´filepath.Join("..", "..", "artifacts", "openapi", "swagger-with-shared-parameters.json")´

	* batch.k8s.io_v1.json: is in
	  `staging/src/k8s.io/kubectl/pkg/explain/v2/templates/plaintext_test.go`,
          in a "//go:embed batch.k8s.io_v1.json".

Signed-off-by: Rodrigo Campos <rodrigo@amutable.com>

Kubernetes-commit: 8d0f80e4ed87658c0e05b9db0690927547be6ad5
2026-02-13 16:04:51 +01:00
Joe Betz
8304d788bb Explain limitations and maintenance policy of fake client
Kubernetes-commit: bce392d1a7dbbe1112d8113ec6539826bfdfcdca
2026-02-10 16:49:53 -05:00
Lukasz Szaszkiewicz
7b594c4c71 reflector: reject Table format resources in List and Watch paths
Kubernetes-commit: a46b1903a5426ede16d021b49c96d3f4ba7aea4d
2026-02-10 21:42:42 +01:00
Jefftree
d6503fcc3e Update leasecandidate client to read from cache
Kubernetes-commit: 5a306036a53754ce26938cedd89b2ddf3b105aa2
2026-01-22 16:55:50 +00:00
Stephen Kitt
80c1d965be Run codegen
Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: af5317bb8842ba758b92bd169056eb9a666198b8
2026-01-21 14:06:32 +01:00
Monis Khan
f5fc1e5f67 Add GC to client-go TLS cache
Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: fa9a1fe5f7084c0a1371d87e880c1a9e58f935a4
2026-01-16 14:58:52 -05:00
yliao
e924e3f2c5 codegen
Kubernetes-commit: 58da2e682f1ecba5d848da4810c49ad6baf886a1
2026-01-14 21:34:37 +00:00
Lalit Chauhan
2ca150601d promote MutatingAdmissionPolicy to v1: add types and generated code
Kubernetes-commit: 5505c010fd7c29d24b2718ae8659a4296cb2cc37
2025-12-29 19:15:16 +00:00
Kubernetes Publisher
e334b2d6e7 Merge pull request #136895 from youwalther65/csr-create
Add CertificateSigningRequest create log entry for default kubelet debug level V2

Kubernetes-commit: 4edf082c406416b170d923e8f2c2cee69d933ae6
2026-02-18 06:10:00 +00:00
Kubernetes Publisher
6cda0df027 Merge pull request #136824 from cnuss/issues/136823
client-go: Replace deprecated BackoffManager with DelayFunc in Reflector

Kubernetes-commit: fb78de873af5e2611776f0c5093d994a9331f698
2026-02-13 04:27:35 +00:00
Kubernetes Publisher
fd1b7118fd Merge pull request #134675 from JoelSpeed/enable-kal-optionalorrequired-apiserver-internal
Enforce either optional or required tag on apiserverinternal API group

Kubernetes-commit: 9571e19da950a23312100fbb7c5d4fe76ce0413c
2026-02-13 04:27:34 +00:00
Kubernetes Publisher
ca54862893 Merge pull request #134827 from michaelasp/rvStore
Add Resource Version query and Bookmarks to thread safe store

Kubernetes-commit: 03da2455859aacb1e542e1e46a4c8b41750d55dc
2026-02-13 04:27:31 +00:00
Kubernetes Publisher
7aaede7872 Merge pull request #136921 from dims/dump-from-utils
Move dump package from apimachinery to k8s.io/utils

Kubernetes-commit: 5b63a8c68e8e4d417ab3758c7a80118c2db27ac9
2026-02-12 20:52:28 +00:00
Joel Speed
2c400a844a Restore omitempty on ServerStorageVersion fields
Kubernetes-commit: 82a9a99a44ce2c41fc07dfcd8651d89652659976
2026-02-12 17:59:07 +00:00
Kubernetes Publisher
9f57ca57bd Merge pull request #136729 from ahmedtd/podcert-pkcs10
Pod Certificates: Add StubPKCS10Request; migrate in-tree usages

Kubernetes-commit: 54489c1a338ba521f36f5b73667f03a8e164d18e
2026-02-12 00:52:04 +00:00
Kubernetes Publisher
0efa7daafd Merge pull request #136925 from michaelasp/pipeFeatureGate
Pipe feature gate of unlockWhileProcessing

Kubernetes-commit: 7b999810bf37c025ba146e3e1feae80b44eac6d6
2026-02-11 08:51:42 +00:00
Kubernetes Publisher
82ed9ba53e Merge pull request #135395 from pohly/apimachinery-wait-for-cache-sync
apimachinery + client-go + device taint eviction unit test: context-aware Start/WaitFor, waiting through channels

Kubernetes-commit: eb09a3c23e3c3905c89e996fcec2c02ba8c4bb0e
2026-02-11 08:51:41 +00:00
Kubernetes Publisher
07f99e4437 Merge pull request #135256 from natasha41575/pod-gen-field
remove Pod Generation feature gate from field descriptions

Kubernetes-commit: 99d4b4d426b751cc7ca3f7b3e118c899af8fbfde
2026-02-11 00:51:49 +00:00
Michael Aspinwall
b8c6b3c159 Pipe feature gates
Kubernetes-commit: 718ebb6dfc7a5a64ee17821a0de177e3a1eb11f0
2026-02-10 22:39:18 +00:00
Davanum Srinivas
decb8c0791 Move dump package from apimachinery to k8s.io/utils
Replace all imports of k8s.io/apimachinery/pkg/util/dump with
k8s.io/utils/dump across the repo. The apimachinery dump package
now contains deprecated wrapper functions that delegate to
k8s.io/utils/dump for backwards compatibility.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 550cc8645bedcc8b187e0ebeb52ead29d5631a32
2026-02-10 15:20:41 -05:00
Jens-Uwe Walther
18a54f0a40 Add CertificateSigningRequest create log entry for default kubelet debug level V2
Kubernetes-commit: b7bd70192397c5d52c18a5f85e87cec66ccc9a9f
2026-02-09 21:12:39 +01:00
Christian Nuss
b5668cea26 client-go: Replace deprecated BackoffManager with DelayFunc in Reflector
Move backoff documentation comments to var block for better discoverability.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Kubernetes-commit: 33ebd41b2c1abdc03beabd9ccff3428a8fd46473
2026-02-07 12:04:08 -05:00
Taahir Ahmed
3721aecc15 Pod Certificates: make update
Kubernetes-commit: c76efb3a145830f40ee042b8823e83a973e24372
2026-02-03 20:26:42 -08:00
Michael Aspinwall
139a95c065 Plumb bookmark RVs to controller for observation
Kubernetes-commit: 428b903cd990762a2588fa471791d9c8c747c196
2026-01-28 22:30:06 +00:00
Michael Aspinwall
d883e606da Add rv query to store
Kubernetes-commit: 9c6ac550efa6e721c85b0f1074f26f734286fba9
2026-01-28 22:29:39 +00:00
Ayato Tokubi
1f85fd1a13 Update OCI image volume type description to remove "noexec" attribute
Signed-off-by: Ayato Tokubi <atokubi@redhat.com>

Kubernetes-commit: aa1e24659ee18378426fa3b83616c7d96e098bbe
2025-12-16 16:57:37 +00:00
Patrick Ohly
ff8083eb1d client-go informers: context-aware Start + WaitForCacheSync
Passing a context to StartWithContext enables context-aware reflector
logging. This is the main remaining source of log spam (output to stderr
instead of per-test logger) in controller unit tests.

WaitForCacheSynceWithContext takes advantage of the new cache.WaitFor +
NamedHasSynced functionality to finish "immediately" (= no virtual time
passed) in a synctest bubble. While at it, the return type gets improved so
that a failure is easier to handle.

Kubernetes-commit: 5ff323de791df88880f6e065f5de4b445e5c90ed
2025-11-21 16:23:44 +01:00
Patrick Ohly
e70bc766e0 client-go cache: wait for cache sync via channels, better logging
The main advantage is that waiting on channels creates a causal relationship
between goroutines which is visible to synctest. When a controller in a
synctest bubble does a WaitFor in a test's background goroutine for the
controller, the test can use synctest.Wait to wait for completion of cache
sync, without requiring any test specific "has controller synced" API. Without
this, the test had to poll or otherwise wait for the controller.

The polling in WaitForCacheSync moved the virtual clock forward by a random
amount, depending on how often it had to check in wait.Poll. Now tests can be
written such that all events during a test happen at a predictable time. This
will be demonstrated in a separate commit for the
pkg/controller/devicetainteviction unit test.

The benefit for normal production is immediate continuation when the last
informer is synced (not really a problem, but still...) and more important,
nicer logging thanks to the names associated with the thing that is being
waited for. The caller decides whether logging is enabled or disabled and
describes what is being waited for (typically informer caches, but maybe also
event handlers or even something else entirely as long as it implements the
DoneChecker interface).

Before:

    Waiting for caches to sync
    Caches are synced

After:

    Waiting for="cache and event handler sync"
    Done waiting for="cache and event handler sync" instance="SharedIndexInformer *v1.Pod"
    Done waiting for="cache and event handler sync" instance="SharedIndexInformer *v1.ResourceClaim"
    Done waiting for="cache and event handler sync" instance="SharedIndexInformer *v1.ResourceSlice"
    Done waiting for="cache and event handler sync" instance="SharedIndexInformer *v1.DeviceClass"
    Done waiting for="cache and event handler sync" instance="SharedIndexInformer *v1alpha3.DeviceTaintRule"
    Done waiting for="cache and event handler sync" instance="SharedIndexInformer *v1.ResourceClaim + event handler k8s.io/kubernetes/pkg/controller/devicetainteviction.(*Controller).Run"
    Done waiting for="cache and event handler sync" instance="SharedIndexInformer *v1.Pod + event handler k8s.io/kubernetes/pkg/controller/devicetainteviction.(*Controller).Run"
    Done waiting for="cache and event handler sync" instance="SharedIndexInformer *v1alpha3.DeviceTaintRule + event handler k8s.io/kubernetes/pkg/controller/devicetainteviction.(*Controller).Run"
    Done waiting for="cache and event handler sync" instance="SharedIndexInformer *v1.ResourceSlice + event handler k8s.io/kubernetes/pkg/controller/devicetainteviction.(*Controller).Run"

The "SharedIndexInformer *v1.Pod" is also how this appears in metrics.

Kubernetes-commit: fdcbb6cba9a04c028b158bf66d505df7431f63fe
2025-11-18 12:39:11 +01:00
Patrick Ohly
b37e79caad client-go cache: allow passing name+logger to DeltaFIFO, RealFIFO and Reflector
This improves logging and enables more informative waiting for cache sync in a
following commit. It addresses one klog.TODO in the Reflector.

The RealFIFOOptions and InformerOptions structs get extended the same way as
DeltaFIFOOptions before: a logger may be set, but it's not required. This is
not an API break.

That the name has to be passed separately is a bit annoying at first glance
because it could also be set directly on the logger through WithName, but
keeping it separate is better:
- name can be set without providing a logger
- name can be defaulted
- less code in the caller when passing through a logger and adding
  the name only in the field
- last but not least, extracting the name is not supported in a portable
  manner by logr

All in-tree references in production code get updated.

While at it, logging in the fifos gets updated to follow best practices: if
some code encounters an abnormal situation and then continues, it should use
utilruntime.HandleErrorWithLogger instead of normal error logging.

Existing "logger" fields get moved to the top because that is a more common
place for such a read-only field.

Kubernetes-commit: 45251e5f654e6c052659d110cd721f9fbe185191
2025-11-18 18:09:46 +01:00
Natasha Sarkar
1ee3eb7041 remove Pod Generation feature gate from field descriptions
Kubernetes-commit: d5dabfcd658def79f6b1e1c3c680d5c1711e24f7
2025-11-11 16:44:33 +00:00
Kubernetes Publisher
8fcd3c218f Merge pull request #136826 from alvaroaleman/bumpv0.32
Bump structured merge diff to v6.3.2

Kubernetes-commit: 65f09e605cb206b2e5fcff4d69a4ae8acf62dbc3
2026-02-10 20:21:19 +00:00
Kubernetes Publisher
c6e2e47b31 Merge pull request #136455 from pohly/client-go-simpleclient-undeprecation
fake client-go: un-deprecate NewSimpleClientset

Kubernetes-commit: 09e1c9fe0ec3d3a61fa71c43610b42e1e3f53612
2026-02-10 00:00:21 +00:00
Alvaro Aleman
c02524f944 Bump structured merge diff to v6.3.2
Diff: https://github.com/kubernetes-sigs/structured-merge-diff/compare/v6.3.1...v6.3.2

It's just one change that prevents a NPD when an embedded pointer to a
struct is encountered.

Kubernetes-commit: f59cfe60ef2063e2383ebef416f9da05196903d6
2026-02-07 13:49:48 -05:00
Patrick Ohly
aac099e7c2 fake client-go: un-deprecate NewSimpleClientset
NewSimpleClientset was marked as deprecated when NewClientset was
introduced. This has caused some confusion:
- Not all packages have NewClientset (https://github.com/kubernetes/kubernetes/issues/135980).
- Tests that work with NewSimpleClientset fail when
  switched to NewClientset (https://github.com/kubernetes/kubernetes/issues/136327)
  because of missing CRD support (https://github.com/kubernetes/kubernetes/issues/126850).

It doesn't seem burdensome to keep NewSimpleClientset around forever. Some unit
tests may even prefer to use it when they don't need server-side apply (less
overhead). Therefore there is no need to deprecate it.

This avoids churn in the eco system because contributors no longer create PRs
"because the linter complains about the usage of a deprecated function".

Kubernetes-commit: e80da21868059f789c90105a00481fa8cef169e1
2026-01-23 11:20:40 +01:00
Carlos Eduardo Arango Gutierrez
7bb07cbe8e KEP-4680: Add message field support to DRA device health reporting
Author: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Co-Authored-By: Harshal Patil <12152047+harche@users.noreply.github.com>

Signed-off-by: Harshal Patil <12152047+harche@users.noreply.github.com>

Kubernetes-commit: ad6c155449e38d7cca22230fdb99ae02b65ccb59
2025-11-10 15:50:09 -05:00
Joel Speed
d416af4df4 Update generated code
Kubernetes-commit: 0ebf47cb080a207a4829ce8e604e51bb494d63fb
2025-10-23 11:11:45 +01:00
Patrick Ohly
3db82856dc client-go features: ignore contextual logging
The client-go feature gates implementation logs information about feature
states at V(1). Changing that would imply changing the Enabled method, which is
very intrusive because there are many callers which are not expected to log and
thus don't have access to a contextual logger.

The code is not active in Kubernetes components, those use the clientAdapter to
make client-go use the normal feature gate implementation, which doesn't log
anything. Therefore the code doesn't get changed and only annotated so that
logcheck won't complain.

Kubernetes-commit: ee9d998d6e0c89bcf2b39fc011bfbc916060d451
2024-12-09 13:00:47 +01:00
227 changed files with 11072 additions and 1273 deletions

View File

@@ -0,0 +1,81 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
// ApplyConfigurationApplyConfiguration represents a declarative configuration of the ApplyConfiguration type for use
// with apply.
//
// ApplyConfiguration defines the desired configuration values of an object.
type ApplyConfigurationApplyConfiguration struct {
// expression will be evaluated by CEL to create an apply configuration.
// ref: https://github.com/google/cel-spec
//
// Apply configurations are declared in CEL using object initialization. For example, this CEL expression
// returns an apply configuration to set a single field:
//
// Object{
// spec: Object.spec{
// serviceAccountName: "example"
// }
// }
//
// Apply configurations may not modify atomic structs, maps or arrays due to the risk of accidental deletion of
// values not included in the apply configuration.
//
// CEL expressions have access to the object types needed to create apply configurations:
//
// - 'Object' - CEL type of the resource object.
// - 'Object.<fieldName>' - CEL type of object field (such as 'Object.spec')
// - 'Object.<fieldName1>.<fieldName2>...<fieldNameN>` - CEL type of nested field (such as 'Object.spec.containers')
//
// CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables:
//
// - 'object' - The object from the incoming request. The value is null for DELETE requests.
// - 'oldObject' - The existing object. The value is null for CREATE requests.
// - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)).
// - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind.
// - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources.
// - 'variables' - Map of composited variables, from its name to its lazily evaluated value.
// For example, a variable named 'foo' can be accessed as 'variables.foo'.
// - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.
// See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz
// - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the
// request resource.
//
// The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the
// object. No other metadata properties are accessible.
//
// Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.
// Required.
Expression *string `json:"expression,omitempty"`
}
// ApplyConfigurationApplyConfiguration constructs a declarative configuration of the ApplyConfiguration type for use with
// apply.
func ApplyConfiguration() *ApplyConfigurationApplyConfiguration {
return &ApplyConfigurationApplyConfiguration{}
}
// WithExpression sets the Expression field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Expression field is set to the value of the last call.
func (b *ApplyConfigurationApplyConfiguration) WithExpression(value string) *ApplyConfigurationApplyConfiguration {
b.Expression = &value
return b
}

View File

@@ -0,0 +1,105 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
// JSONPatchApplyConfiguration represents a declarative configuration of the JSONPatch type for use
// with apply.
//
// JSONPatch defines a JSON Patch.
type JSONPatchApplyConfiguration struct {
// expression will be evaluated by CEL to create a [JSON patch](https://jsonpatch.com/).
// ref: https://github.com/google/cel-spec
//
// expression must return an array of JSONPatch values.
//
// For example, this CEL expression returns a JSON patch to conditionally modify a value:
//
// [
// JSONPatch{op: "test", path: "/spec/example", value: "Red"},
// JSONPatch{op: "replace", path: "/spec/example", value: "Green"}
// ]
//
// To define an object for the patch value, use Object types. For example:
//
// [
// JSONPatch{
// op: "add",
// path: "/spec/selector",
// value: Object.spec.selector{matchLabels: {"environment": "test"}}
// }
// ]
//
// To use strings containing '/' and '~' as JSONPatch path keys, use "jsonpatch.escapeKey". For example:
//
// [
// JSONPatch{
// op: "add",
// path: "/metadata/labels/" + jsonpatch.escapeKey("example.com/environment"),
// value: "test"
// },
// ]
//
// CEL expressions have access to the types needed to create JSON patches and objects:
//
// - 'JSONPatch' - CEL type of JSON Patch operations. JSONPatch has the fields 'op', 'from', 'path' and 'value'.
// See [JSON patch](https://jsonpatch.com/) for more details. The 'value' field may be set to any of: string,
// integer, array, map or object. If set, the 'path' and 'from' fields must be set to a
// [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901/) string, where the 'jsonpatch.escapeKey()' CEL
// function may be used to escape path keys containing '/' and '~'.
// - 'Object' - CEL type of the resource object.
// - 'Object.<fieldName>' - CEL type of object field (such as 'Object.spec')
// - 'Object.<fieldName1>.<fieldName2>...<fieldNameN>` - CEL type of nested field (such as 'Object.spec.containers')
//
// CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables:
//
// - 'object' - The object from the incoming request. The value is null for DELETE requests.
// - 'oldObject' - The existing object. The value is null for CREATE requests.
// - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)).
// - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind.
// - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources.
// - 'variables' - Map of composited variables, from its name to its lazily evaluated value.
// For example, a variable named 'foo' can be accessed as 'variables.foo'.
// - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.
// See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz
// - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the
// request resource.
//
// CEL expressions have access to [Kubernetes CEL function libraries](https://kubernetes.io/docs/reference/using-api/cel/#cel-options-language-features-and-libraries)
// as well as:
//
// - 'jsonpatch.escapeKey' - Performs JSONPatch key escaping. '~' and '/' are escaped as '~0' and `~1' respectively).
//
// Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.
// Required.
Expression *string `json:"expression,omitempty"`
}
// JSONPatchApplyConfiguration constructs a declarative configuration of the JSONPatch type for use with
// apply.
func JSONPatch() *JSONPatchApplyConfiguration {
return &JSONPatchApplyConfiguration{}
}
// WithExpression sets the Expression field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Expression field is set to the value of the last call.
func (b *JSONPatchApplyConfiguration) WithExpression(value string) *JSONPatchApplyConfiguration {
b.Expression = &value
return b
}

View File

@@ -0,0 +1,274 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
import (
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
internal "k8s.io/client-go/applyconfigurations/internal"
metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// MutatingAdmissionPolicyApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicy type for use
// with apply.
//
// MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain.
type MutatingAdmissionPolicyApplyConfiguration struct {
metav1.TypeMetaApplyConfiguration `json:",inline"`
// metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
*metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
// spec defines the desired behavior of the MutatingAdmissionPolicy.
Spec *MutatingAdmissionPolicySpecApplyConfiguration `json:"spec,omitempty"`
}
// MutatingAdmissionPolicy constructs a declarative configuration of the MutatingAdmissionPolicy type for use with
// apply.
func MutatingAdmissionPolicy(name string) *MutatingAdmissionPolicyApplyConfiguration {
b := &MutatingAdmissionPolicyApplyConfiguration{}
b.WithName(name)
b.WithKind("MutatingAdmissionPolicy")
b.WithAPIVersion("admissionregistration.k8s.io/v1")
return b
}
// ExtractMutatingAdmissionPolicyFrom extracts the applied configuration owned by fieldManager from
// mutatingAdmissionPolicy for the specified subresource. Pass an empty string for subresource to extract
// the main resource. Common subresources include "status", "scale", etc.
// mutatingAdmissionPolicy must be a unmodified MutatingAdmissionPolicy API object that was retrieved from the Kubernetes API.
// ExtractMutatingAdmissionPolicyFrom provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractMutatingAdmissionPolicyFrom(mutatingAdmissionPolicy *admissionregistrationv1.MutatingAdmissionPolicy, fieldManager string, subresource string) (*MutatingAdmissionPolicyApplyConfiguration, error) {
b := &MutatingAdmissionPolicyApplyConfiguration{}
err := managedfields.ExtractInto(mutatingAdmissionPolicy, internal.Parser().Type("io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicy"), fieldManager, b, subresource)
if err != nil {
return nil, err
}
b.WithName(mutatingAdmissionPolicy.Name)
b.WithKind("MutatingAdmissionPolicy")
b.WithAPIVersion("admissionregistration.k8s.io/v1")
return b, nil
}
// ExtractMutatingAdmissionPolicy extracts the applied configuration owned by fieldManager from
// mutatingAdmissionPolicy. If no managedFields are found in mutatingAdmissionPolicy for fieldManager, a
// MutatingAdmissionPolicyApplyConfiguration is returned with only the Name, Namespace (if applicable),
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
// the fieldManager never owned fields any fields.
// mutatingAdmissionPolicy must be a unmodified MutatingAdmissionPolicy API object that was retrieved from the Kubernetes API.
// ExtractMutatingAdmissionPolicy provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractMutatingAdmissionPolicy(mutatingAdmissionPolicy *admissionregistrationv1.MutatingAdmissionPolicy, fieldManager string) (*MutatingAdmissionPolicyApplyConfiguration, error) {
return ExtractMutatingAdmissionPolicyFrom(mutatingAdmissionPolicy, fieldManager, "")
}
func (b MutatingAdmissionPolicyApplyConfiguration) IsApplyConfiguration() {}
// WithKind sets the Kind field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Kind field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithKind(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.TypeMetaApplyConfiguration.Kind = &value
return b
}
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the APIVersion field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithAPIVersion(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.TypeMetaApplyConfiguration.APIVersion = &value
return b
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithName(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Name = &value
return b
}
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the GenerateName field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithGenerateName(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.GenerateName = &value
return b
}
// WithNamespace sets the Namespace field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Namespace field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithNamespace(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Namespace = &value
return b
}
// WithUID sets the UID field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the UID field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithUID(value types.UID) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.UID = &value
return b
}
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceVersion field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithResourceVersion(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
return b
}
// WithGeneration sets the Generation field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Generation field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithGeneration(value int64) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Generation = &value
return b
}
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
return b
}
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
return b
}
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
return b
}
// WithLabels puts the entries into the Labels field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithLabels(entries map[string]string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Labels[k] = v
}
return b
}
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Annotations field,
// overwriting an existing map entries in Annotations field with the same key.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithAnnotations(entries map[string]string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Annotations[k] = v
}
return b
}
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
if values[i] == nil {
panic("nil value passed to WithOwnerReferences")
}
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
}
return b
}
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Finalizers field.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithFinalizers(values ...string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
}
return b
}
func (b *MutatingAdmissionPolicyApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
if b.ObjectMetaApplyConfiguration == nil {
b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{}
}
}
// WithSpec sets the Spec field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Spec field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithSpec(value *MutatingAdmissionPolicySpecApplyConfiguration) *MutatingAdmissionPolicyApplyConfiguration {
b.Spec = value
return b
}
// GetKind retrieves the value of the Kind field in the declarative configuration.
func (b *MutatingAdmissionPolicyApplyConfiguration) GetKind() *string {
return b.TypeMetaApplyConfiguration.Kind
}
// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
func (b *MutatingAdmissionPolicyApplyConfiguration) GetAPIVersion() *string {
return b.TypeMetaApplyConfiguration.APIVersion
}
// GetName retrieves the value of the Name field in the declarative configuration.
func (b *MutatingAdmissionPolicyApplyConfiguration) GetName() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Name
}
// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
func (b *MutatingAdmissionPolicyApplyConfiguration) GetNamespace() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Namespace
}

View File

@@ -0,0 +1,284 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
import (
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
internal "k8s.io/client-go/applyconfigurations/internal"
metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// MutatingAdmissionPolicyBindingApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicyBinding type for use
// with apply.
//
// MutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources.
// MutatingAdmissionPolicyBinding and the optional parameter resource together define how cluster administrators
// configure policies for clusters.
//
// For a given admission request, each binding will cause its policy to be
// evaluated N times, where N is 1 for policies/bindings that don't use
// params, otherwise N is the number of parameters selected by the binding.
// Each evaluation is constrained by a [runtime cost budget](https://kubernetes.io/docs/reference/using-api/cel/#runtime-cost-budget).
//
// Adding/removing policies, bindings, or params can not affect whether a
// given (policy, binding, param) combination is within its own CEL budget.
type MutatingAdmissionPolicyBindingApplyConfiguration struct {
metav1.TypeMetaApplyConfiguration `json:",inline"`
// metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
*metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
// spec defines the desired behavior of the MutatingAdmissionPolicyBinding.
Spec *MutatingAdmissionPolicyBindingSpecApplyConfiguration `json:"spec,omitempty"`
}
// MutatingAdmissionPolicyBinding constructs a declarative configuration of the MutatingAdmissionPolicyBinding type for use with
// apply.
func MutatingAdmissionPolicyBinding(name string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b := &MutatingAdmissionPolicyBindingApplyConfiguration{}
b.WithName(name)
b.WithKind("MutatingAdmissionPolicyBinding")
b.WithAPIVersion("admissionregistration.k8s.io/v1")
return b
}
// ExtractMutatingAdmissionPolicyBindingFrom extracts the applied configuration owned by fieldManager from
// mutatingAdmissionPolicyBinding for the specified subresource. Pass an empty string for subresource to extract
// the main resource. Common subresources include "status", "scale", etc.
// mutatingAdmissionPolicyBinding must be a unmodified MutatingAdmissionPolicyBinding API object that was retrieved from the Kubernetes API.
// ExtractMutatingAdmissionPolicyBindingFrom provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractMutatingAdmissionPolicyBindingFrom(mutatingAdmissionPolicyBinding *admissionregistrationv1.MutatingAdmissionPolicyBinding, fieldManager string, subresource string) (*MutatingAdmissionPolicyBindingApplyConfiguration, error) {
b := &MutatingAdmissionPolicyBindingApplyConfiguration{}
err := managedfields.ExtractInto(mutatingAdmissionPolicyBinding, internal.Parser().Type("io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyBinding"), fieldManager, b, subresource)
if err != nil {
return nil, err
}
b.WithName(mutatingAdmissionPolicyBinding.Name)
b.WithKind("MutatingAdmissionPolicyBinding")
b.WithAPIVersion("admissionregistration.k8s.io/v1")
return b, nil
}
// ExtractMutatingAdmissionPolicyBinding extracts the applied configuration owned by fieldManager from
// mutatingAdmissionPolicyBinding. If no managedFields are found in mutatingAdmissionPolicyBinding for fieldManager, a
// MutatingAdmissionPolicyBindingApplyConfiguration is returned with only the Name, Namespace (if applicable),
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
// the fieldManager never owned fields any fields.
// mutatingAdmissionPolicyBinding must be a unmodified MutatingAdmissionPolicyBinding API object that was retrieved from the Kubernetes API.
// ExtractMutatingAdmissionPolicyBinding provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractMutatingAdmissionPolicyBinding(mutatingAdmissionPolicyBinding *admissionregistrationv1.MutatingAdmissionPolicyBinding, fieldManager string) (*MutatingAdmissionPolicyBindingApplyConfiguration, error) {
return ExtractMutatingAdmissionPolicyBindingFrom(mutatingAdmissionPolicyBinding, fieldManager, "")
}
func (b MutatingAdmissionPolicyBindingApplyConfiguration) IsApplyConfiguration() {}
// WithKind sets the Kind field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Kind field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithKind(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.TypeMetaApplyConfiguration.Kind = &value
return b
}
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the APIVersion field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithAPIVersion(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.TypeMetaApplyConfiguration.APIVersion = &value
return b
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithName(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Name = &value
return b
}
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the GenerateName field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithGenerateName(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.GenerateName = &value
return b
}
// WithNamespace sets the Namespace field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Namespace field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithNamespace(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Namespace = &value
return b
}
// WithUID sets the UID field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the UID field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithUID(value types.UID) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.UID = &value
return b
}
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceVersion field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithResourceVersion(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
return b
}
// WithGeneration sets the Generation field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Generation field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithGeneration(value int64) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Generation = &value
return b
}
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
return b
}
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
return b
}
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
return b
}
// WithLabels puts the entries into the Labels field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithLabels(entries map[string]string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Labels[k] = v
}
return b
}
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Annotations field,
// overwriting an existing map entries in Annotations field with the same key.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithAnnotations(entries map[string]string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Annotations[k] = v
}
return b
}
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
if values[i] == nil {
panic("nil value passed to WithOwnerReferences")
}
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
}
return b
}
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Finalizers field.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithFinalizers(values ...string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
}
return b
}
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
if b.ObjectMetaApplyConfiguration == nil {
b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{}
}
}
// WithSpec sets the Spec field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Spec field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithSpec(value *MutatingAdmissionPolicyBindingSpecApplyConfiguration) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.Spec = value
return b
}
// GetKind retrieves the value of the Kind field in the declarative configuration.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) GetKind() *string {
return b.TypeMetaApplyConfiguration.Kind
}
// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) GetAPIVersion() *string {
return b.TypeMetaApplyConfiguration.APIVersion
}
// GetName retrieves the value of the Name field in the declarative configuration.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) GetName() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Name
}
// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) GetNamespace() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Namespace
}

View File

@@ -0,0 +1,75 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
// MutatingAdmissionPolicyBindingSpecApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicyBindingSpec type for use
// with apply.
//
// MutatingAdmissionPolicyBindingSpec defines the specification of the MutatingAdmissionPolicyBinding.
type MutatingAdmissionPolicyBindingSpecApplyConfiguration struct {
// policyName references a MutatingAdmissionPolicy name which the MutatingAdmissionPolicyBinding binds to.
// If the referenced resource does not exist, this binding is considered invalid and will be ignored
// Required.
PolicyName *string `json:"policyName,omitempty"`
// paramRef specifies the parameter resource used to configure the admission control policy.
// It should point to a resource of the type specified in spec.ParamKind of the bound MutatingAdmissionPolicy.
// If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the MutatingAdmissionPolicy applied.
// If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param.
ParamRef *ParamRefApplyConfiguration `json:"paramRef,omitempty"`
// matchResources limits what resources match this binding and may be mutated by it.
// Note that if matchResources matches a resource, the resource must also match a policy's matchConstraints and
// matchConditions before the resource may be mutated.
// When matchResources is unset, it does not constrain resource matching, and only the policy's matchConstraints
// and matchConditions must match for the resource to be mutated.
// Additionally, matchResources.resourceRules are optional and do not constraint matching when unset.
// Note that this is differs from MutatingAdmissionPolicy matchConstraints, where resourceRules are required.
// The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched.
// '*' matches CREATE, UPDATE and CONNECT.
MatchResources *MatchResourcesApplyConfiguration `json:"matchResources,omitempty"`
}
// MutatingAdmissionPolicyBindingSpecApplyConfiguration constructs a declarative configuration of the MutatingAdmissionPolicyBindingSpec type for use with
// apply.
func MutatingAdmissionPolicyBindingSpec() *MutatingAdmissionPolicyBindingSpecApplyConfiguration {
return &MutatingAdmissionPolicyBindingSpecApplyConfiguration{}
}
// WithPolicyName sets the PolicyName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PolicyName field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingSpecApplyConfiguration) WithPolicyName(value string) *MutatingAdmissionPolicyBindingSpecApplyConfiguration {
b.PolicyName = &value
return b
}
// WithParamRef sets the ParamRef field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ParamRef field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingSpecApplyConfiguration) WithParamRef(value *ParamRefApplyConfiguration) *MutatingAdmissionPolicyBindingSpecApplyConfiguration {
b.ParamRef = value
return b
}
// WithMatchResources sets the MatchResources field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the MatchResources field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingSpecApplyConfiguration) WithMatchResources(value *MatchResourcesApplyConfiguration) *MutatingAdmissionPolicyBindingSpecApplyConfiguration {
b.MatchResources = value
return b
}

View File

@@ -0,0 +1,172 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
import (
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
)
// MutatingAdmissionPolicySpecApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicySpec type for use
// with apply.
//
// MutatingAdmissionPolicySpec defines the desired behavior of the admission policy.
type MutatingAdmissionPolicySpecApplyConfiguration struct {
// paramKind specifies the kind of resources used to parameterize this policy.
// If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions.
// If paramKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied.
// If paramKind is specified but paramRef is unset in MutatingAdmissionPolicyBinding, the params variable will be null.
ParamKind *ParamKindApplyConfiguration `json:"paramKind,omitempty"`
// matchConstraints specifies what resources this policy is designed to validate.
// The MutatingAdmissionPolicy cares about a request if it matches _all_ Constraints.
// However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API
// MutatingAdmissionPolicy cannot match MutatingAdmissionPolicy and MutatingAdmissionPolicyBinding.
// The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched.
// '*' matches CREATE, UPDATE and CONNECT.
// Required.
MatchConstraints *MatchResourcesApplyConfiguration `json:"matchConstraints,omitempty"`
// variables contain definitions of variables that can be used in composition of other expressions.
// Each variable is defined as a named CEL expression.
// The variables defined here will be available under `variables` in other expressions of the policy
// except matchConditions because matchConditions are evaluated before the rest of the policy.
//
// The expression of a variable can refer to other variables defined earlier in the list but not those after.
// Thus, variables must be sorted by the order of first appearance and acyclic.
Variables []VariableApplyConfiguration `json:"variables,omitempty"`
// mutations contain operations to perform on matching objects.
// mutations may not be empty; a minimum of one mutation is required.
// mutations are evaluated in order, and are reinvoked according to
// the reinvocationPolicy.
// The mutations of a policy are invoked for each binding of this policy
// and reinvocation of mutations occurs on a per binding basis.
Mutations []MutationApplyConfiguration `json:"mutations,omitempty"`
// failurePolicy defines how to handle failures for the admission policy. Failures can
// occur from CEL expression parse errors, type check errors, runtime errors and invalid
// or mis-configured policy definitions or bindings.
//
// A policy is invalid if paramKind refers to a non-existent Kind.
// A binding is invalid if paramRef.name refers to a non-existent resource.
//
// failurePolicy does not define how validations that evaluate to false are handled.
//
// Allowed values are Ignore or Fail. Defaults to Fail.
FailurePolicy *admissionregistrationv1.FailurePolicyType `json:"failurePolicy,omitempty"`
// matchConditions is a list of conditions that must be met for a request to be validated.
// Match conditions filter requests that have already been matched by the matchConstraints.
// An empty list of matchConditions matches all requests.
// There are a maximum of 64 match conditions allowed.
//
// If a parameter object is provided, it can be accessed via the `params` handle in the same
// manner as validation expressions.
//
// The exact matching logic is (in order):
// 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.
// 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.
// 3. If any matchCondition evaluates to an error (but none are FALSE):
// - If failurePolicy=Fail, reject the request
// - If failurePolicy=Ignore, the policy is skipped
MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"`
// reinvocationPolicy indicates whether mutations may be called multiple times per MutatingAdmissionPolicyBinding
// as part of a single admission evaluation.
// Allowed values are "Never" and "IfNeeded".
//
// Never: These mutations will not be called more than once per binding in a single admission evaluation.
//
// IfNeeded: These mutations may be invoked more than once per binding for a single admission request and there is no guarantee of
// order with respect to other admission plugins, admission webhooks, bindings of this policy and admission policies. Mutations are only
// reinvoked when mutations change the object after this mutation is invoked.
// Required.
ReinvocationPolicy *admissionregistrationv1.ReinvocationPolicyType `json:"reinvocationPolicy,omitempty"`
}
// MutatingAdmissionPolicySpecApplyConfiguration constructs a declarative configuration of the MutatingAdmissionPolicySpec type for use with
// apply.
func MutatingAdmissionPolicySpec() *MutatingAdmissionPolicySpecApplyConfiguration {
return &MutatingAdmissionPolicySpecApplyConfiguration{}
}
// WithParamKind sets the ParamKind field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ParamKind field is set to the value of the last call.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithParamKind(value *ParamKindApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration {
b.ParamKind = value
return b
}
// WithMatchConstraints sets the MatchConstraints field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the MatchConstraints field is set to the value of the last call.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithMatchConstraints(value *MatchResourcesApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration {
b.MatchConstraints = value
return b
}
// WithVariables adds the given value to the Variables field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Variables field.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithVariables(values ...*VariableApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithVariables")
}
b.Variables = append(b.Variables, *values[i])
}
return b
}
// WithMutations adds the given value to the Mutations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Mutations field.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithMutations(values ...*MutationApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithMutations")
}
b.Mutations = append(b.Mutations, *values[i])
}
return b
}
// WithFailurePolicy sets the FailurePolicy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the FailurePolicy field is set to the value of the last call.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithFailurePolicy(value admissionregistrationv1.FailurePolicyType) *MutatingAdmissionPolicySpecApplyConfiguration {
b.FailurePolicy = &value
return b
}
// WithMatchConditions adds the given value to the MatchConditions field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the MatchConditions field.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithMatchConditions(values ...*MatchConditionApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithMatchConditions")
}
b.MatchConditions = append(b.MatchConditions, *values[i])
}
return b
}
// WithReinvocationPolicy sets the ReinvocationPolicy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ReinvocationPolicy field is set to the value of the last call.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithReinvocationPolicy(value admissionregistrationv1.ReinvocationPolicyType) *MutatingAdmissionPolicySpecApplyConfiguration {
b.ReinvocationPolicy = &value
return b
}

View File

@@ -0,0 +1,72 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
import (
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
)
// MutationApplyConfiguration represents a declarative configuration of the Mutation type for use
// with apply.
//
// Mutation specifies the CEL expression which is used to apply the Mutation.
type MutationApplyConfiguration struct {
// patchType indicates the patch strategy used.
// Allowed values are "ApplyConfiguration" and "JSONPatch".
// Required.
PatchType *admissionregistrationv1.PatchType `json:"patchType,omitempty"`
// applyConfiguration defines the desired configuration values of an object.
// The configuration is applied to the admission object using
// [structured merge diff](https://github.com/kubernetes-sigs/structured-merge-diff).
// A CEL expression is used to create apply configuration.
ApplyConfiguration *ApplyConfigurationApplyConfiguration `json:"applyConfiguration,omitempty"`
// jsonPatch defines a [JSON patch](https://jsonpatch.com/) operation to perform a mutation to the object.
// A CEL expression is used to create the JSON patch.
JSONPatch *JSONPatchApplyConfiguration `json:"jsonPatch,omitempty"`
}
// MutationApplyConfiguration constructs a declarative configuration of the Mutation type for use with
// apply.
func Mutation() *MutationApplyConfiguration {
return &MutationApplyConfiguration{}
}
// WithPatchType sets the PatchType field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PatchType field is set to the value of the last call.
func (b *MutationApplyConfiguration) WithPatchType(value admissionregistrationv1.PatchType) *MutationApplyConfiguration {
b.PatchType = &value
return b
}
// WithApplyConfiguration sets the ApplyConfiguration field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ApplyConfiguration field is set to the value of the last call.
func (b *MutationApplyConfiguration) WithApplyConfiguration(value *ApplyConfigurationApplyConfiguration) *MutationApplyConfiguration {
b.ApplyConfiguration = value
return b
}
// WithJSONPatch sets the JSONPatch field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the JSONPatch field is set to the value of the last call.
func (b *MutationApplyConfiguration) WithJSONPatch(value *JSONPatchApplyConfiguration) *MutationApplyConfiguration {
b.JSONPatch = value
return b
}

View File

@@ -24,15 +24,16 @@ package v1alpha1
// An API server instance reports the version it can decode and the version it
// encodes objects to when persisting objects in the backend.
type ServerStorageVersionApplyConfiguration struct {
// The ID of the reporting API server.
// apiServerID is the ID of the reporting API server.
APIServerID *string `json:"apiServerID,omitempty"`
// The API server encodes the object to this version when persisting it in
// encodingVersion the API server encodes the object to when persisting it in
// the backend (e.g., etcd).
EncodingVersion *string `json:"encodingVersion,omitempty"`
// decodableVersions are the encoding versions the API server can handle to decode.
// The API server can decode objects encoded in these versions.
// The encodingVersion must be included in the decodableVersions.
DecodableVersions []string `json:"decodableVersions,omitempty"`
// The API server can serve these versions.
// servedVersions lists all versions the API server can serve.
// DecodableVersions must include all ServedVersions.
ServedVersions []string `json:"servedVersions,omitempty"`
}

View File

@@ -33,11 +33,12 @@ import (
// Storage version of a specific resource.
type StorageVersionApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
// metadata is the standard object metadata.
// The name is <group>.<resource>.
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
// Spec is an empty spec. It is here to comply with Kubernetes API style.
// spec is an empty spec. It is here to comply with Kubernetes API style.
Spec *apiserverinternalv1alpha1.StorageVersionSpec `json:"spec,omitempty"`
// API server instances report the version they can decode and the version they
// status on the version the API server instance can decode from and
// encode objects to when persisting objects in the backend.
Status *StorageVersionStatusApplyConfiguration `json:"status,omitempty"`
}

View File

@@ -28,17 +28,17 @@ import (
//
// Describes the state of the storageVersion at a certain point.
type StorageVersionConditionApplyConfiguration struct {
// Type of the condition.
// type of the condition.
Type *apiserverinternalv1alpha1.StorageVersionConditionType `json:"type,omitempty"`
// Status of the condition, one of True, False, Unknown.
// status of the condition, one of True, False, Unknown.
Status *apiserverinternalv1alpha1.ConditionStatus `json:"status,omitempty"`
// If set, this represents the .metadata.generation that the condition was set based upon.
// observedGeneration represents the .metadata.generation that the condition was set based upon, if field is set.
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
// Last time the condition transitioned from one status to another.
// lastTransitionTime is the last time the condition transitioned from one status to another.
LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
// reason for the condition's last transition.
Reason *string `json:"reason,omitempty"`
// A human readable message indicating details about the transition.
// message is a human readable string indicating details about the transition.
Message *string `json:"message,omitempty"`
}

View File

@@ -24,14 +24,15 @@ package v1alpha1
// API server instances report the versions they can decode and the version they
// encode objects to when persisting objects in the backend.
type StorageVersionStatusApplyConfiguration struct {
// The reported versions per API server instance.
// storageVersions lists the reported versions per API server instance.
StorageVersions []ServerStorageVersionApplyConfiguration `json:"storageVersions,omitempty"`
// If all API server instances agree on the same encoding storage version,
// then this field is set to that version. Otherwise this field is left empty.
// commonEncodingVersion is set to an encoding storage version if all API server
// instances share that same version. If they don't share one storage version, this
// field is left empty.
// API servers should finish updating its storageVersionStatus entry before
// serving write operations, so that this field will be in sync with the reality.
CommonEncodingVersion *string `json:"commonEncodingVersion,omitempty"`
// The latest available observations of the storageVersion's state.
// conditions lists the latest available observations of the storageVersion's state.
Conditions []StorageVersionConditionApplyConfiguration `json:"conditions,omitempty"`
}

View File

@@ -62,8 +62,7 @@ type PodCertificateRequestSpecApplyConfiguration struct {
// `kubernetes.io` signers will never issue certificates with a lifetime
// longer than 24 hours.
MaxExpirationSeconds *int32 `json:"maxExpirationSeconds,omitempty"`
// pkixPublicKey is the PKIX-serialized public key the signer will issue the
// certificate to.
// The PKIX-serialized public key the signer will issue the certificate to.
//
// The key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521,
// or ED25519. Note that this list may be expanded in the future.
@@ -74,9 +73,14 @@ type PodCertificateRequestSpecApplyConfiguration struct {
// setting a status.conditions entry with a type of "Denied" and a reason of
// "UnsupportedKeyType". It may also suggest a key type that it does support
// in the message field.
//
// Deprecated: This field is replaced by StubPKCS10Request. If
// StubPKCS10Request is set, this field must be empty. Signer
// implementations should extract the public key from the StubPKCS10Request
// field.
PKIXPublicKey []byte `json:"pkixPublicKey,omitempty"`
// proofOfPossession proves that the requesting kubelet holds the private
// key corresponding to pkixPublicKey.
// A proof that the requesting kubelet holds the private key corresponding
// to pkixPublicKey.
//
// It is contructed by signing the ASCII bytes of the pod's UID using
// `pkixPublicKey`.
@@ -93,9 +97,31 @@ type PodCertificateRequestSpecApplyConfiguration struct {
// golang library function crypto/ecdsa.SignASN1)
//
// If the key is an ED25519 key, the the signature is as described by the
// [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by
// the golang library crypto/ed25519.Sign).
// [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by the
// golang library crypto/ed25519.Sign).
//
// Deprecated: This field is replaced by StubPKCS10Request. If
// StubPKCS10Request is set, this field must be empty.
ProofOfPossession []byte `json:"proofOfPossession,omitempty"`
// A PKCS#10 certificate signing request (DER-serialized) generated by
// Kubelet using the subject private key.
//
// Most signer implementations will ignore the contents of the CSR except to
// extract the subject public key. The API server automatically verifies the
// CSR signature during admission, so the signer does not need to repeat the
// verification. CSRs generated by kubelet are completely empty.
//
// The subject public key must be one of RSA3072, RSA4096, ECDSAP256,
// ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in
// the future.
//
// Signer implementations do not need to support all key types supported by
// kube-apiserver and kubelet. If a signer does not support the key type
// used for a given PodCertificateRequest, it must deny the request by
// setting a status.conditions entry with a type of "Denied" and a reason of
// "UnsupportedKeyType". It may also suggest a key type that it does support
// in the message field.
StubPKCS10Request []byte `json:"stubPKCS10Request,omitempty"`
// unverifiedUserAnnotations allow pod authors to pass additional information to
// the signer implementation. Kubernetes does not restrict or validate this
// metadata in any way.
@@ -199,6 +225,16 @@ func (b *PodCertificateRequestSpecApplyConfiguration) WithProofOfPossession(valu
return b
}
// WithStubPKCS10Request adds the given value to the StubPKCS10Request field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the StubPKCS10Request field.
func (b *PodCertificateRequestSpecApplyConfiguration) WithStubPKCS10Request(values ...byte) *PodCertificateRequestSpecApplyConfiguration {
for i := range values {
b.StubPKCS10Request = append(b.StubPKCS10Request, values[i])
}
return b
}
// WithUnverifiedUserAnnotations puts the entries into the UnverifiedUserAnnotations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the UnverifiedUserAnnotations field,

View File

@@ -0,0 +1,75 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
import (
corev1 "k8s.io/api/core/v1"
resource "k8s.io/apimachinery/pkg/api/resource"
)
// NodeAllocatableResourceClaimStatusApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceClaimStatus type for use
// with apply.
//
// NodeAllocatableResourceClaimStatus describes the status of node allocatable resources allocated via DRA.
type NodeAllocatableResourceClaimStatusApplyConfiguration struct {
// ResourceClaimName is the resource claim referenced by the pod that resulted in this node allocatable resource allocation.
ResourceClaimName *string `json:"resourceClaimName,omitempty"`
// Containers lists the names of all containers in this pod that reference the claim.
Containers []string `json:"containers,omitempty"`
// Resources is a map of the node-allocatable resource name to the aggregate quantity allocated to the claim.
Resources map[corev1.ResourceName]resource.Quantity `json:"resources,omitempty"`
}
// NodeAllocatableResourceClaimStatusApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceClaimStatus type for use with
// apply.
func NodeAllocatableResourceClaimStatus() *NodeAllocatableResourceClaimStatusApplyConfiguration {
return &NodeAllocatableResourceClaimStatusApplyConfiguration{}
}
// WithResourceClaimName sets the ResourceClaimName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceClaimName field is set to the value of the last call.
func (b *NodeAllocatableResourceClaimStatusApplyConfiguration) WithResourceClaimName(value string) *NodeAllocatableResourceClaimStatusApplyConfiguration {
b.ResourceClaimName = &value
return b
}
// WithContainers adds the given value to the Containers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Containers field.
func (b *NodeAllocatableResourceClaimStatusApplyConfiguration) WithContainers(values ...string) *NodeAllocatableResourceClaimStatusApplyConfiguration {
for i := range values {
b.Containers = append(b.Containers, values[i])
}
return b
}
// WithResources puts the entries into the Resources field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Resources field,
// overwriting an existing map entries in Resources field with the same key.
func (b *NodeAllocatableResourceClaimStatusApplyConfiguration) WithResources(entries map[corev1.ResourceName]resource.Quantity) *NodeAllocatableResourceClaimStatusApplyConfiguration {
if b.Resources == nil && len(entries) > 0 {
b.Resources = make(map[corev1.ResourceName]resource.Quantity, len(entries))
}
for k, v := range entries {
b.Resources[k] = v
}
return b
}

View File

@@ -32,7 +32,6 @@ type PodConditionApplyConfiguration struct {
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions
Type *corev1.PodConditionType `json:"type,omitempty"`
// If set, this represents the .metadata.generation that the pod condition was set based upon.
// The PodObservedGenerationTracking feature gate must be enabled to use this field.
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
// Status is the status of the condition.
// Can be True, False, Unknown.

View File

@@ -27,6 +27,14 @@ package v1
//
// It adds a name to it that uniquely identifies the ResourceClaim inside the Pod.
// Containers that need access to the ResourceClaim reference it with this name.
//
// When the DRAWorkloadResourceClaims feature gate is enabled and this Pod
// belongs to a PodGroup, a PodResourceClaim is matched to a
// PodGroupResourceClaim if all of their fields are equal (Name,
// ResourceClaimName, and ResourceClaimTemplateName). A matched claim references
// a single ResourceClaim shared across all Pods in the PodGroup, reserved for
// the PodGroup in ResourceClaimStatus.ReservedFor rather than for individual
// Pods.
type PodResourceClaimApplyConfiguration struct {
// Name uniquely identifies this resource claim inside the pod.
// This must be a DNS_LABEL.
@@ -46,6 +54,16 @@ type PodResourceClaimApplyConfiguration struct {
// generated component, will be used to form a unique name for the
// ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses.
//
// When the DRAWorkloadResourceClaims feature gate is enabled and the pod
// belongs to a PodGroup that defines a PodGroupResourceClaim with the same
// Name and ResourceClaimTemplateName, this PodResourceClaim resolves to the
// ResourceClaim generated for the PodGroup. All pods in the group that
// define an equivalent PodResourceClaim matching the
// PodGroupResourceClaim's Name and ResourceClaimTemplateName share the same
// generated ResourceClaim. ResourceClaims generated for a PodGroup are
// owned by the PodGroup and their lifecycles are tied to the PodGroup
// instead of any individual pod.
//
// This field is immutable and no changes will be made to the
// corresponding ResourceClaim by the control plane after creating the
// ResourceClaim.

View File

@@ -30,9 +30,16 @@ type PodResourceClaimStatusApplyConfiguration struct {
// which implies that the string must be a DNS_LABEL.
Name *string `json:"name,omitempty"`
// ResourceClaimName is the name of the ResourceClaim that was
// generated for the Pod in the namespace of the Pod. If this is
// unset, then generating a ResourceClaim was not necessary. The
// pod.spec.resourceClaims entry can be ignored in this case.
// generated for the Pod in the namespace of the Pod.
//
// When the DRAWorkloadResourceClaims feature is enabled and the
// corresponding PodResourceClaim matches a PodGroupResourceClaim
// made by the Pod's PodGroup, then this is the name of the
// ResourceClaim generated and reserved for the PodGroup.
//
// If this is unset, then generating a ResourceClaim was not
// necessary. The pod.spec.resourceClaims entry can be ignored in
// this case.
ResourceClaimName *string `json:"resourceClaimName,omitempty"`
}

View File

@@ -0,0 +1,46 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
// PodSchedulingGroupApplyConfiguration represents a declarative configuration of the PodSchedulingGroup type for use
// with apply.
//
// PodSchedulingGroup identifies the runtime scheduling group instance that a Pod belongs to.
// The scheduler uses this information to apply workload-aware scheduling semantics.
// Exactly one field must be specified.
type PodSchedulingGroupApplyConfiguration struct {
// PodGroupName specifies the name of the standalone PodGroup object
// that represents the runtime instance of this group.
// Must be a DNS subdomain.
PodGroupName *string `json:"podGroupName,omitempty"`
}
// PodSchedulingGroupApplyConfiguration constructs a declarative configuration of the PodSchedulingGroup type for use with
// apply.
func PodSchedulingGroup() *PodSchedulingGroupApplyConfiguration {
return &PodSchedulingGroupApplyConfiguration{}
}
// WithPodGroupName sets the PodGroupName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PodGroupName field is set to the value of the last call.
func (b *PodSchedulingGroupApplyConfiguration) WithPodGroupName(value string) *PodSchedulingGroupApplyConfiguration {
b.PodGroupName = &value
return b
}

View File

@@ -233,7 +233,6 @@ type PodSpecApplyConfiguration struct {
// When set to false, a new userns is created for the pod. Setting false is useful for
// mitigating container breakout vulnerabilities even allowing users to run their
// containers as root without actually having root privileges on the host.
// This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature.
HostUsers *bool `json:"hostUsers,omitempty"`
// SchedulingGates is an opaque list of values that if specified will block scheduling the pod.
// If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the
@@ -273,14 +272,19 @@ type PodSpecApplyConfiguration struct {
// This field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters.
// Requires the HostnameOverride feature gate to be enabled.
HostnameOverride *string `json:"hostnameOverride,omitempty"`
// WorkloadRef provides a reference to the Workload object that this Pod belongs to.
// This field is used by the scheduler to identify the PodGroup and apply the
// correct group scheduling policies. The Workload object referenced
// by this field may not exist at the time the Pod is created.
// This field is immutable, but a Workload object with the same name
// may be recreated with different policies. Doing this during pod scheduling
// SchedulingGroup provides a reference to the immediate scheduling runtime
// grouping object that this Pod belongs to.
// This field is used by the scheduler to identify the group and apply the
// correct group scheduling policies. The association with a group also
// impacts other lifecycle aspects of a Pod that are relevant in a wider context
// of scheduling like preemption, resource attachment, etc. If not specified,
// the Pod is treated as a single unit in all of these aspects.
// The group object referenced by this field may not exist at the time the
// Pod is created.
// This field is immutable, but a group object with the same name may be
// recreated with different policies. Doing this during pod scheduling
// may result in the placement not conforming to the expected policies.
WorkloadRef *WorkloadReferenceApplyConfiguration `json:"workloadRef,omitempty"`
SchedulingGroup *PodSchedulingGroupApplyConfiguration `json:"schedulingGroup,omitempty"`
}
// PodSpecApplyConfiguration constructs a declarative configuration of the PodSpec type for use with
@@ -678,10 +682,10 @@ func (b *PodSpecApplyConfiguration) WithHostnameOverride(value string) *PodSpecA
return b
}
// WithWorkloadRef sets the WorkloadRef field in the declarative configuration to the given value
// WithSchedulingGroup sets the SchedulingGroup field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the WorkloadRef field is set to the value of the last call.
func (b *PodSpecApplyConfiguration) WithWorkloadRef(value *WorkloadReferenceApplyConfiguration) *PodSpecApplyConfiguration {
b.WorkloadRef = value
// If called multiple times, the SchedulingGroup field is set to the value of the last call.
func (b *PodSpecApplyConfiguration) WithSchedulingGroup(value *PodSchedulingGroupApplyConfiguration) *PodSpecApplyConfiguration {
b.SchedulingGroup = value
return b
}

View File

@@ -139,6 +139,12 @@ type PodStatusApplyConfiguration struct {
// applied at the pod level if pod-level requests or limits are set in
// PodSpec.Resources
Resources *ResourceRequirementsApplyConfiguration `json:"resources,omitempty"`
// NodeAllocatableResourceClaimStatuses contains the status of node-allocatable resources
// that were allocated for this pod through DRA claims. This includes resources currently
// reported in v1.Node `status.allocatable` that are not extended resources
// (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources).
// Examples include "cpu", "memory", "ephemeral-storage", and hugepages.
NodeAllocatableResourceClaimStatuses []NodeAllocatableResourceClaimStatusApplyConfiguration `json:"nodeAllocatableResourceClaimStatuses,omitempty"`
}
// PodStatusApplyConfiguration constructs a declarative configuration of the PodStatus type for use with
@@ -341,3 +347,16 @@ func (b *PodStatusApplyConfiguration) WithResources(value *ResourceRequirementsA
b.Resources = value
return b
}
// WithNodeAllocatableResourceClaimStatuses adds the given value to the NodeAllocatableResourceClaimStatuses field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the NodeAllocatableResourceClaimStatuses field.
func (b *PodStatusApplyConfiguration) WithNodeAllocatableResourceClaimStatuses(values ...*NodeAllocatableResourceClaimStatusApplyConfiguration) *PodStatusApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithNodeAllocatableResourceClaimStatuses")
}
b.NodeAllocatableResourceClaimStatuses = append(b.NodeAllocatableResourceClaimStatuses, *values[i])
}
return b
}

View File

@@ -41,6 +41,9 @@ type ResourceHealthApplyConfiguration struct {
//
// In future we may want to introduce the PermanentlyUnhealthy Status.
Health *corev1.ResourceHealthStatus `json:"health,omitempty"`
// Message provides human-readable context for Health (e.g. "ECC error count exceeded threshold").
// This field is populated by the kubelet when ResourceHealthStatusMessage is enabled if the DRA plugin returns a message, and is null otherwise.
Message *string `json:"message,omitempty"`
}
// ResourceHealthApplyConfiguration constructs a declarative configuration of the ResourceHealth type for use with
@@ -64,3 +67,11 @@ func (b *ResourceHealthApplyConfiguration) WithHealth(value corev1.ResourceHealt
b.Health = &value
return b
}
// WithMessage sets the Message field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Message field is set to the value of the last call.
func (b *ResourceHealthApplyConfiguration) WithMessage(value string) *ResourceHealthApplyConfiguration {
b.Message = &value
return b
}

View File

@@ -83,7 +83,6 @@ type SecurityContextApplyConfiguration struct {
// procMount denotes the type of proc mount to use for the containers.
// The default value is Default which uses the container runtime defaults for
// readonly paths and masked paths.
// This requires the ProcMountType feature flag to be enabled.
// Note that this field cannot be set when spec.os.name is windows.
ProcMount *corev1.ProcMountType `json:"procMount,omitempty"`
// The seccomp options to use by this container. If seccomp options are

View File

@@ -39,7 +39,7 @@ type VolumeMountStatusApplyConfiguration struct {
RecursiveReadOnly *corev1.RecursiveReadOnlyMode `json:"recursiveReadOnly,omitempty"`
// volumeStatus represents volume-type-specific status about the mounted
// volume.
*VolumeStatusApplyConfiguration `json:"volumeStatus,omitempty"`
VolumeStatus *VolumeStatusApplyConfiguration `json:"volumeStatus,omitempty"`
}
// VolumeMountStatusApplyConfiguration constructs a declarative configuration of the VolumeMountStatus type for use with
@@ -80,17 +80,10 @@ func (b *VolumeMountStatusApplyConfiguration) WithRecursiveReadOnly(value corev1
return b
}
// WithImage sets the Image field in the declarative configuration to the given value
// WithVolumeStatus sets the VolumeStatus field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Image field is set to the value of the last call.
func (b *VolumeMountStatusApplyConfiguration) WithImage(value *ImageVolumeStatusApplyConfiguration) *VolumeMountStatusApplyConfiguration {
b.ensureVolumeStatusApplyConfigurationExists()
b.VolumeStatusApplyConfiguration.Image = value
// If called multiple times, the VolumeStatus field is set to the value of the last call.
func (b *VolumeMountStatusApplyConfiguration) WithVolumeStatus(value *VolumeStatusApplyConfiguration) *VolumeMountStatusApplyConfiguration {
b.VolumeStatus = value
return b
}
func (b *VolumeMountStatusApplyConfiguration) ensureVolumeStatusApplyConfigurationExists() {
if b.VolumeStatusApplyConfiguration == nil {
b.VolumeStatusApplyConfiguration = &VolumeStatusApplyConfiguration{}
}
}

View File

@@ -162,7 +162,7 @@ type VolumeSourceApplyConfiguration struct {
// A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message.
// The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field.
// The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images.
// The volume will be mounted read-only (ro) and non-executable files (noexec).
// The volume will be mounted read-only (ro).
// Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33.
// The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.
Image *ImageVolumeSourceApplyConfiguration `json:"image,omitempty"`

View File

@@ -1,74 +0,0 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
// WorkloadReferenceApplyConfiguration represents a declarative configuration of the WorkloadReference type for use
// with apply.
//
// WorkloadReference identifies the Workload object and PodGroup membership
// that a Pod belongs to. The scheduler uses this information to apply
// workload-aware scheduling semantics.
type WorkloadReferenceApplyConfiguration struct {
// Name defines the name of the Workload object this Pod belongs to.
// Workload must be in the same namespace as the Pod.
// If it doesn't match any existing Workload, the Pod will remain unschedulable
// until a Workload object is created and observed by the kube-scheduler.
// It must be a DNS subdomain.
Name *string `json:"name,omitempty"`
// PodGroup is the name of the PodGroup within the Workload that this Pod
// belongs to. If it doesn't match any existing PodGroup within the Workload,
// the Pod will remain unschedulable until the Workload object is recreated
// and observed by the kube-scheduler. It must be a DNS label.
PodGroup *string `json:"podGroup,omitempty"`
// PodGroupReplicaKey specifies the replica key of the PodGroup to which this
// Pod belongs. It is used to distinguish pods belonging to different replicas
// of the same pod group. The pod group policy is applied separately to each replica.
// When set, it must be a DNS label.
PodGroupReplicaKey *string `json:"podGroupReplicaKey,omitempty"`
}
// WorkloadReferenceApplyConfiguration constructs a declarative configuration of the WorkloadReference type for use with
// apply.
func WorkloadReference() *WorkloadReferenceApplyConfiguration {
return &WorkloadReferenceApplyConfiguration{}
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *WorkloadReferenceApplyConfiguration) WithName(value string) *WorkloadReferenceApplyConfiguration {
b.Name = &value
return b
}
// WithPodGroup sets the PodGroup field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PodGroup field is set to the value of the last call.
func (b *WorkloadReferenceApplyConfiguration) WithPodGroup(value string) *WorkloadReferenceApplyConfiguration {
b.PodGroup = &value
return b
}
// WithPodGroupReplicaKey sets the PodGroupReplicaKey field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PodGroupReplicaKey field is set to the value of the last call.
func (b *WorkloadReferenceApplyConfiguration) WithPodGroupReplicaKey(value string) *WorkloadReferenceApplyConfiguration {
b.PodGroupReplicaKey = &value
return b
}

View File

@@ -39,6 +39,12 @@ func Parser() *typed.Parser {
var parserOnce sync.Once
var parser *typed.Parser
var schemaYAML = typed.YAMLObject(`types:
- name: io.k8s.api.admissionregistration.v1.ApplyConfiguration
map:
fields:
- name: expression
type:
scalar: string
- name: io.k8s.api.admissionregistration.v1.AuditAnnotation
map:
fields:
@@ -61,6 +67,12 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: io.k8s.api.admissionregistration.v1.JSONPatch
map:
fields:
- name: expression
type:
scalar: string
- name: io.k8s.api.admissionregistration.v1.MatchCondition
map:
fields:
@@ -97,6 +109,87 @@ var schemaYAML = typed.YAMLObject(`types:
namedType: io.k8s.api.admissionregistration.v1.NamedRuleWithOperations
elementRelationship: atomic
elementRelationship: atomic
- name: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicy
map:
fields:
- name: apiVersion
type:
scalar: string
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: spec
type:
namedType: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicySpec
default: {}
- name: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyBinding
map:
fields:
- name: apiVersion
type:
scalar: string
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: spec
type:
namedType: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyBindingSpec
default: {}
- name: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyBindingSpec
map:
fields:
- name: matchResources
type:
namedType: io.k8s.api.admissionregistration.v1.MatchResources
- name: paramRef
type:
namedType: io.k8s.api.admissionregistration.v1.ParamRef
- name: policyName
type:
scalar: string
- name: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicySpec
map:
fields:
- name: failurePolicy
type:
scalar: string
- name: matchConditions
type:
list:
elementType:
namedType: io.k8s.api.admissionregistration.v1.MatchCondition
elementRelationship: associative
keys:
- name
- name: matchConstraints
type:
namedType: io.k8s.api.admissionregistration.v1.MatchResources
- name: mutations
type:
list:
elementType:
namedType: io.k8s.api.admissionregistration.v1.Mutation
elementRelationship: atomic
- name: paramKind
type:
namedType: io.k8s.api.admissionregistration.v1.ParamKind
- name: reinvocationPolicy
type:
scalar: string
- name: variables
type:
list:
elementType:
namedType: io.k8s.api.admissionregistration.v1.Variable
elementRelationship: atomic
- name: io.k8s.api.admissionregistration.v1.MutatingWebhook
map:
fields:
@@ -170,6 +263,19 @@ var schemaYAML = typed.YAMLObject(`types:
elementRelationship: associative
keys:
- name
- name: io.k8s.api.admissionregistration.v1.Mutation
map:
fields:
- name: applyConfiguration
type:
namedType: io.k8s.api.admissionregistration.v1.ApplyConfiguration
- name: jsonPatch
type:
namedType: io.k8s.api.admissionregistration.v1.JSONPatch
- name: patchType
type:
scalar: string
default: ""
- name: io.k8s.api.admissionregistration.v1.NamedRuleWithOperations
map:
fields:
@@ -3983,6 +4089,9 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: stubPKCS10Request
type:
scalar: string
- name: unverifiedUserAnnotations
type:
map:
@@ -5931,6 +6040,24 @@ var schemaYAML = typed.YAMLObject(`types:
- name: requiredDuringSchedulingIgnoredDuringExecution
type:
namedType: io.k8s.api.core.v1.NodeSelector
- name: io.k8s.api.core.v1.NodeAllocatableResourceClaimStatus
map:
fields:
- name: containers
type:
list:
elementType:
scalar: string
elementRelationship: associative
- name: resourceClaimName
type:
scalar: string
default: ""
- name: resources
type:
map:
elementType:
namedType: io.k8s.apimachinery.pkg.api.resource.Quantity
- name: io.k8s.api.core.v1.NodeCondition
map:
fields:
@@ -6764,6 +6891,16 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: io.k8s.api.core.v1.PodSchedulingGroup
map:
fields:
- name: podGroupName
type:
scalar: string
unions:
- fields:
- fieldName: podGroupName
discriminatorValue: PodGroupName
- name: io.k8s.api.core.v1.PodSecurityContext
map:
fields:
@@ -6951,6 +7088,9 @@ var schemaYAML = typed.YAMLObject(`types:
elementRelationship: associative
keys:
- name
- name: schedulingGroup
type:
namedType: io.k8s.api.core.v1.PodSchedulingGroup
- name: securityContext
type:
namedType: io.k8s.api.core.v1.PodSecurityContext
@@ -6995,9 +7135,6 @@ var schemaYAML = typed.YAMLObject(`types:
elementRelationship: associative
keys:
- name
- name: workloadRef
type:
namedType: io.k8s.api.core.v1.WorkloadReference
- name: io.k8s.api.core.v1.PodStatus
map:
fields:
@@ -7047,6 +7184,12 @@ var schemaYAML = typed.YAMLObject(`types:
- name: message
type:
scalar: string
- name: nodeAllocatableResourceClaimStatuses
type:
list:
elementType:
namedType: io.k8s.api.core.v1.NodeAllocatableResourceClaimStatus
elementRelationship: atomic
- name: nominatedNodeName
type:
scalar: string
@@ -7410,6 +7553,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: health
type:
scalar: string
- name: message
type:
scalar: string
- name: resourceID
type:
scalar: string
@@ -8301,7 +8447,6 @@ var schemaYAML = typed.YAMLObject(`types:
- name: volumeStatus
type:
namedType: io.k8s.api.core.v1.VolumeStatus
default: {}
- name: io.k8s.api.core.v1.VolumeNodeAffinity
map:
fields:
@@ -8390,20 +8535,6 @@ var schemaYAML = typed.YAMLObject(`types:
- name: runAsUserName
type:
scalar: string
- name: io.k8s.api.core.v1.WorkloadReference
map:
fields:
- name: name
type:
scalar: string
default: ""
- name: podGroup
type:
scalar: string
default: ""
- name: podGroupReplicaKey
type:
scalar: string
- name: io.k8s.api.discovery.v1.Endpoint
map:
fields:
@@ -12345,6 +12476,11 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: nodeAllocatableResourceMappings
type:
map:
elementType:
namedType: io.k8s.api.resource.v1.NodeAllocatableResourceMapping
- name: nodeName
type:
scalar: string
@@ -12394,15 +12530,39 @@ var schemaYAML = typed.YAMLObject(`types:
- name: bool
type:
scalar: boolean
- name: bools
type:
list:
elementType:
scalar: boolean
elementRelationship: atomic
- name: int
type:
scalar: numeric
- name: ints
type:
list:
elementType:
scalar: numeric
elementRelationship: atomic
- name: string
type:
scalar: string
- name: strings
type:
list:
elementType:
scalar: string
elementRelationship: atomic
- name: version
type:
scalar: string
- name: versions
type:
list:
elementType:
scalar: string
elementRelationship: atomic
- name: io.k8s.api.resource.v1.DeviceCapacity
map:
fields:
@@ -12697,6 +12857,15 @@ var schemaYAML = typed.YAMLObject(`types:
elementType:
scalar: string
elementRelationship: atomic
- name: io.k8s.api.resource.v1.NodeAllocatableResourceMapping
map:
fields:
- name: allocationMultiplier
type:
namedType: io.k8s.apimachinery.pkg.api.resource.Quantity
- name: capacityKey
type:
scalar: string
- name: io.k8s.api.resource.v1.OpaqueDeviceConfiguration
map:
fields:
@@ -12944,6 +13113,94 @@ var schemaYAML = typed.YAMLObject(`types:
- name: pool
type:
scalar: string
- name: io.k8s.api.resource.v1alpha3.PoolStatus
map:
fields:
- name: allocatedDevices
type:
scalar: numeric
- name: availableDevices
type:
scalar: numeric
- name: driver
type:
scalar: string
- name: generation
type:
scalar: numeric
default: 0
- name: nodeName
type:
scalar: string
- name: poolName
type:
scalar: string
- name: resourceSliceCount
type:
scalar: numeric
- name: totalDevices
type:
scalar: numeric
- name: unavailableDevices
type:
scalar: numeric
- name: validationError
type:
scalar: string
- name: io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequest
map:
fields:
- name: apiVersion
type:
scalar: string
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: spec
type:
namedType: io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestSpec
default: {}
- name: status
type:
namedType: io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestStatus
- name: io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestSpec
map:
fields:
- name: driver
type:
scalar: string
default: ""
- name: limit
type:
scalar: numeric
default: 100
- name: poolName
type:
scalar: string
- name: io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestStatus
map:
fields:
- name: conditions
type:
list:
elementType:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition
elementRelationship: associative
keys:
- type
- name: poolCount
type:
scalar: numeric
- name: pools
type:
list:
elementType:
namedType: io.k8s.api.resource.v1alpha3.PoolStatus
elementRelationship: atomic
- name: io.k8s.api.resource.v1beta1.AllocatedDeviceStatus
map:
fields:
@@ -13029,6 +13286,11 @@ var schemaYAML = typed.YAMLObject(`types:
elementType:
namedType: io.k8s.api.resource.v1beta1.DeviceCounterConsumption
elementRelationship: atomic
- name: nodeAllocatableResourceMappings
type:
map:
elementType:
namedType: io.k8s.api.resource.v1beta1.NodeAllocatableResourceMapping
- name: nodeName
type:
scalar: string
@@ -13148,15 +13410,39 @@ var schemaYAML = typed.YAMLObject(`types:
- name: bool
type:
scalar: boolean
- name: bools
type:
list:
elementType:
scalar: boolean
elementRelationship: atomic
- name: int
type:
scalar: numeric
- name: ints
type:
list:
elementType:
scalar: numeric
elementRelationship: atomic
- name: string
type:
scalar: string
- name: strings
type:
list:
elementType:
scalar: string
elementRelationship: atomic
- name: version
type:
scalar: string
- name: versions
type:
list:
elementType:
scalar: string
elementRelationship: atomic
- name: io.k8s.api.resource.v1beta1.DeviceCapacity
map:
fields:
@@ -13445,6 +13731,15 @@ var schemaYAML = typed.YAMLObject(`types:
elementType:
scalar: string
elementRelationship: atomic
- name: io.k8s.api.resource.v1beta1.NodeAllocatableResourceMapping
map:
fields:
- name: allocationMultiplier
type:
namedType: io.k8s.apimachinery.pkg.api.resource.Quantity
- name: capacityKey
type:
scalar: string
- name: io.k8s.api.resource.v1beta1.OpaqueDeviceConfiguration
map:
fields:
@@ -13770,6 +14065,11 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: nodeAllocatableResourceMappings
type:
map:
elementType:
namedType: io.k8s.api.resource.v1beta2.NodeAllocatableResourceMapping
- name: nodeName
type:
scalar: string
@@ -13819,15 +14119,39 @@ var schemaYAML = typed.YAMLObject(`types:
- name: bool
type:
scalar: boolean
- name: bools
type:
list:
elementType:
scalar: boolean
elementRelationship: atomic
- name: int
type:
scalar: numeric
- name: ints
type:
list:
elementType:
scalar: numeric
elementRelationship: atomic
- name: string
type:
scalar: string
- name: strings
type:
list:
elementType:
scalar: string
elementRelationship: atomic
- name: version
type:
scalar: string
- name: versions
type:
list:
elementType:
scalar: string
elementRelationship: atomic
- name: io.k8s.api.resource.v1beta2.DeviceCapacity
map:
fields:
@@ -14057,6 +14381,60 @@ var schemaYAML = typed.YAMLObject(`types:
- name: value
type:
scalar: string
- name: io.k8s.api.resource.v1beta2.DeviceTaintRule
map:
fields:
- name: apiVersion
type:
scalar: string
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: spec
type:
namedType: io.k8s.api.resource.v1beta2.DeviceTaintRuleSpec
default: {}
- name: status
type:
namedType: io.k8s.api.resource.v1beta2.DeviceTaintRuleStatus
default: {}
- name: io.k8s.api.resource.v1beta2.DeviceTaintRuleSpec
map:
fields:
- name: deviceSelector
type:
namedType: io.k8s.api.resource.v1beta2.DeviceTaintSelector
- name: taint
type:
namedType: io.k8s.api.resource.v1beta2.DeviceTaint
default: {}
- name: io.k8s.api.resource.v1beta2.DeviceTaintRuleStatus
map:
fields:
- name: conditions
type:
list:
elementType:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition
elementRelationship: associative
keys:
- type
- name: io.k8s.api.resource.v1beta2.DeviceTaintSelector
map:
fields:
- name: device
type:
scalar: string
- name: driver
type:
scalar: string
- name: pool
type:
scalar: string
- name: io.k8s.api.resource.v1beta2.DeviceToleration
map:
fields:
@@ -14122,6 +14500,15 @@ var schemaYAML = typed.YAMLObject(`types:
elementType:
scalar: string
elementRelationship: atomic
- name: io.k8s.api.resource.v1beta2.NodeAllocatableResourceMapping
map:
fields:
- name: allocationMultiplier
type:
namedType: io.k8s.apimachinery.pkg.api.resource.Quantity
- name: capacityKey
type:
scalar: string
- name: io.k8s.api.resource.v1beta2.OpaqueDeviceConfiguration
map:
fields:
@@ -14324,7 +14711,7 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: numeric
default: 0
- name: io.k8s.api.scheduling.v1alpha1.BasicSchedulingPolicy
- name: io.k8s.api.scheduling.v1alpha2.BasicSchedulingPolicy
map:
elementType:
scalar: untyped
@@ -14336,80 +14723,14 @@ var schemaYAML = typed.YAMLObject(`types:
elementType:
namedType: __untyped_deduced_
elementRelationship: separable
- name: io.k8s.api.scheduling.v1alpha1.GangSchedulingPolicy
- name: io.k8s.api.scheduling.v1alpha2.GangSchedulingPolicy
map:
fields:
- name: minCount
type:
scalar: numeric
default: 0
- name: io.k8s.api.scheduling.v1alpha1.PodGroup
map:
fields:
- name: name
type:
scalar: string
default: ""
- name: policy
type:
namedType: io.k8s.api.scheduling.v1alpha1.PodGroupPolicy
default: {}
- name: io.k8s.api.scheduling.v1alpha1.PodGroupPolicy
map:
fields:
- name: basic
type:
namedType: io.k8s.api.scheduling.v1alpha1.BasicSchedulingPolicy
- name: gang
type:
namedType: io.k8s.api.scheduling.v1alpha1.GangSchedulingPolicy
unions:
- fields:
- fieldName: basic
discriminatorValue: Basic
- fieldName: gang
discriminatorValue: Gang
- name: io.k8s.api.scheduling.v1alpha1.PriorityClass
map:
fields:
- name: apiVersion
type:
scalar: string
- name: description
type:
scalar: string
- name: globalDefault
type:
scalar: boolean
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: preemptionPolicy
type:
scalar: string
- name: value
type:
scalar: numeric
default: 0
- name: io.k8s.api.scheduling.v1alpha1.TypedLocalObjectReference
map:
fields:
- name: apiGroup
type:
scalar: string
- name: kind
type:
scalar: string
default: ""
- name: name
type:
scalar: string
default: ""
- name: io.k8s.api.scheduling.v1alpha1.Workload
- name: io.k8s.api.scheduling.v1alpha2.PodGroup
map:
fields:
- name: apiVersion
@@ -14424,19 +14745,210 @@ var schemaYAML = typed.YAMLObject(`types:
default: {}
- name: spec
type:
namedType: io.k8s.api.scheduling.v1alpha1.WorkloadSpec
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSpec
default: {}
- name: io.k8s.api.scheduling.v1alpha1.WorkloadSpec
- name: status
type:
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupStatus
default: {}
- name: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaim
map:
fields:
- name: name
type:
scalar: string
default: ""
- name: resourceClaimName
type:
scalar: string
- name: resourceClaimTemplateName
type:
scalar: string
- name: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaimStatus
map:
fields:
- name: name
type:
scalar: string
default: ""
- name: resourceClaimName
type:
scalar: string
- name: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingConstraints
map:
fields:
- name: topology
type:
list:
elementType:
namedType: io.k8s.api.scheduling.v1alpha2.TopologyConstraint
elementRelationship: atomic
- name: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingPolicy
map:
fields:
- name: basic
type:
namedType: io.k8s.api.scheduling.v1alpha2.BasicSchedulingPolicy
- name: gang
type:
namedType: io.k8s.api.scheduling.v1alpha2.GangSchedulingPolicy
unions:
- fields:
- fieldName: basic
discriminatorValue: Basic
- fieldName: gang
discriminatorValue: Gang
- name: io.k8s.api.scheduling.v1alpha2.PodGroupSpec
map:
fields:
- name: disruptionMode
type:
scalar: string
default: Pod
- name: podGroupTemplateRef
type:
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupTemplateReference
- name: priority
type:
scalar: numeric
- name: priorityClassName
type:
scalar: string
- name: resourceClaims
type:
list:
elementType:
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaim
elementRelationship: associative
keys:
- name
- name: schedulingConstraints
type:
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingConstraints
- name: schedulingPolicy
type:
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingPolicy
default: {}
- name: io.k8s.api.scheduling.v1alpha2.PodGroupStatus
map:
fields:
- name: conditions
type:
list:
elementType:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition
elementRelationship: associative
keys:
- type
- name: resourceClaimStatuses
type:
list:
elementType:
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaimStatus
elementRelationship: associative
keys:
- name
- name: io.k8s.api.scheduling.v1alpha2.PodGroupTemplate
map:
fields:
- name: disruptionMode
type:
scalar: string
- name: name
type:
scalar: string
default: ""
- name: priority
type:
scalar: numeric
- name: priorityClassName
type:
scalar: string
- name: resourceClaims
type:
list:
elementType:
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaim
elementRelationship: associative
keys:
- name
- name: schedulingConstraints
type:
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingConstraints
- name: schedulingPolicy
type:
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingPolicy
default: {}
- name: io.k8s.api.scheduling.v1alpha2.PodGroupTemplateReference
map:
fields:
- name: workload
type:
namedType: io.k8s.api.scheduling.v1alpha2.WorkloadPodGroupTemplateReference
unions:
- fields:
- fieldName: workload
discriminatorValue: Workload
- name: io.k8s.api.scheduling.v1alpha2.TopologyConstraint
map:
fields:
- name: key
type:
scalar: string
default: ""
- name: io.k8s.api.scheduling.v1alpha2.TypedLocalObjectReference
map:
fields:
- name: apiGroup
type:
scalar: string
- name: kind
type:
scalar: string
default: ""
- name: name
type:
scalar: string
default: ""
- name: io.k8s.api.scheduling.v1alpha2.Workload
map:
fields:
- name: apiVersion
type:
scalar: string
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: spec
type:
namedType: io.k8s.api.scheduling.v1alpha2.WorkloadSpec
default: {}
- name: io.k8s.api.scheduling.v1alpha2.WorkloadPodGroupTemplateReference
map:
fields:
- name: podGroupTemplateName
type:
scalar: string
default: ""
- name: workloadName
type:
scalar: string
default: ""
- name: io.k8s.api.scheduling.v1alpha2.WorkloadSpec
map:
fields:
- name: controllerRef
type:
namedType: io.k8s.api.scheduling.v1alpha1.TypedLocalObjectReference
- name: podGroups
namedType: io.k8s.api.scheduling.v1alpha2.TypedLocalObjectReference
- name: podGroupTemplates
type:
list:
elementType:
namedType: io.k8s.api.scheduling.v1alpha1.PodGroup
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupTemplate
elementRelationship: associative
keys:
- name
@@ -14498,6 +15010,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: podInfoOnMount
type:
scalar: boolean
- name: preventPodSchedulingIfMissing
type:
scalar: boolean
- name: requiresRepublish
type:
scalar: boolean
@@ -14907,6 +15422,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: podInfoOnMount
type:
scalar: boolean
- name: preventPodSchedulingIfMissing
type:
scalar: boolean
- name: requiresRepublish
type:
scalar: boolean

View File

@@ -36,7 +36,7 @@ type AllocationResultApplyConfiguration struct {
// AllocationTimestamp stores the time when the resources were allocated.
// This field is not guaranteed to be set, in which case that time is unknown.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gate.
AllocationTimestamp *metav1.Time `json:"allocationTimestamp,omitempty"`
}

View File

@@ -72,6 +72,14 @@ type CELDeviceSelectorApplyConfiguration struct {
//
// cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool)
//
// When the DRAListTypeAttributes feature gate is enabled,
// the includes() helper is available and it can work for both scalar
// and list-type attributes. It was introduced to support smooth migration
// from scalar attributes to list-type attributes while keeping
// CEL expressions simple. For example:
//
// device.attributes["dra.example.com"].models.includes("some-model")
//
// The length of the expression must be smaller or equal to 10 Ki. The
// cost of evaluating it is also limited based on the estimated number
// of logical steps.

View File

@@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
apicorev1 "k8s.io/api/core/v1"
resourcev1 "k8s.io/api/resource/v1"
corev1 "k8s.io/client-go/applyconfigurations/core/v1"
)
@@ -74,7 +75,7 @@ type DeviceApplyConfiguration struct {
// any device in a ResourceSlice, then the maximum number of
// allowed devices per ResourceSlice is 64 instead of 128.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Taints []DeviceTaintApplyConfiguration `json:"taints,omitempty"`
// BindsToNode indicates if the usage of an allocation involving this device
@@ -82,7 +83,7 @@ type DeviceApplyConfiguration struct {
// If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector
// to match the node where the allocation was made.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindsToNode *bool `json:"bindsToNode,omitempty"`
// BindingConditions defines the conditions for proceeding with binding.
@@ -94,7 +95,7 @@ type DeviceApplyConfiguration struct {
//
// The conditions must be a valid condition type string.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingConditions []string `json:"bindingConditions,omitempty"`
// BindingFailureConditions defines the conditions for binding failure.
@@ -105,7 +106,7 @@ type DeviceApplyConfiguration struct {
//
// The conditions must be a valid condition type string.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"`
// AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.
@@ -113,6 +114,18 @@ type DeviceApplyConfiguration struct {
// If AllowMultipleAllocations is set to true, the device can be allocated more than once,
// and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.
AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty"`
// NodeAllocatableResourceMappings defines the mapping of node resources
// that are managed by the DRA driver exposing this device. This includes resources currently
// reported in v1.Node `status.allocatable` that are not extended resources
// (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources).
// Examples include "cpu", "memory", "ephemeral-storage", and hugepages.
// In addition to standard requests made through the Pod `spec`, these resources
// can also be requested through claims and allocated by the DRA driver.
// For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory
// dependencies of an accelerator device.
// The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory").
// Extended resource names are not permitted as keys.
NodeAllocatableResourceMappings map[apicorev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration `json:"nodeAllocatableResourceMappings,omitempty"`
}
// DeviceApplyConfiguration constructs a declarative configuration of the Device type for use with
@@ -242,3 +255,17 @@ func (b *DeviceApplyConfiguration) WithAllowMultipleAllocations(value bool) *Dev
b.AllowMultipleAllocations = &value
return b
}
// WithNodeAllocatableResourceMappings puts the entries into the NodeAllocatableResourceMappings field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the NodeAllocatableResourceMappings field,
// overwriting an existing map entries in NodeAllocatableResourceMappings field with the same key.
func (b *DeviceApplyConfiguration) WithNodeAllocatableResourceMappings(entries map[apicorev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration) *DeviceApplyConfiguration {
if b.NodeAllocatableResourceMappings == nil && len(entries) > 0 {
b.NodeAllocatableResourceMappings = make(map[apicorev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration, len(entries))
}
for k, v := range entries {
b.NodeAllocatableResourceMappings[k] = v
}
return b
}

View File

@@ -32,6 +32,22 @@ type DeviceAttributeApplyConfiguration struct {
// VersionValue is a semantic version according to semver.org spec 2.0.0.
// Must not be longer than 64 characters.
VersionValue *string `json:"version,omitempty"`
// IntValues is a non-empty list of numbers.
//
// This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
IntValues []int64 `json:"ints,omitempty"`
// BoolValues is a non-empty list of true/false values.
BoolValues []bool `json:"bools,omitempty"`
// StringValues is a non-empty list of strings.
// Each string must not be longer than 64 characters.
//
// This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
StringValues []string `json:"strings,omitempty"`
// VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0.
// Each version string must not be longer than 64 characters.
//
// This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
VersionValues []string `json:"versions,omitempty"`
}
// DeviceAttributeApplyConfiguration constructs a declarative configuration of the DeviceAttribute type for use with
@@ -71,3 +87,43 @@ func (b *DeviceAttributeApplyConfiguration) WithVersionValue(value string) *Devi
b.VersionValue = &value
return b
}
// WithIntValues adds the given value to the IntValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the IntValues field.
func (b *DeviceAttributeApplyConfiguration) WithIntValues(values ...int64) *DeviceAttributeApplyConfiguration {
for i := range values {
b.IntValues = append(b.IntValues, values[i])
}
return b
}
// WithBoolValues adds the given value to the BoolValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the BoolValues field.
func (b *DeviceAttributeApplyConfiguration) WithBoolValues(values ...bool) *DeviceAttributeApplyConfiguration {
for i := range values {
b.BoolValues = append(b.BoolValues, values[i])
}
return b
}
// WithStringValues adds the given value to the StringValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the StringValues field.
func (b *DeviceAttributeApplyConfiguration) WithStringValues(values ...string) *DeviceAttributeApplyConfiguration {
for i := range values {
b.StringValues = append(b.StringValues, values[i])
}
return b
}
// WithVersionValues adds the given value to the VersionValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the VersionValues field.
func (b *DeviceAttributeApplyConfiguration) WithVersionValues(values ...string) *DeviceAttributeApplyConfiguration {
for i := range values {
b.VersionValues = append(b.VersionValues, values[i])
}
return b
}

View File

@@ -41,7 +41,7 @@ type DeviceClassSpecApplyConfiguration struct {
// If two classes are created at the same time, then the name of the class
// lexicographically sorted first is picked.
//
// This is an alpha field.
// This is a beta field.
ExtendedResourceName *string `json:"extendedResourceName,omitempty"`
}

View File

@@ -48,11 +48,21 @@ type DeviceConstraintApplyConfiguration struct {
// its specification, but if one device doesn't, then it also will not be
// chosen.
//
// When the DRAListTypeAttributes feature gate is enabled, comparison uses
// set semantics(i.e., element order and duplicates are ignored): list-valued attributes
// match when the intersection across all devices is non-empty.
// Scalar values are treated as single-element lists for backward compatibility.
//
// Must include the domain qualifier.
MatchAttribute *resourcev1.FullyQualifiedName `json:"matchAttribute,omitempty"`
// DistinctAttribute requires that all devices in question have this
// attribute and that its type and value are unique across those devices.
//
// When the DRAListTypeAttributes feature gate is enabled, comparison uses
// set semantics (i.e., element order and duplicates are ignored):
// list-valued attributes must be pairwise disjoint across devices.
// Scalar values are treated as singleton sets for backward compatibility.
//
// This acts as the inverse of MatchAttribute.
//
// This constraint is used to avoid allocating multiple requests to the same device

View File

@@ -57,8 +57,7 @@ type DeviceRequestAllocationResultApplyConfiguration struct {
// administrative access. See the corresponding request field
// for a definition of mode.
//
// This is an beta field and requires enabling the DRAAdminAccess
// feature gate. Admin access is disabled if this field is unset or
// Admin access is disabled if this field is unset or
// set to false, otherwise it is enabled.
AdminAccess *bool `json:"adminAccess,omitempty"`
// A copy of all tolerations specified in the request at the time
@@ -66,19 +65,19 @@ type DeviceRequestAllocationResultApplyConfiguration struct {
//
// The maximum number of tolerations is 16.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
// BindingConditions contains a copy of the BindingConditions
// from the corresponding ResourceSlice at the time of allocation.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingConditions []string `json:"bindingConditions,omitempty"`
// BindingFailureConditions contains a copy of the BindingFailureConditions
// from the corresponding ResourceSlice at the time of allocation.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"`
// ShareID uniquely identifies an individual allocation share of the device,

View File

@@ -93,7 +93,7 @@ type DeviceSubRequestApplyConfiguration struct {
//
// The maximum number of tolerations is 16.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
// Capacity define resource requirements against each capacity.

View File

@@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct {
// nodes is not valid here. More effects may get added in the future.
// Consumers must treat unknown effects like None.
Effect *resourcev1.DeviceTaintEffect `json:"effect,omitempty"`
// TimeAdded represents the time at which the taint was added.
// TimeAdded represents the time at which the taint was added or
// (only in a DeviceTaintRule) the effect was modified.
// Added automatically during create or update if not set.
//
// In addition, in a DeviceTaintRule a value provided during
// an update gets replaced with the current time if the provided
// value is the same as the old one and the new effect is different.
// Changing the key and/or value while keeping the effect unchanged
// is possible and does not update the time stamp because the eviction
// which uses it is either already started (NoExecute) or
// not started yet (NoEffect, NoSchedule).
TimeAdded *metav1.Time `json:"timeAdded,omitempty"`
}

View File

@@ -72,8 +72,7 @@ type ExactDeviceRequestApplyConfiguration struct {
// all ordinary claims to the device with respect to access modes and
// any resource allocations.
//
// This is an beta field and requires enabling the DRAAdminAccess
// feature gate. Admin access is disabled if this field is unset or
// Admin access is disabled if this field is unset or
// set to false, otherwise it is enabled.
AdminAccess *bool `json:"adminAccess,omitempty"`
// If specified, the request's tolerations.
@@ -91,7 +90,7 @@ type ExactDeviceRequestApplyConfiguration struct {
//
// The maximum number of tolerations is 16.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
// Capacity define resource requirements against each capacity.

View File

@@ -29,7 +29,7 @@ type NetworkDeviceDataApplyConfiguration struct {
// the allocated device. This might be the name of a physical or virtual
// network interface being configured in the pod.
//
// Must not be longer than 256 characters.
// Must not be longer than 256 bytes.
InterfaceName *string `json:"interfaceName,omitempty"`
// IPs lists the network addresses assigned to the device's network interface.
// This can include both IPv4 and IPv6 addresses.
@@ -39,7 +39,7 @@ type NetworkDeviceDataApplyConfiguration struct {
IPs []string `json:"ips,omitempty"`
// HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.
//
// Must not be longer than 128 characters.
// Must not be longer than 128 bytes.
HardwareAddress *string `json:"hardwareAddress,omitempty"`
}

View File

@@ -0,0 +1,84 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
import (
resourcev1 "k8s.io/api/resource/v1"
resource "k8s.io/apimachinery/pkg/api/resource"
)
// NodeAllocatableResourceMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceMapping type for use
// with apply.
//
// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity
// units requested to the corresponding quantity of the node allocatable resource.
type NodeAllocatableResourceMappingApplyConfiguration struct {
// CapacityKey references a capacity name defined as a key in the
// `spec.devices[*].capacity` map. When this field is set, the value associated with
// this key in the `status.allocation.devices.results[*].consumedCapacity` map
// (for a specific claim allocation) determines the base quantity for
// the node allocatable resource. If `allocationMultiplier` is also set, it is
// multiplied with the base quantity.
// For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi",
// and this field is set to "dra.example.com/memory", then for a claim allocation
// that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the
// node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should
// be omitted or set to "1".
CapacityKey *resourcev1.QualifiedName `json:"capacityKey,omitempty"`
// AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim.
// It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set.
// 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim.
// a. A DRA driver representing each CPU core as a device would have
// {ResourceName: "cpu", allocationMultiplier: "2"} in its
// `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim,
// 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity.
// b. A GPU device that needs additional node memory per GPU allocation would
// have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated
// GPU device instance of this type will account for 2Gi of memory.
//
// 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed.
// The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`.
// For example, if a Device's capacity "dra.example.com/cores" is consumed,
// and each "core" provides 2 "cpu"s, the mapping would be:
// {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}.
// If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16.
AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty"`
}
// NodeAllocatableResourceMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceMapping type for use with
// apply.
func NodeAllocatableResourceMapping() *NodeAllocatableResourceMappingApplyConfiguration {
return &NodeAllocatableResourceMappingApplyConfiguration{}
}
// WithCapacityKey sets the CapacityKey field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CapacityKey field is set to the value of the last call.
func (b *NodeAllocatableResourceMappingApplyConfiguration) WithCapacityKey(value resourcev1.QualifiedName) *NodeAllocatableResourceMappingApplyConfiguration {
b.CapacityKey = &value
return b
}
// WithAllocationMultiplier sets the AllocationMultiplier field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the AllocationMultiplier field is set to the value of the last call.
func (b *NodeAllocatableResourceMappingApplyConfiguration) WithAllocationMultiplier(value resource.Quantity) *NodeAllocatableResourceMappingApplyConfiguration {
b.AllocationMultiplier = &value
return b
}

View File

@@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct {
// nodes is not valid here. More effects may get added in the future.
// Consumers must treat unknown effects like None.
Effect *resourcev1alpha3.DeviceTaintEffect `json:"effect,omitempty"`
// TimeAdded represents the time at which the taint was added.
// TimeAdded represents the time at which the taint was added or
// (only in a DeviceTaintRule) the effect was modified.
// Added automatically during create or update if not set.
//
// In addition, in a DeviceTaintRule a value provided during
// an update gets replaced with the current time if the provided
// value is the same as the old one and the new effect is different.
// Changing the key and/or value while keeping the effect unchanged
// is possible and does not update the time stamp because the eviction
// which uses it is either already started (NoExecute) or
// not started yet (NoEffect, NoSchedule).
TimeAdded *v1.Time `json:"timeAdded,omitempty"`
}

View File

@@ -0,0 +1,152 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha3
// PoolStatusApplyConfiguration represents a declarative configuration of the PoolStatus type for use
// with apply.
//
// PoolStatus contains status information for a single resource pool.
type PoolStatusApplyConfiguration struct {
// Driver is the DRA driver name for this pool.
// Must be a DNS subdomain (e.g., "gpu.example.com").
Driver *string `json:"driver,omitempty"`
// PoolName is the name of the pool.
// Must be a valid resource pool name (DNS subdomains separated by "/").
PoolName *string `json:"poolName,omitempty"`
// Generation is the pool generation observed across all ResourceSlices
// in this pool. Only the latest generation is reported. During a generation
// rollout, if not all slices at the latest generation have been published,
// the pool is included with a validationError and device counts unset.
Generation *int64 `json:"generation,omitempty"`
// ResourceSliceCount is the number of ResourceSlices that make up this pool.
// May be unset when validationError is set.
ResourceSliceCount *int32 `json:"resourceSliceCount,omitempty"`
// TotalDevices is the total number of devices in the pool across all slices.
// A value of 0 means the pool has no devices.
// May be unset when validationError is set.
TotalDevices *int32 `json:"totalDevices,omitempty"`
// AllocatedDevices is the number of devices currently allocated to claims.
// A value of 0 means no devices are allocated.
// May be unset when validationError is set.
AllocatedDevices *int32 `json:"allocatedDevices,omitempty"`
// AvailableDevices is the number of devices available for allocation.
// This equals TotalDevices - AllocatedDevices - UnavailableDevices.
// A value of 0 means no devices are currently available.
// May be unset when validationError is set.
AvailableDevices *int32 `json:"availableDevices,omitempty"`
// UnavailableDevices is the number of devices that are not available
// due to taints or other conditions, but are not allocated.
// A value of 0 means all unallocated devices are available.
// May be unset when validationError is set.
UnavailableDevices *int32 `json:"unavailableDevices,omitempty"`
// NodeName is the node this pool is associated with.
// When omitted, the pool is not associated with a specific node.
// Must be a valid DNS subdomain name (RFC1123).
NodeName *string `json:"nodeName,omitempty"`
// ValidationError is set when the pool's data could not be fully
// validated (e.g., incomplete slice publication). When set, device
// count fields and ResourceSliceCount may be unset.
ValidationError *string `json:"validationError,omitempty"`
}
// PoolStatusApplyConfiguration constructs a declarative configuration of the PoolStatus type for use with
// apply.
func PoolStatus() *PoolStatusApplyConfiguration {
return &PoolStatusApplyConfiguration{}
}
// WithDriver sets the Driver field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Driver field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithDriver(value string) *PoolStatusApplyConfiguration {
b.Driver = &value
return b
}
// WithPoolName sets the PoolName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PoolName field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithPoolName(value string) *PoolStatusApplyConfiguration {
b.PoolName = &value
return b
}
// WithGeneration sets the Generation field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Generation field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithGeneration(value int64) *PoolStatusApplyConfiguration {
b.Generation = &value
return b
}
// WithResourceSliceCount sets the ResourceSliceCount field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceSliceCount field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithResourceSliceCount(value int32) *PoolStatusApplyConfiguration {
b.ResourceSliceCount = &value
return b
}
// WithTotalDevices sets the TotalDevices field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the TotalDevices field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithTotalDevices(value int32) *PoolStatusApplyConfiguration {
b.TotalDevices = &value
return b
}
// WithAllocatedDevices sets the AllocatedDevices field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the AllocatedDevices field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithAllocatedDevices(value int32) *PoolStatusApplyConfiguration {
b.AllocatedDevices = &value
return b
}
// WithAvailableDevices sets the AvailableDevices field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the AvailableDevices field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithAvailableDevices(value int32) *PoolStatusApplyConfiguration {
b.AvailableDevices = &value
return b
}
// WithUnavailableDevices sets the UnavailableDevices field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the UnavailableDevices field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithUnavailableDevices(value int32) *PoolStatusApplyConfiguration {
b.UnavailableDevices = &value
return b
}
// WithNodeName sets the NodeName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the NodeName field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithNodeName(value string) *PoolStatusApplyConfiguration {
b.NodeName = &value
return b
}
// WithValidationError sets the ValidationError field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ValidationError field is set to the value of the last call.
func (b *PoolStatusApplyConfiguration) WithValidationError(value string) *PoolStatusApplyConfiguration {
b.ValidationError = &value
return b
}

View File

@@ -0,0 +1,295 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha3
import (
resourcev1alpha3 "k8s.io/api/resource/v1alpha3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
internal "k8s.io/client-go/applyconfigurations/internal"
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// ResourcePoolStatusRequestApplyConfiguration represents a declarative configuration of the ResourcePoolStatusRequest type for use
// with apply.
//
// ResourcePoolStatusRequest triggers a one-time calculation of resource pool status
// based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed.
// Users should delete and recreate requests to get updated information.
type ResourcePoolStatusRequestApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
// Standard object metadata
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
// Spec defines the filters for which pools to include in the status.
// The spec is immutable once created.
Spec *ResourcePoolStatusRequestSpecApplyConfiguration `json:"spec,omitempty"`
// Status is populated by the controller with the calculated pool status.
// When status is non-nil, the request is considered complete and the
// entire object becomes immutable.
Status *ResourcePoolStatusRequestStatusApplyConfiguration `json:"status,omitempty"`
}
// ResourcePoolStatusRequest constructs a declarative configuration of the ResourcePoolStatusRequest type for use with
// apply.
func ResourcePoolStatusRequest(name string) *ResourcePoolStatusRequestApplyConfiguration {
b := &ResourcePoolStatusRequestApplyConfiguration{}
b.WithName(name)
b.WithKind("ResourcePoolStatusRequest")
b.WithAPIVersion("resource.k8s.io/v1alpha3")
return b
}
// ExtractResourcePoolStatusRequestFrom extracts the applied configuration owned by fieldManager from
// resourcePoolStatusRequest for the specified subresource. Pass an empty string for subresource to extract
// the main resource. Common subresources include "status", "scale", etc.
// resourcePoolStatusRequest must be a unmodified ResourcePoolStatusRequest API object that was retrieved from the Kubernetes API.
// ExtractResourcePoolStatusRequestFrom provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractResourcePoolStatusRequestFrom(resourcePoolStatusRequest *resourcev1alpha3.ResourcePoolStatusRequest, fieldManager string, subresource string) (*ResourcePoolStatusRequestApplyConfiguration, error) {
b := &ResourcePoolStatusRequestApplyConfiguration{}
err := managedfields.ExtractInto(resourcePoolStatusRequest, internal.Parser().Type("io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequest"), fieldManager, b, subresource)
if err != nil {
return nil, err
}
b.WithName(resourcePoolStatusRequest.Name)
b.WithKind("ResourcePoolStatusRequest")
b.WithAPIVersion("resource.k8s.io/v1alpha3")
return b, nil
}
// ExtractResourcePoolStatusRequest extracts the applied configuration owned by fieldManager from
// resourcePoolStatusRequest. If no managedFields are found in resourcePoolStatusRequest for fieldManager, a
// ResourcePoolStatusRequestApplyConfiguration is returned with only the Name, Namespace (if applicable),
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
// the fieldManager never owned fields any fields.
// resourcePoolStatusRequest must be a unmodified ResourcePoolStatusRequest API object that was retrieved from the Kubernetes API.
// ExtractResourcePoolStatusRequest provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractResourcePoolStatusRequest(resourcePoolStatusRequest *resourcev1alpha3.ResourcePoolStatusRequest, fieldManager string) (*ResourcePoolStatusRequestApplyConfiguration, error) {
return ExtractResourcePoolStatusRequestFrom(resourcePoolStatusRequest, fieldManager, "")
}
// ExtractResourcePoolStatusRequestStatus extracts the applied configuration owned by fieldManager from
// resourcePoolStatusRequest for the status subresource.
func ExtractResourcePoolStatusRequestStatus(resourcePoolStatusRequest *resourcev1alpha3.ResourcePoolStatusRequest, fieldManager string) (*ResourcePoolStatusRequestApplyConfiguration, error) {
return ExtractResourcePoolStatusRequestFrom(resourcePoolStatusRequest, fieldManager, "status")
}
func (b ResourcePoolStatusRequestApplyConfiguration) IsApplyConfiguration() {}
// WithKind sets the Kind field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Kind field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithKind(value string) *ResourcePoolStatusRequestApplyConfiguration {
b.TypeMetaApplyConfiguration.Kind = &value
return b
}
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the APIVersion field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithAPIVersion(value string) *ResourcePoolStatusRequestApplyConfiguration {
b.TypeMetaApplyConfiguration.APIVersion = &value
return b
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithName(value string) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Name = &value
return b
}
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the GenerateName field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithGenerateName(value string) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.GenerateName = &value
return b
}
// WithNamespace sets the Namespace field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Namespace field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithNamespace(value string) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Namespace = &value
return b
}
// WithUID sets the UID field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the UID field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithUID(value types.UID) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.UID = &value
return b
}
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceVersion field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithResourceVersion(value string) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
return b
}
// WithGeneration sets the Generation field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Generation field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithGeneration(value int64) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Generation = &value
return b
}
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
return b
}
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
return b
}
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
return b
}
// WithLabels puts the entries into the Labels field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithLabels(entries map[string]string) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Labels[k] = v
}
return b
}
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Annotations field,
// overwriting an existing map entries in Annotations field with the same key.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithAnnotations(entries map[string]string) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Annotations[k] = v
}
return b
}
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
if values[i] == nil {
panic("nil value passed to WithOwnerReferences")
}
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
}
return b
}
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Finalizers field.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithFinalizers(values ...string) *ResourcePoolStatusRequestApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
}
return b
}
func (b *ResourcePoolStatusRequestApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
if b.ObjectMetaApplyConfiguration == nil {
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
}
}
// WithSpec sets the Spec field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Spec field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithSpec(value *ResourcePoolStatusRequestSpecApplyConfiguration) *ResourcePoolStatusRequestApplyConfiguration {
b.Spec = value
return b
}
// WithStatus sets the Status field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Status field is set to the value of the last call.
func (b *ResourcePoolStatusRequestApplyConfiguration) WithStatus(value *ResourcePoolStatusRequestStatusApplyConfiguration) *ResourcePoolStatusRequestApplyConfiguration {
b.Status = value
return b
}
// GetKind retrieves the value of the Kind field in the declarative configuration.
func (b *ResourcePoolStatusRequestApplyConfiguration) GetKind() *string {
return b.TypeMetaApplyConfiguration.Kind
}
// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
func (b *ResourcePoolStatusRequestApplyConfiguration) GetAPIVersion() *string {
return b.TypeMetaApplyConfiguration.APIVersion
}
// GetName retrieves the value of the Name field in the declarative configuration.
func (b *ResourcePoolStatusRequestApplyConfiguration) GetName() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Name
}
// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
func (b *ResourcePoolStatusRequestApplyConfiguration) GetNamespace() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Namespace
}

View File

@@ -0,0 +1,73 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha3
// ResourcePoolStatusRequestSpecApplyConfiguration represents a declarative configuration of the ResourcePoolStatusRequestSpec type for use
// with apply.
//
// ResourcePoolStatusRequestSpec defines the filters for the pool status request.
type ResourcePoolStatusRequestSpecApplyConfiguration struct {
// Driver specifies the DRA driver name to filter pools.
// Only pools from ResourceSlices with this driver will be included.
// Must be a DNS subdomain (e.g., "gpu.example.com").
Driver *string `json:"driver,omitempty"`
// PoolName optionally filters to a specific pool name.
// If not specified, all pools from the specified driver are included.
// When specified, must be a non-empty valid resource pool name
// (DNS subdomains separated by "/").
PoolName *string `json:"poolName,omitempty"`
// Limit optionally specifies the maximum number of pools to return in the status.
// If more pools match the filter criteria, the response will be truncated
// (i.e., len(status.pools) < status.poolCount).
//
// Default: 100
// Minimum: 1
// Maximum: 1000
Limit *int32 `json:"limit,omitempty"`
}
// ResourcePoolStatusRequestSpecApplyConfiguration constructs a declarative configuration of the ResourcePoolStatusRequestSpec type for use with
// apply.
func ResourcePoolStatusRequestSpec() *ResourcePoolStatusRequestSpecApplyConfiguration {
return &ResourcePoolStatusRequestSpecApplyConfiguration{}
}
// WithDriver sets the Driver field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Driver field is set to the value of the last call.
func (b *ResourcePoolStatusRequestSpecApplyConfiguration) WithDriver(value string) *ResourcePoolStatusRequestSpecApplyConfiguration {
b.Driver = &value
return b
}
// WithPoolName sets the PoolName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PoolName field is set to the value of the last call.
func (b *ResourcePoolStatusRequestSpecApplyConfiguration) WithPoolName(value string) *ResourcePoolStatusRequestSpecApplyConfiguration {
b.PoolName = &value
return b
}
// WithLimit sets the Limit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Limit field is set to the value of the last call.
func (b *ResourcePoolStatusRequestSpecApplyConfiguration) WithLimit(value int32) *ResourcePoolStatusRequestSpecApplyConfiguration {
b.Limit = &value
return b
}

View File

@@ -0,0 +1,87 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha3
import (
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// ResourcePoolStatusRequestStatusApplyConfiguration represents a declarative configuration of the ResourcePoolStatusRequestStatus type for use
// with apply.
//
// ResourcePoolStatusRequestStatus contains the calculated pool status information.
type ResourcePoolStatusRequestStatusApplyConfiguration struct {
// PoolCount is the total number of pools that matched the filter criteria,
// regardless of truncation. This helps users understand how many pools exist
// even when the response is truncated. A value of 0 means no pools matched
// the filter criteria.
PoolCount *int32 `json:"poolCount,omitempty"`
// Pools contains the first `spec.limit` matching pools, sorted by driver
// then pool name. If `len(pools) < poolCount`, the list was truncated.
// When omitted, no pools matched the request filters.
Pools []PoolStatusApplyConfiguration `json:"pools,omitempty"`
// Conditions provide information about the state of the request.
// A condition with type=Complete or type=Failed will always be set
// when the status is populated.
//
// Known condition types:
// - "Complete": True when the request has been processed successfully
// - "Failed": True when the request could not be processed
Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
}
// ResourcePoolStatusRequestStatusApplyConfiguration constructs a declarative configuration of the ResourcePoolStatusRequestStatus type for use with
// apply.
func ResourcePoolStatusRequestStatus() *ResourcePoolStatusRequestStatusApplyConfiguration {
return &ResourcePoolStatusRequestStatusApplyConfiguration{}
}
// WithPoolCount sets the PoolCount field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PoolCount field is set to the value of the last call.
func (b *ResourcePoolStatusRequestStatusApplyConfiguration) WithPoolCount(value int32) *ResourcePoolStatusRequestStatusApplyConfiguration {
b.PoolCount = &value
return b
}
// WithPools adds the given value to the Pools field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Pools field.
func (b *ResourcePoolStatusRequestStatusApplyConfiguration) WithPools(values ...*PoolStatusApplyConfiguration) *ResourcePoolStatusRequestStatusApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithPools")
}
b.Pools = append(b.Pools, *values[i])
}
return b
}
// WithConditions adds the given value to the Conditions field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Conditions field.
func (b *ResourcePoolStatusRequestStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *ResourcePoolStatusRequestStatusApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithConditions")
}
b.Conditions = append(b.Conditions, *values[i])
}
return b
}

View File

@@ -36,7 +36,7 @@ type AllocationResultApplyConfiguration struct {
// AllocationTimestamp stores the time when the resources were allocated.
// This field is not guaranteed to be set, in which case that time is unknown.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gate.
AllocationTimestamp *metav1.Time `json:"allocationTimestamp,omitempty"`
}

View File

@@ -19,6 +19,7 @@ limitations under the License.
package v1beta1
import (
corev1 "k8s.io/api/core/v1"
resourcev1beta1 "k8s.io/api/resource/v1beta1"
v1 "k8s.io/client-go/applyconfigurations/core/v1"
)
@@ -70,7 +71,7 @@ type BasicDeviceApplyConfiguration struct {
// any device in a ResourceSlice, then the maximum number of
// allowed devices per ResourceSlice is 64 instead of 128.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Taints []DeviceTaintApplyConfiguration `json:"taints,omitempty"`
// BindsToNode indicates if the usage of an allocation involving this device
@@ -78,7 +79,7 @@ type BasicDeviceApplyConfiguration struct {
// If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector
// to match the node where the allocation was made.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindsToNode *bool `json:"bindsToNode,omitempty"`
// BindingConditions defines the conditions for proceeding with binding.
@@ -90,7 +91,7 @@ type BasicDeviceApplyConfiguration struct {
//
// The conditions must be a valid condition type string.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingConditions []string `json:"bindingConditions,omitempty"`
// BindingFailureConditions defines the conditions for binding failure.
@@ -101,7 +102,7 @@ type BasicDeviceApplyConfiguration struct {
//
// The conditions must be a valid condition type string.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"`
// AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.
@@ -109,6 +110,18 @@ type BasicDeviceApplyConfiguration struct {
// If AllowMultipleAllocations is set to true, the device can be allocated more than once,
// and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.
AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty"`
// NodeAllocatableResourceMappings defines the mapping of node resources
// that are managed by the DRA driver exposing this device. This includes resources currently
// reported in v1.Node `status.allocatable` that are not extended resources
// (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources).
// Examples include "cpu", "memory", "ephemeral-storage", and hugepages.
// In addition to standard requests made through the Pod `spec`, these resources
// can also be requested through claims and allocated by the DRA driver.
// For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory
// dependencies of an accelerator device.
// The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory").
// Extended resource names are not permitted as keys.
NodeAllocatableResourceMappings map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration `json:"nodeAllocatableResourceMappings,omitempty"`
}
// BasicDeviceApplyConfiguration constructs a declarative configuration of the BasicDevice type for use with
@@ -230,3 +243,17 @@ func (b *BasicDeviceApplyConfiguration) WithAllowMultipleAllocations(value bool)
b.AllowMultipleAllocations = &value
return b
}
// WithNodeAllocatableResourceMappings puts the entries into the NodeAllocatableResourceMappings field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the NodeAllocatableResourceMappings field,
// overwriting an existing map entries in NodeAllocatableResourceMappings field with the same key.
func (b *BasicDeviceApplyConfiguration) WithNodeAllocatableResourceMappings(entries map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration) *BasicDeviceApplyConfiguration {
if b.NodeAllocatableResourceMappings == nil && len(entries) > 0 {
b.NodeAllocatableResourceMappings = make(map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration, len(entries))
}
for k, v := range entries {
b.NodeAllocatableResourceMappings[k] = v
}
return b
}

View File

@@ -72,6 +72,14 @@ type CELDeviceSelectorApplyConfiguration struct {
//
// cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool)
//
// When the DRAListTypeAttributes feature gate is enabled,
// the includes() helper is available and it can work for both scalar
// and list-type attributes. It was introduced to support smooth migration
// from scalar attributes to list-type attributes while keeping
// CEL expressions simple. For example:
//
// device.attributes["dra.example.com"].models.includes("some-model")
//
// The length of the expression must be smaller or equal to 10 Ki. The
// cost of evaluating it is also limited based on the estimated number
// of logical steps.

View File

@@ -32,6 +32,22 @@ type DeviceAttributeApplyConfiguration struct {
// VersionValue is a semantic version according to semver.org spec 2.0.0.
// Must not be longer than 64 characters.
VersionValue *string `json:"version,omitempty"`
// IntValues is a non-empty list of numbers.
//
// This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
IntValues []int64 `json:"ints,omitempty"`
// BoolValues is a non-empty list of true/false values.
BoolValues []bool `json:"bools,omitempty"`
// StringValues is a non-empty list of strings.
// Each string must not be longer than 64 characters.
//
// This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
StringValues []string `json:"strings,omitempty"`
// VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0.
// Each version string must not be longer than 64 characters.
//
// This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
VersionValues []string `json:"versions,omitempty"`
}
// DeviceAttributeApplyConfiguration constructs a declarative configuration of the DeviceAttribute type for use with
@@ -71,3 +87,43 @@ func (b *DeviceAttributeApplyConfiguration) WithVersionValue(value string) *Devi
b.VersionValue = &value
return b
}
// WithIntValues adds the given value to the IntValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the IntValues field.
func (b *DeviceAttributeApplyConfiguration) WithIntValues(values ...int64) *DeviceAttributeApplyConfiguration {
for i := range values {
b.IntValues = append(b.IntValues, values[i])
}
return b
}
// WithBoolValues adds the given value to the BoolValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the BoolValues field.
func (b *DeviceAttributeApplyConfiguration) WithBoolValues(values ...bool) *DeviceAttributeApplyConfiguration {
for i := range values {
b.BoolValues = append(b.BoolValues, values[i])
}
return b
}
// WithStringValues adds the given value to the StringValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the StringValues field.
func (b *DeviceAttributeApplyConfiguration) WithStringValues(values ...string) *DeviceAttributeApplyConfiguration {
for i := range values {
b.StringValues = append(b.StringValues, values[i])
}
return b
}
// WithVersionValues adds the given value to the VersionValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the VersionValues field.
func (b *DeviceAttributeApplyConfiguration) WithVersionValues(values ...string) *DeviceAttributeApplyConfiguration {
for i := range values {
b.VersionValues = append(b.VersionValues, values[i])
}
return b
}

View File

@@ -41,7 +41,7 @@ type DeviceClassSpecApplyConfiguration struct {
// If two classes are created at the same time, then the name of the class
// lexicographically sorted first is picked.
//
// This is an alpha field.
// This is a beta field.
ExtendedResourceName *string `json:"extendedResourceName,omitempty"`
}

View File

@@ -48,11 +48,21 @@ type DeviceConstraintApplyConfiguration struct {
// its specification, but if one device doesn't, then it also will not be
// chosen.
//
// When the DRAListTypeAttributes feature gate is enabled, comparison uses
// set semantics(i.e., element order and duplicates are ignored): list-valued attributes
// match when the intersection across all devices is non-empty.
// Scalar values are treated as singleton sets for backward compatibility.
//
// Must include the domain qualifier.
MatchAttribute *resourcev1beta1.FullyQualifiedName `json:"matchAttribute,omitempty"`
// DistinctAttribute requires that all devices in question have this
// attribute and that its type and value are unique across those devices.
//
// When the DRAListTypeAttributes feature gate is enabled, comparison uses
// set semantics (i.e., element order and duplicates are ignored):
// list-valued attributes must be pairwise disjoint across devices.
// Scalar values are treated as singleton sets for backward compatibility.
//
// This acts as the inverse of MatchAttribute.
//
// This constraint is used to avoid allocating multiple requests to the same device

View File

@@ -133,7 +133,7 @@ type DeviceRequestApplyConfiguration struct {
// This field can only be set when deviceClassName is set and no subrequests
// are specified in the firstAvailable list.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
// Capacity define resource requirements against each capacity.

View File

@@ -66,19 +66,19 @@ type DeviceRequestAllocationResultApplyConfiguration struct {
//
// The maximum number of tolerations is 16.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
// BindingConditions contains a copy of the BindingConditions
// from the corresponding ResourceSlice at the time of allocation.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingConditions []string `json:"bindingConditions,omitempty"`
// BindingFailureConditions contains a copy of the BindingFailureConditions
// from the corresponding ResourceSlice at the time of allocation.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"`
// ShareID uniquely identifies an individual allocation share of the device,

View File

@@ -94,7 +94,7 @@ type DeviceSubRequestApplyConfiguration struct {
//
// The maximum number of tolerations is 16.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
// Capacity define resource requirements against each capacity.

View File

@@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct {
// nodes is not valid here. More effects may get added in the future.
// Consumers must treat unknown effects like None.
Effect *resourcev1beta1.DeviceTaintEffect `json:"effect,omitempty"`
// TimeAdded represents the time at which the taint was added.
// TimeAdded represents the time at which the taint was added or
// (only in a DeviceTaintRule) the effect was modified.
// Added automatically during create or update if not set.
//
// In addition, in a DeviceTaintRule a value provided during
// an update gets replaced with the current time if the provided
// value is the same as the old one and the new effect is different.
// Changing the key and/or value while keeping the effect unchanged
// is possible and does not update the time stamp because the eviction
// which uses it is either already started (NoExecute) or
// not started yet (NoEffect, NoSchedule).
TimeAdded *v1.Time `json:"timeAdded,omitempty"`
}

View File

@@ -29,7 +29,7 @@ type NetworkDeviceDataApplyConfiguration struct {
// the allocated device. This might be the name of a physical or virtual
// network interface being configured in the pod.
//
// Must not be longer than 256 characters.
// Must not be longer than 256 bytes.
InterfaceName *string `json:"interfaceName,omitempty"`
// IPs lists the network addresses assigned to the device's network interface.
// This can include both IPv4 and IPv6 addresses.
@@ -41,7 +41,7 @@ type NetworkDeviceDataApplyConfiguration struct {
IPs []string `json:"ips,omitempty"`
// HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.
//
// Must not be longer than 128 characters.
// Must not be longer than 128 bytes.
HardwareAddress *string `json:"hardwareAddress,omitempty"`
}

View File

@@ -0,0 +1,84 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta1
import (
resourcev1beta1 "k8s.io/api/resource/v1beta1"
resource "k8s.io/apimachinery/pkg/api/resource"
)
// NodeAllocatableResourceMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceMapping type for use
// with apply.
//
// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity
// units requested to the corresponding quantity of the node allocatable resource.
type NodeAllocatableResourceMappingApplyConfiguration struct {
// CapacityKey references a capacity name defined as a key in the
// `spec.devices[*].capacity` map. When this field is set, the value associated with
// this key in the `status.allocation.devices.results[*].consumedCapacity` map
// (for a specific claim allocation) determines the base quantity for
// the node allocatable resource. If `allocationMultiplier` is also set, it is
// multiplied with the base quantity.
// For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi",
// and this field is set to "dra.example.com/memory", then for a claim allocation
// that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the
// node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should
// be omitted or set to "1".
CapacityKey *resourcev1beta1.QualifiedName `json:"capacityKey,omitempty"`
// AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim.
// It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set.
// 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim.
// a. A DRA driver representing each CPU core as a device would have
// {ResourceName: "cpu", allocationMultiplier: "2"} in its
// `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim,
// 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity.
// b. A GPU device that needs additional node memory per GPU allocation would
// have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated
// GPU device instance of this type will account for 2Gi of memory.
//
// 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed.
// The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`.
// For example, if a Device's capacity "dra.example.com/cores" is consumed,
// and each "core" provides 2 "cpu"s, the mapping would be:
// {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}.
// If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16.
AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty"`
}
// NodeAllocatableResourceMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceMapping type for use with
// apply.
func NodeAllocatableResourceMapping() *NodeAllocatableResourceMappingApplyConfiguration {
return &NodeAllocatableResourceMappingApplyConfiguration{}
}
// WithCapacityKey sets the CapacityKey field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CapacityKey field is set to the value of the last call.
func (b *NodeAllocatableResourceMappingApplyConfiguration) WithCapacityKey(value resourcev1beta1.QualifiedName) *NodeAllocatableResourceMappingApplyConfiguration {
b.CapacityKey = &value
return b
}
// WithAllocationMultiplier sets the AllocationMultiplier field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the AllocationMultiplier field is set to the value of the last call.
func (b *NodeAllocatableResourceMappingApplyConfiguration) WithAllocationMultiplier(value resource.Quantity) *NodeAllocatableResourceMappingApplyConfiguration {
b.AllocationMultiplier = &value
return b
}

View File

@@ -36,7 +36,7 @@ type AllocationResultApplyConfiguration struct {
// AllocationTimestamp stores the time when the resources were allocated.
// This field is not guaranteed to be set, in which case that time is unknown.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gate.
AllocationTimestamp *metav1.Time `json:"allocationTimestamp,omitempty"`
}

View File

@@ -72,6 +72,14 @@ type CELDeviceSelectorApplyConfiguration struct {
//
// cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool)
//
// When the DRAListTypeAttributes feature gate is enabled,
// the includes() helper is available and it can work for both scalar
// and list-type attributes. It was introduced to support smooth migration
// from scalar attributes to list-type attributes while keeping
// CEL expressions simple. For example:
//
// device.attributes["dra.example.com"].models.includes("some-model")
//
// The length of the expression must be smaller or equal to 10 Ki. The
// cost of evaluating it is also limited based on the estimated number
// of logical steps.

View File

@@ -19,6 +19,7 @@ limitations under the License.
package v1beta2
import (
corev1 "k8s.io/api/core/v1"
resourcev1beta2 "k8s.io/api/resource/v1beta2"
v1 "k8s.io/client-go/applyconfigurations/core/v1"
)
@@ -74,7 +75,7 @@ type DeviceApplyConfiguration struct {
// any device in a ResourceSlice, then the maximum number of
// allowed devices per ResourceSlice is 64 instead of 128.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Taints []DeviceTaintApplyConfiguration `json:"taints,omitempty"`
// BindsToNode indicates if the usage of an allocation involving this device
@@ -82,7 +83,7 @@ type DeviceApplyConfiguration struct {
// If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector
// to match the node where the allocation was made.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindsToNode *bool `json:"bindsToNode,omitempty"`
// BindingConditions defines the conditions for proceeding with binding.
@@ -94,7 +95,7 @@ type DeviceApplyConfiguration struct {
//
// The conditions must be a valid condition type string.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingConditions []string `json:"bindingConditions,omitempty"`
// BindingFailureConditions defines the conditions for binding failure.
@@ -105,7 +106,7 @@ type DeviceApplyConfiguration struct {
//
// The conditions must be a valid condition type string.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"`
// AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.
@@ -113,6 +114,18 @@ type DeviceApplyConfiguration struct {
// If AllowMultipleAllocations is set to true, the device can be allocated more than once,
// and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.
AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty"`
// NodeAllocatableResourceMappings defines the mapping of node resources
// that are managed by the DRA driver exposing this device. This includes resources currently
// reported in v1.Node `status.allocatable` that are not extended resources
// (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources).
// Examples include "cpu", "memory", "ephemeral-storage", and hugepages.
// In addition to standard requests made through the Pod `spec`, these resources
// can also be requested through claims and allocated by the DRA driver.
// For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory
// dependencies of an accelerator device.
// The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory").
// Extended resource names are not permitted as keys.
NodeAllocatableResourceMappings map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration `json:"nodeAllocatableResourceMappings,omitempty"`
}
// DeviceApplyConfiguration constructs a declarative configuration of the Device type for use with
@@ -242,3 +255,17 @@ func (b *DeviceApplyConfiguration) WithAllowMultipleAllocations(value bool) *Dev
b.AllowMultipleAllocations = &value
return b
}
// WithNodeAllocatableResourceMappings puts the entries into the NodeAllocatableResourceMappings field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the NodeAllocatableResourceMappings field,
// overwriting an existing map entries in NodeAllocatableResourceMappings field with the same key.
func (b *DeviceApplyConfiguration) WithNodeAllocatableResourceMappings(entries map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration) *DeviceApplyConfiguration {
if b.NodeAllocatableResourceMappings == nil && len(entries) > 0 {
b.NodeAllocatableResourceMappings = make(map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration, len(entries))
}
for k, v := range entries {
b.NodeAllocatableResourceMappings[k] = v
}
return b
}

View File

@@ -32,6 +32,22 @@ type DeviceAttributeApplyConfiguration struct {
// VersionValue is a semantic version according to semver.org spec 2.0.0.
// Must not be longer than 64 characters.
VersionValue *string `json:"version,omitempty"`
// IntValues is a non-empty list of numbers.
//
// This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
IntValues []int64 `json:"ints,omitempty"`
// BoolValues is a non-empty list of true/false values.
BoolValues []bool `json:"bools,omitempty"`
// StringValues is a non-empty list of strings.
// Each string must not be longer than 64 characters.
//
// This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
StringValues []string `json:"strings,omitempty"`
// VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0.
// Each version string must not be longer than 64 characters.
//
// This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
VersionValues []string `json:"versions,omitempty"`
}
// DeviceAttributeApplyConfiguration constructs a declarative configuration of the DeviceAttribute type for use with
@@ -71,3 +87,43 @@ func (b *DeviceAttributeApplyConfiguration) WithVersionValue(value string) *Devi
b.VersionValue = &value
return b
}
// WithIntValues adds the given value to the IntValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the IntValues field.
func (b *DeviceAttributeApplyConfiguration) WithIntValues(values ...int64) *DeviceAttributeApplyConfiguration {
for i := range values {
b.IntValues = append(b.IntValues, values[i])
}
return b
}
// WithBoolValues adds the given value to the BoolValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the BoolValues field.
func (b *DeviceAttributeApplyConfiguration) WithBoolValues(values ...bool) *DeviceAttributeApplyConfiguration {
for i := range values {
b.BoolValues = append(b.BoolValues, values[i])
}
return b
}
// WithStringValues adds the given value to the StringValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the StringValues field.
func (b *DeviceAttributeApplyConfiguration) WithStringValues(values ...string) *DeviceAttributeApplyConfiguration {
for i := range values {
b.StringValues = append(b.StringValues, values[i])
}
return b
}
// WithVersionValues adds the given value to the VersionValues field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the VersionValues field.
func (b *DeviceAttributeApplyConfiguration) WithVersionValues(values ...string) *DeviceAttributeApplyConfiguration {
for i := range values {
b.VersionValues = append(b.VersionValues, values[i])
}
return b
}

View File

@@ -41,7 +41,7 @@ type DeviceClassSpecApplyConfiguration struct {
// If two classes are created at the same time, then the name of the class
// lexicographically sorted first is picked.
//
// This is an alpha field.
// This is a beta field.
ExtendedResourceName *string `json:"extendedResourceName,omitempty"`
}

View File

@@ -48,11 +48,21 @@ type DeviceConstraintApplyConfiguration struct {
// its specification, but if one device doesn't, then it also will not be
// chosen.
//
// When the DRAListTypeAttributes feature gate is enabled, comparison uses
// set semantics(i.e., element order and duplicates are ignored): list-valued attributes
// match when the intersection across all devices is non-empty.
// Scalar values are treated as singleton sets for backward compatibility.
//
// Must include the domain qualifier.
MatchAttribute *resourcev1beta2.FullyQualifiedName `json:"matchAttribute,omitempty"`
// DistinctAttribute requires that all devices in question have this
// attribute and that its type and value are unique across those devices.
//
// When the DRAListTypeAttributes feature gate is enabled, comparison uses
// set semantics (i.e., element order and duplicates are ignored):
// list-valued attributes must be pairwise disjoint across devices.
// Scalar values are treated as singleton sets for backward compatibility.
//
// This acts as the inverse of MatchAttribute.
//
// This constraint is used to avoid allocating multiple requests to the same device

View File

@@ -66,19 +66,19 @@ type DeviceRequestAllocationResultApplyConfiguration struct {
//
// The maximum number of tolerations is 16.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
// BindingConditions contains a copy of the BindingConditions
// from the corresponding ResourceSlice at the time of allocation.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingConditions []string `json:"bindingConditions,omitempty"`
// BindingFailureConditions contains a copy of the BindingFailureConditions
// from the corresponding ResourceSlice at the time of allocation.
//
// This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus
// feature gates.
BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"`
// ShareID uniquely identifies an individual allocation share of the device,

View File

@@ -93,7 +93,7 @@ type DeviceSubRequestApplyConfiguration struct {
//
// The maximum number of tolerations is 16.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
// Capacity define resource requirements against each capacity.

View File

@@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct {
// nodes is not valid here. More effects may get added in the future.
// Consumers must treat unknown effects like None.
Effect *resourcev1beta2.DeviceTaintEffect `json:"effect,omitempty"`
// TimeAdded represents the time at which the taint was added.
// TimeAdded represents the time at which the taint was added or
// (only in a DeviceTaintRule) the effect was modified.
// Added automatically during create or update if not set.
//
// In addition, in a DeviceTaintRule a value provided during
// an update gets replaced with the current time if the provided
// value is the same as the old one and the new effect is different.
// Changing the key and/or value while keeping the effect unchanged
// is possible and does not update the time stamp because the eviction
// which uses it is either already started (NoExecute) or
// not started yet (NoEffect, NoSchedule).
TimeAdded *v1.Time `json:"timeAdded,omitempty"`
}

View File

@@ -0,0 +1,294 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta2
import (
resourcev1beta2 "k8s.io/api/resource/v1beta2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
internal "k8s.io/client-go/applyconfigurations/internal"
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// DeviceTaintRuleApplyConfiguration represents a declarative configuration of the DeviceTaintRule type for use
// with apply.
//
// DeviceTaintRule adds one taint to all devices which match the selector.
// This has the same effect as if the taint was specified directly
// in the ResourceSlice by the DRA driver.
type DeviceTaintRuleApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
// Standard object metadata
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
// Spec specifies the selector and one taint.
//
// Changing the spec automatically increments the metadata.generation number.
Spec *DeviceTaintRuleSpecApplyConfiguration `json:"spec,omitempty"`
// Status provides information about what was requested in the spec.
Status *DeviceTaintRuleStatusApplyConfiguration `json:"status,omitempty"`
}
// DeviceTaintRule constructs a declarative configuration of the DeviceTaintRule type for use with
// apply.
func DeviceTaintRule(name string) *DeviceTaintRuleApplyConfiguration {
b := &DeviceTaintRuleApplyConfiguration{}
b.WithName(name)
b.WithKind("DeviceTaintRule")
b.WithAPIVersion("resource.k8s.io/v1beta2")
return b
}
// ExtractDeviceTaintRuleFrom extracts the applied configuration owned by fieldManager from
// deviceTaintRule for the specified subresource. Pass an empty string for subresource to extract
// the main resource. Common subresources include "status", "scale", etc.
// deviceTaintRule must be a unmodified DeviceTaintRule API object that was retrieved from the Kubernetes API.
// ExtractDeviceTaintRuleFrom provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractDeviceTaintRuleFrom(deviceTaintRule *resourcev1beta2.DeviceTaintRule, fieldManager string, subresource string) (*DeviceTaintRuleApplyConfiguration, error) {
b := &DeviceTaintRuleApplyConfiguration{}
err := managedfields.ExtractInto(deviceTaintRule, internal.Parser().Type("io.k8s.api.resource.v1beta2.DeviceTaintRule"), fieldManager, b, subresource)
if err != nil {
return nil, err
}
b.WithName(deviceTaintRule.Name)
b.WithKind("DeviceTaintRule")
b.WithAPIVersion("resource.k8s.io/v1beta2")
return b, nil
}
// ExtractDeviceTaintRule extracts the applied configuration owned by fieldManager from
// deviceTaintRule. If no managedFields are found in deviceTaintRule for fieldManager, a
// DeviceTaintRuleApplyConfiguration is returned with only the Name, Namespace (if applicable),
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
// the fieldManager never owned fields any fields.
// deviceTaintRule must be a unmodified DeviceTaintRule API object that was retrieved from the Kubernetes API.
// ExtractDeviceTaintRule provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractDeviceTaintRule(deviceTaintRule *resourcev1beta2.DeviceTaintRule, fieldManager string) (*DeviceTaintRuleApplyConfiguration, error) {
return ExtractDeviceTaintRuleFrom(deviceTaintRule, fieldManager, "")
}
// ExtractDeviceTaintRuleStatus extracts the applied configuration owned by fieldManager from
// deviceTaintRule for the status subresource.
func ExtractDeviceTaintRuleStatus(deviceTaintRule *resourcev1beta2.DeviceTaintRule, fieldManager string) (*DeviceTaintRuleApplyConfiguration, error) {
return ExtractDeviceTaintRuleFrom(deviceTaintRule, fieldManager, "status")
}
func (b DeviceTaintRuleApplyConfiguration) IsApplyConfiguration() {}
// WithKind sets the Kind field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Kind field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithKind(value string) *DeviceTaintRuleApplyConfiguration {
b.TypeMetaApplyConfiguration.Kind = &value
return b
}
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the APIVersion field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithAPIVersion(value string) *DeviceTaintRuleApplyConfiguration {
b.TypeMetaApplyConfiguration.APIVersion = &value
return b
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithName(value string) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Name = &value
return b
}
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the GenerateName field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithGenerateName(value string) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.GenerateName = &value
return b
}
// WithNamespace sets the Namespace field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Namespace field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithNamespace(value string) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Namespace = &value
return b
}
// WithUID sets the UID field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the UID field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithUID(value types.UID) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.UID = &value
return b
}
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceVersion field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithResourceVersion(value string) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
return b
}
// WithGeneration sets the Generation field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Generation field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithGeneration(value int64) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Generation = &value
return b
}
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithCreationTimestamp(value metav1.Time) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
return b
}
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
return b
}
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
return b
}
// WithLabels puts the entries into the Labels field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key.
func (b *DeviceTaintRuleApplyConfiguration) WithLabels(entries map[string]string) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Labels[k] = v
}
return b
}
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Annotations field,
// overwriting an existing map entries in Annotations field with the same key.
func (b *DeviceTaintRuleApplyConfiguration) WithAnnotations(entries map[string]string) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Annotations[k] = v
}
return b
}
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
func (b *DeviceTaintRuleApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
if values[i] == nil {
panic("nil value passed to WithOwnerReferences")
}
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
}
return b
}
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Finalizers field.
func (b *DeviceTaintRuleApplyConfiguration) WithFinalizers(values ...string) *DeviceTaintRuleApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
}
return b
}
func (b *DeviceTaintRuleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
if b.ObjectMetaApplyConfiguration == nil {
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
}
}
// WithSpec sets the Spec field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Spec field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithSpec(value *DeviceTaintRuleSpecApplyConfiguration) *DeviceTaintRuleApplyConfiguration {
b.Spec = value
return b
}
// WithStatus sets the Status field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Status field is set to the value of the last call.
func (b *DeviceTaintRuleApplyConfiguration) WithStatus(value *DeviceTaintRuleStatusApplyConfiguration) *DeviceTaintRuleApplyConfiguration {
b.Status = value
return b
}
// GetKind retrieves the value of the Kind field in the declarative configuration.
func (b *DeviceTaintRuleApplyConfiguration) GetKind() *string {
return b.TypeMetaApplyConfiguration.Kind
}
// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
func (b *DeviceTaintRuleApplyConfiguration) GetAPIVersion() *string {
return b.TypeMetaApplyConfiguration.APIVersion
}
// GetName retrieves the value of the Name field in the declarative configuration.
func (b *DeviceTaintRuleApplyConfiguration) GetName() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Name
}
// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
func (b *DeviceTaintRuleApplyConfiguration) GetNamespace() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Namespace
}

View File

@@ -0,0 +1,55 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta2
// DeviceTaintRuleSpecApplyConfiguration represents a declarative configuration of the DeviceTaintRuleSpec type for use
// with apply.
//
// DeviceTaintRuleSpec specifies the selector and one taint.
type DeviceTaintRuleSpecApplyConfiguration struct {
// DeviceSelector defines which device(s) the taint is applied to.
// All selector criteria must be satisfied for a device to
// match. The empty selector matches all devices. Without
// a selector, no devices are matches.
DeviceSelector *DeviceTaintSelectorApplyConfiguration `json:"deviceSelector,omitempty"`
// The taint that gets applied to matching devices.
Taint *DeviceTaintApplyConfiguration `json:"taint,omitempty"`
}
// DeviceTaintRuleSpecApplyConfiguration constructs a declarative configuration of the DeviceTaintRuleSpec type for use with
// apply.
func DeviceTaintRuleSpec() *DeviceTaintRuleSpecApplyConfiguration {
return &DeviceTaintRuleSpecApplyConfiguration{}
}
// WithDeviceSelector sets the DeviceSelector field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeviceSelector field is set to the value of the last call.
func (b *DeviceTaintRuleSpecApplyConfiguration) WithDeviceSelector(value *DeviceTaintSelectorApplyConfiguration) *DeviceTaintRuleSpecApplyConfiguration {
b.DeviceSelector = value
return b
}
// WithTaint sets the Taint field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Taint field is set to the value of the last call.
func (b *DeviceTaintRuleSpecApplyConfiguration) WithTaint(value *DeviceTaintApplyConfiguration) *DeviceTaintRuleSpecApplyConfiguration {
b.Taint = value
return b
}

View File

@@ -0,0 +1,70 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta2
import (
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// DeviceTaintRuleStatusApplyConfiguration represents a declarative configuration of the DeviceTaintRuleStatus type for use
// with apply.
//
// DeviceTaintRuleStatus provides information about an on-going pod eviction.
type DeviceTaintRuleStatusApplyConfiguration struct {
// Conditions provide information about the state of the DeviceTaintRule
// and the cluster at some point in time,
// in a machine-readable and human-readable format.
//
// The following condition is currently defined as part of this API, more may
// get added:
// - Type: EvictionInProgress
// - Status: True if there are currently pods which need to be evicted, False otherwise
// (includes the effects which don't cause eviction).
// - Reason: not specified, may change
// - Message: includes information about number of pending pods and already evicted pods
// in a human-readable format, updated periodically, may change
//
// For `effect: None`, the condition above gets set once for each change to
// the spec, with the message containing information about what would happen
// if the effect was `NoExecute`. This feedback can be used to decide whether
// changing the effect to `NoExecute` will work as intended. It only gets
// set once to avoid having to constantly update the status.
//
// Must have 8 or fewer entries.
Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
}
// DeviceTaintRuleStatusApplyConfiguration constructs a declarative configuration of the DeviceTaintRuleStatus type for use with
// apply.
func DeviceTaintRuleStatus() *DeviceTaintRuleStatusApplyConfiguration {
return &DeviceTaintRuleStatusApplyConfiguration{}
}
// WithConditions adds the given value to the Conditions field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Conditions field.
func (b *DeviceTaintRuleStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *DeviceTaintRuleStatusApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithConditions")
}
b.Conditions = append(b.Conditions, *values[i])
}
return b
}

View File

@@ -0,0 +1,76 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta2
// DeviceTaintSelectorApplyConfiguration represents a declarative configuration of the DeviceTaintSelector type for use
// with apply.
//
// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to.
// The empty selector matches all devices. Without a selector, no devices
// are matched.
type DeviceTaintSelectorApplyConfiguration struct {
// If driver is set, only devices from that driver are selected.
// This fields corresponds to slice.spec.driver.
Driver *string `json:"driver,omitempty"`
// If pool is set, only devices in that pool are selected.
//
// Also setting the driver name may be useful to avoid
// ambiguity when different drivers use the same pool name,
// but this is not required because selecting pools from
// different drivers may also be useful, for example when
// drivers with node-local devices use the node name as
// their pool name.
Pool *string `json:"pool,omitempty"`
// If device is set, only devices with that name are selected.
// This field corresponds to slice.spec.devices[].name.
//
// Setting also driver and pool may be required to avoid ambiguity,
// but is not required.
Device *string `json:"device,omitempty"`
}
// DeviceTaintSelectorApplyConfiguration constructs a declarative configuration of the DeviceTaintSelector type for use with
// apply.
func DeviceTaintSelector() *DeviceTaintSelectorApplyConfiguration {
return &DeviceTaintSelectorApplyConfiguration{}
}
// WithDriver sets the Driver field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Driver field is set to the value of the last call.
func (b *DeviceTaintSelectorApplyConfiguration) WithDriver(value string) *DeviceTaintSelectorApplyConfiguration {
b.Driver = &value
return b
}
// WithPool sets the Pool field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Pool field is set to the value of the last call.
func (b *DeviceTaintSelectorApplyConfiguration) WithPool(value string) *DeviceTaintSelectorApplyConfiguration {
b.Pool = &value
return b
}
// WithDevice sets the Device field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Device field is set to the value of the last call.
func (b *DeviceTaintSelectorApplyConfiguration) WithDevice(value string) *DeviceTaintSelectorApplyConfiguration {
b.Device = &value
return b
}

View File

@@ -91,7 +91,7 @@ type ExactDeviceRequestApplyConfiguration struct {
//
// The maximum number of tolerations is 16.
//
// This is an alpha field and requires enabling the DRADeviceTaints
// This is a beta field and requires enabling the DRADeviceTaints
// feature gate.
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
// Capacity define resource requirements against each capacity.

View File

@@ -29,7 +29,7 @@ type NetworkDeviceDataApplyConfiguration struct {
// the allocated device. This might be the name of a physical or virtual
// network interface being configured in the pod.
//
// Must not be longer than 256 characters.
// Must not be longer than 256 bytes.
InterfaceName *string `json:"interfaceName,omitempty"`
// IPs lists the network addresses assigned to the device's network interface.
// This can include both IPv4 and IPv6 addresses.
@@ -39,7 +39,7 @@ type NetworkDeviceDataApplyConfiguration struct {
IPs []string `json:"ips,omitempty"`
// HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.
//
// Must not be longer than 128 characters.
// Must not be longer than 128 bytes.
HardwareAddress *string `json:"hardwareAddress,omitempty"`
}

View File

@@ -0,0 +1,84 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta2
import (
resourcev1beta2 "k8s.io/api/resource/v1beta2"
resource "k8s.io/apimachinery/pkg/api/resource"
)
// NodeAllocatableResourceMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceMapping type for use
// with apply.
//
// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity
// units requested to the corresponding quantity of the node allocatable resource.
type NodeAllocatableResourceMappingApplyConfiguration struct {
// CapacityKey references a capacity name defined as a key in the
// `spec.devices[*].capacity` map. When this field is set, the value associated with
// this key in the `status.allocation.devices.results[*].consumedCapacity` map
// (for a specific claim allocation) determines the base quantity for
// the node allocatable resource. If `allocationMultiplier` is also set, it is
// multiplied with the base quantity.
// For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi",
// and this field is set to "dra.example.com/memory", then for a claim allocation
// that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the
// node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should
// be omitted or set to "1".
CapacityKey *resourcev1beta2.QualifiedName `json:"capacityKey,omitempty"`
// AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim.
// It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set.
// 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim.
// a. A DRA driver representing each CPU core as a device would have
// {ResourceName: "cpu", allocationMultiplier: "2"} in its
// `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim,
// 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity.
// b. A GPU device that needs additional node memory per GPU allocation would
// have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated
// GPU device instance of this type will account for 2Gi of memory.
//
// 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed.
// The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`.
// For example, if a Device's capacity "dra.example.com/cores" is consumed,
// and each "core" provides 2 "cpu"s, the mapping would be:
// {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}.
// If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16.
AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty"`
}
// NodeAllocatableResourceMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceMapping type for use with
// apply.
func NodeAllocatableResourceMapping() *NodeAllocatableResourceMappingApplyConfiguration {
return &NodeAllocatableResourceMappingApplyConfiguration{}
}
// WithCapacityKey sets the CapacityKey field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CapacityKey field is set to the value of the last call.
func (b *NodeAllocatableResourceMappingApplyConfiguration) WithCapacityKey(value resourcev1beta2.QualifiedName) *NodeAllocatableResourceMappingApplyConfiguration {
b.CapacityKey = &value
return b
}
// WithAllocationMultiplier sets the AllocationMultiplier field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the AllocationMultiplier field is set to the value of the last call.
func (b *NodeAllocatableResourceMappingApplyConfiguration) WithAllocationMultiplier(value resource.Quantity) *NodeAllocatableResourceMappingApplyConfiguration {
b.AllocationMultiplier = &value
return b
}

View File

@@ -1,53 +0,0 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
// PodGroupApplyConfiguration represents a declarative configuration of the PodGroup type for use
// with apply.
//
// PodGroup represents a set of pods with a common scheduling policy.
type PodGroupApplyConfiguration struct {
// Name is a unique identifier for the PodGroup within the Workload.
// It must be a DNS label. This field is immutable.
Name *string `json:"name,omitempty"`
// Policy defines the scheduling policy for this PodGroup.
Policy *PodGroupPolicyApplyConfiguration `json:"policy,omitempty"`
}
// PodGroupApplyConfiguration constructs a declarative configuration of the PodGroup type for use with
// apply.
func PodGroup() *PodGroupApplyConfiguration {
return &PodGroupApplyConfiguration{}
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *PodGroupApplyConfiguration) WithName(value string) *PodGroupApplyConfiguration {
b.Name = &value
return b
}
// WithPolicy sets the Policy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Policy field is set to the value of the last call.
func (b *PodGroupApplyConfiguration) WithPolicy(value *PodGroupPolicyApplyConfiguration) *PodGroupApplyConfiguration {
b.Policy = value
return b
}

View File

@@ -16,7 +16,7 @@ limitations under the License.
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
package v1alpha2
// GangSchedulingPolicyApplyConfiguration represents a declarative configuration of the GangSchedulingPolicy type for use
// with apply.

View File

@@ -16,11 +16,10 @@ limitations under the License.
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
package v1alpha2
import (
corev1 "k8s.io/api/core/v1"
schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1"
schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
@@ -28,85 +27,82 @@ import (
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// PriorityClassApplyConfiguration represents a declarative configuration of the PriorityClass type for use
// PodGroupApplyConfiguration represents a declarative configuration of the PodGroup type for use
// with apply.
//
// DEPRECATED - This group version of PriorityClass is deprecated by scheduling.k8s.io/v1/PriorityClass.
// PriorityClass defines mapping from a priority class name to the priority
// integer value. The value can be any valid integer.
type PriorityClassApplyConfiguration struct {
// PodGroup represents a runtime instance of pods grouped together.
// PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from
// Workload.podGroupTemplates.
// PodGroup API enablement is toggled by the GenericWorkload feature gate.
type PodGroupApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
// value represents the integer value of this priority class. This is the actual priority that pods
// receive when they have the name of this class in their pod spec.
Value *int32 `json:"value,omitempty"`
// globalDefault specifies whether this PriorityClass should be considered as
// the default priority for pods that do not have any priority class.
// Only one PriorityClass can be marked as `globalDefault`. However, if more than
// one PriorityClasses exists with their `globalDefault` field set to true,
// the smallest value of such global default PriorityClasses will be used as the default priority.
GlobalDefault *bool `json:"globalDefault,omitempty"`
// description is an arbitrary string that usually provides guidelines on
// when this priority class should be used.
Description *string `json:"description,omitempty"`
// preemptionPolicy is the Policy for preempting pods with lower priority.
// One of Never, PreemptLowerPriority.
// Defaults to PreemptLowerPriority if unset.
PreemptionPolicy *corev1.PreemptionPolicy `json:"preemptionPolicy,omitempty"`
// Spec defines the desired state of the PodGroup.
Spec *PodGroupSpecApplyConfiguration `json:"spec,omitempty"`
// Status represents the current observed state of the PodGroup.
Status *PodGroupStatusApplyConfiguration `json:"status,omitempty"`
}
// PriorityClass constructs a declarative configuration of the PriorityClass type for use with
// PodGroup constructs a declarative configuration of the PodGroup type for use with
// apply.
func PriorityClass(name string) *PriorityClassApplyConfiguration {
b := &PriorityClassApplyConfiguration{}
func PodGroup(name, namespace string) *PodGroupApplyConfiguration {
b := &PodGroupApplyConfiguration{}
b.WithName(name)
b.WithKind("PriorityClass")
b.WithAPIVersion("scheduling.k8s.io/v1alpha1")
b.WithNamespace(namespace)
b.WithKind("PodGroup")
b.WithAPIVersion("scheduling.k8s.io/v1alpha2")
return b
}
// ExtractPriorityClassFrom extracts the applied configuration owned by fieldManager from
// priorityClass for the specified subresource. Pass an empty string for subresource to extract
// ExtractPodGroupFrom extracts the applied configuration owned by fieldManager from
// podGroup for the specified subresource. Pass an empty string for subresource to extract
// the main resource. Common subresources include "status", "scale", etc.
// priorityClass must be a unmodified PriorityClass API object that was retrieved from the Kubernetes API.
// ExtractPriorityClassFrom provides a way to perform a extract/modify-in-place/apply workflow.
// podGroup must be a unmodified PodGroup API object that was retrieved from the Kubernetes API.
// ExtractPodGroupFrom provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractPriorityClassFrom(priorityClass *schedulingv1alpha1.PriorityClass, fieldManager string, subresource string) (*PriorityClassApplyConfiguration, error) {
b := &PriorityClassApplyConfiguration{}
err := managedfields.ExtractInto(priorityClass, internal.Parser().Type("io.k8s.api.scheduling.v1alpha1.PriorityClass"), fieldManager, b, subresource)
func ExtractPodGroupFrom(podGroup *schedulingv1alpha2.PodGroup, fieldManager string, subresource string) (*PodGroupApplyConfiguration, error) {
b := &PodGroupApplyConfiguration{}
err := managedfields.ExtractInto(podGroup, internal.Parser().Type("io.k8s.api.scheduling.v1alpha2.PodGroup"), fieldManager, b, subresource)
if err != nil {
return nil, err
}
b.WithName(priorityClass.Name)
b.WithName(podGroup.Name)
b.WithNamespace(podGroup.Namespace)
b.WithKind("PriorityClass")
b.WithAPIVersion("scheduling.k8s.io/v1alpha1")
b.WithKind("PodGroup")
b.WithAPIVersion("scheduling.k8s.io/v1alpha2")
return b, nil
}
// ExtractPriorityClass extracts the applied configuration owned by fieldManager from
// priorityClass. If no managedFields are found in priorityClass for fieldManager, a
// PriorityClassApplyConfiguration is returned with only the Name, Namespace (if applicable),
// ExtractPodGroup extracts the applied configuration owned by fieldManager from
// podGroup. If no managedFields are found in podGroup for fieldManager, a
// PodGroupApplyConfiguration is returned with only the Name, Namespace (if applicable),
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
// the fieldManager never owned fields any fields.
// priorityClass must be a unmodified PriorityClass API object that was retrieved from the Kubernetes API.
// ExtractPriorityClass provides a way to perform a extract/modify-in-place/apply workflow.
// podGroup must be a unmodified PodGroup API object that was retrieved from the Kubernetes API.
// ExtractPodGroup provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractPriorityClass(priorityClass *schedulingv1alpha1.PriorityClass, fieldManager string) (*PriorityClassApplyConfiguration, error) {
return ExtractPriorityClassFrom(priorityClass, fieldManager, "")
func ExtractPodGroup(podGroup *schedulingv1alpha2.PodGroup, fieldManager string) (*PodGroupApplyConfiguration, error) {
return ExtractPodGroupFrom(podGroup, fieldManager, "")
}
func (b PriorityClassApplyConfiguration) IsApplyConfiguration() {}
// ExtractPodGroupStatus extracts the applied configuration owned by fieldManager from
// podGroup for the status subresource.
func ExtractPodGroupStatus(podGroup *schedulingv1alpha2.PodGroup, fieldManager string) (*PodGroupApplyConfiguration, error) {
return ExtractPodGroupFrom(podGroup, fieldManager, "status")
}
func (b PodGroupApplyConfiguration) IsApplyConfiguration() {}
// WithKind sets the Kind field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Kind field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithKind(value string) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithKind(value string) *PodGroupApplyConfiguration {
b.TypeMetaApplyConfiguration.Kind = &value
return b
}
@@ -114,7 +110,7 @@ func (b *PriorityClassApplyConfiguration) WithKind(value string) *PriorityClassA
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the APIVersion field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithAPIVersion(value string) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithAPIVersion(value string) *PodGroupApplyConfiguration {
b.TypeMetaApplyConfiguration.APIVersion = &value
return b
}
@@ -122,7 +118,7 @@ func (b *PriorityClassApplyConfiguration) WithAPIVersion(value string) *Priority
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithName(value string) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithName(value string) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Name = &value
return b
@@ -131,7 +127,7 @@ func (b *PriorityClassApplyConfiguration) WithName(value string) *PriorityClassA
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the GenerateName field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithGenerateName(value string) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithGenerateName(value string) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.GenerateName = &value
return b
@@ -140,7 +136,7 @@ func (b *PriorityClassApplyConfiguration) WithGenerateName(value string) *Priori
// WithNamespace sets the Namespace field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Namespace field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithNamespace(value string) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithNamespace(value string) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Namespace = &value
return b
@@ -149,7 +145,7 @@ func (b *PriorityClassApplyConfiguration) WithNamespace(value string) *PriorityC
// WithUID sets the UID field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the UID field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithUID(value types.UID) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithUID(value types.UID) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.UID = &value
return b
@@ -158,7 +154,7 @@ func (b *PriorityClassApplyConfiguration) WithUID(value types.UID) *PriorityClas
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceVersion field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithResourceVersion(value string) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithResourceVersion(value string) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
return b
@@ -167,7 +163,7 @@ func (b *PriorityClassApplyConfiguration) WithResourceVersion(value string) *Pri
// WithGeneration sets the Generation field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Generation field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithGeneration(value int64) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithGeneration(value int64) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Generation = &value
return b
@@ -176,7 +172,7 @@ func (b *PriorityClassApplyConfiguration) WithGeneration(value int64) *PriorityC
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
return b
@@ -185,7 +181,7 @@ func (b *PriorityClassApplyConfiguration) WithCreationTimestamp(value metav1.Tim
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
return b
@@ -194,7 +190,7 @@ func (b *PriorityClassApplyConfiguration) WithDeletionTimestamp(value metav1.Tim
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
return b
@@ -204,7 +200,7 @@ func (b *PriorityClassApplyConfiguration) WithDeletionGracePeriodSeconds(value i
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key.
func (b *PriorityClassApplyConfiguration) WithLabels(entries map[string]string) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithLabels(entries map[string]string) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
@@ -219,7 +215,7 @@ func (b *PriorityClassApplyConfiguration) WithLabels(entries map[string]string)
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Annotations field,
// overwriting an existing map entries in Annotations field with the same key.
func (b *PriorityClassApplyConfiguration) WithAnnotations(entries map[string]string) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithAnnotations(entries map[string]string) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
@@ -233,7 +229,7 @@ func (b *PriorityClassApplyConfiguration) WithAnnotations(entries map[string]str
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
func (b *PriorityClassApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
if values[i] == nil {
@@ -247,7 +243,7 @@ func (b *PriorityClassApplyConfiguration) WithOwnerReferences(values ...*v1.Owne
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Finalizers field.
func (b *PriorityClassApplyConfiguration) WithFinalizers(values ...string) *PriorityClassApplyConfiguration {
func (b *PodGroupApplyConfiguration) WithFinalizers(values ...string) *PodGroupApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
@@ -255,62 +251,46 @@ func (b *PriorityClassApplyConfiguration) WithFinalizers(values ...string) *Prio
return b
}
func (b *PriorityClassApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
func (b *PodGroupApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
if b.ObjectMetaApplyConfiguration == nil {
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
}
}
// WithValue sets the Value field in the declarative configuration to the given value
// WithSpec sets the Spec field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Value field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithValue(value int32) *PriorityClassApplyConfiguration {
b.Value = &value
// If called multiple times, the Spec field is set to the value of the last call.
func (b *PodGroupApplyConfiguration) WithSpec(value *PodGroupSpecApplyConfiguration) *PodGroupApplyConfiguration {
b.Spec = value
return b
}
// WithGlobalDefault sets the GlobalDefault field in the declarative configuration to the given value
// WithStatus sets the Status field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the GlobalDefault field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithGlobalDefault(value bool) *PriorityClassApplyConfiguration {
b.GlobalDefault = &value
return b
}
// WithDescription sets the Description field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Description field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithDescription(value string) *PriorityClassApplyConfiguration {
b.Description = &value
return b
}
// WithPreemptionPolicy sets the PreemptionPolicy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PreemptionPolicy field is set to the value of the last call.
func (b *PriorityClassApplyConfiguration) WithPreemptionPolicy(value corev1.PreemptionPolicy) *PriorityClassApplyConfiguration {
b.PreemptionPolicy = &value
// If called multiple times, the Status field is set to the value of the last call.
func (b *PodGroupApplyConfiguration) WithStatus(value *PodGroupStatusApplyConfiguration) *PodGroupApplyConfiguration {
b.Status = value
return b
}
// GetKind retrieves the value of the Kind field in the declarative configuration.
func (b *PriorityClassApplyConfiguration) GetKind() *string {
func (b *PodGroupApplyConfiguration) GetKind() *string {
return b.TypeMetaApplyConfiguration.Kind
}
// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
func (b *PriorityClassApplyConfiguration) GetAPIVersion() *string {
func (b *PodGroupApplyConfiguration) GetAPIVersion() *string {
return b.TypeMetaApplyConfiguration.APIVersion
}
// GetName retrieves the value of the Name field in the declarative configuration.
func (b *PriorityClassApplyConfiguration) GetName() *string {
func (b *PodGroupApplyConfiguration) GetName() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Name
}
// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
func (b *PriorityClassApplyConfiguration) GetNamespace() *string {
func (b *PodGroupApplyConfiguration) GetNamespace() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Namespace
}

View File

@@ -0,0 +1,89 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha2
// PodGroupResourceClaimApplyConfiguration represents a declarative configuration of the PodGroupResourceClaim type for use
// with apply.
//
// PodGroupResourceClaim references exactly one ResourceClaim, either directly
// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim
// for the PodGroup.
//
// It adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup.
// Pods that need access to the ResourceClaim define a matching reference in its
// own Spec.ResourceClaims. The Pod's claim must match all fields of the
// PodGroup's claim exactly.
type PodGroupResourceClaimApplyConfiguration struct {
// Name uniquely identifies this resource claim inside the PodGroup.
// This must be a DNS_LABEL.
Name *string `json:"name,omitempty"`
// ResourceClaimName is the name of a ResourceClaim object in the same
// namespace as this PodGroup. The ResourceClaim will be reserved for the
// PodGroup instead of its individual pods.
//
// Exactly one of ResourceClaimName and ResourceClaimTemplateName must
// be set.
ResourceClaimName *string `json:"resourceClaimName,omitempty"`
// ResourceClaimTemplateName is the name of a ResourceClaimTemplate
// object in the same namespace as this PodGroup.
//
// The template will be used to create a new ResourceClaim, which will
// be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim
// will also be deleted. The PodGroup name and resource name, along with a
// generated component, will be used to form a unique name for the
// ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses.
//
// This field is immutable and no changes will be made to the
// corresponding ResourceClaim by the control plane after creating the
// ResourceClaim.
//
// Exactly one of ResourceClaimName and ResourceClaimTemplateName must
// be set.
ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty"`
}
// PodGroupResourceClaimApplyConfiguration constructs a declarative configuration of the PodGroupResourceClaim type for use with
// apply.
func PodGroupResourceClaim() *PodGroupResourceClaimApplyConfiguration {
return &PodGroupResourceClaimApplyConfiguration{}
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *PodGroupResourceClaimApplyConfiguration) WithName(value string) *PodGroupResourceClaimApplyConfiguration {
b.Name = &value
return b
}
// WithResourceClaimName sets the ResourceClaimName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceClaimName field is set to the value of the last call.
func (b *PodGroupResourceClaimApplyConfiguration) WithResourceClaimName(value string) *PodGroupResourceClaimApplyConfiguration {
b.ResourceClaimName = &value
return b
}
// WithResourceClaimTemplateName sets the ResourceClaimTemplateName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceClaimTemplateName field is set to the value of the last call.
func (b *PodGroupResourceClaimApplyConfiguration) WithResourceClaimTemplateName(value string) *PodGroupResourceClaimApplyConfiguration {
b.ResourceClaimTemplateName = &value
return b
}

View File

@@ -0,0 +1,59 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha2
// PodGroupResourceClaimStatusApplyConfiguration represents a declarative configuration of the PodGroupResourceClaimStatus type for use
// with apply.
//
// PodGroupResourceClaimStatus is stored in the PodGroupStatus for each
// PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the
// generated name for the corresponding ResourceClaim.
type PodGroupResourceClaimStatusApplyConfiguration struct {
// Name uniquely identifies this resource claim inside the PodGroup. This
// must match the name of an entry in podgroup.spec.resourceClaims, which
// implies that the string must be a DNS_LABEL.
Name *string `json:"name,omitempty"`
// ResourceClaimName is the name of the ResourceClaim that was generated for
// the PodGroup in the namespace of the PodGroup. If this is unset, then
// generating a ResourceClaim was not necessary. The
// podgroup.spec.resourceClaims entry can be ignored in this case.
ResourceClaimName *string `json:"resourceClaimName,omitempty"`
}
// PodGroupResourceClaimStatusApplyConfiguration constructs a declarative configuration of the PodGroupResourceClaimStatus type for use with
// apply.
func PodGroupResourceClaimStatus() *PodGroupResourceClaimStatusApplyConfiguration {
return &PodGroupResourceClaimStatusApplyConfiguration{}
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *PodGroupResourceClaimStatusApplyConfiguration) WithName(value string) *PodGroupResourceClaimStatusApplyConfiguration {
b.Name = &value
return b
}
// WithResourceClaimName sets the ResourceClaimName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceClaimName field is set to the value of the last call.
func (b *PodGroupResourceClaimStatusApplyConfiguration) WithResourceClaimName(value string) *PodGroupResourceClaimStatusApplyConfiguration {
b.ResourceClaimName = &value
return b
}

View File

@@ -0,0 +1,48 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha2
// PodGroupSchedulingConstraintsApplyConfiguration represents a declarative configuration of the PodGroupSchedulingConstraints type for use
// with apply.
//
// PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup.
type PodGroupSchedulingConstraintsApplyConfiguration struct {
// Topology defines the topology constraints for the pod group.
// Currently only a single topology constraint can be specified. This may change in the future.
Topology []TopologyConstraintApplyConfiguration `json:"topology,omitempty"`
}
// PodGroupSchedulingConstraintsApplyConfiguration constructs a declarative configuration of the PodGroupSchedulingConstraints type for use with
// apply.
func PodGroupSchedulingConstraints() *PodGroupSchedulingConstraintsApplyConfiguration {
return &PodGroupSchedulingConstraintsApplyConfiguration{}
}
// WithTopology adds the given value to the Topology field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Topology field.
func (b *PodGroupSchedulingConstraintsApplyConfiguration) WithTopology(values ...*TopologyConstraintApplyConfiguration) *PodGroupSchedulingConstraintsApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithTopology")
}
b.Topology = append(b.Topology, *values[i])
}
return b
}

View File

@@ -16,35 +16,36 @@ limitations under the License.
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
package v1alpha2
import (
schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1"
schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2"
)
// PodGroupPolicyApplyConfiguration represents a declarative configuration of the PodGroupPolicy type for use
// PodGroupSchedulingPolicyApplyConfiguration represents a declarative configuration of the PodGroupSchedulingPolicy type for use
// with apply.
//
// PodGroupPolicy defines the scheduling configuration for a PodGroup.
type PodGroupPolicyApplyConfiguration struct {
// PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup.
// Exactly one policy must be set.
type PodGroupSchedulingPolicyApplyConfiguration struct {
// Basic specifies that the pods in this group should be scheduled using
// standard Kubernetes scheduling behavior.
Basic *schedulingv1alpha1.BasicSchedulingPolicy `json:"basic,omitempty"`
Basic *schedulingv1alpha2.BasicSchedulingPolicy `json:"basic,omitempty"`
// Gang specifies that the pods in this group should be scheduled using
// all-or-nothing semantics.
Gang *GangSchedulingPolicyApplyConfiguration `json:"gang,omitempty"`
}
// PodGroupPolicyApplyConfiguration constructs a declarative configuration of the PodGroupPolicy type for use with
// PodGroupSchedulingPolicyApplyConfiguration constructs a declarative configuration of the PodGroupSchedulingPolicy type for use with
// apply.
func PodGroupPolicy() *PodGroupPolicyApplyConfiguration {
return &PodGroupPolicyApplyConfiguration{}
func PodGroupSchedulingPolicy() *PodGroupSchedulingPolicyApplyConfiguration {
return &PodGroupSchedulingPolicyApplyConfiguration{}
}
// WithBasic sets the Basic field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Basic field is set to the value of the last call.
func (b *PodGroupPolicyApplyConfiguration) WithBasic(value schedulingv1alpha1.BasicSchedulingPolicy) *PodGroupPolicyApplyConfiguration {
func (b *PodGroupSchedulingPolicyApplyConfiguration) WithBasic(value schedulingv1alpha2.BasicSchedulingPolicy) *PodGroupSchedulingPolicyApplyConfiguration {
b.Basic = &value
return b
}
@@ -52,7 +53,7 @@ func (b *PodGroupPolicyApplyConfiguration) WithBasic(value schedulingv1alpha1.Ba
// WithGang sets the Gang field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Gang field is set to the value of the last call.
func (b *PodGroupPolicyApplyConfiguration) WithGang(value *GangSchedulingPolicyApplyConfiguration) *PodGroupPolicyApplyConfiguration {
func (b *PodGroupSchedulingPolicyApplyConfiguration) WithGang(value *GangSchedulingPolicyApplyConfiguration) *PodGroupSchedulingPolicyApplyConfiguration {
b.Gang = value
return b
}

View File

@@ -0,0 +1,145 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha2
import (
schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2"
)
// PodGroupSpecApplyConfiguration represents a declarative configuration of the PodGroupSpec type for use
// with apply.
//
// PodGroupSpec defines the desired state of a PodGroup.
type PodGroupSpecApplyConfiguration struct {
// PodGroupTemplateRef references an optional PodGroup template within other object
// (e.g. Workload) that was used to create the PodGroup. This field is immutable.
PodGroupTemplateRef *PodGroupTemplateReferenceApplyConfiguration `json:"podGroupTemplateRef,omitempty"`
// SchedulingPolicy defines the scheduling policy for this instance of the PodGroup.
// Controllers are expected to fill this field by copying it from a PodGroupTemplate.
// This field is immutable.
SchedulingPolicy *PodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"`
// SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup.
// Controllers are expected to fill this field by copying it from a PodGroupTemplate.
// This field is immutable.
// This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled.
SchedulingConstraints *PodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"`
// ResourceClaims defines which ResourceClaims may be shared among Pods in
// the group. Pods consume the devices allocated to a PodGroup's claim by
// defining a claim in its own Spec.ResourceClaims that matches the
// PodGroup's claim exactly. The claim must have the same name and refer to
// the same ResourceClaim or ResourceClaimTemplate.
//
// This is an alpha-level field and requires that the
// DRAWorkloadResourceClaims feature gate is enabled.
//
// This field is immutable.
ResourceClaims []PodGroupResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"`
// DisruptionMode defines the mode in which a given PodGroup can be disrupted.
// Controllers are expected to fill this field by copying it from a PodGroupTemplate.
// One of Pod, PodGroup. Defaults to Pod if unset.
// This field is immutable.
// This field is available only when the WorkloadAwarePreemption feature gate
// is enabled.
DisruptionMode *schedulingv1alpha2.DisruptionMode `json:"disruptionMode,omitempty"`
// PriorityClassName defines the priority that should be considered when scheduling this pod group.
// Controllers are expected to fill this field by copying it from a PodGroupTemplate.
// Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate
// (i.e. if no priority class is specified, admission control can set this to the global default
// priority class if it exists. Otherwise, the pod group's priority will be zero).
// This field is immutable.
// This field is available only when the WorkloadAwarePreemption feature gate
// is enabled.
PriorityClassName *string `json:"priorityClassName,omitempty"`
// Priority is the value of priority of this pod group. Various system components
// use this field to find the priority of the pod group. When Priority Admission
// Controller is enabled, it prevents users from setting this field. The admission
// controller populates this field from PriorityClassName.
// The higher the value, the higher the priority.
// This field is immutable.
// This field is available only when the WorkloadAwarePreemption feature gate
// is enabled.
Priority *int32 `json:"priority,omitempty"`
}
// PodGroupSpecApplyConfiguration constructs a declarative configuration of the PodGroupSpec type for use with
// apply.
func PodGroupSpec() *PodGroupSpecApplyConfiguration {
return &PodGroupSpecApplyConfiguration{}
}
// WithPodGroupTemplateRef sets the PodGroupTemplateRef field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PodGroupTemplateRef field is set to the value of the last call.
func (b *PodGroupSpecApplyConfiguration) WithPodGroupTemplateRef(value *PodGroupTemplateReferenceApplyConfiguration) *PodGroupSpecApplyConfiguration {
b.PodGroupTemplateRef = value
return b
}
// WithSchedulingPolicy sets the SchedulingPolicy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SchedulingPolicy field is set to the value of the last call.
func (b *PodGroupSpecApplyConfiguration) WithSchedulingPolicy(value *PodGroupSchedulingPolicyApplyConfiguration) *PodGroupSpecApplyConfiguration {
b.SchedulingPolicy = value
return b
}
// WithSchedulingConstraints sets the SchedulingConstraints field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SchedulingConstraints field is set to the value of the last call.
func (b *PodGroupSpecApplyConfiguration) WithSchedulingConstraints(value *PodGroupSchedulingConstraintsApplyConfiguration) *PodGroupSpecApplyConfiguration {
b.SchedulingConstraints = value
return b
}
// WithResourceClaims adds the given value to the ResourceClaims field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the ResourceClaims field.
func (b *PodGroupSpecApplyConfiguration) WithResourceClaims(values ...*PodGroupResourceClaimApplyConfiguration) *PodGroupSpecApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithResourceClaims")
}
b.ResourceClaims = append(b.ResourceClaims, *values[i])
}
return b
}
// WithDisruptionMode sets the DisruptionMode field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DisruptionMode field is set to the value of the last call.
func (b *PodGroupSpecApplyConfiguration) WithDisruptionMode(value schedulingv1alpha2.DisruptionMode) *PodGroupSpecApplyConfiguration {
b.DisruptionMode = &value
return b
}
// WithPriorityClassName sets the PriorityClassName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PriorityClassName field is set to the value of the last call.
func (b *PodGroupSpecApplyConfiguration) WithPriorityClassName(value string) *PodGroupSpecApplyConfiguration {
b.PriorityClassName = &value
return b
}
// WithPriority sets the Priority field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Priority field is set to the value of the last call.
func (b *PodGroupSpecApplyConfiguration) WithPriority(value int32) *PodGroupSpecApplyConfiguration {
b.Priority = &value
return b
}

View File

@@ -0,0 +1,81 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha2
import (
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// PodGroupStatusApplyConfiguration represents a declarative configuration of the PodGroupStatus type for use
// with apply.
//
// PodGroupStatus represents information about the status of a pod group.
type PodGroupStatusApplyConfiguration struct {
// Conditions represent the latest observations of the PodGroup's state.
//
// Known condition types:
// - "PodGroupScheduled": Indicates whether the scheduling requirement has been satisfied.
// - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated
// due to disruption such as preemption.
//
// Known reasons for the PodGroupScheduled condition:
// - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints,
// affinity/anti-affinity rules, or insufficient capacity for the gang.
// - "SchedulerError": The PodGroup cannot be scheduled due to some internal error
// that happened during scheduling, for example due to nodeAffinity parsing errors.
//
// Known reasons for the DisruptionTarget condition:
// - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for
// higher-priority PodGroups or Pods.
Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
// Status of resource claims.
ResourceClaimStatuses []PodGroupResourceClaimStatusApplyConfiguration `json:"resourceClaimStatuses,omitempty"`
}
// PodGroupStatusApplyConfiguration constructs a declarative configuration of the PodGroupStatus type for use with
// apply.
func PodGroupStatus() *PodGroupStatusApplyConfiguration {
return &PodGroupStatusApplyConfiguration{}
}
// WithConditions adds the given value to the Conditions field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Conditions field.
func (b *PodGroupStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *PodGroupStatusApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithConditions")
}
b.Conditions = append(b.Conditions, *values[i])
}
return b
}
// WithResourceClaimStatuses adds the given value to the ResourceClaimStatuses field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the ResourceClaimStatuses field.
func (b *PodGroupStatusApplyConfiguration) WithResourceClaimStatuses(values ...*PodGroupResourceClaimStatusApplyConfiguration) *PodGroupStatusApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithResourceClaimStatuses")
}
b.ResourceClaimStatuses = append(b.ResourceClaimStatuses, *values[i])
}
return b
}

View File

@@ -0,0 +1,136 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha2
import (
schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2"
)
// PodGroupTemplateApplyConfiguration represents a declarative configuration of the PodGroupTemplate type for use
// with apply.
//
// PodGroupTemplate represents a template for a set of pods with a scheduling policy.
type PodGroupTemplateApplyConfiguration struct {
// Name is a unique identifier for the PodGroupTemplate within the Workload.
// It must be a DNS label. This field is immutable.
Name *string `json:"name,omitempty"`
// SchedulingPolicy defines the scheduling policy for this PodGroupTemplate.
SchedulingPolicy *PodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"`
// SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate.
// This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled.
SchedulingConstraints *PodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"`
// ResourceClaims defines which ResourceClaims may be shared among Pods in
// the group. Pods consume the devices allocated to a PodGroup's claim by
// defining a claim in its own Spec.ResourceClaims that matches the
// PodGroup's claim exactly. The claim must have the same name and refer to
// the same ResourceClaim or ResourceClaimTemplate.
//
// This is an alpha-level field and requires that the
// DRAWorkloadResourceClaims feature gate is enabled.
//
// This field is immutable.
ResourceClaims []PodGroupResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"`
// DisruptionMode defines the mode in which a given PodGroup can be disrupted.
// One of Pod, PodGroup.
// This field is available only when the WorkloadAwarePreemption feature gate
// is enabled.
DisruptionMode *schedulingv1alpha2.DisruptionMode `json:"disruptionMode,omitempty"`
// PriorityClassName indicates the priority that should be considered when scheduling
// a pod group created from this template. If no priority class is specified, admission
// control can set this to the global default priority class if it exists. Otherwise,
// pod groups created from this template will have the priority set to zero.
// This field is available only when the WorkloadAwarePreemption feature gate
// is enabled.
PriorityClassName *string `json:"priorityClassName,omitempty"`
// Priority is the value of priority of pod groups created from this template. Various
// system components use this field to find the priority of the pod group. When
// Priority Admission Controller is enabled, it prevents users from setting this field.
// The admission controller populates this field from PriorityClassName.
// The higher the value, the higher the priority.
// This field is available only when the WorkloadAwarePreemption feature gate
// is enabled.
Priority *int32 `json:"priority,omitempty"`
}
// PodGroupTemplateApplyConfiguration constructs a declarative configuration of the PodGroupTemplate type for use with
// apply.
func PodGroupTemplate() *PodGroupTemplateApplyConfiguration {
return &PodGroupTemplateApplyConfiguration{}
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *PodGroupTemplateApplyConfiguration) WithName(value string) *PodGroupTemplateApplyConfiguration {
b.Name = &value
return b
}
// WithSchedulingPolicy sets the SchedulingPolicy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SchedulingPolicy field is set to the value of the last call.
func (b *PodGroupTemplateApplyConfiguration) WithSchedulingPolicy(value *PodGroupSchedulingPolicyApplyConfiguration) *PodGroupTemplateApplyConfiguration {
b.SchedulingPolicy = value
return b
}
// WithSchedulingConstraints sets the SchedulingConstraints field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SchedulingConstraints field is set to the value of the last call.
func (b *PodGroupTemplateApplyConfiguration) WithSchedulingConstraints(value *PodGroupSchedulingConstraintsApplyConfiguration) *PodGroupTemplateApplyConfiguration {
b.SchedulingConstraints = value
return b
}
// WithResourceClaims adds the given value to the ResourceClaims field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the ResourceClaims field.
func (b *PodGroupTemplateApplyConfiguration) WithResourceClaims(values ...*PodGroupResourceClaimApplyConfiguration) *PodGroupTemplateApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithResourceClaims")
}
b.ResourceClaims = append(b.ResourceClaims, *values[i])
}
return b
}
// WithDisruptionMode sets the DisruptionMode field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DisruptionMode field is set to the value of the last call.
func (b *PodGroupTemplateApplyConfiguration) WithDisruptionMode(value schedulingv1alpha2.DisruptionMode) *PodGroupTemplateApplyConfiguration {
b.DisruptionMode = &value
return b
}
// WithPriorityClassName sets the PriorityClassName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PriorityClassName field is set to the value of the last call.
func (b *PodGroupTemplateApplyConfiguration) WithPriorityClassName(value string) *PodGroupTemplateApplyConfiguration {
b.PriorityClassName = &value
return b
}
// WithPriority sets the Priority field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Priority field is set to the value of the last call.
func (b *PodGroupTemplateApplyConfiguration) WithPriority(value int32) *PodGroupTemplateApplyConfiguration {
b.Priority = &value
return b
}

View File

@@ -0,0 +1,44 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha2
// PodGroupTemplateReferenceApplyConfiguration represents a declarative configuration of the PodGroupTemplateReference type for use
// with apply.
//
// PodGroupTemplateReference references a PodGroup template defined in some object (e.g. Workload).
// Exactly one reference must be set.
type PodGroupTemplateReferenceApplyConfiguration struct {
// Workload references the PodGroupTemplate within the Workload object that was used to create
// the PodGroup.
Workload *WorkloadPodGroupTemplateReferenceApplyConfiguration `json:"workload,omitempty"`
}
// PodGroupTemplateReferenceApplyConfiguration constructs a declarative configuration of the PodGroupTemplateReference type for use with
// apply.
func PodGroupTemplateReference() *PodGroupTemplateReferenceApplyConfiguration {
return &PodGroupTemplateReferenceApplyConfiguration{}
}
// WithWorkload sets the Workload field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Workload field is set to the value of the last call.
func (b *PodGroupTemplateReferenceApplyConfiguration) WithWorkload(value *WorkloadPodGroupTemplateReferenceApplyConfiguration) *PodGroupTemplateReferenceApplyConfiguration {
b.Workload = value
return b
}

View File

@@ -0,0 +1,45 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha2
// TopologyConstraintApplyConfiguration represents a declarative configuration of the TopologyConstraint type for use
// with apply.
//
// TopologyConstraint defines a topology constraint for a PodGroup.
type TopologyConstraintApplyConfiguration struct {
// Key specifies the key of the node label representing the topology domain.
// All pods within the PodGroup must be colocated within the same domain instance.
// Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate.
// Examples: "topology.kubernetes.io/rack"
Key *string `json:"key,omitempty"`
}
// TopologyConstraintApplyConfiguration constructs a declarative configuration of the TopologyConstraint type for use with
// apply.
func TopologyConstraint() *TopologyConstraintApplyConfiguration {
return &TopologyConstraintApplyConfiguration{}
}
// WithKey sets the Key field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Key field is set to the value of the last call.
func (b *TopologyConstraintApplyConfiguration) WithKey(value string) *TopologyConstraintApplyConfiguration {
b.Key = &value
return b
}

View File

@@ -16,7 +16,7 @@ limitations under the License.
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
package v1alpha2
// TypedLocalObjectReferenceApplyConfiguration represents a declarative configuration of the TypedLocalObjectReference type for use
// with apply.

View File

@@ -16,10 +16,10 @@ limitations under the License.
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
package v1alpha2
import (
schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1"
schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
@@ -31,12 +31,13 @@ import (
// with apply.
//
// Workload allows for expressing scheduling constraints that should be used
// when managing lifecycle of workloads from scheduling perspective,
// when managing the lifecycle of workloads from the scheduling perspective,
// including scheduling, preemption, eviction and other phases.
// Workload API enablement is toggled by the GenericWorkload feature gate.
type WorkloadApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
// Standard object's metadata.
// Name must be a DNS subdomain.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
// Spec defines the desired behavior of a Workload.
Spec *WorkloadSpecApplyConfiguration `json:"spec,omitempty"`
@@ -49,7 +50,7 @@ func Workload(name, namespace string) *WorkloadApplyConfiguration {
b.WithName(name)
b.WithNamespace(namespace)
b.WithKind("Workload")
b.WithAPIVersion("scheduling.k8s.io/v1alpha1")
b.WithAPIVersion("scheduling.k8s.io/v1alpha2")
return b
}
@@ -60,9 +61,9 @@ func Workload(name, namespace string) *WorkloadApplyConfiguration {
// ExtractWorkloadFrom provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractWorkloadFrom(workload *schedulingv1alpha1.Workload, fieldManager string, subresource string) (*WorkloadApplyConfiguration, error) {
func ExtractWorkloadFrom(workload *schedulingv1alpha2.Workload, fieldManager string, subresource string) (*WorkloadApplyConfiguration, error) {
b := &WorkloadApplyConfiguration{}
err := managedfields.ExtractInto(workload, internal.Parser().Type("io.k8s.api.scheduling.v1alpha1.Workload"), fieldManager, b, subresource)
err := managedfields.ExtractInto(workload, internal.Parser().Type("io.k8s.api.scheduling.v1alpha2.Workload"), fieldManager, b, subresource)
if err != nil {
return nil, err
}
@@ -70,7 +71,7 @@ func ExtractWorkloadFrom(workload *schedulingv1alpha1.Workload, fieldManager str
b.WithNamespace(workload.Namespace)
b.WithKind("Workload")
b.WithAPIVersion("scheduling.k8s.io/v1alpha1")
b.WithAPIVersion("scheduling.k8s.io/v1alpha2")
return b, nil
}
@@ -84,7 +85,7 @@ func ExtractWorkloadFrom(workload *schedulingv1alpha1.Workload, fieldManager str
// ExtractWorkload provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
func ExtractWorkload(workload *schedulingv1alpha1.Workload, fieldManager string) (*WorkloadApplyConfiguration, error) {
func ExtractWorkload(workload *schedulingv1alpha2.Workload, fieldManager string) (*WorkloadApplyConfiguration, error) {
return ExtractWorkloadFrom(workload, fieldManager, "")
}

View File

@@ -0,0 +1,52 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha2
// WorkloadPodGroupTemplateReferenceApplyConfiguration represents a declarative configuration of the WorkloadPodGroupTemplateReference type for use
// with apply.
//
// WorkloadPodGroupTemplateReference references the PodGroupTemplate within the Workload object.
type WorkloadPodGroupTemplateReferenceApplyConfiguration struct {
// WorkloadName defines the name of the Workload object.
WorkloadName *string `json:"workloadName,omitempty"`
// PodGroupTemplateName defines the PodGroupTemplate name within the Workload object.
PodGroupTemplateName *string `json:"podGroupTemplateName,omitempty"`
}
// WorkloadPodGroupTemplateReferenceApplyConfiguration constructs a declarative configuration of the WorkloadPodGroupTemplateReference type for use with
// apply.
func WorkloadPodGroupTemplateReference() *WorkloadPodGroupTemplateReferenceApplyConfiguration {
return &WorkloadPodGroupTemplateReferenceApplyConfiguration{}
}
// WithWorkloadName sets the WorkloadName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the WorkloadName field is set to the value of the last call.
func (b *WorkloadPodGroupTemplateReferenceApplyConfiguration) WithWorkloadName(value string) *WorkloadPodGroupTemplateReferenceApplyConfiguration {
b.WorkloadName = &value
return b
}
// WithPodGroupTemplateName sets the PodGroupTemplateName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PodGroupTemplateName field is set to the value of the last call.
func (b *WorkloadPodGroupTemplateReferenceApplyConfiguration) WithPodGroupTemplateName(value string) *WorkloadPodGroupTemplateReferenceApplyConfiguration {
b.PodGroupTemplateName = &value
return b
}

View File

@@ -16,7 +16,7 @@ limitations under the License.
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
package v1alpha2
// WorkloadSpecApplyConfiguration represents a declarative configuration of the WorkloadSpec type for use
// with apply.
@@ -26,11 +26,11 @@ type WorkloadSpecApplyConfiguration struct {
// ControllerRef is an optional reference to the controlling object, such as a
// Deployment or Job. This field is intended for use by tools like CLIs
// to provide a link back to the original workload definition.
// When set, it cannot be changed.
// This field is immutable.
ControllerRef *TypedLocalObjectReferenceApplyConfiguration `json:"controllerRef,omitempty"`
// PodGroups is the list of pod groups that make up the Workload.
// The maximum number of pod groups is 8. This field is immutable.
PodGroups []PodGroupApplyConfiguration `json:"podGroups,omitempty"`
// PodGroupTemplates is the list of templates that make up the Workload.
// The maximum number of templates is 8. This field is immutable.
PodGroupTemplates []PodGroupTemplateApplyConfiguration `json:"podGroupTemplates,omitempty"`
}
// WorkloadSpecApplyConfiguration constructs a declarative configuration of the WorkloadSpec type for use with
@@ -47,15 +47,15 @@ func (b *WorkloadSpecApplyConfiguration) WithControllerRef(value *TypedLocalObje
return b
}
// WithPodGroups adds the given value to the PodGroups field in the declarative configuration
// WithPodGroupTemplates adds the given value to the PodGroupTemplates field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the PodGroups field.
func (b *WorkloadSpecApplyConfiguration) WithPodGroups(values ...*PodGroupApplyConfiguration) *WorkloadSpecApplyConfiguration {
// If called multiple times, values provided by each call will be appended to the PodGroupTemplates field.
func (b *WorkloadSpecApplyConfiguration) WithPodGroupTemplates(values ...*PodGroupTemplateApplyConfiguration) *WorkloadSpecApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithPodGroups")
panic("nil value passed to WithPodGroupTemplates")
}
b.PodGroups = append(b.PodGroups, *values[i])
b.PodGroupTemplates = append(b.PodGroupTemplates, *values[i])
}
return b
}

View File

@@ -154,7 +154,7 @@ type CSIDriverSpecApplyConfiguration struct {
// occur (neither periodic nor upon detecting capacity-related failures), and the
// allocatable.count remains static. The minimum allowed value for this field is 10 seconds.
//
// This is a beta feature and requires the MutableCSINodeAllocatableCount feature gate to be enabled.
// This feature requires the MutableCSINodeAllocatableCount feature gate to be enabled.
//
// This field is mutable.
NodeAllocatableUpdatePeriodSeconds *int64 `json:"nodeAllocatableUpdatePeriodSeconds,omitempty"`
@@ -178,6 +178,24 @@ type CSIDriverSpecApplyConfiguration struct {
//
// Default behavior if unset is to pass tokens in the VolumeContext field.
ServiceAccountTokenInSecrets *bool `json:"serviceAccountTokenInSecrets,omitempty"`
// PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod
// scheduling if the CSI driver on the node is missing.
//
// Enabling this option will prevent the scheduler (or any other
// component which embeds default scheduler such as cluster-autoscaler) from
// scheduling pods to nodes where CSI driver is not installed.
//
// For components(such as cluster-autoscaler) that embed the scheduler and run
// pod placement simulations using scheduler plugins, they MUST be aware of
// CSI driver registration information via CSINode object. They must create simulated
// CSINode objects in addition to Node objects during scheduling simulation, otherwise
// if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any
// newly created node may be rejected by the scheduler because of missing CSI driver
// information from the node.
//
// This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled.
// Default is "false".
PreventPodSchedulingIfMissing *bool `json:"preventPodSchedulingIfMissing,omitempty"`
}
// CSIDriverSpecApplyConfiguration constructs a declarative configuration of the CSIDriverSpec type for use with
@@ -272,3 +290,11 @@ func (b *CSIDriverSpecApplyConfiguration) WithServiceAccountTokenInSecrets(value
b.ServiceAccountTokenInSecrets = &value
return b
}
// WithPreventPodSchedulingIfMissing sets the PreventPodSchedulingIfMissing field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PreventPodSchedulingIfMissing field is set to the value of the last call.
func (b *CSIDriverSpecApplyConfiguration) WithPreventPodSchedulingIfMissing(value bool) *CSIDriverSpecApplyConfiguration {
b.PreventPodSchedulingIfMissing = &value
return b
}

View File

@@ -35,7 +35,7 @@ type VolumeErrorApplyConfiguration struct {
Message *string `json:"message,omitempty"`
// errorCode is a numeric gRPC code representing the error encountered during Attach or Detach operations.
//
// This is an optional, beta field that requires the MutableCSINodeAllocatableCount feature gate being enabled to be set.
// This field requires the MutableCSINodeAllocatableCount feature gate being enabled to be set.
ErrorCode *int32 `json:"errorCode,omitempty"`
}

View File

@@ -178,6 +178,24 @@ type CSIDriverSpecApplyConfiguration struct {
//
// Default behavior if unset is to pass tokens in the VolumeContext field.
ServiceAccountTokenInSecrets *bool `json:"serviceAccountTokenInSecrets,omitempty"`
// PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod
// scheduling if the CSI driver on the node is missing.
//
// Enabling this option will prevent the scheduler (or any other
// component which embeds default scheduler such as cluster-autoscaler) from
// scheduling pods to nodes where CSI driver is not installed.
//
// For components(such as cluster-autoscaler) that embed the scheduler and run
// pod placement simulations using scheduler plugins, they MUST be aware of
// CSI driver registration information via CSINode object. They must create simulated
// CSINode objects in addition to Node objects during scheduling simulation, otherwise
// if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any
// newly created node may be rejected by the scheduler because of missing CSI driver
// information from the node.
//
// This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled.
// Default is "false".
PreventPodSchedulingIfMissing *bool `json:"preventPodSchedulingIfMissing,omitempty"`
}
// CSIDriverSpecApplyConfiguration constructs a declarative configuration of the CSIDriverSpec type for use with
@@ -272,3 +290,11 @@ func (b *CSIDriverSpecApplyConfiguration) WithServiceAccountTokenInSecrets(value
b.ServiceAccountTokenInSecrets = &value
return b
}
// WithPreventPodSchedulingIfMissing sets the PreventPodSchedulingIfMissing field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PreventPodSchedulingIfMissing field is set to the value of the last call.
func (b *CSIDriverSpecApplyConfiguration) WithPreventPodSchedulingIfMissing(value bool) *CSIDriverSpecApplyConfiguration {
b.PreventPodSchedulingIfMissing = &value
return b
}

View File

@@ -62,7 +62,7 @@ import (
resourcev1beta1 "k8s.io/api/resource/v1beta1"
resourcev1beta2 "k8s.io/api/resource/v1beta2"
schedulingv1 "k8s.io/api/scheduling/v1"
schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1"
schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2"
schedulingv1beta1 "k8s.io/api/scheduling/v1beta1"
storagev1 "k8s.io/api/storage/v1"
storagev1alpha1 "k8s.io/api/storage/v1alpha1"
@@ -117,7 +117,7 @@ import (
applyconfigurationsresourcev1beta1 "k8s.io/client-go/applyconfigurations/resource/v1beta1"
applyconfigurationsresourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2"
applyconfigurationsschedulingv1 "k8s.io/client-go/applyconfigurations/scheduling/v1"
applyconfigurationsschedulingv1alpha1 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha1"
applyconfigurationsschedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2"
applyconfigurationsschedulingv1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1"
applyconfigurationsstoragev1 "k8s.io/client-go/applyconfigurations/storage/v1"
applyconfigurationsstoragev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1"
@@ -130,18 +130,32 @@ import (
func ForKind(kind schema.GroupVersionKind) interface{} {
switch kind {
// Group=admissionregistration.k8s.io, Version=v1
case v1.SchemeGroupVersion.WithKind("ApplyConfiguration"):
return &admissionregistrationv1.ApplyConfigurationApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("AuditAnnotation"):
return &admissionregistrationv1.AuditAnnotationApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("ExpressionWarning"):
return &admissionregistrationv1.ExpressionWarningApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("JSONPatch"):
return &admissionregistrationv1.JSONPatchApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("MatchCondition"):
return &admissionregistrationv1.MatchConditionApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("MatchResources"):
return &admissionregistrationv1.MatchResourcesApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicy"):
return &admissionregistrationv1.MutatingAdmissionPolicyApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBinding"):
return &admissionregistrationv1.MutatingAdmissionPolicyBindingApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBindingSpec"):
return &admissionregistrationv1.MutatingAdmissionPolicyBindingSpecApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicySpec"):
return &admissionregistrationv1.MutatingAdmissionPolicySpecApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("MutatingWebhook"):
return &admissionregistrationv1.MutatingWebhookApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("MutatingWebhookConfiguration"):
return &admissionregistrationv1.MutatingWebhookConfigurationApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("Mutation"):
return &admissionregistrationv1.MutationApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("NamedRuleWithOperations"):
return &admissionregistrationv1.NamedRuleWithOperationsApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("ParamKind"):
@@ -776,6 +790,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationscorev1.NodeAddressApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("NodeAffinity"):
return &applyconfigurationscorev1.NodeAffinityApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("NodeAllocatableResourceClaimStatus"):
return &applyconfigurationscorev1.NodeAllocatableResourceClaimStatusApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("NodeCondition"):
return &applyconfigurationscorev1.NodeConditionApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("NodeConfigSource"):
@@ -860,6 +876,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationscorev1.PodResourceClaimStatusApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("PodSchedulingGate"):
return &applyconfigurationscorev1.PodSchedulingGateApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("PodSchedulingGroup"):
return &applyconfigurationscorev1.PodSchedulingGroupApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("PodSecurityContext"):
return &applyconfigurationscorev1.PodSecurityContextApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("PodSpec"):
@@ -1000,8 +1018,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationscorev1.WeightedPodAffinityTermApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("WindowsSecurityContextOptions"):
return &applyconfigurationscorev1.WindowsSecurityContextOptionsApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("WorkloadReference"):
return &applyconfigurationscorev1.WorkloadReferenceApplyConfiguration{}
// Group=discovery.k8s.io, Version=v1
case discoveryv1.SchemeGroupVersion.WithKind("Endpoint"):
@@ -1606,6 +1622,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationsresourcev1.ExactDeviceRequestApplyConfiguration{}
case resourcev1.SchemeGroupVersion.WithKind("NetworkDeviceData"):
return &applyconfigurationsresourcev1.NetworkDeviceDataApplyConfiguration{}
case resourcev1.SchemeGroupVersion.WithKind("NodeAllocatableResourceMapping"):
return &applyconfigurationsresourcev1.NodeAllocatableResourceMappingApplyConfiguration{}
case resourcev1.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"):
return &applyconfigurationsresourcev1.OpaqueDeviceConfigurationApplyConfiguration{}
case resourcev1.SchemeGroupVersion.WithKind("ResourceClaim"):
@@ -1638,6 +1656,14 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &resourcev1alpha3.DeviceTaintRuleStatusApplyConfiguration{}
case v1alpha3.SchemeGroupVersion.WithKind("DeviceTaintSelector"):
return &resourcev1alpha3.DeviceTaintSelectorApplyConfiguration{}
case v1alpha3.SchemeGroupVersion.WithKind("PoolStatus"):
return &resourcev1alpha3.PoolStatusApplyConfiguration{}
case v1alpha3.SchemeGroupVersion.WithKind("ResourcePoolStatusRequest"):
return &resourcev1alpha3.ResourcePoolStatusRequestApplyConfiguration{}
case v1alpha3.SchemeGroupVersion.WithKind("ResourcePoolStatusRequestSpec"):
return &resourcev1alpha3.ResourcePoolStatusRequestSpecApplyConfiguration{}
case v1alpha3.SchemeGroupVersion.WithKind("ResourcePoolStatusRequestStatus"):
return &resourcev1alpha3.ResourcePoolStatusRequestStatusApplyConfiguration{}
// Group=resource.k8s.io, Version=v1beta1
case resourcev1beta1.SchemeGroupVersion.WithKind("AllocatedDeviceStatus"):
@@ -1698,6 +1724,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationsresourcev1beta1.DeviceTolerationApplyConfiguration{}
case resourcev1beta1.SchemeGroupVersion.WithKind("NetworkDeviceData"):
return &applyconfigurationsresourcev1beta1.NetworkDeviceDataApplyConfiguration{}
case resourcev1beta1.SchemeGroupVersion.WithKind("NodeAllocatableResourceMapping"):
return &applyconfigurationsresourcev1beta1.NodeAllocatableResourceMappingApplyConfiguration{}
case resourcev1beta1.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"):
return &applyconfigurationsresourcev1beta1.OpaqueDeviceConfigurationApplyConfiguration{}
case resourcev1beta1.SchemeGroupVersion.WithKind("ResourceClaim"):
@@ -1772,12 +1800,22 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationsresourcev1beta2.DeviceSubRequestApplyConfiguration{}
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaint"):
return &applyconfigurationsresourcev1beta2.DeviceTaintApplyConfiguration{}
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintRule"):
return &applyconfigurationsresourcev1beta2.DeviceTaintRuleApplyConfiguration{}
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintRuleSpec"):
return &applyconfigurationsresourcev1beta2.DeviceTaintRuleSpecApplyConfiguration{}
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintRuleStatus"):
return &applyconfigurationsresourcev1beta2.DeviceTaintRuleStatusApplyConfiguration{}
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintSelector"):
return &applyconfigurationsresourcev1beta2.DeviceTaintSelectorApplyConfiguration{}
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceToleration"):
return &applyconfigurationsresourcev1beta2.DeviceTolerationApplyConfiguration{}
case resourcev1beta2.SchemeGroupVersion.WithKind("ExactDeviceRequest"):
return &applyconfigurationsresourcev1beta2.ExactDeviceRequestApplyConfiguration{}
case resourcev1beta2.SchemeGroupVersion.WithKind("NetworkDeviceData"):
return &applyconfigurationsresourcev1beta2.NetworkDeviceDataApplyConfiguration{}
case resourcev1beta2.SchemeGroupVersion.WithKind("NodeAllocatableResourceMapping"):
return &applyconfigurationsresourcev1beta2.NodeAllocatableResourceMappingApplyConfiguration{}
case resourcev1beta2.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"):
return &applyconfigurationsresourcev1beta2.OpaqueDeviceConfigurationApplyConfiguration{}
case resourcev1beta2.SchemeGroupVersion.WithKind("ResourceClaim"):
@@ -1803,21 +1841,37 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
case schedulingv1.SchemeGroupVersion.WithKind("PriorityClass"):
return &applyconfigurationsschedulingv1.PriorityClassApplyConfiguration{}
// Group=scheduling.k8s.io, Version=v1alpha1
case schedulingv1alpha1.SchemeGroupVersion.WithKind("GangSchedulingPolicy"):
return &applyconfigurationsschedulingv1alpha1.GangSchedulingPolicyApplyConfiguration{}
case schedulingv1alpha1.SchemeGroupVersion.WithKind("PodGroup"):
return &applyconfigurationsschedulingv1alpha1.PodGroupApplyConfiguration{}
case schedulingv1alpha1.SchemeGroupVersion.WithKind("PodGroupPolicy"):
return &applyconfigurationsschedulingv1alpha1.PodGroupPolicyApplyConfiguration{}
case schedulingv1alpha1.SchemeGroupVersion.WithKind("PriorityClass"):
return &applyconfigurationsschedulingv1alpha1.PriorityClassApplyConfiguration{}
case schedulingv1alpha1.SchemeGroupVersion.WithKind("TypedLocalObjectReference"):
return &applyconfigurationsschedulingv1alpha1.TypedLocalObjectReferenceApplyConfiguration{}
case schedulingv1alpha1.SchemeGroupVersion.WithKind("Workload"):
return &applyconfigurationsschedulingv1alpha1.WorkloadApplyConfiguration{}
case schedulingv1alpha1.SchemeGroupVersion.WithKind("WorkloadSpec"):
return &applyconfigurationsschedulingv1alpha1.WorkloadSpecApplyConfiguration{}
// Group=scheduling.k8s.io, Version=v1alpha2
case schedulingv1alpha2.SchemeGroupVersion.WithKind("GangSchedulingPolicy"):
return &applyconfigurationsschedulingv1alpha2.GangSchedulingPolicyApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroup"):
return &applyconfigurationsschedulingv1alpha2.PodGroupApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupResourceClaim"):
return &applyconfigurationsschedulingv1alpha2.PodGroupResourceClaimApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupResourceClaimStatus"):
return &applyconfigurationsschedulingv1alpha2.PodGroupResourceClaimStatusApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupSchedulingConstraints"):
return &applyconfigurationsschedulingv1alpha2.PodGroupSchedulingConstraintsApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupSchedulingPolicy"):
return &applyconfigurationsschedulingv1alpha2.PodGroupSchedulingPolicyApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupSpec"):
return &applyconfigurationsschedulingv1alpha2.PodGroupSpecApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupStatus"):
return &applyconfigurationsschedulingv1alpha2.PodGroupStatusApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupTemplate"):
return &applyconfigurationsschedulingv1alpha2.PodGroupTemplateApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupTemplateReference"):
return &applyconfigurationsschedulingv1alpha2.PodGroupTemplateReferenceApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("TopologyConstraint"):
return &applyconfigurationsschedulingv1alpha2.TopologyConstraintApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("TypedLocalObjectReference"):
return &applyconfigurationsschedulingv1alpha2.TypedLocalObjectReferenceApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("Workload"):
return &applyconfigurationsschedulingv1alpha2.WorkloadApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("WorkloadPodGroupTemplateReference"):
return &applyconfigurationsschedulingv1alpha2.WorkloadPodGroupTemplateReferenceApplyConfiguration{}
case schedulingv1alpha2.SchemeGroupVersion.WithKind("WorkloadSpec"):
return &applyconfigurationsschedulingv1alpha2.WorkloadSpecApplyConfiguration{}
// Group=scheduling.k8s.io, Version=v1beta1
case schedulingv1beta1.SchemeGroupVersion.WithKind("PriorityClass"):

View File

@@ -157,6 +157,13 @@ func (f *envVarFeatureGates) set(featureName Feature, featureValue bool, allowCh
// read from the corresponding environmental variable.
func (f *envVarFeatureGates) getEnabledMapFromEnvVar() map[Feature]bool {
f.readEnvVarsOnce.Do(func() {
// This code does not really support contextual logging. Making it do so has huge
// implications for several call chains because the Enabled call then needs
// a `*WithLogger` variant. This does not matter in Kubernetes itself because
// all Kubernetes components replace the feature gate implementation used
// by client-go, but it might matter elsewhere.
logger := klog.Background()
featureGatesState := map[Feature]bool{}
for feature, featureSpec := range f.known {
featureState, featureStateSet := os.LookupEnv(fmt.Sprintf("KUBE_FEATURE_%s", feature))
@@ -166,10 +173,10 @@ func (f *envVarFeatureGates) getEnabledMapFromEnvVar() map[Feature]bool {
boolVal, boolErr := strconv.ParseBool(featureState)
switch {
case boolErr != nil:
utilruntime.HandleError(fmt.Errorf("cannot set feature gate %q to %q, due to %v", feature, featureState, boolErr))
utilruntime.HandleErrorWithLogger(logger, boolErr, "Could not set feature gate", "feature", feature, "desiredState", featureState)
case featureSpec.LockToDefault:
if boolVal != featureSpec.Default {
utilruntime.HandleError(fmt.Errorf("cannot set feature gate %q to %q, feature is locked to %v", feature, featureState, featureSpec.Default))
utilruntime.HandleErrorWithLogger(logger, nil, "Could not set feature gate, feature is locked", "feature", feature, "desiredState", featureState, "lockedState", featureSpec.Default)
break
}
featureGatesState[feature] = featureSpec.Default
@@ -182,10 +189,10 @@ func (f *envVarFeatureGates) getEnabledMapFromEnvVar() map[Feature]bool {
for feature, featureSpec := range f.known {
if featureState, ok := featureGatesState[feature]; ok {
klog.V(1).InfoS("Feature gate updated state", "feature", feature, "enabled", featureState)
logger.V(1).Info("Feature gate updated state", "feature", feature, "enabled", featureState)
continue
}
klog.V(1).InfoS("Feature gate default state", "feature", feature, "enabled", featureSpec.Default)
logger.V(1).Info("Feature gate default state", "feature", feature, "enabled", featureSpec.Default)
}
})
return f.enabledViaEnvVar.Load().(map[Feature]bool)

View File

@@ -17,7 +17,7 @@ limitations under the License.
package features
import (
"errors"
"context"
"sync/atomic"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
@@ -127,7 +127,9 @@ func AddVersionedFeaturesToExistingFeatureGates(registry VersionedRegistry) erro
// clientgofeaturegate.ReplaceFeatureGates(utilfeature.DefaultMutableFeatureGate)
func ReplaceFeatureGates(newFeatureGates Gates) {
if replaceFeatureGatesWithWarningIndicator(newFeatureGates) {
utilruntime.HandleError(errors.New("the default feature gates implementation has already been used and now it's being overwritten. This might lead to unexpected behaviour. Check your initialization order"))
// TODO (?): A new API would be needed where callers pass in a context or logger.
// Probably not worth it.
utilruntime.HandleErrorWithContext(context.TODO(), nil, "The default feature gates implementation has already been used and now it's being overwritten. This might lead to unexpected behaviour. Check your initialization order.")
}
}

View File

@@ -38,6 +38,13 @@ const (
// events for items popped off the FIFO.
AtomicFIFO Feature = "AtomicFIFO"
// owner: @yt2985
// beta: 1.36
//
// If enabled, allows clients to gracefully handle Certificate Authority (CA)
// rotations without dropping connections or requiring a restart.
ClientsAllowCARotation Feature = "ClientsAllowCARotation"
// owner: @benluddy
// kep: https://kep.k8s.io/4222
// alpha: 1.32
@@ -48,6 +55,13 @@ const (
// "application/json" or "application/apply-patch+yaml", respectively.
ClientsAllowCBOR Feature = "ClientsAllowCBOR"
// owner: @enj
// beta: v1.36
//
// If enabled, the client-go TLS transport cache uses weak pointers to allow
// garbage collection of unused transports, preventing unbounded cache growth.
ClientsAllowTLSCacheGC Feature = "ClientsAllowTLSCacheGC"
// owner: @benluddy
// kep: https://kep.k8s.io/4222
// alpha: 1.32
@@ -98,9 +112,15 @@ var defaultVersionedKubernetesFeatureGates = map[Feature]VersionedSpecs{
AtomicFIFO: {
{Version: version.MustParse("1.36"), Default: true, PreRelease: Beta},
},
ClientsAllowCARotation: {
{Version: version.MustParse("1.36"), Default: true, PreRelease: Beta},
},
ClientsAllowCBOR: {
{Version: version.MustParse("1.32"), Default: false, PreRelease: Alpha},
},
ClientsAllowTLSCacheGC: {
{Version: version.MustParse("1.36"), Default: true, PreRelease: Beta},
},
ClientsPreferCBOR: {
{Version: version.MustParse("1.32"), Default: false, PreRelease: Alpha},
},

24
go.mod
View File

@@ -2,9 +2,9 @@
module k8s.io/client-go
go 1.25.0
go 1.26.0
godebug default=go1.25
godebug default=go1.26
require (
github.com/go-logr/logr v1.4.3
@@ -21,21 +21,21 @@ require (
golang.org/x/oauth2 v0.34.0
golang.org/x/term v0.39.0
golang.org/x/time v0.14.0
google.golang.org/protobuf v1.36.11
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af
gopkg.in/evanphx/json-patch.v4 v4.13.0
k8s.io/api v0.0.0-20260205193817-6f99b47a2bbd
k8s.io/apimachinery v0.0.0-20260205233455-f12546b4989d
k8s.io/klog/v2 v2.130.1
k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4
k8s.io/utils v0.0.0-20260108192941-914a6e750570
k8s.io/api v0.36.2
k8s.io/apimachinery v0.36.2
k8s.io/klog/v2 v2.140.0
k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a
k8s.io/streaming v0.36.2
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730
sigs.k8s.io/randfill v1.0.0
sigs.k8s.io/structured-merge-diff/v6 v6.3.1
sigs.k8s.io/structured-merge-diff/v6 v6.3.2
sigs.k8s.io/yaml v1.6.0
)
require (
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
@@ -43,14 +43,12 @@ require (
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/moby/spdystream v0.5.0 // indirect
github.com/moby/spdystream v0.5.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/x448/float16 v0.8.4 // indirect

52
go.sum
View File

@@ -1,5 +1,3 @@
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
@@ -21,8 +19,6 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo=
@@ -30,8 +26,6 @@ github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7O
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8=
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo=
@@ -49,8 +43,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/moby/spdystream v0.5.0 h1:7r0J1Si3QO/kjRitvSLVVFUjxMEb/YLj6S9FF62JBCU=
github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI=
github.com/moby/spdystream v0.5.1 h1:9sNYeYZUcci9R6/w7KDaFWEWeV4LStVG78Mpyq/Zm/Y=
github.com/moby/spdystream v0.5.1/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -59,12 +53,6 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFd
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/onsi/ginkgo/v2 v2.27.4 h1:fcEcQW/A++6aZAZQNUmNjvA9PSOzefMJBerHJ4t8v8Y=
github.com/onsi/ginkgo/v2 v2.27.4/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
github.com/onsi/gomega v1.39.0 h1:y2ROC3hKFmQZJNFeGAMeHZKkjBL65mIZcvrLQBF9k6Q=
github.com/onsi/gomega v1.39.0/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4=
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@@ -93,14 +81,10 @@ go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c=
golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU=
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw=
golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.39.0 h1:RclSuaJf32jOqZz74CkPA9qFuVTX7vhLlpfj/IGWlqY=
@@ -109,10 +93,8 @@ golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA=
golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI=
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
@@ -123,21 +105,23 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.0.0-20260205193817-6f99b47a2bbd h1:tgzQul+6n5AQYpFcrhpV9fn7dLVlLG7J+7GkXPe8LOg=
k8s.io/api v0.0.0-20260205193817-6f99b47a2bbd/go.mod h1:GZUpeSi8zsYiS/GDA9jMt0/+n6PAFNj8Z/eK2Rd/IvQ=
k8s.io/apimachinery v0.0.0-20260205233455-f12546b4989d h1:bxuu4ynFTom/p7dq3+D7rcM500tuOXgMoEY7OqtmboE=
k8s.io/apimachinery v0.0.0-20260205233455-f12546b4989d/go.mod h1:hQkG060WLAG1TIkYsu5lj3tb6YdNpKe5Zrr2UPGg+/k=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4 h1:HhDfevmPS+OalTjQRKbTHppRIz01AWi8s45TMXStgYY=
k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ=
k8s.io/utils v0.0.0-20260108192941-914a6e750570 h1:JT4W8lsdrGENg9W+YwwdLJxklIuKWdRm+BC+xt33FOY=
k8s.io/utils v0.0.0-20260108192941-914a6e750570/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
k8s.io/api v0.36.2 h1:TF6YDLIzKfccK7cq9YpTcGX8TJmEkHVRv78DM51fRYY=
k8s.io/api v0.36.2/go.mod h1:F4LbMO4brjZYh7yFkXWhynSvtB7YauxV4c+HHkNRGNg=
k8s.io/apimachinery v0.36.2 h1:0PE/W/WNy1UX61NLbXY5TMbJ6UwLL6E6lAPkYrKFxbQ=
k8s.io/apimachinery v0.36.2/go.mod h1:fvf/HOLXq9RId0rnDIbN1OEBvHXdQbLMM8nu0LcBUf4=
k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc=
k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0=
k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a h1:xCeOEAOoGYl2jnJoHkC3hkbPJgdATINPMAxaynU2Ovg=
k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0=
k8s.io/streaming v0.36.2 h1:NSKthPPg9UFSKsRauVJUVGH2Dvn8fhKmY4qrMkw/p98=
k8s.io/streaming v0.36.2/go.mod h1:z6fV3D+NVkoeqRMtWwlUZK6U17SY/LqNzOxWL6GyR/s=
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU=
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/structured-merge-diff/v6 v6.3.1 h1:JrhdFMqOd/+3ByqlP2I45kTOZmTRLBUm5pvRjeheg7E=
sigs.k8s.io/structured-merge-diff/v6 v6.3.1/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE=
sigs.k8s.io/structured-merge-diff/v6 v6.3.2 h1:kwVWMx5yS1CrnFWA/2QHyRVJ8jM6dBA80uLmm0wJkk8=
sigs.k8s.io/structured-merge-diff/v6 v6.3.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE=
sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=

View File

@@ -24,6 +24,10 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
// MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer.
MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer
// MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer.
MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer
// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer.
MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer
// ValidatingAdmissionPolicies returns a ValidatingAdmissionPolicyInformer.
@@ -45,6 +49,16 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer.
func (v *version) MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer {
return &mutatingAdmissionPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer.
func (v *version) MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer {
return &mutatingAdmissionPolicyBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer.
func (v *version) MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer {
return &mutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}

View File

@@ -0,0 +1,115 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1
import (
context "context"
time "time"
apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
admissionregistrationv1 "k8s.io/client-go/listers/admissionregistration/v1"
cache "k8s.io/client-go/tools/cache"
)
// MutatingAdmissionPolicyInformer provides access to a shared informer and lister for
// MutatingAdmissionPolicies.
type MutatingAdmissionPolicyInformer interface {
Informer() cache.SharedIndexInformer
Lister() admissionregistrationv1.MutatingAdmissionPolicyLister
}
type mutatingAdmissionPolicyInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers})
}
// NewFilteredMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions})
}
// NewMutatingAdmissionPolicyInformerWithOptions constructs a new informer for MutatingAdmissionPolicy type with additional options.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer {
gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "mutatingadmissionpolicys"}
identifier := options.InformerName.WithResource(gvr)
tweakListOptions := options.TweakListOptions
return cache.NewSharedIndexInformerWithOptions(
cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&opts)
}
return client.AdmissionregistrationV1().MutatingAdmissionPolicies().List(context.Background(), opts)
},
WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&opts)
}
return client.AdmissionregistrationV1().MutatingAdmissionPolicies().Watch(context.Background(), opts)
},
ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&opts)
}
return client.AdmissionregistrationV1().MutatingAdmissionPolicies().List(ctx, opts)
},
WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&opts)
}
return client.AdmissionregistrationV1().MutatingAdmissionPolicies().Watch(ctx, opts)
},
}, client),
&apiadmissionregistrationv1.MutatingAdmissionPolicy{},
cache.SharedIndexInformerOptions{
ResyncPeriod: options.ResyncPeriod,
Indexers: options.Indexers,
Identifier: identifier,
},
)
}
func (f *mutatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions})
}
func (f *mutatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&apiadmissionregistrationv1.MutatingAdmissionPolicy{}, f.defaultInformer)
}
func (f *mutatingAdmissionPolicyInformer) Lister() admissionregistrationv1.MutatingAdmissionPolicyLister {
return admissionregistrationv1.NewMutatingAdmissionPolicyLister(f.Informer().GetIndexer())
}

View File

@@ -0,0 +1,115 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1
import (
context "context"
time "time"
apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
admissionregistrationv1 "k8s.io/client-go/listers/admissionregistration/v1"
cache "k8s.io/client-go/tools/cache"
)
// MutatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for
// MutatingAdmissionPolicyBindings.
type MutatingAdmissionPolicyBindingInformer interface {
Informer() cache.SharedIndexInformer
Lister() admissionregistrationv1.MutatingAdmissionPolicyBindingLister
}
type mutatingAdmissionPolicyBindingInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers})
}
// NewFilteredMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions})
}
// NewMutatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for MutatingAdmissionPolicyBinding type with additional options.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer {
gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "mutatingadmissionpolicybindings"}
identifier := options.InformerName.WithResource(gvr)
tweakListOptions := options.TweakListOptions
return cache.NewSharedIndexInformerWithOptions(
cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&opts)
}
return client.AdmissionregistrationV1().MutatingAdmissionPolicyBindings().List(context.Background(), opts)
},
WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&opts)
}
return client.AdmissionregistrationV1().MutatingAdmissionPolicyBindings().Watch(context.Background(), opts)
},
ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&opts)
}
return client.AdmissionregistrationV1().MutatingAdmissionPolicyBindings().List(ctx, opts)
},
WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&opts)
}
return client.AdmissionregistrationV1().MutatingAdmissionPolicyBindings().Watch(ctx, opts)
},
}, client),
&apiadmissionregistrationv1.MutatingAdmissionPolicyBinding{},
cache.SharedIndexInformerOptions{
ResyncPeriod: options.ResyncPeriod,
Indexers: options.Indexers,
Identifier: identifier,
},
)
}
func (f *mutatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions})
}
func (f *mutatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&apiadmissionregistrationv1.MutatingAdmissionPolicyBinding{}, f.defaultInformer)
}
func (f *mutatingAdmissionPolicyBindingInformer) Lister() admissionregistrationv1.MutatingAdmissionPolicyBindingLister {
return admissionregistrationv1.NewMutatingAdmissionPolicyBindingLister(f.Informer().GetIndexer())
}

View File

@@ -19,6 +19,7 @@ limitations under the License.
package informers
import (
context "context"
reflect "reflect"
sync "sync"
time "time"
@@ -26,6 +27,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
wait "k8s.io/apimachinery/pkg/util/wait"
admissionregistration "k8s.io/client-go/informers/admissionregistration"
apiserverinternal "k8s.io/client-go/informers/apiserverinternal"
apps "k8s.io/client-go/informers/apps"
@@ -158,6 +160,10 @@ func NewSharedInformerFactoryWithOptions(client kubernetes.Interface, defaultRes
}
func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
f.StartWithContext(wait.ContextForChannel(stopCh))
}
func (f *sharedInformerFactory) StartWithContext(ctx context.Context) {
f.lock.Lock()
defer f.lock.Unlock()
@@ -167,15 +173,9 @@ func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
for informerType, informer := range f.informers {
if !f.startedInformers[informerType] {
f.wg.Add(1)
// We need a new variable in each loop iteration,
// otherwise the goroutine would use the loop variable
// and that keeps changing.
informer := informer
go func() {
defer f.wg.Done()
informer.Run(stopCh)
}()
f.wg.Go(func() {
informer.RunWithContext(ctx)
})
f.startedInformers[informerType] = true
}
}
@@ -192,6 +192,11 @@ func (f *sharedInformerFactory) Shutdown() {
}
func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool {
result := f.WaitForCacheSyncWithContext(wait.ContextForChannel(stopCh))
return result.Synced
}
func (f *sharedInformerFactory) WaitForCacheSyncWithContext(ctx context.Context) cache.SyncResult {
informers := func() map[reflect.Type]cache.SharedIndexInformer {
f.lock.Lock()
defer f.lock.Unlock()
@@ -205,10 +210,31 @@ func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[ref
return informers
}()
res := map[reflect.Type]bool{}
for informType, informer := range informers {
res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced)
// Wait for informers to sync, without polling.
cacheSyncs := make([]cache.DoneChecker, 0, len(informers))
for _, informer := range informers {
cacheSyncs = append(cacheSyncs, informer.HasSyncedChecker())
}
cache.WaitFor(ctx, "" /* no logging */, cacheSyncs...)
res := cache.SyncResult{
Synced: make(map[reflect.Type]bool, len(informers)),
}
failed := false
for informType, informer := range informers {
hasSynced := informer.HasSynced()
if !hasSynced {
failed = true
}
res.Synced[informType] = hasSynced
}
if failed {
// context.Cause is more informative than ctx.Err().
// This must be non-nil, otherwise WaitFor wouldn't have stopped
// prematurely.
res.Err = context.Cause(ctx)
}
return res
}
@@ -230,7 +256,9 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal
}
informer = newFunc(f.client, resyncPeriod)
informer.SetTransform(f.transform)
if f.transform != nil {
informer.SetTransform(f.transform)
}
f.informers[informerType] = informer
return informer
@@ -247,27 +275,46 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal
// defer factory.WaitForStop() // Returns immediately if nothing was started.
// genericInformer := factory.ForResource(resource)
// typedInformer := factory.SomeAPIGroup().V1().SomeType()
// factory.Start(ctx.Done()) // Start processing these informers.
// synced := factory.WaitForCacheSync(ctx.Done())
// for v, ok := range synced {
// if !ok {
// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v)
// return
// }
// handle, err := typeInformer.Informer().AddEventHandler(...)
// if err != nil {
// return fmt.Errorf("register event handler: %v", err)
// }
// defer typeInformer.Informer().RemoveEventHandler(handle) // Avoids leaking goroutines.
// factory.StartWithContext(ctx) // Start processing these informers.
// synced := factory.WaitForCacheSyncWithContext(ctx)
// if err := synced.AsError(); err != nil {
// return err
// }
// for v := range synced {
// // Only if desired log some information similar to this.
// fmt.Fprintf(os.Stdout, "cache synced: %s", v)
// }
//
// // Also make sure that all of the initial cache events have been delivered.
// if !WaitFor(ctx, "event handler sync", handle.HasSyncedChecker()) {
// // Must have failed because of context.
// return fmt.Errorf("sync event handler: %w", context.Cause(ctx))
// }
//
// // Creating informers can also be created after Start, but then
// // Start must be called again:
// anotherGenericInformer := factory.ForResource(resource)
// factory.Start(ctx.Done())
// factory.StartWithContext(ctx)
type SharedInformerFactory interface {
internalinterfaces.SharedInformerFactory
// Start initializes all requested informers. They are handled in goroutines
// which run until the stop channel gets closed.
// Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync.
//
// Contextual logging: StartWithContext should be used instead of Start in code which supports contextual logging.
Start(stopCh <-chan struct{})
// StartWithContext initializes all requested informers. They are handled in goroutines
// which run until the context gets canceled.
// Warning: StartWithContext does not block. When run in a go-routine, it will race with a later WaitForCacheSync.
StartWithContext(ctx context.Context)
// Shutdown marks a factory as shutting down. At that point no new
// informers can be started anymore and Start will return without
// doing anything.
@@ -282,8 +329,14 @@ type SharedInformerFactory interface {
// WaitForCacheSync blocks until all started informers' caches were synced
// or the stop channel gets closed.
//
// Contextual logging: WaitForCacheSync should be used instead of WaitForCacheSync in code which supports contextual logging. It also returns a more useful result.
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
// WaitForCacheSyncWithContext blocks until all started informers' caches were synced
// or the context gets canceled.
WaitForCacheSyncWithContext(ctx context.Context) cache.SyncResult
// ForResource gives generic access to a shared informer of the matching type.
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)

View File

@@ -63,7 +63,7 @@ import (
resourcev1beta1 "k8s.io/api/resource/v1beta1"
resourcev1beta2 "k8s.io/api/resource/v1beta2"
schedulingv1 "k8s.io/api/scheduling/v1"
schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1"
schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2"
schedulingv1beta1 "k8s.io/api/scheduling/v1beta1"
storagev1 "k8s.io/api/storage/v1"
storagev1alpha1 "k8s.io/api/storage/v1alpha1"
@@ -100,6 +100,10 @@ func (f *genericInformer) Lister() cache.GenericLister {
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource {
// Group=admissionregistration.k8s.io, Version=v1
case v1.SchemeGroupVersion.WithResource("mutatingadmissionpolicies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().MutatingAdmissionPolicies().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("mutatingadmissionpolicybindings"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().MutatingAdmissionPolicyBindings().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().MutatingWebhookConfigurations().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"):
@@ -388,6 +392,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
// Group=resource.k8s.io, Version=v1alpha3
case v1alpha3.SchemeGroupVersion.WithResource("devicetaintrules"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha3().DeviceTaintRules().Informer()}, nil
case v1alpha3.SchemeGroupVersion.WithResource("resourcepoolstatusrequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha3().ResourcePoolStatusRequests().Informer()}, nil
// Group=resource.k8s.io, Version=v1beta1
case resourcev1beta1.SchemeGroupVersion.WithResource("deviceclasses"):
@@ -402,6 +408,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
// Group=resource.k8s.io, Version=v1beta2
case resourcev1beta2.SchemeGroupVersion.WithResource("deviceclasses"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta2().DeviceClasses().Informer()}, nil
case resourcev1beta2.SchemeGroupVersion.WithResource("devicetaintrules"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta2().DeviceTaintRules().Informer()}, nil
case resourcev1beta2.SchemeGroupVersion.WithResource("resourceclaims"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta2().ResourceClaims().Informer()}, nil
case resourcev1beta2.SchemeGroupVersion.WithResource("resourceclaimtemplates"):
@@ -413,11 +421,11 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case schedulingv1.SchemeGroupVersion.WithResource("priorityclasses"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().PriorityClasses().Informer()}, nil
// Group=scheduling.k8s.io, Version=v1alpha1
case schedulingv1alpha1.SchemeGroupVersion.WithResource("priorityclasses"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().PriorityClasses().Informer()}, nil
case schedulingv1alpha1.SchemeGroupVersion.WithResource("workloads"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().Workloads().Informer()}, nil
// Group=scheduling.k8s.io, Version=v1alpha2
case schedulingv1alpha2.SchemeGroupVersion.WithResource("podgroups"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha2().PodGroups().Informer()}, nil
case schedulingv1alpha2.SchemeGroupVersion.WithResource("workloads"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha2().Workloads().Informer()}, nil
// Group=scheduling.k8s.io, Version=v1beta1
case schedulingv1beta1.SchemeGroupVersion.WithResource("priorityclasses"):

Some files were not shown because too many files have changed in this diff Show More