Skip to content

Commit

Permalink
Merge master branch into statefulset-refactoring (#1232)
Browse files Browse the repository at this point in the history
* Support for APM server configuration (#1181)

* Add a config section to the APM server configuration

* APM: Add support for keystore

* Factorize ElasticsearchAuthSettings

* Update dev setup doc + fix GKE bootstrap script (#1203)

* Update dev setup doc + fix GKE bootstrap script

* Update wording of container registry authentication

* Ensure disks removal after removing cluster in GKE (#1163)

* Update gke-cluster.sh

* Implement cleanup for unused disks in GCP

* Update Makefile

* Update CI jobs to do proper cleanup

* Normalize the raw config when creating canonical configs (#1208)

This aims at counteracting the difference between JSON centric serialization and the use of YAML as the serialization format in canonical config. If not normalizing numeric values
like 1 will differ when comparing configs as JSON deserializes integer numbers to float64 and YAML to uint64.

* Homogenize logs (#1168)

* Don't run tests if only docs are changed (#1216)

* Update Jenkinsfile

* Simplify notOnlyDocs()

* Update Jenkinsfile

* Push snapshot ECK release on successful PR build (#1184)

* Update makefile's to support snapshots

* Add snapshot releases to Jenkins pipelines

* Cleanup

* Rename RELEASE to USE_ELASTIC_DOCKER_REGISTRY

* Update Jenkinsfile

* Add a note on EKS inbound traffic & validating webhook (#1211)

EKS users must explicitly enable communication from the k8s control
plane and nodes port 443 in order for the control plane to reach the
validating webhook.

Should help with #896.

* Update PodSpec with Hostname from PVC when re-using (#1204)

* Bind the Debug HTTP server to localhost by default (#1220)

* Run e2e tests against custom Docker image (#1135)

* Add implementation

* Update makefile's

* Update Makefile

* Rename Jenkisnfile

* Fix review comments

* Update e2e-custom.yml

* Update e2e-custom.yml

* Return deploy-all-in-one to normal

* Delete GKE cluster only if changes not in docs (#1223)

* Add operator version to resources (#1224)

* Warn if unsupported distribution (#1228)

The operator only works with the official ES distributions to enable the security
available with the basic (free), gold and platinum licenses in order to ensure that
all clusters launched are secured by default.

A check is done in the prepare-fs script by looking at the existence of the
Elastic License. If not present, the script exit with a custom exit code.

Then the ES reconcilation loop sends an event of type warning if it detects that
a prepare-fs init container terminated with this exit code.

* Document Elasticsearch update strategy change budget & groups (#1210)

Add documentation for the `updateStrategy` section of the Elasticsearch
spec.

It documents how (and why) `changeBudget` and `groups` are used by ECK,
and how both settings can be specified by the user.
  • Loading branch information
sebgl committed Jul 12, 2019
1 parent a15245a commit 0546f81
Show file tree
Hide file tree
Showing 106 changed files with 1,949 additions and 905 deletions.
30 changes: 30 additions & 0 deletions .ci/jobs/e2e-custom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
- job:
description: Job that runs e2e tests against custom ECK image running in a dedicated k8s cluster in GKE. This Job is managed by JJB.
logrotate:
daysToKeep: 7
numToKeep: 100
artifactDaysToKeep: 5
artifactNumToKeep: 10
name: cloud-on-k8s-e2e-tests-custom
project-type: pipeline
parameters:
- string:
name: IMAGE
description: "Docker image with ECK"
- string:
name: VERSION
default: 1.12
description: "Kubernetes version, default is 1.12"
concurrent: true
pipeline-scm:
scm:
- git:
url: https://github.com/elastic/cloud-on-k8s
branches:
- master
credentials-id: 'f6c7695a-671e-4f4f-a331-acdce44ff9ba'
script-path: build/ci/e2e/custom_operator_image.jenkinsfile
lightweight-checkout: true
wrappers:
- ansicolor
38 changes: 35 additions & 3 deletions build/ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ ci-release: vault-public-key vault-docker-creds
-e "REPOSITORY=$(REPOSITORY)" \
-e "ELASTIC_DOCKER_LOGIN=$(DOCKER_LOGIN)" \
-e "ELASTIC_DOCKER_PASSWORD=$(shell cat $(DOCKER_CREDENTIALS_FILE))" \
-e "RELEASE=true" \
-e "USE_ELASTIC_DOCKER_REGISTRY=true" \
-e "SNAPSHOT_RELEASE=$(SNAPSHOT_RELEASE)" \
cloud-on-k8s-ci-release \
bash -c "make -C operators ci-release"

Expand Down Expand Up @@ -130,7 +131,26 @@ ci-e2e: vault-gke-creds
-e "TESTS_MATCH=$(TESTS_MATCH)" \
-e "GKE_CLUSTER_VERSION=$(GKE_CLUSTER_VERSION)" \
cloud-on-k8s-ci-e2e \
bash -c "make -C operators ci-e2e GKE_MACHINE_TYPE=n1-standard-8"
bash -c "make -C operators ci-e2e"

# Run e2e tests in GKE against provided ECK image
ci-e2e-rc: vault-gke-creds
docker build -f Dockerfile -t cloud-on-k8s-ci-e2e .
docker run --rm -t \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(ROOT_DIR):$(GO_MOUNT_PATH) \
-w $(GO_MOUNT_PATH) \
-e "IMG_SUFFIX=-ci" \
-e "GCLOUD_PROJECT=$(GCLOUD_PROJECT)" \
-e "REGISTRY=$(REGISTRY)" \
-e "REPOSITORY=$(GCLOUD_PROJECT)" \
-e "GKE_CLUSTER_NAME=$(GKE_CLUSTER_NAME)" \
-e "GKE_SERVICE_ACCOUNT_KEY_FILE=$(GO_MOUNT_PATH)/build/ci/$(GKE_CREDS_FILE)" \
-e "TESTS_MATCH=$(TESTS_MATCH)" \
-e "GKE_CLUSTER_VERSION=$(GKE_CLUSTER_VERSION)" \
-e "OPERATOR_IMAGE=$(OPERATOR_IMAGE)" \
cloud-on-k8s-ci-e2e \
bash -c "make -C operators ci-e2e-rc"

# Remove k8s cluster
ci-e2e-delete-cluster: vault-gke-creds
Expand All @@ -145,10 +165,22 @@ ci-e2e-delete-cluster: vault-gke-creds
cloud-on-k8s-ci-e2e \
bash -c "make -C operators set-context-gke delete-gke"

# Remove all unused resources in GKE
ci-gke-cleanup: ci-e2e-delete-cluster
docker run --rm -t \
-v $(ROOT_DIR):$(GO_MOUNT_PATH) \
-w $(GO_MOUNT_PATH) \
-e "GCLOUD_PROJECT=$(GCLOUD_PROJECT)" \
-e "GKE_CLUSTER_NAME=$(GKE_CLUSTER_NAME)" \
-e "GKE_SERVICE_ACCOUNT_KEY_FILE=$(GO_MOUNT_PATH)/build/ci/$(GKE_CREDS_FILE)" \
cloud-on-k8s-ci-e2e \
bash -c "GKE_CLUSTER_VERSION=1.11 $(GO_MOUNT_PATH)/operators/hack/gke-cluster.sh auth && \
$(GO_MOUNT_PATH)/build/ci/delete_unused_disks.py"

# Run docs build
ci-build-docs:
docker run --rm -t \
-v $(ROOT_DIR):$(GO_MOUNT_PATH) \
-v $(ROOT_DIR):$(GO_MOUNT_PATH) \
docker.elastic.co/docs/build:1 \
bash -c "git clone https://github.com/elastic/docs.git && \
/docs/build_docs.pl --doc $(GO_MOUNT_PATH)/docs/index.asciidoc --out $(GO_MOUNT_PATH)/docs/html --chunk 1 && \
Expand Down
25 changes: 25 additions & 0 deletions build/ci/delete_unused_disks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python

import os
import json

project = os.environ['GCLOUD_PROJECT']

os.system('gcloud compute disks list --filter="-users:*" --format="json" --project {} > unused_disks.json'
.format(project))

with open('unused_disks.json', 'r') as f:
content = f.read()
try:
parsed_json_dict = json.loads(content)
if len(parsed_json_dict) == 0:
print("There is no unused disks. Congratulations!")
else:
for entry in parsed_json_dict:
name = entry['name']
head, tail = os.path.split(entry['zone'])
os.system('gcloud compute disks delete {} --project {} --zone {} --quiet'
.format(name, project, tail))
except:
print("Can't parse JSON:")
print(content)
2 changes: 1 addition & 1 deletion build/ci/e2e/GKE_k8s_versions.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pipeline {
for (int i = 0; i < clusters.size(); i++) {
sh """
export GKE_CLUSTER_NAME=${clusters[i]}
make -C build/ci ci-e2e-delete-cluster
make -C build/ci ci-gke-cleanup
"""
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/ci/e2e/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pipeline {
}
}
cleanup {
sh 'make -C build/ci ci-e2e-delete-cluster'
sh 'make -C build/ci ci-gke-cleanup'
cleanWs()
}
}
Expand Down
53 changes: 53 additions & 0 deletions build/ci/e2e/custom_operator_image.jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
pipeline {

agent {
label 'linux'
}

options {
timeout(time: 150, unit: 'MINUTES')
}

environment {
VAULT_ADDR = credentials('vault-addr')
VAULT_ROLE_ID = credentials('vault-role-id')
VAULT_SECRET_ID = credentials('vault-secret-id')
REGISTRY = "eu.gcr.io"
GCLOUD_PROJECT = credentials('k8s-operators-gcloud-project')
GKE_CLUSTER_VERSION = "${VERSION}"
GKE_CLUSTER_NAME = "${BUILD_TAG}"
OPERATOR_IMAGE = "${IMAGE}"
LATEST_RELEASED_IMG = "${IMAGE}"
}

stages {
stage('Checkout from GitHub') {
steps {
checkout scm
}
}
stage("Run E2E tests") {
steps {
sh 'make -C build/ci ci-e2e-rc'
}
}
}

post {
unsuccessful {
script {
def msg = "E2E tests failed!\r\n" + env.BUILD_URL
slackSend botUser: true,
channel: '#cloud-k8s',
color: 'danger',
message: msg,
tokenCredentialId: 'cloud-ci-slack-integration-token'
}
}
cleanup {
sh 'make -C build/ci ci-e2e-delete-cluster'
cleanWs()
}
}

}
39 changes: 36 additions & 3 deletions build/ci/pr/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ pipeline {
stage('Run tests in parallel') {
parallel {
stage("Run unit and integration tests") {
when {
expression {
checkout scm
notOnlyDocs()
}
}
agent {
label 'linux'
}
steps {
checkout scm
sh 'make -C build/ci ci-pr'
}
}
Expand All @@ -38,11 +43,16 @@ pipeline {
}
}
stage("Run smoke E2E tests") {
when {
expression {
checkout scm
notOnlyDocs()
}
}
agent {
label 'linux'
}
steps {
checkout scm
sh 'make -C build/ci ci-e2e'
}
}
Expand All @@ -51,10 +61,33 @@ pipeline {
}

post {
success {
withEnv([
'REGISTRY=push.docker.elastic.co',
'REPOSITORY=eck-snapshots',
'IMG_SUFFIX=',
'SNAPSHOT_RELEASE=true',
'TAG_NAME=${ghprbPullId}'
]) {
sh 'make -C build/ci ci-release'
}
}
cleanup {
sh 'make -C build/ci ci-e2e-delete-cluster'
script {
if (notOnlyDocs()) {
sh 'make -C build/ci ci-gke-cleanup'
}
}
cleanWs()
}
}

}

def notOnlyDocs() {
// grep succeeds if there is at least one line without docs/
return sh (
script: "git diff --name-status HEAD~1 HEAD | grep -v docs/",
returnStatus: true
) == 0
}
1 change: 1 addition & 0 deletions build/ci/release/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pipeline {
IMG_NAME = 'eck-operator'
IMG_SUFFIX = ''
LATEST_RELEASED_IMG = "docker.elastic.co/${REPOSITORY}/${IMG_NAME}:${TAG_NAME}"
SNAPSHOT_RELEASE = 'false'
}

options {
Expand Down

0 comments on commit 0546f81

Please sign in to comment.