Skip to content

Commit

Permalink
Add OAP+Istio(mixer) to CI pipeline (#3904)
Browse files Browse the repository at this point in the history
  • Loading branch information
innerpeacez authored and wu-sheng committed Dec 3, 2019
1 parent d62f29c commit 3e22ff5
Show file tree
Hide file tree
Showing 24 changed files with 516 additions and 163 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/istio-mixer-ci.yaml
Expand Up @@ -18,23 +18,32 @@ name: istio-mixer-ci

on: [pull_request]
env:
SCRIPTS_DIR: ./test/scripts
SCRIPTS_DIR: ./test/e2e-mesh/e2e-istio/scripts
LOG_DIR: /tmp/skywalking
INSTALL_SCRIPTS_DIR: ./install/deploy
jobs:
build:
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v1
- name: Prepare enviroment
run: |
bash ./test/scripts/pre.sh
bash ${SCRIPTS_DIR}/pre.sh
mkdir -p ${LOG_DIR}
- name: Start minikube
run: bash ${SCRIPTS_DIR}/minikube.sh start > ${LOG_DIR}/minikube-start-log.txt 2>&1 &
- name: Wating minikube ready
run: bash ${SCRIPTS_DIR}/minikube.sh wait
- name: Setup tunnel
run: minikube tunnel --log_dir=${LOG_DIR} &
- name: Compile all and Build docker image
run: bash ${SCRIPTS_DIR}/compile_build.sh
- name: Istio install
run: bash ${INSTALL_SCRIPTS_DIR}/istio-deploy.sh
- name: SW And ES install
run: bash ${INSTALL_SCRIPTS_DIR}/skywalking-deploy.sh
- name: Bookinfo demo install
run: bash ${INSTALL_SCRIPTS_DIR}/demo-deploy.sh
- uses: actions/upload-artifact@v1.0.0
with:
name: logs
Expand Down
4 changes: 3 additions & 1 deletion install/deploy/demo-deploy.sh
Expand Up @@ -17,6 +17,8 @@

set -e

#free -lh

# The script for bookinfo Application to deploy
BOOKINFO_VERSION="1.3"
kubectl label namespace default istio-injection=enabled
Expand All @@ -25,7 +27,7 @@ kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-${BOOKINF
# check status
kubectl get deploy | grep -E 'details|productpage|ratings|reviews' | awk '{print "deployment/"$1}' | while read deploy
do
kubectl rollout status ${deploy} --timeout 3m
kubectl wait ${deploy} --for condition=available --timeout=600s
done

# request
Expand Down
11 changes: 8 additions & 3 deletions install/deploy/istio-deploy.sh
Expand Up @@ -70,13 +70,18 @@ create_crd() {
deploy_istio() {
NAMESPACE=$1
VERSION=$2
helm pull istio/istio && tar zxvf istio-${VERSION}.tgz && rm istio-${VERSION}.tgz
helm install istio istio -n ${NAMESPACE}
CHART_DIR="istio-skywalking-ci/install/kubernetes/helm"

git clone -b istio-skywalking-ci https://github.com/SkyAPMTest/istio-skywalking-ci.git

cd $CHART_DIR

helm install istio istio -n ${NAMESPACE} -f istio/values-istio-skywalking.yaml

check() {
kubectl -n ${NAMESPACE} get deploy | grep istio | awk '{print "deployment/"$1}' | while read line ;
do
kubectl rollout status $line -n ${NAMESPACE} --timeout 3m
kubectl rollout status $line -n ${NAMESPACE} --timeout 10m
done
}
check
Expand Down
22 changes: 18 additions & 4 deletions install/deploy/skywalking-deploy.sh
Expand Up @@ -17,7 +17,7 @@

set -e

CHART_PATH="../kubernetes/helm"
CHART_PATH="./install/kubernetes/helm"
DPELOY_NAMESPACE="istio-system"
NEED_CHECK_PREFIX="deployment/skywalking-skywalking-"
ALS_ENABLED=true
Expand Down Expand Up @@ -47,10 +47,24 @@ and_stable_repo

helm dep up skywalking

helm -n $DPELOY_NAMESPACE install skywalking skywalking --set oap.istio.adapter.enabled=$MIXER_ENABLED --set oap.envoy.als.enabled=$ALS_ENABLED
sudo sysctl -w vm.max_map_count=262144
sudo sysctl -w vm.drop_caches=1
sudo sysctl -w vm.drop_caches=3

for component in $NEED_CHECK_PREFIX"oap" $NEED_CHECK_PREFIX"ui" ; do
kubectl -n istio-system rollout status $component --timeout 3m
TAG="ci"
IMAGE="skywalking/oap"

docker images

helm -n $DPELOY_NAMESPACE install skywalking skywalking --set oap.istio.adapter.enabled=$MIXER_ENABLED \
--set oap.envoy.als.enabled=$ALS_ENABLED --set oap.replicas=1 --set oap.image.tag=$TAG --set oap.image.repository=$IMAGE

for component in $NEED_CHECK_PREFIX"oap" ; do
sleep 60
kubectl get deploy -o wide -n $DPELOY_NAMESPACE
kubectl -n ${DPELOY_NAMESPACE} wait $component --for condition=available --timeout=600s
done

rm -rf tag.txt

echo "SkyWalking deployed successfully"
3 changes: 1 addition & 2 deletions install/kubernetes/helm/skywalking/Chart.yaml
Expand Up @@ -30,6 +30,5 @@ maintainers:

dependencies:
- name: elasticsearch
version: ~1.32.0
repository: https://kubernetes-charts.storage.googleapis.com/
version: 6.8.2
condition: elasticsearch.enabled
@@ -0,0 +1,37 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
42 changes: 42 additions & 0 deletions install/kubernetes/helm/skywalking/charts/elasticsearch/Chart.yaml
@@ -0,0 +1,42 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

apiVersion: v2
name: elasticsearch
description: A ES Helm chart for SkyWalking CI pipeline

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 6.8.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 6.8.2

maintainers:
- name: hanahmily
email: hanahmily@gmail.com
- name: innerpeacez
email: innerpeace.zhai@gmail.com
@@ -0,0 +1,38 @@
{{/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
*/}}

1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "elasticsearch.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "elasticsearch.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "elasticsearch.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "elasticsearch.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }}
@@ -0,0 +1,80 @@
{{/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
*/}}

{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "elasticsearch.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "elasticsearch.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "elasticsearch.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "elasticsearch.labels" -}}
helm.sh/chart: {{ include "elasticsearch.chart" . }}
{{ include "elasticsearch.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "elasticsearch.selectorLabels" -}}
app.kubernetes.io/name: {{ include "elasticsearch.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "elasticsearch.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "elasticsearch.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,71 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "elasticsearch.fullname" . }}
labels:
{{- include "elasticsearch.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "elasticsearch.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "elasticsearch.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "elasticsearch.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 9200
- name: transport
containerPort: 9300
# livenessProbe:
# httpGet:
# path: /
# port: http
# readinessProbe:
# httpGet:
# path: /
# port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

0 comments on commit 3e22ff5

Please sign in to comment.