go.mod: bump client-go and api machinerie
I had to run `make generate`. Some API functions got additional parameters `Options` and `Context`. I used empty options and `context.TODO()` for now. Signed-off-by: leonnicolas <leonloechner@gmx.de>
This commit is contained in:
		
							
								
								
									
										15
									
								
								vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -116,6 +116,10 @@ const ( | ||||
| 	// This is similar to ErrorTypeInvalid, but the error will not include the | ||||
| 	// too-long value.  See TooLong(). | ||||
| 	ErrorTypeTooLong ErrorType = "FieldValueTooLong" | ||||
| 	// ErrorTypeTooMany is used to report "too many". This is used to | ||||
| 	// report that a given list has too many items. This is similar to FieldValueTooLong, | ||||
| 	// but the error indicates quantity instead of length. | ||||
| 	ErrorTypeTooMany ErrorType = "FieldValueTooMany" | ||||
| 	// ErrorTypeInternal is used to report other errors that are not related | ||||
| 	// to user input.  See InternalError(). | ||||
| 	ErrorTypeInternal ErrorType = "InternalError" | ||||
| @@ -138,6 +142,8 @@ func (t ErrorType) String() string { | ||||
| 		return "Forbidden" | ||||
| 	case ErrorTypeTooLong: | ||||
| 		return "Too long" | ||||
| 	case ErrorTypeTooMany: | ||||
| 		return "Too many" | ||||
| 	case ErrorTypeInternal: | ||||
| 		return "Internal error" | ||||
| 	default: | ||||
| @@ -198,7 +204,14 @@ func Forbidden(field *Path, detail string) *Error { | ||||
| // Invalid, but the returned error will not include the too-long | ||||
| // value. | ||||
| func TooLong(field *Path, value interface{}, maxLength int) *Error { | ||||
| 	return &Error{ErrorTypeTooLong, field.String(), value, fmt.Sprintf("must have at most %d characters", maxLength)} | ||||
| 	return &Error{ErrorTypeTooLong, field.String(), value, fmt.Sprintf("must have at most %d bytes", maxLength)} | ||||
| } | ||||
|  | ||||
| // TooMany returns a *Error indicating "too many". This is used to | ||||
| // report that a given list has too many items. This is similar to TooLong, | ||||
| // but the returned error indicates quantity instead of length. | ||||
| func TooMany(field *Path, actualQuantity, maxQuantity int) *Error { | ||||
| 	return &Error{ErrorTypeTooMany, field.String(), actualQuantity, fmt.Sprintf("must have at most %d items", maxQuantity)} | ||||
| } | ||||
|  | ||||
| // InternalError returns a *Error indicating "internal error".  This is used | ||||
|   | ||||
							
								
								
									
										26
									
								
								vendor/k8s.io/apimachinery/pkg/util/validation/field/path.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								vendor/k8s.io/apimachinery/pkg/util/validation/field/path.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -22,6 +22,29 @@ import ( | ||||
| 	"strconv" | ||||
| ) | ||||
|  | ||||
| type pathOptions struct { | ||||
| 	path *Path | ||||
| } | ||||
|  | ||||
| // PathOption modifies a pathOptions | ||||
| type PathOption func(o *pathOptions) | ||||
|  | ||||
| // WithPath generates a PathOption | ||||
| func WithPath(p *Path) PathOption { | ||||
| 	return func(o *pathOptions) { | ||||
| 		o.path = p | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // ToPath produces *Path from a set of PathOption | ||||
| func ToPath(opts ...PathOption) *Path { | ||||
| 	c := &pathOptions{} | ||||
| 	for _, opt := range opts { | ||||
| 		opt(c) | ||||
| 	} | ||||
| 	return c.path | ||||
| } | ||||
|  | ||||
| // Path represents the path from some root to a particular field. | ||||
| type Path struct { | ||||
| 	name   string // the name of this field or "" if this is an index | ||||
| @@ -67,6 +90,9 @@ func (p *Path) Key(key string) *Path { | ||||
|  | ||||
| // String produces a string representation of the Path. | ||||
| func (p *Path) String() string { | ||||
| 	if p == nil { | ||||
| 		return "<nil>" | ||||
| 	} | ||||
| 	// make a slice to iterate | ||||
| 	elems := []*Path{} | ||||
| 	for ; p != nil; p = p.parent { | ||||
|   | ||||
							
								
								
									
										95
									
								
								vendor/k8s.io/apimachinery/pkg/util/validation/validation.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										95
									
								
								vendor/k8s.io/apimachinery/pkg/util/validation/validation.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -70,7 +70,11 @@ func IsQualifiedName(value string) []string { | ||||
| 	return errs | ||||
| } | ||||
|  | ||||
| // IsFullyQualifiedName checks if the name is fully qualified. | ||||
| // IsFullyQualifiedName checks if the name is fully qualified. This is similar | ||||
| // to IsFullyQualifiedDomainName but requires a minimum of 3 segments instead of | ||||
| // 2 and does not accept a trailing . as valid. | ||||
| // TODO: This function is deprecated and preserved until all callers migrate to | ||||
| // IsFullyQualifiedDomainName; please don't add new callers. | ||||
| func IsFullyQualifiedName(fldPath *field.Path, name string) field.ErrorList { | ||||
| 	var allErrors field.ErrorList | ||||
| 	if len(name) == 0 { | ||||
| @@ -85,6 +89,69 @@ func IsFullyQualifiedName(fldPath *field.Path, name string) field.ErrorList { | ||||
| 	return allErrors | ||||
| } | ||||
|  | ||||
| // IsFullyQualifiedDomainName checks if the domain name is fully qualified. This | ||||
| // is similar to IsFullyQualifiedName but only requires a minimum of 2 segments | ||||
| // instead of 3 and accepts a trailing . as valid. | ||||
| func IsFullyQualifiedDomainName(fldPath *field.Path, name string) field.ErrorList { | ||||
| 	var allErrors field.ErrorList | ||||
| 	if len(name) == 0 { | ||||
| 		return append(allErrors, field.Required(fldPath, "")) | ||||
| 	} | ||||
| 	if strings.HasSuffix(name, ".") { | ||||
| 		name = name[:len(name)-1] | ||||
| 	} | ||||
| 	if errs := IsDNS1123Subdomain(name); len(errs) > 0 { | ||||
| 		return append(allErrors, field.Invalid(fldPath, name, strings.Join(errs, ","))) | ||||
| 	} | ||||
| 	if len(strings.Split(name, ".")) < 2 { | ||||
| 		return append(allErrors, field.Invalid(fldPath, name, "should be a domain with at least two segments separated by dots")) | ||||
| 	} | ||||
| 	for _, label := range strings.Split(name, ".") { | ||||
| 		if errs := IsDNS1123Label(label); len(errs) > 0 { | ||||
| 			return append(allErrors, field.Invalid(fldPath, label, strings.Join(errs, ","))) | ||||
| 		} | ||||
| 	} | ||||
| 	return allErrors | ||||
| } | ||||
|  | ||||
| // Allowed characters in an HTTP Path as defined by RFC 3986. A HTTP path may | ||||
| // contain: | ||||
| // * unreserved characters (alphanumeric, '-', '.', '_', '~') | ||||
| // * percent-encoded octets | ||||
| // * sub-delims ("!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=") | ||||
| // * a colon character (":") | ||||
| const httpPathFmt string = `[A-Za-z0-9/\-._~%!$&'()*+,;=:]+` | ||||
|  | ||||
| var httpPathRegexp = regexp.MustCompile("^" + httpPathFmt + "$") | ||||
|  | ||||
| // IsDomainPrefixedPath checks if the given string is a domain-prefixed path | ||||
| // (e.g. acme.io/foo). All characters before the first "/" must be a valid | ||||
| // subdomain as defined by RFC 1123. All characters trailing the first "/" must | ||||
| // be valid HTTP Path characters as defined by RFC 3986. | ||||
| func IsDomainPrefixedPath(fldPath *field.Path, dpPath string) field.ErrorList { | ||||
| 	var allErrs field.ErrorList | ||||
| 	if len(dpPath) == 0 { | ||||
| 		return append(allErrs, field.Required(fldPath, "")) | ||||
| 	} | ||||
|  | ||||
| 	segments := strings.SplitN(dpPath, "/", 2) | ||||
| 	if len(segments) != 2 || len(segments[0]) == 0 || len(segments[1]) == 0 { | ||||
| 		return append(allErrs, field.Invalid(fldPath, dpPath, "must be a domain-prefixed path (such as \"acme.io/foo\")")) | ||||
| 	} | ||||
|  | ||||
| 	host := segments[0] | ||||
| 	for _, err := range IsDNS1123Subdomain(host) { | ||||
| 		allErrs = append(allErrs, field.Invalid(fldPath, host, err)) | ||||
| 	} | ||||
|  | ||||
| 	path := segments[1] | ||||
| 	if !httpPathRegexp.MatchString(path) { | ||||
| 		return append(allErrs, field.Invalid(fldPath, path, RegexError("Invalid path", httpPathFmt))) | ||||
| 	} | ||||
|  | ||||
| 	return allErrs | ||||
| } | ||||
|  | ||||
| const labelValueFmt string = "(" + qualifiedNameFmt + ")?" | ||||
| const labelValueErrMsg string = "a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character" | ||||
|  | ||||
| @@ -108,7 +175,7 @@ func IsValidLabelValue(value string) []string { | ||||
| } | ||||
|  | ||||
| const dns1123LabelFmt string = "[a-z0-9]([-a-z0-9]*[a-z0-9])?" | ||||
| const dns1123LabelErrMsg string = "a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character" | ||||
| const dns1123LabelErrMsg string = "a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character" | ||||
|  | ||||
| // DNS1123LabelMaxLength is a label's max length in DNS (RFC 1123) | ||||
| const DNS1123LabelMaxLength int = 63 | ||||
| @@ -129,7 +196,7 @@ func IsDNS1123Label(value string) []string { | ||||
| } | ||||
|  | ||||
| const dns1123SubdomainFmt string = dns1123LabelFmt + "(\\." + dns1123LabelFmt + ")*" | ||||
| const dns1123SubdomainErrorMsg string = "a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character" | ||||
| const dns1123SubdomainErrorMsg string = "a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character" | ||||
|  | ||||
| // DNS1123SubdomainMaxLength is a subdomain's max length in DNS (RFC 1123) | ||||
| const DNS1123SubdomainMaxLength int = 253 | ||||
| @@ -280,11 +347,31 @@ func IsValidPortName(port string) []string { | ||||
| // IsValidIP tests that the argument is a valid IP address. | ||||
| func IsValidIP(value string) []string { | ||||
| 	if net.ParseIP(value) == nil { | ||||
| 		return []string{"must be a valid IP address, (e.g. 10.9.8.7)"} | ||||
| 		return []string{"must be a valid IP address, (e.g. 10.9.8.7 or 2001:db8::ffff)"} | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // IsValidIPv4Address tests that the argument is a valid IPv4 address. | ||||
| func IsValidIPv4Address(fldPath *field.Path, value string) field.ErrorList { | ||||
| 	var allErrors field.ErrorList | ||||
| 	ip := net.ParseIP(value) | ||||
| 	if ip == nil || ip.To4() == nil { | ||||
| 		allErrors = append(allErrors, field.Invalid(fldPath, value, "must be a valid IPv4 address")) | ||||
| 	} | ||||
| 	return allErrors | ||||
| } | ||||
|  | ||||
| // IsValidIPv6Address tests that the argument is a valid IPv6 address. | ||||
| func IsValidIPv6Address(fldPath *field.Path, value string) field.ErrorList { | ||||
| 	var allErrors field.ErrorList | ||||
| 	ip := net.ParseIP(value) | ||||
| 	if ip == nil || ip.To4() != nil { | ||||
| 		allErrors = append(allErrors, field.Invalid(fldPath, value, "must be a valid IPv6 address")) | ||||
| 	} | ||||
| 	return allErrors | ||||
| } | ||||
|  | ||||
| const percentFmt string = "[0-9]+%" | ||||
| const percentErrMsg string = "a valid percent string must be a numeric string followed by an ending '%'" | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user