-
Notifications
You must be signed in to change notification settings - Fork 883
app/add: Allow to define annotations for app from CLI #3814
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of small comments. Looks good after that (given tests).
stage0/common.go
Outdated
} | ||
kAci, err := types.NewACIdentifier(k) | ||
if err != nil { | ||
return ra, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do
return errwrap.Wrap(fmt.Errorf("error parsing annotation key %q", k), err)
I'd like to avoid confusing errors like these:
> sudo -E rkt --debug app add 64a8c4bf kinvolk.io/aci/busybox --annotation=FOO=BAR --name=buzyboxz
stage0: locking pod manifest
stage0: Loading image sha512-140375b2a2bd836559a7c978f36762b75b80a7665e5d922db055d1792d6a4182
stage0: Writing image manifest
add: error adding app to pod
└─ACIdentifier must contain only lower case alphanumeric characters plus "-._~/"
rkt/cli_apps.go
Outdated
@@ -600,12 +600,49 @@ func (au *appName) Type() string { | |||
return "appName" | |||
} | |||
|
|||
// appAnnotation is for --user-annotation flags in the form of: --user-annotation=NAME=VALUE. | |||
// appAnnotation is for --annotation flags in the form of: --annotation=NAME=VALUE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do --annotation=name=value
since for annotations the key has to be an ACIdentifier and can't be upper case.
You could also add a functional test in https://github.com/rkt/rkt/blob/master/tests/rkt_metadata_service_test.go that starts pods with |
e3acbb3
to
b7904c2
Compare
@iaguis done, PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit and LGTM after that.
}{ | ||
{ | ||
args: []string{ | ||
"--annotation=foo=bar", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use different key/value to differentiate from user annotations here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Before this change, "app add" CLI allowed only to define user annotations. User annotations were designed mostly to store annotations from Kubernetes API. At the same time, we want to store some data related to rktlet which aren't k8s annotations (i.e. log directories for CRI-compatible logs). Defining annotations is allowed here by --annotation CLI option (i.e. --annotation=foo=bar). Ref rkt#3813
b7904c2
to
18f7624
Compare
Before this change, "app add" CLI allowed only to define
user annotations. User annotations were designed mostly
to store annotations from Kubernetes API. At the same time,
we want to store some data related to rktlet which aren't
k8s annotations (i.e. log directories for CRI-compatible
logs).
Defining annotations is allowed here by --annotation
CLI option (i.e. --annotation=foo=bar).
Ref #3813
TODO: