-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/289-elasticsearch-cluster-rebase'
- Loading branch information
Showing
28 changed files
with
408 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#! /bin/bash | ||
|
||
# Copyright 2016 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
CFG=/usr/share/elasticsearch/config/elasticsearch.yml | ||
|
||
|
||
function join { | ||
local IFS="$1"; shift; echo "$*"; | ||
} | ||
|
||
HOSTNAME=$(hostname) | ||
# Parse out cluster name, from service name: | ||
CLUSTER_NAME="$(hostname -f | cut -d'.' -f2)" | ||
|
||
while read -ra LINE; do | ||
if [[ "${LINE}" == *"${HOSTNAME}"* ]]; then | ||
MY_NAME=$LINE | ||
fi | ||
PEERS=("${PEERS[@]}" $LINE) | ||
done | ||
|
||
if [ "${#PEERS[@]}" = 1 ]; then | ||
ES_CLUSTER_ADDRESS="$MY_NAME" | ||
else | ||
ES_CLUSTER_ADDRESS=$(join , "${PEERS[@]}") | ||
fi | ||
|
||
echo "discovery.zen.ping.unicast.hosts: ${ES_CLUSTER_ADDRESS}" >> ${CFG} | ||
|
||
# don't need a restart, we're just writing the conf in case there's an | ||
# unexpected restart on the node. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
if [ -z "$POD_NAMESPACE" ]; then | ||
# Single container runs in docker | ||
echo "POD_NAMESPACE not set, spin up single node" | ||
else | ||
# Is running in Kubernetes/OpenShift, so find all other pods | ||
# belonging to the namespace | ||
echo "Elasticsearch: Finding peers" | ||
K8S_SVC_NAME=$(hostname -f | cut -d"." -f2) | ||
echo "Using service name: ${K8S_SVC_NAME}" | ||
# copy the pristine version to the one that can be edited | ||
/usr/bin/peer-finder -on-start="/lagoon/configure-es.sh" -service=${K8S_SVC_NAME} | ||
fi | ||
|
||
exec $@ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
images/oc-build-deploy-dind/openshift-templates/elasticsearch-cluster/services.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
apiVersion: v1 | ||
kind: Template | ||
metadata: | ||
creationTimestamp: null | ||
name: lagoon-openshift-template-elasticsearch | ||
parameters: | ||
- name: SERVICE_NAME | ||
description: Name of this service | ||
required: true | ||
- name: SAFE_BRANCH | ||
description: Which branch this belongs to, special chars replaced with dashes | ||
required: true | ||
- name: SAFE_PROJECT | ||
description: Which project this belongs to, special chars replaced with dashes | ||
required: true | ||
- name: BRANCH | ||
description: Which branch this belongs to, original value | ||
required: true | ||
- name: PROJECT | ||
description: Which project this belongs to, original value | ||
required: true | ||
- name: LAGOON_GIT_SHA | ||
description: git hash sha of the current deployment | ||
required: true | ||
- name: SERVICE_ROUTER_URL | ||
description: URL of the Router for this service | ||
value: "" | ||
- name: OPENSHIFT_PROJECT | ||
description: Name of the Project that this service is in | ||
required: true | ||
- name: REGISTRY | ||
description: Registry where Images are pushed to | ||
required: true | ||
objects: | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" | ||
creationTimestamp: null | ||
labels: | ||
service: ${SERVICE_NAME} | ||
branch: ${SAFE_BRANCH} | ||
project: ${SAFE_PROJECT} | ||
name: ${SERVICE_NAME} | ||
spec: | ||
clusterIP: None | ||
ports: | ||
- name: 9200-tcp | ||
port: 9200 | ||
protocol: TCP | ||
- name: 9300-tcp | ||
port: 9300 | ||
protocol: TCP | ||
selector: | ||
service: ${SERVICE_NAME} | ||
status: | ||
loadBalancer: {} |
92 changes: 92 additions & 0 deletions
92
images/oc-build-deploy-dind/openshift-templates/elasticsearch-cluster/statefulset.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
apiVersion: v1 | ||
kind: Template | ||
metadata: | ||
creationTimestamp: null | ||
name: lagoon-openshift-template-elasticsearch-cluster | ||
parameters: | ||
- name: SERVICE_NAME | ||
description: Name of this service | ||
required: true | ||
- name: SAFE_BRANCH | ||
description: Which branch this belongs to, special chars replaced with dashes | ||
required: true | ||
- name: SAFE_PROJECT | ||
description: Which project this belongs to, special chars replaced with dashes | ||
required: true | ||
- name: BRANCH | ||
description: Which branch this belongs to, original value | ||
required: true | ||
- name: PROJECT | ||
description: Which project this belongs to, original value | ||
required: true | ||
- name: LAGOON_GIT_SHA | ||
description: git hash sha of the current deployment | ||
required: true | ||
- name: SERVICE_ROUTER_URL | ||
description: URL of the Router for this service | ||
value: "" | ||
- name: OPENSHIFT_PROJECT | ||
description: Name of the Project that this service is in | ||
required: true | ||
- name: REGISTRY | ||
description: Registry where Images are pushed to | ||
required: true | ||
- name: SERVICE_IMAGE | ||
description: Pullable image of service | ||
required: true | ||
objects: | ||
- apiVersion: apps/v1beta1 | ||
kind: StatefulSet | ||
metadata: | ||
name: ${SERVICE_NAME} | ||
spec: | ||
serviceName: ${SERVICE_NAME} | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
service: ${SERVICE_NAME} | ||
template: | ||
metadata: | ||
labels: | ||
branch: ${SAFE_BRANCH} | ||
project: ${SAFE_PROJECT} | ||
service: ${SERVICE_NAME} | ||
spec: | ||
containers: | ||
- name: ${SERVICE_NAME} | ||
image: ${SERVICE_IMAGE} | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 9200 | ||
protocol: TCP | ||
- containerPort: 9300 | ||
protocol: TCP | ||
readinessProbe: | ||
httpGet: | ||
path: /_cluster/health?local=true | ||
port: 9200 | ||
initialDelaySeconds: 20 | ||
livenessProbe: | ||
httpGet: | ||
path: /_cluster/health?local=true | ||
port: 9200 | ||
initialDelaySeconds: 120 | ||
envFrom: | ||
- configMapRef: | ||
name: lagoon-env | ||
resources: | ||
requests: | ||
cpu: 10m | ||
memory: 10Mi | ||
volumeMounts: | ||
- mountPath: /usr/share/elasticsearch/data | ||
name: ${SERVICE_NAME} | ||
env: | ||
- name: POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: metadata.namespace | ||
volumes: | ||
- name: ${SERVICE_NAME} | ||
emptyDir: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,4 +94,4 @@ objects: | |
test: false | ||
triggers: | ||
- type: ConfigChange | ||
status: {} | ||
status: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,18 +155,25 @@ mutation FillAPI { | |
CiFeatures: addProject(input: {id: 12, name: "ci-features", customer: 3, openshift: 2, git_url: "ssh://[email protected]:2222/git/features.git", production_environment:"master"}) { | ||
id | ||
} | ||
CiFeaturesSlack: addNotificationToProject(input: {project: "ci-features", notificationType: "slack", notificationName: "amazeeio--lagoon-local-ci"}) { | ||
CiFeaturesSlack: addNotificationToProject(input: {project: "ci-features", notificationType: "slack", notificationName: "amazeeio--lagoon-local-ci"}) { | ||
id | ||
} | ||
|
||
CiDrupalGalera: addProject(input: {id: 14, name: "ci-drupal-galera", customer: 3, openshift: 2, git_url: "ssh://[email protected]:2222/git/drupal-galera.git"}) { | ||
CiElasticsearch: addProject(input: {id: 14, name: "ci-elasticsearch", customer: 3, openshift: 2, git_url: "ssh://[email protected]:2222/git/elasticsearch.git", production_environment:"master"}) { | ||
id | ||
} | ||
CiElasticsearchSlack: addNotificationToProject(input: {project: "ci-elasticsearch", notificationType: "slack", notificationName: "amazeeio--lagoon-local-ci"}) { | ||
id | ||
} | ||
|
||
CiDrupalGalera: addProject(input: {id: 15, name: "ci-drupal-galera", customer: 3, openshift: 2, git_url: "ssh://[email protected]:2222/git/drupal-galera.git"}) { | ||
id | ||
} | ||
CiDrupalGaleraSlack: addNotificationToProject(input: {project: "ci-drupal-galera", notificationType: "slack", notificationName: "amazeeio--lagoon-local-ci"}) { | ||
id | ||
} | ||
|
||
CiDrupalPostgres: addProject(input: {id: 15, name: "ci-drupal-postgres", customer: 3, openshift: 2, git_url: "ssh://[email protected]:2222/git/drupal-postgres.git"}) { | ||
CiDrupalPostgres: addProject(input: {id: 16, name: "ci-drupal-postgres", customer: 3, openshift: 2, git_url: "ssh://[email protected]:2222/git/drupal-postgres.git"}) { | ||
id | ||
} | ||
CiDrupalPostgresSlack: addNotificationToProject(input: {project: "ci-drupal-postgres", notificationType: "slack", notificationName: "amazeeio--lagoon-local-ci"}) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
ARG IMAGE_REPO | ||
FROM ${IMAGE_REPO:-lagoon}/elasticsearch | ||
|
||
COPY conf/elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml | ||
COPY docker-entrypoint.sh /lagoon/entrypoints/95-logs-db.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
- name: "{{ testname }} - Check if URL {{url}} contains json {{expected_key}}:{{expected_value}}" | ||
uri: | ||
url: "{{ url }}" | ||
return_content: yes | ||
body_format: json | ||
register: response | ||
until: response.json is defined and response.json.number_of_nodes is defined and response.json.number_of_nodes == node_count | ||
retries: 30 | ||
delay: 10 | ||
- debug: msg="Success!!!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker-compose-yaml: docker-compose.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ARG IMAGE_REPO | ||
FROM ${IMAGE_REPO:-amazeeio}/elasticsearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ARG IMAGE_REPO | ||
FROM ${IMAGE_REPO:-amazeeio}/nginx | ||
|
||
COPY app.conf /etc/nginx/conf.d/app.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
server { | ||
|
||
listen 8080 default_server; | ||
|
||
include /etc/nginx/helpers/*.conf; | ||
|
||
location / { | ||
proxy_pass http://elasticsearch:9200/; | ||
} | ||
} |
Oops, something went wrong.