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

// NodeAllocatableOverheadResourcesApplyConfiguration represents a declarative configuration of the NodeAllocatableOverheadResources type for use
// with apply.
//
// NodeAllocatableOverheadResources describes auxiliary overhead resource allocations.
type NodeAllocatableOverheadResourcesApplyConfiguration struct {
	// Name is the name of the resource (e.g., cpu, memory).
	Name *corev1.ResourceName `json:"name,omitempty"`
	// PerPod is the flat overhead quantity allocated per pod.
	// Adding to each container limit allows individual containers to utilize the overhead, while the parent pod-level cgroup limit caps the total usage at the pod boundary where the overhead is accounted for exactly once.
	// At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration.
	PerPod *resource.Quantity `json:"perPod,omitempty"`
	// PerContainer is the variable overhead quantity applied for each container referencing the claim.
	// The container references are recorded in `nodeAllocatableResourceClaimStatuses.containers`.
	// The total overhead quantity allocated for the claim is computed as:
	// Quantity = PerPod + (PerContainer * NumReferences)
	// Kubelet accounts for this overhead in cgroups:
	// - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences).
	// - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container.
	// This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once.
	// At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration.
	PerContainer *resource.Quantity `json:"perContainer,omitempty"`
}

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

// 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 *NodeAllocatableOverheadResourcesApplyConfiguration) WithName(value corev1.ResourceName) *NodeAllocatableOverheadResourcesApplyConfiguration {
	b.Name = &value
	return b
}

// WithPerPod sets the PerPod 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 PerPod field is set to the value of the last call.
func (b *NodeAllocatableOverheadResourcesApplyConfiguration) WithPerPod(value resource.Quantity) *NodeAllocatableOverheadResourcesApplyConfiguration {
	b.PerPod = &value
	return b
}

// WithPerContainer sets the PerContainer 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 PerContainer field is set to the value of the last call.
func (b *NodeAllocatableOverheadResourcesApplyConfiguration) WithPerContainer(value resource.Quantity) *NodeAllocatableOverheadResourcesApplyConfiguration {
	b.PerContainer = &value
	return b
}
