Skip to content
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

Embed the HAProxy template file in the agent binary #14

Open
ema-pe opened this issue Nov 19, 2024 · 5 comments
Open

Embed the HAProxy template file in the agent binary #14

ema-pe opened this issue Nov 19, 2024 · 5 comments
Labels
dfaas-agent Related to the agent component good first issue Good for newcomers refactoring

Comments

@ema-pe
Copy link
Collaborator

ema-pe commented Nov 19, 2024

Currently in the agent configuration dfaasagent.env there are two keys that are always fixed with the same value in every file I found:

dfaas/dfaasagent.env

Lines 20 to 21 in 3a9fc2b

AGENT_HAPROXY_TEMPLATE_FILE_NMS="/agent/haproxycfgnms.tmpl"
AGENT_HAPROXY_TEMPLATE_FILE_RECALC="/agent/haproxycfgrecalc.tmpl"

These two file paths are the same in every configuration file, which means that the agent expects the same file and they are mandatory. To simplify the configuration file and reduce the number of unnecessary keys, we could embed these files into the binary using the Go embed package.

@ema-pe ema-pe added good first issue Good for newcomers refactoring dfaas-agent Related to the agent component labels Nov 19, 2024
@miciav
Copy link
Member

miciav commented Nov 19, 2024

I agree.

@ema-pe
Copy link
Collaborator Author

ema-pe commented Nov 19, 2024

I do not know if also loadbalancer/group_list.json file can also be included in the binary, but it seems to be a good candidate along with the other two files.

@aletundo
Copy link
Collaborator

I actually commented about the group_list.json, I don't think it should be harcoded because it indicates the function group's, but functions can change overtime.

@aletundo
Copy link
Collaborator

Currently in the agent configuration dfaasagent.env there are two keys that are always fixed with the same value in every file I found:

dfaas/dfaasagent.env

Lines 20 to 21 in 3a9fc2b

AGENT_HAPROXY_TEMPLATE_FILE_NMS="/agent/haproxycfgnms.tmpl"
AGENT_HAPROXY_TEMPLATE_FILE_RECALC="/agent/haproxycfgrecalc.tmpl"

These two file paths are the same in every configuration file, which means that the agent expects the same file and they are mandatory. To simplify the configuration file and reduce the number of unnecessary keys, we could embed these files into the binary using the Go embed package.

If these templates do not need to be modified at deployment time for any reason, yes it makes sense to embed.

@ema-pe
Copy link
Collaborator Author

ema-pe commented Nov 19, 2024

Currently in the agent configuration dfaasagent.env there are two keys that are always fixed with the same value in every file I found:

dfaas/dfaasagent.env

Lines 20 to 21 in 3a9fc2b

AGENT_HAPROXY_TEMPLATE_FILE_NMS="/agent/haproxycfgnms.tmpl"
AGENT_HAPROXY_TEMPLATE_FILE_RECALC="/agent/haproxycfgrecalc.tmpl"

These two file paths are the same in every configuration file, which means that the agent expects the same file and they are mandatory. To simplify the configuration file and reduce the number of unnecessary keys, we could embed these files into the binary using the Go embed package.

If these templates do not need to be modified at deployment time for any reason, yes it makes sense to embed.

Yes, that is the point. I'm thinking if there is a need to change the template after deployment. In any case, the default templates should be embedded to provide some defaults.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dfaas-agent Related to the agent component good first issue Good for newcomers refactoring
Projects
None yet
Development

No branches or pull requests

3 participants