v3.3.0 - fixed set kibana_system pass creation
This commit is contained in:
parent
e49e14e71c
commit
5e3c8e08ca
@ -1,37 +0,0 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: create-kibana-user
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,post-upgrade
|
||||
"helm.sh/hook-delete-policy": before-hook-creation
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: create-kibana-user
|
||||
image: curlimages/curl:8.6.0
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- |
|
||||
echo "waiting for elasticsearch..."
|
||||
until curl -s -u ${ELASTIC_USERNAME}:${ELASTIC_PASSWORD} http://service-elasticsearch:9200/_cluster/health | grep -q '"status":"green"'; do
|
||||
echo "elasticsearch not ready yet..."
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo "checking if user '${KIBANA_USERNAME}' exists..."
|
||||
USER_EXISTS=$(curl -s -o /dev/null -w "%{http_code}" -u ${ELASTIC_USERNAME}:${ELASTIC_PASSWORD} http://service-elasticsearch:9200/_security/user/${KIBANA_USERNAME})
|
||||
|
||||
if [ "$USER_EXISTS" -eq 200 ]; then
|
||||
echo "user '${KIBANA_USERNAME}' already exists."
|
||||
else
|
||||
echo "creating user '${KIBANA_USERNAME}'..."
|
||||
curl -s -X POST -u "elastic:{{ required ".Values.elastic.password entry is required!" .Values.elastic.password }}" -H "Content-Type: application/json" http://localhost:9200/_security/user/kibana_system/_password -d "{\"password\" : \"{{ required ".Values.kibana.password entry is required!" .Values.kibana.password }}\"}"
|
||||
echo "user '${KIBANA_USERNAME}' created."
|
||||
fi
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: secret-elasticsearch
|
||||
@ -79,6 +79,21 @@ spec:
|
||||
initialDelaySeconds: 30
|
||||
timeoutSeconds: 5
|
||||
|
||||
lifecycle:
|
||||
postStart:
|
||||
exec:
|
||||
command:
|
||||
- "/bin/sh"
|
||||
- "-c"
|
||||
- |
|
||||
loop=0
|
||||
until curl -s http://localhost:9200 | grep -q "missing authentication credentials"; do let loop=loop+1 ; sleep 30; if [ $loop -ge 4 ]; then exit 1; fi; done
|
||||
echo "Setting sihusearch role and user/password"
|
||||
loop=0
|
||||
echo "Setting Kibana System password"
|
||||
curl -s -X POST -u "elastic:{{ required ".Values.elastic.password entry is required!" .Values.elastic.password }}" -H "Content-Type: application/json" http://localhost:9200/_security/user/kibana_system/_password -d "{\"password\" : \"{{ required ".Values.kibana.password entry is required!" .Values.kibana.password }}\"}"
|
||||
echo "All done!"
|
||||
|
||||
initContainers:
|
||||
- name: fix-permissions
|
||||
image: busybox
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user