func (b *Builder) WithNodeAffinity(nodeName string) *Builder {
	if len(nodeName) == 0 {
		b.errs = append(b.errs, errors.New("failed to build PV object: missing PV node name"))
		return b
	}
	nodeAffinity := &corev1.VolumeNodeAffinity{
		Required: &corev1.NodeSelector{
			NodeSelectorTerms: []corev1.NodeSelectorTerm{
				{
					MatchExpressions: []corev1.NodeSelectorRequirement{
						{
							Key:      KeyNode,
							Operator: corev1.NodeSelectorOpIn,
							Values: []string{
								nodeName,
							},
						},
					},
				},
			},
		},
	}
	b.pv.object.Spec.NodeAffinity = nodeAffinity
	return b
}
// WithNodeAffinity sets the NodeAffinity field of PV with provided node name
WithNodeAffinity sets the NodeAffinity field of PV with provided node name
// WithNodeAffinity sets the NodeAffinity field of PV with provided node name
func (b *Builder) WithNodeAffinity(nodeName string) *Builder {
	if len(nodeName) == 0 {
		b.errs = append(b.errs, errors.New("failed to build PV object: missing PV node name"))
		return b
	}
	nodeAffinity := &corev1.VolumeNodeAffinity{
		Required: &corev1.NodeSelector{
			NodeSelectorTerms: []corev1.NodeSelectorTerm{
				{
					MatchExpressions: []corev1.NodeSelectorRequirement{
						{
							Key:      KeyNode,
							Operator: corev1.NodeSelectorOpIn,
							Values: []string{
								nodeName,
							},
						},
					},
				},
			},
		},
	}
	b.pv.object.Spec.NodeAffinity = nodeAffinity
	return b
}
func ( b * Builder ) WithNodeAffinity ( nodeName string ) * Builder { if len ( nodeName ) == 0 { b . errs = append ( b . errs , errors . New ( " " ) ) return b } nodeAffinity := & corev1 . VolumeNodeAffinity { Required : & corev1 . NodeSelector { NodeSelectorTerms : [ ] corev1 . NodeSelectorTerm { { MatchExpressions : [ ] corev1 . NodeSelectorRequirement { { Key : KeyNode , Operator : corev1 . NodeSelectorOpIn , Values : [ ] string { nodeName , } , } , } , } , } , } , } b . pv . object . Spec . NodeAffinity = nodeAffinity return b }
WithNodeAffinity sets the NodeAffinity field of PV with provided node name
WithNodeAffinity sets the NodeAffinity field of PV with provided node name