github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/pkg/kubernetes/k8s/toleration.go (about)

     1  package k8s
     2  
     3  import corev1 "k8s.io/api/core/v1"
     4  
     5  type Tolerations []Toleration
     6  
     7  func (t Tolerations) K8s() []corev1.Toleration {
     8  	if t == nil {
     9  		return nil
    10  	}
    11  	tolerations := make([]corev1.Toleration, len(t))
    12  	for idx := range t {
    13  		tolerations[idx] = t[idx].K8s()
    14  	}
    15  	return tolerations
    16  }
    17  
    18  type Toleration corev1.Toleration
    19  
    20  func (t Toleration) K8s() corev1.Toleration {
    21  	return corev1.Toleration(t)
    22  }
    23  
    24  func (t Toleration) MarshalYAML() (interface{}, error) {
    25  	return MarshalYAML(&t)
    26  }
    27  
    28  func (t *Toleration) UnmarshalYAML(unmarshal func(interface{}) error) error {
    29  	return UnmarshalYAML(t, unmarshal)
    30  }