mirror of
https://github.com/cozystack/cozystack.git
synced 2026-10-29 16:17:20 +09:00
The NVIDIA and mediated entries of the KubeVirt permittedHostDevices table are GPU resource names besides the hoster's gpu.resourceNames list, whether the hoster sets one or not. Without that, a GPU name only the table carries, on a node whose agent reports nothing and with no class of its own, would not be a GPU resource name: under forbidden the raw-name policy would let a VM or a pod request it directly, and the VMI webhook would take it for a non-GPU host device. The binder adds those names to the effective set it publishes in the settings ConfigMap, which the policy and cozystack-api read, and the VMI webhook adds them when it looks for a VMI's own GPU entries. A PCI entry of another vendor, such as a ConnectX VF, stays out. Whether a class's resource name is in the table at all is still checked against every PCI and mediated entry. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
50 lines
1.8 KiB
Go
50 lines
1.8 KiB
Go
/*
|
|
Copyright 2026 The Cozystack 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.
|
|
*/
|
|
|
|
package gpu
|
|
|
|
import "time"
|
|
|
|
// Config is the GPU feature configuration cozystack-controller takes from
|
|
// its flags.
|
|
type Config struct {
|
|
// Enabled turns on everything that watches KubeVirt objects: binder
|
|
// placement, the VMI and pod webhooks, VMI garbage collection. The
|
|
// gpu.cozystack.io lifecycle paths (finalizers, usage-record cleanup)
|
|
// run regardless, so disabling the feature never hangs a deletion.
|
|
Enabled bool
|
|
|
|
// ResourceNames is the hoster's gpu.resourceNames list. The effective
|
|
// set adds the KubeVirt table's GPU names (model.PermittedGPUNames) and
|
|
// class and agent-reported names (model.ResourceNames).
|
|
ResourceNames []string
|
|
|
|
// RawResourceNames is the hoster's gpu.rawResourceNames; empty means
|
|
// RawNamesAllowed.
|
|
RawResourceNames RawNamesPolicy
|
|
|
|
// LostCapacityGrace is how long a node may serve fewer units of a
|
|
// resource than its devices hold, or stay NotReady, before it has lost
|
|
// capacity. kubelet reports zero allocatable after every restart, so it
|
|
// must outlast a plugin re-registration.
|
|
LostCapacityGrace time.Duration
|
|
|
|
// AttachmentGrace is how long an attachment, or a template device, may
|
|
// wait for its VMI to appear. It must exceed the API server request
|
|
// timeout.
|
|
AttachmentGrace time.Duration
|
|
}
|