Labels are consistently validated across services

* The combined size of a key/value pair cannot exceed 4096 bytes

Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
This commit is contained in:
Jess Valarezo
2017-09-21 15:11:46 -07:00
parent d700a9c35b
commit 18c4322bb3
19 changed files with 189 additions and 8 deletions

View File

@@ -108,10 +108,16 @@ var imagesSetLabelsCommand = cli.Command{
Usage: "Set and clear labels for an image.",
ArgsUsage: "[flags] <name> [<key>=<value>, ...]",
Description: "Set and clear labels for an image.",
Flags: []cli.Flag{},
Flags: []cli.Flag{
cli.BoolFlag{
Name: "replace-all, r",
Usage: "replace all labels",
},
},
Action: func(clicontext *cli.Context) error {
var (
ctx, cancel = appContext(clicontext)
replaceAll = clicontext.Bool("replace-all")
name, labels = objectWithLabelArgs(clicontext)
)
defer cancel()
@@ -131,7 +137,11 @@ var imagesSetLabelsCommand = cli.Command{
)
for k := range labels {
fieldpaths = append(fieldpaths, strings.Join([]string{"labels", k}, "."))
if replaceAll {
fieldpaths = append(fieldpaths, "labels")
} else {
fieldpaths = append(fieldpaths, strings.Join([]string{"labels", k}, "."))
}
}
image := images.Image{