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
Implement additional text/template sorting methods #386
Comments
@jnbnyc, can you give a usecase for this? |
I am using confd to reconfigure haproxy dynamically whenever a new kubernetes pod registers itself with etcd. I was registering a thousand keys to be able to easily generate the haproxy.cfg, however all those etcd transactions are exhausting system resources. For the time being my team has increased the TTL (6hrs) so that these transactions are less frequent and in the meantime are figuring out ways to collapse keys. Unfortunately if a pod is removed now, it is still registered for that extremely long time until confd re-configures haproxy. Usecase: You'll see that we are using path_beg matching for routes in haproxy because it is the most efficient. Here is the important part of the registration service: FIBONACCI=89 # some static number to generate the reverse sort
...
LEN=${#url}
ID=$(($FIBONACCI - $LEN))
CLAIM_PATH="$HAPROXY_ETCD_BACKENDS_PATH/claims/$ID/${url//\//-}"
leaf "$CLAIM_PATH/url" $url
leaf "$CLAIM_PATH/frontend" $MELD_FRONTEND_NAME
leaf "$CLAIM_PATH/backend" $MELD_BACKEND_NAME
leaf "$BACKEND_PATH/claims/${url//\//-}" $url
Here is the gist of it: Let me know if you need clarification on anything. |
so thus my haproxy.tmpl is looking like
|
@jnbnyc #416 |
I ran into this error trying to test your PR, which means I missed something when building this version of confd. Do you see where I went wrong?
Here is the gist of all the configurations needed to test: https://gist.github.com/jnbnyc/9673fd0448b6889156ec This is after checking out your PR:
|
@jnbnyc for me it works when i use this Dockerfile:
Not sure where you went wrong. |
That was it ... don't know how it got there.
I can confirm this works, I will apply this to a full haproxy configuration test later. |
In reference to the following:
closed #385
open #190
Two methods that would help tremendously:
Reverse sort
Sort map keys and/or values by length
The text was updated successfully, but these errors were encountered: