Validate a label's key and value are under 4096 bytes
(k, v string)
| 31 | |
| 32 | // Validate a label's key and value are under 4096 bytes |
| 33 | func Validate(k, v string) error { |
| 34 | total := len(k) + len(v) |
| 35 | if total > maxSize { |
| 36 | if len(k) > keyMaxLen { |
| 37 | k = k[:keyMaxLen] |
| 38 | } |
| 39 | return fmt.Errorf("label key and value length (%d bytes) greater than maximum size (%d bytes), key: %s: %w", total, maxSize, k, errdefs.ErrInvalidArgument) |
| 40 | } |
| 41 | return nil |
| 42 | } |
| 43 | |
| 44 | // IsReserved returns true if the label key is in a namespace reserved for |
| 45 | // containerd (ReservedPrefix) or its CRI plugin (CRIContainerdPrefix). |
no outgoing calls
searching dependent graphs…