mirror of
https://github.com/moby/moby.git
synced 2026-07-15 03:51:57 +00:00
This commit extends SwarmKit secret management with pluggable secret backends support. Updating the work in [swarmkit](docker/swarmkit@eebac27434) for pluggable secret backend and adding the driver parameter to `SecretSpec`. Remaining work: - [ ] CLI support (docker/cli) - [ ] api in [plugin helpers](docker/go-plugins-helpers)) - [ ] Reference plugin - [ ] Documenation (after cli work) Signed-off-by: Liron Levin <liron@twistlock.com>
15 lines
423 B
Go
15 lines
423 B
Go
package validation
|
|
|
|
import "fmt"
|
|
|
|
// MaxSecretSize is the maximum byte length of the `Secret.Spec.Data` field.
|
|
const MaxSecretSize = 500 * 1024 // 500KB
|
|
|
|
// ValidateSecretPayload validates the secret payload size
|
|
func ValidateSecretPayload(data []byte) error {
|
|
if len(data) >= MaxSecretSize || len(data) < 1 {
|
|
return fmt.Errorf("secret data must be larger than 0 and less than %d bytes", MaxSecretSize)
|
|
}
|
|
return nil
|
|
}
|