Comments (7)
Hi @webmutation You can use the Data Plane API to create a frontend programmatically. There's an example here:
https://www.haproxy.com/documentation/hapee/latest/configuration/config-sections/frontend/
As for filtering which services get added, you could add a feature request with the Data Plane API project:
https://github.com/haproxytech/dataplaneapi/issues
from dataplaneapi-consul-example.
I am only a user of the integration myself, and not an engineer on the project, but it looks like the code is here in the "discovery" folder: https://github.com/haproxytech/dataplaneapi/tree/master/discovery
from dataplaneapi-consul-example.
@webmutation I see that in the latest release of the Data Plane API, they added: "the Consul Service Discovery now has the ability to filter services by namespace"
https://www.haproxy.com/blog/announcing-haproxy-data-plane-api-2-4/
from dataplaneapi-consul-example.
HI @NickMRamirez thanks for the information. I was hopping it would be possible to have some annotations via consul labels. Similar to what can be done with Fabio LB but i guess that use case is not supported.
Would really like to see how the integration is being done. Can you point me to the code used to support this Sync mechanism? I wonder how hard it would be to extend this mechanism.
I will try to see if I can create some expression to only filter the backends that we want to expose... that probably the simplest workaround to achieve routing via HAProxy of k8s backends.
from dataplaneapi-consul-example.
It seems its a bit limited, it seems its the consul namespace that this refers to, not the cluster namespaces, at least when i tried to filter using
curl -u dataplaneapi:mypassword \
-H 'Content-Type: application/json' \
-d '{
"address": "1.1.1.",
"port": 80,
"enabled": true,
"namespace": "dev",
"retry_timeout": 10
}' http://1.1.1.1:5555/v2/service_discovery/consul
even though I have a service deployed there
backend consul-backend-1.1.1.1-80-another-nginx-service-nodeport-dev
I did not get any services back... after i removed the namespace option it worked with all services. including the one mentioned above.
If I may abuse a bit more your goodwill, how are you managing the creation of the frontend section? Do you incorporate this in the CD stage? Its what I was thinking to have the service register the frontend section once it is deployed.
from dataplaneapi-consul-example.
I asked our engineers about it, and it refers to the Consul namespace, which is a Consul Enterprise feature. You can then add all services that you want to proxy through HAProxy to have that one namespace.
from dataplaneapi-consul-example.
I haven't got as far as automating the frontend creation. My use case was more of a proof of concept to learn the service discovery feature.
from dataplaneapi-consul-example.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dataplaneapi-consul-example.