-
Notifications
You must be signed in to change notification settings - Fork 914
Upload etcd keys by template. #76
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
base: master
Are you sure you want to change the base?
Conversation
I did something similar for consul as a docker plugin: https://github.com/bryanlarsen/docker-plugin-kv-consul Discussion: progrium/docker-plugins#3 |
Ah right, that was you. This is a big addition, so it might take even On Fri, Dec 19, 2014 at 6:46 AM, Bryan Larsen [email protected]
Jeff Lindsay |
This PR is a good idea. It solve my problem for customizing the etcd K/V rule. |
👍 |
👍 |
1 similar comment
👍 |
👍 |
In my option, registrator should definitely have the possibility for storing stuff in a flexible way in etcd like this PR proposes. In addition, this PR makes it possible to store Attrs in etcd too, something the default etcd backend currently does not. So, why has this PR not been merged yet? Is there anything I can do in order to get this merged? |
Help write tests for existing code? That's one of our blockers for more On Thu, May 21, 2015 at 3:49 AM, Vidar [email protected] wrote:
Jeff Lindsay |
@progrium I've been thinking about your comment above regarding tests and I'm a little torn by it. It seems that you are holding meaningful features hostage here. I totally understand the desire to have tests and to automate, I don't have any beef there. My concern is that without these features you will push users away and that could ultimately result in a dead branch. Like anyone else looking at these issues and investigating registrator, I don't want that to happen. It is really close to exactly what I need. The only reason I am currently still searching for a solution for service announcement and discovery is this missing feature. |
I checked to see how far off the current code base my pull request is, and there are some significant issues to work through. However, I will do the work to bring the pull request up to master if there's some hope it will be quickly reviewed. |
👍 |
1 similar comment
👍 |
break | ||
} | ||
} | ||
} |
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 improvement which makes it a lot easier to write the templates ...
- }
+ } else {
+ log.Println("Error processing template :", err)
+ }
_, err = r.client2.Delete(path, false) | ||
toSet, err := r.executeTemplates(service) | ||
if err == nil { | ||
for key, value := range toSet { |
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.
Fix for compile error "'value declared and not used'"
-for key, value := range toSet {
+for key := range toSet {
Currently the etcd backend only creates a very specific style of key in etcd. If you need etcd to contain more information (such as tags and attributes) or for the format to be different for different types of services, you're stuck.
This pull requests adds an additional etcd backend that creates keys based on templates with access to all the information from docker. For example the template below uses the exposed port from the container as part of the key, but uses the published host IP and port in the value.
Since templates allow if...else, you can write add a template that only adds a key if a specific attribute is present.
Usage:
Start registrator with one or more ETCD_TMPL_XXXX environment variables. These variables should contain a template of the key value pair you wish published to etcd. Also be sure to use the 'etcd-tmpl' scheme.