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

[fluentd] Unable to install two charts in same namespace #170

Closed
farnsworth opened this issue Oct 18, 2021 · 9 comments
Closed

[fluentd] Unable to install two charts in same namespace #170

farnsworth opened this issue Oct 18, 2021 · 9 comments
Labels
good first issue Good for newcomers

Comments

@farnsworth
Copy link

I'm trying to install two times the fluentd chart in the same namespace, one with kind: "Deployment" and one with kind: "DaemonSet" (the first to manage a forward type source for external applications, the second to manage kubernetes logs).
This is not possible because all config maps have a fixed name and they they go into conflict.
Even if I can get around this by using two different namespaces, maybe it is better to use fluentd.fullname in the name of config maps.
If you agree with this, I can do a pull request.

@dioguerra dioguerra added the good first issue Good for newcomers label Oct 19, 2021
@dioguerra
Copy link
Collaborator

If you can, please create the necessary modifications :)

@farnsworth
Copy link
Author

farnsworth commented Oct 19, 2021

To proceed I need a clarification.
In fluentd/values.yaml some volumes and volumeMounts are fully coded and can be changed (in particular I am referring to the ones related to the fluentd-main and fluentd-config configMaps). Are there use cases that need such a freedom?
The solution I had in mind was to always mount these config maps inside the _pod.tpl using the configMap names:
{{include "fluentd.fullname". }}-config instead of fluentd-config
{{include "fluentd.fullname". }}-main instead of fluentd-main

Another solution could be to introduce two booleans in fluentd/values.yaml which manage whether these two config maps have to be created, and if needed, mount them with the names above.

@dioguerra
Copy link
Collaborator

dioguerra commented Oct 22, 2021

There is the case, if you want to use the image (that commits to elasticsearch directly) you would overwrite the env variables and it would use the one that comes with the container itself.

Same for the container log mounts, it can be somewhere else, or you might want to use it in a different way, to tail other locations. In this case, what you can do is set it as a default (if no value is specified with on volume/volumeMounts)

for the fluentd ConfigMaps yes, i want to be able to load configmaps from other places without needing to rewrite the full fluentd release each time!
Ideally this would work the same way grafana loads dashboards (grafana_dashboard="1") by means fo the sidecar container. We could do something identicall here where the configMap is loaded into the filesystem and then the fluentd container rebooted (ex)

I'm still not sure what you are proposing tho.

@farnsworth
Copy link
Author

My proposal was to rename in file charts/fluentd/templates/fluentd-configurations-cm.yaml the config maps as:
{{include "fluentd.fullname". }}-config instead of fluentd-config
{{include "fluentd.fullname". }}-main instead of fluentd-main
in order to avoid name conflicts with charts installation in the same namespace.
This of course means that the config map names can't be "statically" written in values.yaml as it is now (lines 165-172 of charts/fluentd/values.yaml):

- name: etcfluentd-main
  configMap:
    name: fluentd-main
    defaultMode: 0777
- name: etcfluentd-config
  configMap:
    name: fluentd-config
    defaultMode: 0777

My proposal was to remove these lines and add two values:
mountFluentdConfig: true
mountFluentdMain: true
which manage whether or not to mounts the two volumes. Volumes and volumeMounts will be still there for custom mounts as it is now.

@dioguerra
Copy link
Collaborator

I don't think this is so trivial like that.

You will need to find a way to guaranttee that you can use the image directly:
https://github.com/fluent/helm-charts/blob/main/charts/fluentd/values.yaml#L149

Why don't you cook something up so i can test it?

@shurikg
Copy link

shurikg commented Jan 19, 2022

@farnsworth you can use the tpl option to solve your doubts.

See this link https://stackoverflow.com/questions/55958507/helm-templating-variables-in-values-yaml

from the link:

values.yaml

- name: etcfluentd-main
  configMap:
    name: "fluentd-main-{{ .Release.Name }}"
    defaultMode: 0777
- name: etcfluentd-config
  configMap:
    name: "fluentd-config-{{ .Release.Name }}"
    defaultMode: 0777

and in _pod.yaml use the tpl command in correct place

@shurikg
Copy link

shurikg commented Jan 20, 2022

PR #207 created

@DaemonDude23
Copy link

Looks to me like a duplicate of #126.

@dioguerra
Copy link
Collaborator

Fixed with: #305

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

No branches or pull requests

4 participants