-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tag annotation to Connect service registration #115
Conversation
Allows users to add Consul tags to their services via a Kubernetes annotation.
|
||
// annotationTags is a list of tags to register with the service | ||
// this is specified as a comma separated list e.g. abc,123 | ||
annotationTags = "consul.hashicorp.com/connect-service-tags" |
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.
is it specific to connect? Why not service-tags
?
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.
This is specific for Connect, since it's only part of the connect injector.
connect-inject/container_init.go
Outdated
tags := strings.Split(raw, ",") | ||
|
||
// Create json array from the annotations | ||
jsonTags, _ := json.Marshal(tags) |
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.
It's a JSON array but then it's being templated into HCL. Are there any json marshaling vs. HCL issues we might run into 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.
I don't think you should swallow the error here. Would be useful to surface instead I think.
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.
I've added a log message for this, but I don't think a bad annotation should stop connect injection. This will at least make it possible for folks to see what's happening if it's not what they expect in this situation.
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.
From the hcl readme: "Arrays can be made by wrapping it in []. Example: ["foo", "bar", 42]", so we should be good for formatting.
Allows users to add Consul tags to their services via a Kubernetes
annotation.