Skip to content

Commit

Permalink
Defininig ES users in vault. Avoiding ArgoCD issues with random gener…
Browse files Browse the repository at this point in the history
…ated passwords in helm templates
  • Loading branch information
ricsanfre committed Apr 21, 2023
1 parent 53dbbe5 commit d98e5e2
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 26 deletions.
2 changes: 2 additions & 0 deletions ansible/create_vault_credentials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
- fluentd_shared_key
- grafana_admin_password
- elasticsearch_admin_password
- elasticsearch_fluentd_password
- elasticsearch_prometheus_password

- name: Generate vault file
ansible.builtin.template:
Expand Down
8 changes: 7 additions & 1 deletion ansible/vars/vault.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ vault:
key: supers1cret0
# elastic search
elasticsearch:
elastic:
es-admin:
user: admin
password: s1cret0
es-fluentd:
user: fluentd
password: s1cret0
es-prometheus:
user: prometheus
password: s1cret0
# Fluentd
fluentd:
shared_key: s1cret0
Expand Down
8 changes: 7 additions & 1 deletion ansible/vars/vault.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ vault:
key: {{ minio_tempo_password }}
# elasticsearch and fluentd
logging:
elastic:
es-admin:
user: admin
password: {{ elasticsearch_admin_password }}
es-fluentd:
user: fluentd
password: {{ elasticsearch_fluentd_password }}
es-prometheus:
user: prometheus
password: {{ elasticsearch_prometheus_password }}
fluentd:
shared_key: {{ fluentd_shared_key }}
# Grafana
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ spec:
data:
- secretKey: username
remoteRef:
key: logging/elastic
key: logging/es-admin
property: user
conversionStrategy: Default # ArgoCD sync issue
decodingStrategy: None # ArgoCD sync issue
- secretKey: password
remoteRef:
key: logging/elastic
key: logging/es-admin
property: password
conversionStrategy: Default # ArgoCD sync issue
decodingStrategy: None # ArgoCD sync issue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: elasticsearch-fluentd-externalsecret
namespace: {{ .Release.Namespace }}
spec:
secretStoreRef:
name: vault-backend
kind: ClusterSecretStore
target:
name: es-fluentd-user-file-realm
template:
type: kubernetes.io/basic-auth
data:
username: |-
{{ `{{ .username | toString }}` }}
password: |-
{{ `{{ .password | toString }}` }}
roles: fluentd_role
data:
- secretKey: username
remoteRef:
key: logging/es-fluentd
property: user
conversionStrategy: Default # ArgoCD sync issue
decodingStrategy: None # ArgoCD sync issue
- secretKey: password
remoteRef:
key: logging/es-fluentd
property: password
conversionStrategy: Default # ArgoCD sync issue
decodingStrategy: None # ArgoCD sync issue
11 changes: 0 additions & 11 deletions argocd/system/logging/templates/elasticsearch-fluentd-secret.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: elasticsearch-fluentd-externalsecret
namespace: {{ .Release.Namespace }}
spec:
secretStoreRef:
name: vault-backend
kind: ClusterSecretStore
target:
name: es-fluentd-user-file-realm
template:
type: kubernetes.io/basic-auth
data:
username: |-
{{ `{{ .username | toString }}` }}
password: |-
{{ `{{ .password | toString }}` }}
roles: prometheus_role
data:
- secretKey: username
remoteRef:
key: logging/es-prometheus
property: user
conversionStrategy: Default # ArgoCD sync issue
decodingStrategy: None # ArgoCD sync issue
- secretKey: password
remoteRef:
key: logging/es-prometheus
property: password
conversionStrategy: Default # ArgoCD sync issue
decodingStrategy: None # ArgoCD sync issue

This file was deleted.

0 comments on commit d98e5e2

Please sign in to comment.