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

fix(vector-aggregator): Fix the conditions for enable/disable SA on the HAProxy #122

Conversation

TACY-octo
Copy link
Contributor

This PR fix the 'if' condition in the serviceaccount.yaml file for use only the value in haproxy block in the value file (haproxy.serviceAccount.create).

And add a condition 'if' in the deployment of haproxy for add or remove the annotation 'serviceAccount' if the value is 'haproxy.serviceAccount.create' is true or false.

If I understood correctly, the SA is only used for the PSP and it is deprecated from version v1.21.

Copy link
Contributor

@spencergilbert spencergilbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you also mind bumping the patch version for the chart in the Chart.yaml?

Comment on lines 30 to 32
{{- if .Values.haproxy.serviceAccount.create }}
serviceAccountName: {{ include "libvector.serviceAccountName" . }}-haproxy
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's common to not wrap this in a conditional, see: https://github.com/haproxytech/helm-charts/blob/main/haproxy/templates/deployment.yaml#L52

Do you have any examples of this pattern in other charts?

Copy link
Contributor Author

@TACY-octo TACY-octo Dec 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, yes indeed this is not a very good solution, the problem is the name of the "ServiceAccountName" "-haproxy" in the deployment file.

When we don't want to activate the "ServiceAccount" in the haproxy, it will use the default "default" and add "-haproxy" at the end to give this name: (default-haproxy) and the replica will fail because it cannot find this serviceaccount.

The "default" value is supplied by the "libvector.serviceAccountName" function present in the "vector-shared" helm which has no condition on the creation value (true / false) of a "ServiceAccount"
Suddenly, it necessarily returns "default".

However, it would be interesting to use the haproxy.serviceAccountName function as for the "vector" helm to correct this problem. :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh - oh yeah, much better solution 😄 I missed that completely.

@spencergilbert spencergilbert changed the title fix(haproxy): Fix the conditions for enable/disable SA on the HAProxy fix(vector-aggregator): Fix the conditions for enable/disable SA on the HAProxy Dec 1, 2021
@spencergilbert spencergilbert enabled auto-merge (squash) December 1, 2021 14:49
@spencergilbert spencergilbert merged commit 83cf509 into vectordotdev:develop Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants