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

[kibana/manage-es-token] scope/promise updates #1727

Merged
merged 1 commit into from
Nov 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions kibana/templates/configmap-helm-scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ data:
// 404 status code is accepted if there is no previous token to clean
return requestPromise(esUrl, esTokenDeleteOptions, {extraStatusCode: 404}).then(() => {
console.log('Creating new token');
requestPromise(esUrl, esTokenCreateOptions).then(response => {
return requestPromise(esUrl, esTokenCreateOptions).then(response => {
const body = JSON.parse(response);
const token = body.token.value

// Encode the token in base64
const base64Token = Buffer.from(token, 'utf8').toString('base64');

// Prepare the k8s secret
secretData = JSON.stringify({
const secretData = JSON.stringify({
"apiVersion": "v1",
"kind": "Secret",
"metadata": {
Expand All @@ -138,7 +138,7 @@ data:

// Create the k8s secret
console.log('Creating K8S secret');
requestPromise(k8sPostSecretUrl, secretCreateOptions, {payload: secretData})
return requestPromise(k8sPostSecretUrl, secretCreateOptions, {payload: secretData})
});
});
}
Expand All @@ -149,7 +149,7 @@ data:
return requestPromise(esUrl, esTokenDeleteOptions).then(() => {
// Create the k8s secret
console.log('Delete K8S secret');
requestPromise(k8sDeleteSecretUrl, secretDeleteOptions)
return requestPromise(k8sDeleteSecretUrl, secretDeleteOptions)
});
}

Expand Down