Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
78147940
Commit
78147940
authored
Feb 12, 2020
by
Adrien Kohlbecker
Committed by
Robert Speicher
Feb 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for elasticsearch to be green on install
parent
7343c4f2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
7 deletions
+46
-7
app/models/clusters/applications/elastic_stack.rb
app/models/clusters/applications/elastic_stack.rb
+13
-2
changelogs/unreleased/ak-wait-for-green-es.yml
changelogs/unreleased/ak-wait-for-green-es.yml
+5
-0
doc/user/clusters/applications.md
doc/user/clusters/applications.md
+2
-2
ee/app/models/ee/clusters/platforms/kubernetes.rb
ee/app/models/ee/clusters/platforms/kubernetes.rb
+1
-1
ee/spec/models/ee/clusters/platforms/kubernetes_spec.rb
ee/spec/models/ee/clusters/platforms/kubernetes_spec.rb
+1
-1
vendor/elastic_stack/values.yaml
vendor/elastic_stack/values.yaml
+1
-1
vendor/elastic_stack/wait-for-elasticsearch.sh
vendor/elastic_stack/wait-for-elasticsearch.sh
+23
-0
No files found.
app/models/clusters/applications/elastic_stack.rb
View file @
78147940
...
...
@@ -30,7 +30,8 @@ module Clusters
version:
VERSION
,
rbac:
cluster
.
platform_kubernetes_rbac?
,
chart:
chart
,
files:
files
files:
files
,
postinstall:
post_install_script
)
end
...
...
@@ -43,6 +44,10 @@ module Clusters
)
end
def
files
super
.
merge
(
'wait-for-elasticsearch.sh'
:
File
.
read
(
"
#{
Rails
.
root
}
/vendor/elastic_stack/wait-for-elasticsearch.sh"
))
end
def
elasticsearch_client
strong_memoize
(
:elasticsearch_client
)
do
next
unless
kube_client
...
...
@@ -69,10 +74,16 @@ module Clusters
private
def
post_install_script
[
"timeout -t60 sh /data/helm/elastic-stack/config/wait-for-elasticsearch.sh http://elastic-stack-elasticsearch-client:9200"
]
end
def
post_delete_script
[
Gitlab
::
Kubernetes
::
KubectlCmd
.
delete
(
"pvc"
,
"--selector"
,
"release=elastic-stack"
)
]
.
compact
]
end
def
kube_client
...
...
changelogs/unreleased/ak-wait-for-green-es.yml
0 → 100644
View file @
78147940
---
title
:
Wait for elasticsearch to be green on install
merge_request
:
24489
author
:
type
:
added
doc/user/clusters/applications.md
View file @
78147940
...
...
@@ -464,8 +464,8 @@ chart is used to install this application with a
file.
NOTE:
**Note:**
The chart will deploy
4 Elasticsearch nodes: 2 masters, 1
data and 1 client node,
with resource requests totalling 0.1
CPU and 3
GB RAM. Each data node requests 1.5GB of memory,
The chart will deploy
5 Elasticsearch nodes: 2 masters, 2
data and 1 client node,
with resource requests totalling 0.1
25 CPU and 4.5
GB RAM. Each data node requests 1.5GB of memory,
which makes it incompatible with clusters of
`f1-micro`
and
`g1-small`
instance types.
## Install using GitLab CI (alpha)
...
...
ee/app/models/ee/clusters/platforms/kubernetes.rb
View file @
78147940
...
...
@@ -100,7 +100,7 @@ module EE
end
def
elastic_stack_available?
!!
cluster
.
application_elastic_stack
!!
cluster
.
application_elastic_stack
&
.
installed?
end
private
...
...
ee/spec/models/ee/clusters/platforms/kubernetes_spec.rb
View file @
78147940
...
...
@@ -174,7 +174,7 @@ describe Clusters::Platforms::Kubernetes do
context
'when ElasticSearch is enabled'
do
let
(
:cluster
)
{
create
(
:cluster
,
:project
,
platform_kubernetes:
service
)
}
let!
(
:elastic_stack
)
{
create
(
:clusters_applications_elastic_stack
,
cluster:
cluster
)
}
let!
(
:elastic_stack
)
{
create
(
:clusters_applications_elastic_stack
,
:installed
,
cluster:
cluster
)
}
before
do
expect_any_instance_of
(
::
Clusters
::
Applications
::
ElasticStack
).
to
receive
(
:elasticsearch_client
).
at_least
(
:once
).
and_return
(
Elasticsearch
::
Transport
::
Client
.
new
)
...
...
vendor/elastic_stack/values.yaml
View file @
78147940
...
...
@@ -8,7 +8,7 @@ elasticsearch:
client
:
replicas
:
1
data
:
replicas
:
1
replicas
:
2
kibana
:
enabled
:
false
...
...
vendor/elastic_stack/wait-for-elasticsearch.sh
0 → 100755
View file @
78147940
#!/bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
IFS
=
$'
\n\t
'
set
-euo
pipefail
HOST
=
"
$1
"
printf
'Waiting for ES to be reachable ...'
until
$(
wget
-O-
-q
"
$HOST
"
&>/dev/null
)
;
do
printf
'.'
sleep
1
done
echo
" OK!"
printf
'Waiting for ES to be healthy ...'
while
:
;
do
HEALTH
=
"
$(
wget
-O-
-q
"
$HOST
/_cat/health?h=status"
2> /dev/null
)
"
HEALTH
=
"
$(
echo
"
$HEALTH
"
|
sed
-r
's/^[[:space:]]+|[[:space:]]+$//g'
)
"
# trim whitespace (otherwise we'll have "green ")
([
"
$HEALTH
"
!=
"green"
]
&&
printf
'.'
&&
sleep
1
)
||
break
done
echo
" OK!"
echo
"Elastic Search is up!"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment