Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Support k8s helm secrets creation for logstash helm chart #705

Closed
kksudo opened this issue Jul 1, 2020 · 5 comments
Closed

Support k8s helm secrets creation for logstash helm chart #705

kksudo opened this issue Jul 1, 2020 · 5 comments

Comments

@kksudo
Copy link
Contributor

kksudo commented Jul 1, 2020

Describe the feature:
For convenient use of k8s secrets should add helm chart for create secrets.

Describe a specific use case for the feature:
Add secrets for using in k8s should be more convenient from the one logstash helm chart.

The helm chart for secret can looks like bellow

secret.yaml

{{- if .Values.logstashSecrets }}
{{- range .Values.logstashSecrets }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ template "logstash.fullname" $ }}-{{ .name }}
labels:
  app: "{{ template "logstash.fullname" $ }}"
  chart: "{{ $.Chart.Name }}"
  heritage: {{ $.Release.Service | quote }}
  release: {{ $.Release.Name | quote }}
  {{- range $key, $value := $.Values.labels }}
  {{ $key }}: {{ $value | quote }}
  {{- end }}
data:
{{- range $key, $val := .value }}
{{ $key }}: {{ $val | toString | b64enc | quote }}
{{- end }}
type: Opaque
{{- end }}
{{- end }}

values.yaml

logstashSecrets:
  - name: "env"
    value:
      logstash.conf: |
          input {
            exec {
              command => "uptime"
              interval => 30
            }
          }
          output { stdout { } }
      api_key: ui2CsdUadTiBasRJRkl9tvNnw
  - name: "tls"
    value:
      ca.crt: "LS0tLS1CRUdJT0K"
      cert.crt: "LS0tLS1CRUdJTiBlRJRklDQVRFLS0tLS0K"
      cert.key: "LS0tLS1CRUdJTiBgUFJJVkFURSBLRVktLS0tLQo="
@jmlrt
Copy link
Member

jmlrt commented Jul 2, 2020

Hi @kksudo, thank you for submitting this request.

The current way is to manage secrets outside of the charts (which allow using something like kube-vault-controller for the secret for example), then using secretMounts or extraEnvs to mount the secret.

You can find an example in security example values.

@kksudo
Copy link
Contributor Author

kksudo commented Jul 2, 2020

Hello!
You can give more freedom of choice for different cases (in my case, we adding the secrets from the vault to k8s via terraform). With default k8s secrets (adding via helm chart) or via kube-vault-controller. If the logstashSecrets ( from my example under spoiler) variable will be empty, helm secrets will not deployed .
But if it's doesn't make sense, you can close this issue.

@jmlrt
Copy link
Member

jmlrt commented Jul 2, 2020

That make sense for me. It's definitely worth keeping in the bandwith, however we won't have any bandwith to work on this in short-term. Would you be interested to create a PR for it?

@kksudo
Copy link
Contributor Author

kksudo commented Jul 2, 2020

Yes, it's easy. I'll be doing PR soon.

fatmcgav added a commit that referenced this issue Jul 8, 2020
Co-authored-by: Gavin Williams <fatmcgav@gmail.com>
fatmcgav added a commit that referenced this issue Jul 8, 2020
Co-authored-by: Gavin Williams <fatmcgav@gmail.com>
fatmcgav added a commit that referenced this issue Jul 8, 2020
Co-authored-by: Gavin Williams <fatmcgav@gmail.com>
fatmcgav added a commit that referenced this issue Jul 8, 2020
Co-authored-by: Gavin Williams <fatmcgav@gmail.com>
@jmlrt
Copy link
Member

jmlrt commented Sep 16, 2020

Done in #712

@jmlrt jmlrt closed this as completed Sep 16, 2020
@jmlrt jmlrt mentioned this issue Oct 28, 2020
This was referenced Nov 17, 2020
@jmlrt jmlrt mentioned this issue Feb 8, 2021
This was referenced Mar 15, 2021
@jmlrt jmlrt mentioned this issue May 25, 2021
@jmlrt jmlrt mentioned this issue Mar 8, 2022
@jmlrt jmlrt mentioned this issue Apr 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants