Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebuildy/3395dcabc02052449163d27e129d135c to your computer and use it in GitHub Desktop.
Save ebuildy/3395dcabc02052449163d27e129d135c to your computer and use it in GitHub Desktop.
apiVersion: batch/v1
kind: Job
metadata:
name: {{ stack_name }}-security-setup-users
spec:
template:
spec:
containers:
- name: update-credentials
image: radial/busyboxplus
command: ["/bin/sh", "-c"]
args:
{% for user in global.security.users %}
{%- if user.to_setup -%}
- "curl -s -u ${ELASTIC_USERNAME}:${ELASTIC_PASSWORD} -H 'Content-Type: application/json' ${ELASTICSEARCH_URL}/_security/user/{{ user.name }}/_password --data \"{\\\"password\\\" : \\\"{{ user.password }}\\\"}\""
{%- endif -%}
{%- endfor %}
env:
- name: ELASTICSEARCH_URL
value: "http://{{ elasticsearch.clusterName }}-{{ elasticsearch.clientNodeGroup }}:9200"
{% for user in global.security.users %}
- name: {{ user.name | upper }}_USERNAME
valueFrom:
secretKeyRef:
name: {{ stack_name }}-{{ user.name }}-credentials
key: username
- name: {{ user.name | upper }}_PASSWORD
valueFrom:
secretKeyRef:
name: {{ stack_name }}-{{ user.name }}-credentials
key: password
{% endfor %}
restartPolicy: Never
backoffLimit: 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment