/*
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

// NodeAllocatableResourceApplyConfiguration represents a declarative configuration of the NodeAllocatableResource type for use
// with apply.
//
// NodeAllocatableResource defines the translation between the DRA device/capacity
// units requested to the corresponding quantity of the node allocatable resource.
// At least one of Mapping or Overhead must be specified. Not specifying either is an invalid configuration.
type NodeAllocatableResourceApplyConfiguration struct {
	// Mapping is used when the device directly models a node allocatable resource like standard CPU or memory
	// (e.g., with a CPU DRA driver). The calculated quantity is accounted for exactly once per claim instance
	// on the node. To prevent node cgroup isolation friction, the scheduler explicitly
	// blocks sharing mapped device claims across multiple pods.
	Mapping *NodeAllocatableMappingApplyConfiguration `json:"mapping,omitempty"`
	// Overhead contains fields for modeling auxiliary overhead incurred on node allocatable resources
	// when allocating devices that are not themselves modeling a node allocatable resource (e.g., host memory overhead for GPUs).
	// Sharing overhead-mapped claims across multiple pods is allowed. The node allocatable overhead is accounted
	// for individually for each pod referencing the claim.
	// Overhead is always subtracted from the node's allocatable capacity for the resource, even when mapping
	// is specified for the same resource.
	// Eg: If a device models memory capacity per socket as a consumable capacity pool via Mapping (with CapacityKey),
	// any overhead specified for the same resource will be subtracted from the node's general allocatable capacity
	// and not from the per-socket capacity pool in Mapping.
	Overhead *NodeAllocatableOverheadApplyConfiguration `json:"overhead,omitempty"`
}

// NodeAllocatableResourceApplyConfiguration constructs a declarative configuration of the NodeAllocatableResource type for use with
// apply.
func NodeAllocatableResource() *NodeAllocatableResourceApplyConfiguration {
	return &NodeAllocatableResourceApplyConfiguration{}
}

// WithMapping sets the Mapping 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 Mapping field is set to the value of the last call.
func (b *NodeAllocatableResourceApplyConfiguration) WithMapping(value *NodeAllocatableMappingApplyConfiguration) *NodeAllocatableResourceApplyConfiguration {
	b.Mapping = value
	return b
}

// WithOverhead sets the Overhead 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 Overhead field is set to the value of the last call.
func (b *NodeAllocatableResourceApplyConfiguration) WithOverhead(value *NodeAllocatableOverheadApplyConfiguration) *NodeAllocatableResourceApplyConfiguration {
	b.Overhead = value
	return b
}
