Open lkysow opened 3 years ago
@lkysow: for meta keys, why make the validation rules be "DNS-valid characters and /
"? If I understand correctly from RFC 1464, Section 2 (Format of TXT record), "any printable ASCII character is permitted for the attribute name". (Note: there's some nuance documented there about handling characters like \
, "
, and =
)
Great question! I was thinking it would be good to conform to the Kubernetes rules in case we wanted to map things back and forth at some point. https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set has those rules which are actually more strict than I'm proposing here.
I haven't looked through the code to see what characters we currently support for meta keys. Have you? If so, it might be good to document here for future readers.
I'm interested in understanding whether this would be a loosening or a tightening of the current validation behavior. And assuming it's a loosening, I like the suggestion to loosen to k8s annotation standards (in case we want to maps things back and forth) rather than going all the way to RFC 1464 (easier to loosen than tighten).
@jkirschner-hashicorp for sure, I've updated the description. The current rules are here: https://www.consul.io/docs/agent/options#_node_meta. This would be a loosening in some cases but a tightening in others.
I just noticed that for our config entries we actually do support all characters in the meta k/v
Feature Description
Currently the only allowed meta characters are [a-z0-9] and -, _ (see https://www.consul.io/docs/agent/options#_node_meta for full rules).
For consul-k8s we'd like to set meta keys like
consul.hashicorp.com/key
but that's not currently supported. There is a reserved key-space withconsul-
, but only Consul can set those keys, not outside tooling.I suggest we follow the k8s standards: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set to allow for potential mapping back-and-forth in the future (although due to how our current rules are looser in some cases this might still be hard).
The k8s standards are looser in some cases but tighter in others in that they require the end of the key be an alphanumeric character, not a
-
or_
and the name portion can only be 64 chars. We could perhaps loosen our requirements to allow for the domain-style prefixes (consul.hashicorp.com/test
) without restricting them.Use Case(s)
This would allow us to have hostname-based scoping of meta keys similar to Kubernetes annotations.
Perhaps this would also be useful for tags.