...

Source file src/k8s.io/client-go/applyconfigurations/node/v1beta1/scheduling.go

Documentation: k8s.io/client-go/applyconfigurations/node/v1beta1

     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  
    17  // Code generated by applyconfiguration-gen. DO NOT EDIT.
    18  
    19  package v1beta1
    20  
    21  import (
    22  	v1 "k8s.io/client-go/applyconfigurations/core/v1"
    23  )
    24  
    25  // SchedulingApplyConfiguration represents an declarative configuration of the Scheduling type for use
    26  // with apply.
    27  type SchedulingApplyConfiguration struct {
    28  	NodeSelector map[string]string                 `json:"nodeSelector,omitempty"`
    29  	Tolerations  []v1.TolerationApplyConfiguration `json:"tolerations,omitempty"`
    30  }
    31  
    32  // SchedulingApplyConfiguration constructs an declarative configuration of the Scheduling type for use with
    33  // apply.
    34  func Scheduling() *SchedulingApplyConfiguration {
    35  	return &SchedulingApplyConfiguration{}
    36  }
    37  
    38  // WithNodeSelector puts the entries into the NodeSelector 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 NodeSelector field,
    41  // overwriting an existing map entries in NodeSelector field with the same key.
    42  func (b *SchedulingApplyConfiguration) WithNodeSelector(entries map[string]string) *SchedulingApplyConfiguration {
    43  	if b.NodeSelector == nil && len(entries) > 0 {
    44  		b.NodeSelector = make(map[string]string, len(entries))
    45  	}
    46  	for k, v := range entries {
    47  		b.NodeSelector[k] = v
    48  	}
    49  	return b
    50  }
    51  
    52  // WithTolerations adds the given value to the Tolerations 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 Tolerations field.
    55  func (b *SchedulingApplyConfiguration) WithTolerations(values ...*v1.TolerationApplyConfiguration) *SchedulingApplyConfiguration {
    56  	for i := range values {
    57  		if values[i] == nil {
    58  			panic("nil value passed to WithTolerations")
    59  		}
    60  		b.Tolerations = append(b.Tolerations, *values[i])
    61  	}
    62  	return b
    63  }
    64  

View as plain text