sigs.k8s.io/kueue@v0.6.2/client-go/applyconfiguration/kueue/v1beta1/resourceflavorspec.go (about)

     1  /*
     2  Copyright The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  // Code generated by applyconfiguration-gen. DO NOT EDIT.
    17  
    18  package v1beta1
    19  
    20  import (
    21  	v1 "k8s.io/api/core/v1"
    22  )
    23  
    24  // ResourceFlavorSpecApplyConfiguration represents an declarative configuration of the ResourceFlavorSpec type for use
    25  // with apply.
    26  type ResourceFlavorSpecApplyConfiguration struct {
    27  	NodeLabels  map[string]string `json:"nodeLabels,omitempty"`
    28  	NodeTaints  []v1.Taint        `json:"nodeTaints,omitempty"`
    29  	Tolerations []v1.Toleration   `json:"tolerations,omitempty"`
    30  }
    31  
    32  // ResourceFlavorSpecApplyConfiguration constructs an declarative configuration of the ResourceFlavorSpec type for use with
    33  // apply.
    34  func ResourceFlavorSpec() *ResourceFlavorSpecApplyConfiguration {
    35  	return &ResourceFlavorSpecApplyConfiguration{}
    36  }
    37  
    38  // WithNodeLabels puts the entries into the NodeLabels field in the declarative configuration
    39  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
    40  // If called multiple times, the entries provided by each call will be put on the NodeLabels field,
    41  // overwriting an existing map entries in NodeLabels field with the same key.
    42  func (b *ResourceFlavorSpecApplyConfiguration) WithNodeLabels(entries map[string]string) *ResourceFlavorSpecApplyConfiguration {
    43  	if b.NodeLabels == nil && len(entries) > 0 {
    44  		b.NodeLabels = make(map[string]string, len(entries))
    45  	}
    46  	for k, v := range entries {
    47  		b.NodeLabels[k] = v
    48  	}
    49  	return b
    50  }
    51  
    52  // WithNodeTaints adds the given value to the NodeTaints field in the declarative configuration
    53  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
    54  // If called multiple times, values provided by each call will be appended to the NodeTaints field.
    55  func (b *ResourceFlavorSpecApplyConfiguration) WithNodeTaints(values ...v1.Taint) *ResourceFlavorSpecApplyConfiguration {
    56  	for i := range values {
    57  		b.NodeTaints = append(b.NodeTaints, values[i])
    58  	}
    59  	return b
    60  }
    61  
    62  // WithTolerations adds the given value to the Tolerations field in the declarative configuration
    63  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
    64  // If called multiple times, values provided by each call will be appended to the Tolerations field.
    65  func (b *ResourceFlavorSpecApplyConfiguration) WithTolerations(values ...v1.Toleration) *ResourceFlavorSpecApplyConfiguration {
    66  	for i := range values {
    67  		b.Tolerations = append(b.Tolerations, values[i])
    68  	}
    69  	return b
    70  }