From 3d2325a4a119ab6ddae7420d32ecc0420e3f1ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=99=9F=20Wu=20Sheng?= Date: Wed, 20 Nov 2019 14:27:02 +0800 Subject: [PATCH] Set up GitHub Action to include istio+sw in CI process (#3902) * Make istio/envoy ci test (#3697) * for #3669 * Add Apache 2.0 header * Fixed some irrational * [WIP]Scripts which deploy Istio + OAP + ES to a standard k8s cluster (#3718) * for #3669 * Add Apache 2.0 header * Fixed some irrational * create istio-deploy.sh * modify notes * istio version and namespace to parameterize * Keep template files and tested successfully * add sw istio adapter * add a new key for isito adapter * notes.txt * add mixer template * add sw deploy script * bookinfo and cleanup scripts * add timeout and set -e * modify cleanup and request timeout of demo * End blank line * Add minikube to CI (#3836) * Test * Add github action files * Add tunnel to provie loadbalancer * upload logs * Fixed some nits --- .github/workflows/istio-mixer-ci.yaml | 41 +++ install/README.md | 7 + install/deploy/all_cleanup.sh | 21 ++ install/deploy/demo-deploy.sh | 45 +++ install/deploy/istio-deploy.sh | 104 +++++++ install/deploy/skywalking-deploy.sh | 56 ++++ .../kubernetes/helm/skywalking/.helmignore | 37 +++ install/kubernetes/helm/skywalking/Chart.yaml | 35 +++ install/kubernetes/helm/skywalking/OWNERS | 21 ++ install/kubernetes/helm/skywalking/README.md | 232 +++++++++++++++ .../helm/skywalking/templates/NOTES.txt | 43 +++ .../helm/skywalking/templates/_helpers.tpl | 78 +++++ .../skywalking/templates/es-init.job.yaml | 53 ++++ .../templates/istio-adapter/adapter.yaml | 27 ++ .../templates/istio-adapter/handler.yaml | 26 ++ .../templates/istio-adapter/instance.yaml | 42 +++ .../templates/istio-adapter/rule.yaml | 28 ++ .../skywalking/templates/oap-clusterrole.yaml | 33 +++ .../templates/oap-clusterrolebinding.yaml | 34 +++ .../skywalking/templates/oap-deployment.yaml | 118 ++++++++ .../helm/skywalking/templates/oap-role.yaml | 30 ++ .../skywalking/templates/oap-rolebinding.yaml | 34 +++ .../templates/oap-serviceaccount.yaml | 25 ++ .../helm/skywalking/templates/oap-svc.yaml | 36 +++ .../skywalking/templates/ui-deployment.yaml | 57 ++++ .../helm/skywalking/templates/ui-ingress.yaml | 49 ++++ .../helm/skywalking/templates/ui-svc.yaml | 63 ++++ .../kubernetes/helm/skywalking/values.yaml | 269 ++++++++++++++++++ test/scripts/clean.sh | 28 ++ test/scripts/minikube.sh | 114 ++++++++ test/scripts/pre.sh | 81 ++++++ 31 files changed, 1867 insertions(+) create mode 100644 .github/workflows/istio-mixer-ci.yaml create mode 100644 install/README.md create mode 100644 install/deploy/all_cleanup.sh create mode 100644 install/deploy/demo-deploy.sh create mode 100644 install/deploy/istio-deploy.sh create mode 100644 install/deploy/skywalking-deploy.sh create mode 100644 install/kubernetes/helm/skywalking/.helmignore create mode 100644 install/kubernetes/helm/skywalking/Chart.yaml create mode 100644 install/kubernetes/helm/skywalking/OWNERS create mode 100644 install/kubernetes/helm/skywalking/README.md create mode 100644 install/kubernetes/helm/skywalking/templates/NOTES.txt create mode 100644 install/kubernetes/helm/skywalking/templates/_helpers.tpl create mode 100644 install/kubernetes/helm/skywalking/templates/es-init.job.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/istio-adapter/adapter.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/istio-adapter/handler.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/istio-adapter/instance.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/istio-adapter/rule.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/oap-clusterrole.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/oap-clusterrolebinding.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/oap-deployment.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/oap-role.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/oap-rolebinding.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/oap-serviceaccount.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/oap-svc.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/ui-deployment.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/ui-ingress.yaml create mode 100644 install/kubernetes/helm/skywalking/templates/ui-svc.yaml create mode 100644 install/kubernetes/helm/skywalking/values.yaml create mode 100755 test/scripts/clean.sh create mode 100755 test/scripts/minikube.sh create mode 100755 test/scripts/pre.sh diff --git a/.github/workflows/istio-mixer-ci.yaml b/.github/workflows/istio-mixer-ci.yaml new file mode 100644 index 000000000..fe4394609 --- /dev/null +++ b/.github/workflows/istio-mixer-ci.yaml @@ -0,0 +1,41 @@ +# 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. + +name: istio-mixer-ci + +on: [push] +env: + SCRIPTS_DIR: ./test/scripts + LOG_DIR: /tmp/skywalking +jobs: + build: + runs-on: ubuntu-16.04 + steps: + - uses: actions/checkout@v1 + - name: Prepare enviroment + run: | + bash ./test/scripts/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} & + - uses: actions/upload-artifact@v1.0.0 + with: + name: logs + path: /tmp/skywalking diff --git a/install/README.md b/install/README.md new file mode 100644 index 000000000..f8d3af051 --- /dev/null +++ b/install/README.md @@ -0,0 +1,7 @@ +These scripts are for istio , skywalking , ES to a kubernetes cluster. + +#### Prerequisites + + - kubernetes 1.9.6+ + - helm 3 + - kubectl \ No newline at end of file diff --git a/install/deploy/all_cleanup.sh b/install/deploy/all_cleanup.sh new file mode 100644 index 000000000..f8ae44688 --- /dev/null +++ b/install/deploy/all_cleanup.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# 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. + +set -e +# cleanup files + +rm -fr istio/ diff --git a/install/deploy/demo-deploy.sh b/install/deploy/demo-deploy.sh new file mode 100644 index 000000000..de63ba70f --- /dev/null +++ b/install/deploy/demo-deploy.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# 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. + +set -e + +# The script for bookinfo Application to deploy +BOOKINFO_VERSION="1.3" +kubectl label namespace default istio-injection=enabled +kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-${BOOKINFO_VERSION}/samples/bookinfo/platform/kube/bookinfo.yaml + +# 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 +done + +# request +start=$(date "+%M") +while true +do + REQUEST_STATUS=$(kubectl exec -it $(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}') -c ratings -- curl -m 10 productpage:9080/productpage | grep -o ".*" | wc -l) + if [ $REQUEST_STATUS == 1 ]; then + break + fi + end=$(date "+%M") + time=$(($end - $start)) + if [ $time -ge 3 ]; then + echo "Request timeout" + break + fi +done diff --git a/install/deploy/istio-deploy.sh b/install/deploy/istio-deploy.sh new file mode 100644 index 000000000..effc955fa --- /dev/null +++ b/install/deploy/istio-deploy.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# 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. + +set -e + +# Add istio official repo +add_repo(){ + VERSION=$1 + REPO="https://storage.googleapis.com/istio-release/releases/${VERSION}/charts/" + helm repo add istio $REPO + + STATUS_CMD=`echo $?` + CHECK_REPO_CMD=`helm repo list | grep $REPO | wc -l` + echo "$STATUS_CMD" + echo "$CHECK_REPO_CMD" + while [[ $STATUS_CMD != 0 && $CHECK_REPO_CMD -ge 1 ]] + do + sleep 5 + helm repo add istio $REPO + + STATUS_CMD=`echo $?` + CHECK_REPO_CMD=`helm repo list | grep $REPO | wc -l` + done +} + +# Create istio-system namespace +create_namespace() { + NAMESPACE=$1 + kubectl create ns ${NAMESPACE} + + STATUS_CMD=`echo $?` + while [[ $STATUS_CMD != 0 ]] + do + sleep 5 + kubectl create ns ${NAMESPACE} + STATUS_CMD=`echo $?` + done +} + +# Create CRD need for istio +create_crd() { + NAMESPACE=$1 + helm install istio-init istio/istio-init -n ${NAMESPACE} + CRD_COUNT=`kubectl get crds | grep 'istio.i' | wc -l` + + while [[ ${CRD_COUNT} != 23 ]] + do + sleep 5 + CRD_COUNT=`kubectl get crds | grep 'istio.io' | wc -l` + done + + echo 'Istio crd create successful' +} + +# Deploy istio related components +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} + + check() { + kubectl -n ${NAMESPACE} get deploy | grep istio | awk '{print "deployment/"$1}' | while read line ; + do + kubectl rollout status $line -n ${NAMESPACE} --timeout 3m + done + } + check + + echo "Istio is deployed successful" +} + +add_mixer_template() { + VERSION=$1 + kubectl apply -f https://raw.githubusercontent.com/istio/istio/$VERSION/mixer/template/metric/template.yaml +} + +main(){ + ISTIO_VERSION="1.3.3" + ISTIO_NAMESPACE="istio-system" + add_repo $ISTIO_VERSION + if [[ `kubectl get ns | grep $ISTIO_NAMESPACE | wc -l ` == 0 && `kubectl get ns $ISTIO_NAMESPACE | grep -v NAME | wc -l` == 0 ]] ;then + create_namespace $ISTIO_NAMESPACE + fi + create_crd $ISTIO_NAMESPACE + deploy_istio $ISTIO_NAMESPACE $ISTIO_VERSION + add_mixer_template $ISTIO_VERSION +} + +main diff --git a/install/deploy/skywalking-deploy.sh b/install/deploy/skywalking-deploy.sh new file mode 100644 index 000000000..6c82ba4fb --- /dev/null +++ b/install/deploy/skywalking-deploy.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# 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. + +set -e + +CHART_PATH="../kubernetes/helm" +DPELOY_NAMESPACE="istio-system" +NEED_CHECK_PREFIX="deployment/skywalking-skywalking-" +ALS_ENABLED=true +MIXER_ENABLED=true + +cd ${CHART_PATH} + +and_stable_repo(){ + STABLE_REPO="https://kubernetes-charts.storage.googleapis.com/" + helm repo add stable $STABLE_REPO + + STATUS_CMD=`echo $?` + CHECK_REPO_CMD=`helm repo list | grep $STABLE_REPO | wc -l` + echo "$STATUS_CMD" + echo "$CHECK_REPO_CMD" + while [[ $STATUS_CMD != 0 && $CHECK_REPO_CMD -ge 1 ]] + do + sleep 5 + helm repo add stable $STABLE_REPO + + STATUS_CMD=`echo $?` + CHECK_REPO_CMD=`helm repo list | grep $STABLE_REPO | wc -l` + done +} + +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 + +for component in $NEED_CHECK_PREFIX"oap" $NEED_CHECK_PREFIX"ui" ; do + kubectl -n istio-system rollout status $component --timeout 3m +done + +echo "SkyWalking deployed successfully" diff --git a/install/kubernetes/helm/skywalking/.helmignore b/install/kubernetes/helm/skywalking/.helmignore new file mode 100644 index 000000000..2044e65a4 --- /dev/null +++ b/install/kubernetes/helm/skywalking/.helmignore @@ -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 +OWNERS diff --git a/install/kubernetes/helm/skywalking/Chart.yaml b/install/kubernetes/helm/skywalking/Chart.yaml new file mode 100644 index 000000000..b4aff3c54 --- /dev/null +++ b/install/kubernetes/helm/skywalking/Chart.yaml @@ -0,0 +1,35 @@ +# 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: skywalking +home: https://skywalking.apache.org +version: 0.1.2 +appVersion: latest +description: Apache SkyWalking APM System +icon: https://raw.githubusercontent.com/apache/skywalking-kubernetes/master/logo/sw-logo-for-chart.jpg +sources: +- https://github.com/apache/skywalking-kubernetes +maintainers: +- name: hanahmily + email: hanahmily@gmail.com +- name: innerpeacez + email: innerpeace.zhai@gmail.com + +dependencies: + - name: elasticsearch + version: ~1.32.0 + repository: https://kubernetes-charts.storage.googleapis.com/ + condition: elasticsearch.enabled \ No newline at end of file diff --git a/install/kubernetes/helm/skywalking/OWNERS b/install/kubernetes/helm/skywalking/OWNERS new file mode 100644 index 000000000..b3b6bec1a --- /dev/null +++ b/install/kubernetes/helm/skywalking/OWNERS @@ -0,0 +1,21 @@ +# 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. + +approvers: +- hanahmily +- wu-sheng +reviewers: +- hanahmily +- wu-sheng diff --git a/install/kubernetes/helm/skywalking/README.md b/install/kubernetes/helm/skywalking/README.md new file mode 100644 index 000000000..95bfd24d8 --- /dev/null +++ b/install/kubernetes/helm/skywalking/README.md @@ -0,0 +1,232 @@ +` +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. +` + +# Apache Skywalking Helm Chart + +[Apache SkyWalking](https://skywalking.apache.org/) is application performance monitor tool for distributed systems, especially designed for microservices, cloud native and container-based (Docker, K8s, Mesos) architectures. + +## Introduction + +This chart bootstraps a [Apache SkyWalking](https://skywalking.apache.org/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + + - Kubernetes 1.9.6+ + - PV dynamic provisioning support on the underlying infrastructure (StorageClass) + - Helm 3 + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```shell +$ helm install my-release skywalking -n +``` + +The command deploys Apache Skywalking on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```shell +$ helm uninstall my-release -n +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following table lists the configurable parameters of the Skywalking chart and their default values. + +| Parameter | Description | Default | +|---------------------------------------|--------------------------------------------------------------------|-------------------------------------| +| `nameOverride` | Override name | `nil` | +| `serviceAccounts.oap` | Name of the OAP service account to use or create | `nil` | +| `oap.name` | OAP deployment name | `oap` | +| `oap.image.repository` | OAP container image name | `apache/skywalking-oap-server` | +| `oap.image.tag` | OAP container image tag | `6.1.0` | +| `oap.image.pullPolicy` | OAP container image pull policy | `IfNotPresent` | +| `oap.ports.grpc` | OAP grpc port for tracing or metric | `11800` | +| `oap.ports.rest` | OAP http port for Web UI | `12800` | +| `oap.replicas` | OAP k8s deployment replicas | `2` | +| `oap.service.type` | OAP svc type | `ClusterIP` | +| `oap.javaOpts` | Parameters to be added to `JAVA_OPTS`environment variable for OAP | `-Xms2g -Xmx2g` | +| `oap.antiAffinity` | OAP anti-affinity policy | `soft` | +| `oap.nodeAffinity` | OAP node affinity policy | `{}` | +| `oap.nodeSelector` | OAP labels for master pod assignment | `{}` | +| `oap.tolerations` | OAP tolerations | `[]` | +| `oap.resources` | OAP node resources requests & limits | `{} - cpu limit must be an integer` | +| `oap.envoy.als.enabled` | Open envoy als | `false` | +| `oap.istio.adapter.enabled` | Open istio adapter | `false` | +| `oap.env` | OAP environment variables | `[]` | +| `ui.name` | Web UI deployment name | `ui` | +| `ui.replicas` | Web UI k8s deployment replicas | `1` | +| `ui.image.repository` | Web UI container image name | `apache/skywalking-ui` | +| `ui.image.tag` | Web UI container image tag | `6.1.0` | +| `ui.image.pullPolicy` | Web UI container image pull policy | `IfNotPresent` | +| `ui.ingress.enabled` | Create Ingress for Web UI | `false` | +| `ui.ingress.annotations` | Associate annotations to the Ingress | `{}` | +| `ui.ingress.path` | Associate path with the Ingress | `/` | +| `ui.ingress.hosts` | Associate hosts with the Ingress | `[]` | +| `ui.ingress.tls` | Associate TLS with the Ingress | `[]` | +| `ui.service.type` | Web UI svc type | `ClusterIP` | +| `ui.service.externalPort` | external port for the service | `80` | +| `ui.service.internalPort` | internal port for the service | `8080` | +| `ui.service.externalIPs` | external IP addresses | `nil` | +| `ui.service.loadBalancerIP` | Load Balancer IP address | `nil` | +| `ui.service.annotations` | Kubernetes service annotations | `{}` | +| `ui.service.loadBalancerSourceRanges` | Limit load balancer source IPs to list of CIDRs (where available)) | `[]` | +| `elasticsearch.enabled` | Spin up a new elasticsearch cluster for SkyWalking | `true` | +| `elasticsearch.client.name` | `client` | Client component name | +| `elasticsearch.client.replicas` | `2` | Client node replicas (deployment) | +| `elasticsearch.client.resources` | `{} - cpu limit must be an integer` | Client node resources requests & limits | +| `elasticsearch.client.priorityClassName` | `nil` | Client priorityClass | +| `elasticsearch.client.heapSize` | `512m` | Client node heap size | +| `elasticsearch.client.podAnnotations` | `{}` | Client Deployment annotations | +| `elasticsearch.client.nodeSelector` | `{}` | Node labels for client pod assignment | +| `elasticsearch.client.tolerations` | `[]` | Client tolerations | +| `elasticsearch.client.serviceAnnotations` | `{}` | Client Service annotations | +| `elasticsearch.client.serviceType` | `ClusterIP` | Client service type | +| `elasticsearch.client.httpNodePort` | `nil` | Client service HTTP NodePort port number. Has no effect if client.serviceType is not `NodePort`. | +| `elasticsearch.client.loadBalancerIP` | `{}` | Client loadBalancerIP | +| `elasticsearch.client.loadBalancerSourceRanges` | `{}` | Client loadBalancerSourceRanges | +| `elasticsearch.client.antiAffinity` | `soft` | Client anti-affinity policy | +| `elasticsearch.client.nodeAffinity` | `{}` | Client node affinity policy | +| `elasticsearch.client.initResources` | `{}` | Client initContainer resources requests & limits | +| `elasticsearch.client.additionalJavaOpts` | `""` | Parameters to be added to `ES_JAVA_OPTS` environment variable for client | +| `elasticsearch.client.ingress.enabled` | `false` | Enable Client Ingress | +| `elasticsearch.client.ingress.user` | `nil` | If this & password are set, enable basic-auth on ingress | +| `elasticsearch.client.ingress.password` | `nil` | If this & user are set, enable basic-auth on ingress | +| `elasticsearch.client.ingress.annotations` | `{}` | Client Ingress annotations | +| `elasticsearch.client.ingress.hosts` | `[]` | Client Ingress Hostnames | +| `elasticsearch.client.ingress.tls` | `[]` | Client Ingress TLS configuration | +| `elasticsearch.client.exposeTransportPort` | `false` | Expose transport port 9300 on client service (ClusterIP) | +| `elasticsearch.master.initResources` | `{}` | Master initContainer resources requests & limits | +| `elasticsearch.master.additionalJavaOpts` | `""` | Parameters to be added to `ES_JAVA_OPTS` environment variable for master | +| `elasticsearch.master.exposeHttp` | `false` | Expose http port 9200 on master Pods for monitoring, etc | +| `elasticsearch.master.name` | `master` | Master component name | +| `elasticsearch.master.replicas` | `2` | Master node replicas (deployment) | +| `elasticsearch.master.resources` | `{} - cpu limit must be an integer` | Master node resources requests & limits | +| `elasticsearch.master.priorityClassName` | `nil` | Master priorityClass | +| `elasticsearch.master.podAnnotations` | `{}` | Master Deployment annotations | +| `elasticsearch.master.nodeSelector` | `{}` | Node labels for master pod assignment | +| `elasticsearch.master.tolerations` | `[]` | Master tolerations | +| `elasticsearch.master.heapSize` | `512m` | Master node heap size | +| `elasticsearch.master.name` | `master` | Master component name | +| `elasticsearch.master.persistence.enabled` | `false` | Master persistent enabled/disabled | +| `elasticsearch.master.persistence.name` | `data` | Master statefulset PVC template name | +| `elasticsearch.master.persistence.size` | `4Gi` | Master persistent volume size | +| `elasticsearch.master.persistence.storageClass` | `nil` | Master persistent volume Class | +| `elasticsearch.master.persistence.accessMode` | `ReadWriteOnce` | Master persistent Access Mode | +| `elasticsearch.master.readinessProbe` | see `values.yaml` for defaults | Master container readiness probes | +| `elasticsearch.master.antiAffinity` | `soft` | Master anti-affinity policy | +| `elasticsearch.master.nodeAffinity` | `{}` | Master node affinity policy | +| `elasticsearch.master.podManagementPolicy` | `OrderedReady` | Master pod creation strategy | +| `elasticsearch.master.updateStrategy` | `{type: "onDelete"}` | Master node update strategy policy | +| `elasticsearch.data.initResources` | `{}` | Data initContainer resources requests & limits | +| `elasticsearch.data.additionalJavaOpts` | `""` | Parameters to be added to `ES_JAVA_OPTS` environment variable for data | +| `elasticsearch.data.exposeHttp` | `false` | Expose http port 9200 on data Pods for monitoring, etc | +| `elasticsearch.data.replicas` | `2` | Data node replicas (statefulset) | +| `elasticsearch.data.resources` | `{} - cpu limit must be an integer` | Data node resources requests & limits | +| `elasticsearch.data.priorityClassName` | `nil` | Data priorityClass | +| `elasticsearch.data.heapSize` | `1536m` | Data node heap size | +| `elasticsearch.data.hooks.drain.enabled` | `true` | Data nodes: Enable drain pre-stop and post-start hook | +| `elasticsearch.data.persistence.enabled` | `false` | Data persistent enabled/disabled | +| `elasticsearch.data.persistence.name` | `data` | Data statefulset PVC template name | +| `elasticsearch.data.persistence.size` | `30Gi` | Data persistent volume size | +| `elasticsearch.data.persistence.storageClass` | `nil` | Data persistent volume Class | +| `elasticsearch.data.persistence.accessMode` | `ReadWriteOnce` | Data persistent Access Mode | +| `elasticsearch.data.readinessProbe` | see `values.yaml` for defaults | Readiness probes for data-containers | +| `elasticsearch.data.podAnnotations` | `{}` | Data StatefulSet annotations | +| `elasticsearch.data.nodeSelector` | `{}` | Node labels for data pod assignment | +| `elasticsearch.data.tolerations` | `[]` | Data tolerations | +| `elasticsearch.data.terminationGracePeriodSeconds` | `3600` | Data termination grace period (seconds) | +| `elasticsearch.data.antiAffinity` | `soft` | Data anti-affinity policy | +| `elasticsearch.data.nodeAffinity` | `{}` | Data node affinity policy | +| `elasticsearch.data.podManagementPolicy` | `OrderedReady` | Data pod creation strategy | +| `elasticsearch.data.updateStrategy` | `{type: "onDelete"}` | Data node update strategy policy | + + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install myrelease skywalking --set nameOverride=newSkywalking +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +$ helm install my-release skywalking -f values.yaml +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +### RBAC Configuration +Roles and RoleBindings resources will be created automatically for `OAP` . + +> **Tip**: You can refer to the default `oap-role.yaml` file in [templates](templates/) to customize your own. + +### Ingress TLS +If your cluster allows automatic create/retrieve of TLS certificates (e.g. [kube-lego](https://github.com/jetstack/kube-lego)), please refer to the documentation for that mechanism. + +To manually configure TLS, first create/retrieve a key & certificate pair for the address(skywalking ui) you wish to protect. Then create a TLS secret in the namespace: + +```console +kubectl create secret tls skywalking-tls --cert=path/to/tls.cert --key=path/to/tls.key +``` + +Include the secret's name, along with the desired hostnames, in the skywalking-ui Ingress TLS section of your custom `values.yaml` file: + +```yaml +ui: + ingress: + ## If true, Skywalking ui server Ingress will be created + ## + enabled: true + + ## Skywalking ui server Ingress hostnames + ## Must be provided if Ingress is enabled + ## + hosts: + - skywalking.domain.com + + ## Skywalking ui server Ingress TLS configuration + ## Secrets must be manually created in the namespace + ## + tls: + - secretName: skywalking-tls + hosts: + - skywalking.domain.com +``` +### Envoy ALS + +Envoy ALS(access log service) provides fully logs about RPC routed, including HTTP and TCP. + +If you want to open envoy ALS, you can do this by modifying values.yaml. + +```yaml +oap: + envoy: + als: + enabled: true +``` + +When envoy als ,will give ServiceAccount clusterrole permission. +More envoy als ,please refer to [als_setting](../../../../docs/en/setup/envoy/als_setting.md) \ No newline at end of file diff --git a/install/kubernetes/helm/skywalking/templates/NOTES.txt b/install/kubernetes/helm/skywalking/templates/NOTES.txt new file mode 100644 index 000000000..8d93db77b --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/NOTES.txt @@ -0,0 +1,43 @@ +{{/* +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. +*/}} + + +Thank you for installing {{ .Chart.Name }}. + +Your release is named {{ .Release.Name }}. + +Learn more, please visit https://skywalking.apache.org/ + +Get the UI URL by running these commands: +{{- if .Values.ui.ingress.enabled }} +{{- range .Values.ui.ingress.hosts }} + http{{ if $.Values.ui.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ui.ingress.path }} +{{- end }} +{{- else if contains "NodePort" .Values.ui.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "skywalking.ui.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.ui.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 svc -w {{ include "skywalking.ui.fullname" . }} -n {{ .Release.Namespace }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "skywalking.ui.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.ui.service.externalPort }} +{{- else if contains "ClusterIP" .Values.ui.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "skywalking.name" . }},release={{ .Release.Name }},component={{ .Values.ui.name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.ui.service.internalPort }} +{{- end }} diff --git a/install/kubernetes/helm/skywalking/templates/_helpers.tpl b/install/kubernetes/helm/skywalking/templates/_helpers.tpl new file mode 100644 index 000000000..019493534 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/_helpers.tpl @@ -0,0 +1,78 @@ +{{/* +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 "skywalking.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). +*/}} +{{- define "skywalking.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 a default fully qualified oap name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "skywalking.oap.fullname" -}} +{{ template "skywalking.fullname" . }}-{{ .Values.oap.name }} +{{- end -}} + +{{/* +Create a default fully qualified ui name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "skywalking.ui.fullname" -}} +{{ template "skywalking.fullname" . }}-{{ .Values.ui.name }} +{{- end -}} + +{{/* +Create the name of the service account to use for the oap cluster +*/}} +{{- define "skywalking.serviceAccountName.oap" -}} +{{ default (include "skywalking.oap.fullname" .) .Values.serviceAccounts.oap }} +{{- end -}} + +{{- define "call-nested" }} +{{- $dot := index . 0 }} +{{- $subchart := index . 1 }} +{{- $template := index . 2 }} +{{- include $template (dict "Chart" (dict "Name" $subchart) "Values" (index $dot.Values $subchart) "Release" $dot.Release "Capabilities" $dot.Capabilities) }} +{{- end }} + +{{- define "skywalking.containers.wait-for-es" -}} +- name: wait-for-elasticsearch + image: busybox:1.30 + imagePullPolicy: IfNotPresent + command: ['sh', '-c', 'for i in $(seq 1 60); do nc -z -w3 {{ include "call-nested" (list . "elasticsearch" "elasticsearch.client.fullname") }} 9200 && exit 0 || sleep 5; done; exit 1'] +{{- end -}} diff --git a/install/kubernetes/helm/skywalking/templates/es-init.job.yaml b/install/kubernetes/helm/skywalking/templates/es-init.job.yaml new file mode 100644 index 000000000..8124ec17e --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/es-init.job.yaml @@ -0,0 +1,53 @@ +# 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. + +# https://docs.sentry.io/server/installation/docker/#running-migrations +apiVersion: batch/v1 +kind: Job +metadata: + name: "{{ .Release.Name }}-es-init" + labels: + app: {{ template "skywalking.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + component: "{{ template "skywalking.fullname" . }}-job" + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} +spec: + template: + metadata: + name: "{{ .Release.Name }}-es-init" + labels: + app: {{ template "skywalking.name" . }} + component: "{{ template "skywalking.fullname" . }}-job" + release: {{ .Release.Name }} + spec: + restartPolicy: Never + initContainers: + {{- include "skywalking.containers.wait-for-es" . | nindent 6 }} + containers: + - name: {{ .Values.oap.name }} + image: "{{ .Values.oap.image.repository }}:{{ .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.oap.image.pullPolicy }} +{{- if .Values.oap.resources }} + resources: +{{ toYaml .Values.oap.resources | indent 10 }} +{{- end }} + env: + - name: JAVA_OPTS + value: "{{ .Values.oap.javaOpts }} -Dmode=init" + - name: SW_STORAGE + value: elasticsearch + - name: SW_STORAGE_ES_CLUSTER_NODES + value: "{{ include "call-nested" (list . "elasticsearch" "elasticsearch.client.fullname") }}:9200" diff --git a/install/kubernetes/helm/skywalking/templates/istio-adapter/adapter.yaml b/install/kubernetes/helm/skywalking/templates/istio-adapter/adapter.yaml new file mode 100644 index 000000000..4a74d2551 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/istio-adapter/adapter.yaml @@ -0,0 +1,27 @@ +# 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. + +{{- if .Values.oap.istio.adapter.enabled }} +apiVersion: "config.istio.io/v1alpha2" +kind: adapter +metadata: + name: skywalking-adapter +spec: + description: + session_based: false + templates: + - metric +{{- end}} diff --git a/install/kubernetes/helm/skywalking/templates/istio-adapter/handler.yaml b/install/kubernetes/helm/skywalking/templates/istio-adapter/handler.yaml new file mode 100644 index 000000000..3ce913a37 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/istio-adapter/handler.yaml @@ -0,0 +1,26 @@ +# 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. + +{{- if .Values.oap.istio.adapter.enabled }} +apiVersion: "config.istio.io/v1alpha2" +kind: handler +metadata: + name: skywalking-handler +spec: + adapter: skywalking-adapter + connection: + address: {{ template "skywalking.oap.fullname" . }}"."{{ .Release.Namespace }}".svc.cluster.local:11800" +{{- end }} \ No newline at end of file diff --git a/install/kubernetes/helm/skywalking/templates/istio-adapter/instance.yaml b/install/kubernetes/helm/skywalking/templates/istio-adapter/instance.yaml new file mode 100644 index 000000000..11a5f8cdf --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/istio-adapter/instance.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. + +# instance for template metric +{{- if .Values.oap.istio.adapter.enabled }} +apiVersion: "config.istio.io/v1alpha2" +kind: instance +metadata: + name: skywalking-metric +spec: + template: metric + params: + value: request.size | 0 + dimensions: + sourceService: source.workload.name | "" + sourceNamespace: source.workload.namespace | "" + sourceUID: source.uid | "" + destinationService: destination.workload.name | "" + destinationNamespace: destination.workload.namespace | "" + destinationUID: destination.uid | "" + requestMethod: request.method | "" + requestPath: request.path | "" + requestScheme: request.scheme | "" + requestTime: request.time + responseTime: response.time + responseCode: response.code | 200 + reporter: conditional((context.reporter.kind | "inbound") == "outbound", "source", "destination") + apiProtocol: api.protocol | "" +{{- end }} \ No newline at end of file diff --git a/install/kubernetes/helm/skywalking/templates/istio-adapter/rule.yaml b/install/kubernetes/helm/skywalking/templates/istio-adapter/rule.yaml new file mode 100644 index 000000000..5949dc2de --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/istio-adapter/rule.yaml @@ -0,0 +1,28 @@ +# 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. + +# rule to dispatch to handler sw +{{- if .Values.oap.istio.adapter.enabled }} +apiVersion: "config.istio.io/v1alpha2" +kind: rule +metadata: + name: swmetric-rule +spec: + actions: + - handler: skywalking-handler.istio-system + instances: + - skywalking-metric +{{- end }} \ No newline at end of file diff --git a/install/kubernetes/helm/skywalking/templates/oap-clusterrole.yaml b/install/kubernetes/helm/skywalking/templates/oap-clusterrole.yaml new file mode 100644 index 000000000..24d90c941 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/oap-clusterrole.yaml @@ -0,0 +1,33 @@ +# 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. + +{{- if .Values.oap.envoy.als.enabled }} +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ template "skywalking.fullname" . }} + labels: + app: {{ template "skywalking.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +rules: +- apiGroups: [""] + resources: ["pods"] + verbs: ["get", "watch", "list"] +- apiGroups: ["extensions"] + resources: ["deployments", "replicasets"] + verbs: ["get", "watch", "list"] +{{- end }} \ No newline at end of file diff --git a/install/kubernetes/helm/skywalking/templates/oap-clusterrolebinding.yaml b/install/kubernetes/helm/skywalking/templates/oap-clusterrolebinding.yaml new file mode 100644 index 000000000..3c4b1f4a6 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/oap-clusterrolebinding.yaml @@ -0,0 +1,34 @@ +# 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. + +{{- if .Values.oap.envoy.als.enabled }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ template "skywalking.fullname" . }} + labels: + app: {{ template "skywalking.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ template "skywalking.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ template "skywalking.serviceAccountName.oap" . }} + namespace: {{ .Release.Namespace }} +{{- end }} \ No newline at end of file diff --git a/install/kubernetes/helm/skywalking/templates/oap-deployment.yaml b/install/kubernetes/helm/skywalking/templates/oap-deployment.yaml new file mode 100644 index 000000000..6d6cc8a20 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/oap-deployment.yaml @@ -0,0 +1,118 @@ +# 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: + labels: + app: {{ template "skywalking.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + component: "{{ .Values.oap.name }}" + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "skywalking.oap.fullname" . }} +spec: + replicas: {{ .Values.oap.replicas }} + selector: + matchLabels: + app: {{ template "skywalking.name" . }} + component: "{{ .Values.oap.name }}" + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ template "skywalking.name" . }} + component: "{{ .Values.oap.name }}" + release: {{ .Release.Name }} + {{- if .Values.oap.podAnnotations }} + annotations: +{{ toYaml .Values.oap.podAnnotations | indent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "skywalking.serviceAccountName.oap" . }} + affinity: + {{- if eq .Values.oap.antiAffinity "hard" }} + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - topologyKey: "kubernetes.io/hostname" + labelSelector: + matchLabels: + app: "{{ template "skywalking.name" . }}" + release: "{{ .Release.Name }}" + component: "{{ .Values.oap.name }}" + {{- else if eq .Values.oap.antiAffinity "soft" }} + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + podAffinityTerm: + topologyKey: kubernetes.io/hostname + labelSelector: + matchLabels: + app: "{{ template "skywalking.name" . }}" + release: "{{ .Release.Name }}" + component: "{{ .Values.oap.name }}" + {{- end }} + {{- with .Values.oap.nodeAffinity }} + nodeAffinity: +{{ toYaml . | indent 10 }} + {{- end }} +{{- if .Values.oap.nodeSelector }} + nodeSelector: +{{ toYaml .Values.oap.nodeSelector | indent 8 }} +{{- end }} +{{- if .Values.oap.tolerations }} + tolerations: +{{ toYaml .Values.oap.tolerations | indent 8 }} +{{- end }} + initContainers: + {{- include "skywalking.containers.wait-for-es" . | nindent 6 }} + containers: + - name: {{ .Values.oap.name }} + image: "{{ .Values.oap.image.repository }}:{{ .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.oap.image.pullPolicy }} + ports: + - containerPort: 11800 + name: grpc + - containerPort: 12800 + name: rest +{{- if .Values.oap.resources }} + resources: +{{ toYaml .Values.oap.resources | indent 10 }} +{{- end }} + env: + - name: JAVA_OPTS + value: "{{ .Values.oap.javaOpts }} -Dmode=no-init" + - name: SW_CLUSTER + value: kubernetes + - name: SW_CLUSTER_K8S_NAMESPACE + value: "{{ .Release.Namespace }}" + - name: SW_CLUSTER_K8S_LABEL + value: "app={{ template "skywalking.name" . }},release={{ .Release.Name }},component={{ .Values.oap.name }}" + - name: SKYWALKING_COLLECTOR_UID + valueFrom: + fieldRef: + fieldPath: metadata.uid + - name: SW_STORAGE + value: elasticsearch + {{- if .Values.oap.envoy.als.enabled }} + - name: SW_ENVOY_ALS_ENABLED + value: {{ .Values.oap.envoy.als.enabled | quote}} + {{- end }} + - name: SW_STORAGE_ES_CLUSTER_NODES + value: "{{ include "call-nested" (list . "elasticsearch" "elasticsearch.client.fullname") }}:9200" + {{- range $key, $value := .Values.oap.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} diff --git a/install/kubernetes/helm/skywalking/templates/oap-role.yaml b/install/kubernetes/helm/skywalking/templates/oap-role.yaml new file mode 100644 index 000000000..2d9646306 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/oap-role.yaml @@ -0,0 +1,30 @@ +# 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. + +{{- if not .Values.oap.envoy.als.enabled }} +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ template "skywalking.fullname" . }} + labels: + app: {{ template "skywalking.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +rules: + - apiGroups: [""] + resources: ["pods"] + verbs: ["get", "watch", "list"] +{{- end }} \ No newline at end of file diff --git a/install/kubernetes/helm/skywalking/templates/oap-rolebinding.yaml b/install/kubernetes/helm/skywalking/templates/oap-rolebinding.yaml new file mode 100644 index 000000000..186dee3b5 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/oap-rolebinding.yaml @@ -0,0 +1,34 @@ +# 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. + +{{- if not .Values.oap.envoy.als.enabled }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ template "skywalking.fullname" . }} + labels: + app: {{ template "skywalking.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ template "skywalking.fullname" . }} +subjects: + - kind: ServiceAccount + name: {{ template "skywalking.serviceAccountName.oap" . }} + namespace: {{ .Release.Namespace }} +{{- end }} \ No newline at end of file diff --git a/install/kubernetes/helm/skywalking/templates/oap-serviceaccount.yaml b/install/kubernetes/helm/skywalking/templates/oap-serviceaccount.yaml new file mode 100644 index 000000000..fd6c2c242 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/oap-serviceaccount.yaml @@ -0,0 +1,25 @@ +# 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: v1 +kind: ServiceAccount +metadata: + labels: + app: {{ template "skywalking.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + component: "{{ .Values.oap.name }}" + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "skywalking.serviceAccountName.oap" . }} diff --git a/install/kubernetes/helm/skywalking/templates/oap-svc.yaml b/install/kubernetes/helm/skywalking/templates/oap-svc.yaml new file mode 100644 index 000000000..aefe78a81 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/oap-svc.yaml @@ -0,0 +1,36 @@ +# 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: v1 +kind: Service +metadata: + name: {{ template "skywalking.oap.fullname" . }} + labels: + app: {{ template "skywalking.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + component: "{{ .Values.oap.name }}" + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} +spec: + type: {{ .Values.oap.service.type }} + ports: + - port: {{ .Values.oap.ports.rest }} + name: rest + - port: {{ .Values.oap.ports.grpc }} + name: grpc + selector: + app: {{ template "skywalking.name" . }} + component: "{{ .Values.oap.name }}" + release: {{ .Release.Name }} diff --git a/install/kubernetes/helm/skywalking/templates/ui-deployment.yaml b/install/kubernetes/helm/skywalking/templates/ui-deployment.yaml new file mode 100644 index 000000000..e8428f7d9 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/ui-deployment.yaml @@ -0,0 +1,57 @@ +# 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: {{ template "skywalking.ui.fullname" . }} + labels: + app: {{ template "skywalking.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + component: "{{ .Values.ui.name }}" + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} +spec: + replicas: {{ .Values.ui.replicas }} + selector: + matchLabels: + app: {{ template "skywalking.name" . }} + component: "{{ .Values.ui.name }}" + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ template "skywalking.name" . }} + component: "{{ .Values.ui.name }}" + release: {{ .Release.Name }} + {{- if .Values.ui.podAnnotations }} + annotations: +{{ toYaml .Values.ui.podAnnotations | indent 8 }} + {{- end }} + spec: + containers: + - name: {{ .Values.ui.name }} + image: "{{ .Values.ui.image.repository }}:{{ .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.ui.image.pullPolicy }} + ports: + - containerPort: {{ .Values.ui.service.internalPort }} + name: page +{{- if .Values.ui.resources }} + resources: +{{ toYaml .Values.ui.resources | indent 10 }} +{{- end }} + env: + - name: SW_OAP_ADDRESS + value: {{ template "skywalking.oap.fullname" . }}:{{ .Values.oap.ports.rest }} diff --git a/install/kubernetes/helm/skywalking/templates/ui-ingress.yaml b/install/kubernetes/helm/skywalking/templates/ui-ingress.yaml new file mode 100644 index 000000000..899c86189 --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/ui-ingress.yaml @@ -0,0 +1,49 @@ +# 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. + +{{- if .Values.ui.ingress.enabled -}} +{{- $serviceName := include "skywalking.ui.fullname" . -}} +{{- $servicePort := .Values.ui.service.externalPort -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + labels: + app: {{ template "skywalking.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + component: "{{ .Values.ui.name }}" + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "skywalking.ui.fullname" . }} + annotations: + {{- range $key, $value := .Values.ui.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + rules: + {{- range .Values.ui.ingress.hosts }} + {{- $url := splitList "/" . }} + - host: {{ first $url }} + http: + paths: + - path: /{{ rest $url | join "/" }} + backend: + serviceName: {{ $serviceName }} + servicePort: {{ $servicePort }} + {{- end -}} + {{- if .Values.ui.ingress.tls }} + tls: +{{ toYaml .Values.ui.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/install/kubernetes/helm/skywalking/templates/ui-svc.yaml b/install/kubernetes/helm/skywalking/templates/ui-svc.yaml new file mode 100644 index 000000000..6250c83bb --- /dev/null +++ b/install/kubernetes/helm/skywalking/templates/ui-svc.yaml @@ -0,0 +1,63 @@ +# 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: v1 +kind: Service +metadata: + labels: + app: {{ template "skywalking.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + component: "{{ .Values.ui.name }}" + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "skywalking.ui.fullname" . }} + {{- with .Values.ui.service.annotations }} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} +spec: + {{- if .Values.ui.service.loadBalancerSourceRanges }} + loadBalancerSourceRanges: + {{- range $cidr := .Values.ui.service.loadBalancerSourceRanges }} + - {{ $cidr }} + {{- end }} + {{- end }} + type: {{ .Values.ui.service.type }} + {{- if and (eq .Values.ui.service.type "ClusterIP") .Values.ui.service.clusterIP }} + clusterIP: {{ .Values.ui.service.clusterIP }} + {{- end }} + ports: + - port: {{ .Values.ui.service.externalPort }} + targetPort: {{ .Values.ui.service.internalPort }} + protocol: TCP +{{ if (and (eq .Values.ui.service.type "NodePort") (not (empty .Values.ui.service.nodePort))) }} + nodePort: {{ .Values.ui.service.nodePort }} +{{ end }} +{{- if .Values.ui.service.portName }} + name: {{ .Values.ui.service.portName }} +{{- end }} +{{- if .Values.ui.service.externalIPs }} + externalIPs: +{{ toYaml .Values.ui.service.externalIPs | indent 4 }} +{{- end }} + selector: + app: {{ template "skywalking.name" . }} + component: "{{ .Values.ui.name }}" + release: {{ .Release.Name }} +{{- if .Values.ui.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.ui.service.loadBalancerIP }} +{{- end }} diff --git a/install/kubernetes/helm/skywalking/values.yaml b/install/kubernetes/helm/skywalking/values.yaml new file mode 100644 index 000000000..8201c3734 --- /dev/null +++ b/install/kubernetes/helm/skywalking/values.yaml @@ -0,0 +1,269 @@ +# 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. + +# Default values for skywalking. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +serviceAccounts: + oap: + +oap: + name: skywalking-oap + image: + repository: apache/skywalking-oap-server + tag: latest + pullPolicy: IfNotPresent + ports: + grpc: 11800 + rest: 12800 + replicas: 2 + service: + type: ClusterIP + javaOpts: -Xmx2g -Xms2g + antiAffinity: "soft" + nodeAffinity: {} + nodeSelector: {} + tolerations: [] + resources: {} + # limits: + # cpu: 8 + # memory: 8Gi + # requests: + # cpu: 8 + # memory: 4Gi + # podAnnotations: + # example: oap-foo + envoy: + als: + enabled: false + # more envoy ALS ,please refer to https://github.com/apache/skywalking/blob/master/docs/en/setup/envoy/als_setting.md#observe-service-mesh-through-als + istio: + adapter: + enabled: false + env: + # more env, please refer to https://hub.docker.com/r/apache/skywalking-oap-server + # or https://github.com/apache/skywalking-docker/blob/master/6/6.4/oap/README.md#sw_telemetry +ui: + name: skywalking-ui + replicas: 1 + image: + repository: apache/skywalking-ui + tag: latest + pullPolicy: IfNotPresent + # podAnnotations: + # example: oap-foo + ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + path: / + hosts: [] + # - skywalking.local + tls: [] + # - secretName: skywalking-tls + # hosts: + # - skywalking.local + service: + type: ClusterIP + # clusterIP: None + externalPort: 80 + internalPort: 8080 + ## External IP addresses of service + ## Default: nil + ## + # externalIPs: + # - 192.168.0.1 + # + ## LoadBalancer IP if service.type is LoadBalancer + ## Default: nil + ## + # loadBalancerIP: 10.2.2.2 + # Annotation example: setup ssl with aws cert when service.type is LoadBalancer + # service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:us-east-1:EXAMPLE_CERT + annotations: {} + ## Limit load balancer source ips to list of CIDRs (where available) + # loadBalancerSourceRanges: [] + +elasticsearch: + enabled: true + # If elasticsearch,enabled=true values for elasticsearch. + + ## Define serviceAccount names for components. Defaults to component's fully qualified name. + serviceAccounts: + client: + create: true + name: + master: + create: true + name: + data: + create: true + name: + + client: + name: client + replicas: 2 + serviceType: ClusterIP + ## If coupled with serviceType = "NodePort", this will set a specific nodePort to the client HTTP port + # httpNodePort: 30920 + loadBalancerIP: {} + loadBalancerSourceRanges: {} + ## (dict) If specified, apply these annotations to the client service + # serviceAnnotations: + # example: client-svc-foo + heapSize: "512m" + # additionalJavaOpts: "-XX:MaxRAM=512m" + antiAffinity: "soft" + nodeAffinity: {} + nodeSelector: {} + tolerations: [] + initResources: {} + # limits: + # cpu: "25m" + # # memory: "128Mi" + # requests: + # cpu: "25m" + # memory: "128Mi" + resources: + limits: + cpu: "1" + # memory: "1024Mi" + requests: + cpu: "25m" + memory: "512Mi" + priorityClassName: "" + ## (dict) If specified, apply these annotations to each client Pod + # podAnnotations: + # example: client-foo + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 + ingress: + enabled: false + # user: NAME + # password: PASSWORD + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + path: / + hosts: + - chart-example.local + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + + master: + name: master + exposeHttp: false + replicas: 3 + heapSize: "512m" + # additionalJavaOpts: "-XX:MaxRAM=512m" + persistence: + enabled: false + accessMode: ReadWriteOnce + name: data + size: "4Gi" + # storageClass: "ssd" + readinessProbe: + httpGet: + path: /_cluster/health?local=true + port: 9200 + initialDelaySeconds: 5 + antiAffinity: "soft" + nodeAffinity: {} + nodeSelector: {} + tolerations: [] + initResources: {} + # limits: + # cpu: "25m" + # # memory: "128Mi" + # requests: + # cpu: "25m" + # memory: "128Mi" + resources: + limits: + cpu: "1" + # memory: "1024Mi" + requests: + cpu: "25m" + memory: "512Mi" + priorityClassName: "" + ## (dict) If specified, apply these annotations to each master Pod + # podAnnotations: + # example: master-foo + podManagementPolicy: OrderedReady + podDisruptionBudget: + enabled: false + minAvailable: 2 # Same as `cluster.env.MINIMUM_MASTER_NODES` + # maxUnavailable: 1 + updateStrategy: + type: OnDelete + + data: + name: data + exposeHttp: false + replicas: 2 + heapSize: "1536m" + # additionalJavaOpts: "-XX:MaxRAM=1536m" + persistence: + enabled: false + accessMode: ReadWriteOnce + name: data + size: "30Gi" + # storageClass: "ssd" + readinessProbe: + httpGet: + path: /_cluster/health?local=true + port: 9200 + initialDelaySeconds: 5 + terminationGracePeriodSeconds: 3600 + antiAffinity: "soft" + nodeAffinity: {} + nodeSelector: {} + tolerations: [] + initResources: {} + # limits: + # cpu: "25m" + # # memory: "128Mi" + # requests: + # cpu: "25m" + # memory: "128Mi" + resources: + limits: + cpu: "1" + # memory: "2048Mi" + requests: + cpu: "25m" + memory: "1536Mi" + priorityClassName: "" + ## (dict) If specified, apply these annotations to each data Pod + # podAnnotations: + # example: data-foo + podDisruptionBudget: + enabled: false + # minAvailable: 1 + maxUnavailable: 1 + podManagementPolicy: OrderedReady + updateStrategy: + type: OnDelete + hooks: # post-start and pre-stop hooks + drain: # drain the node before stopping it and re-integrate it into the cluster after start + enabled: true + +nameOverride: "" diff --git a/test/scripts/clean.sh b/test/scripts/clean.sh new file mode 100755 index 000000000..9de476bff --- /dev/null +++ b/test/scripts/clean.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# ---------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------- + +set -e + +CONTAINER_NAME=$1 +[[ "${CONTAINER_NAME}" == "" ]] && exit 1 + +docker ps | grep -e ${CONTAINER_NAME} | awk '{print $1}' | xargs docker stop +docker ps -a | grep -e ${CONTAINER_NAME} | awk '{print $1}' | xargs docker rm diff --git a/test/scripts/minikube.sh b/test/scripts/minikube.sh new file mode 100755 index 000000000..31309280e --- /dev/null +++ b/test/scripts/minikube.sh @@ -0,0 +1,114 @@ +#!/usr/bin/env bash + +# ---------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------- + +set -x + +K8S_VER=$2 +if [[ "${K8S_VER}" == "" ]]; then + K8S_VER="k8s-v1.15.4" +fi + +function waitMinikube() { + set +e + kubectl cluster-info + # This for loop waits until kubectl can access the api server that Minikube has created. + for _ in {1..24}; do # Timeout for 240 seconds. + kubectl get po --all-namespaces + if [ $? -ne 1 ]; then + break + fi + sleep 10 + done + if ! kubectl get all --all-namespaces; then + echo "Kubernetes failed to start" + ps ax + netstat -an + docker images + cat /var/lib/localkube/localkube.err + printf '\n\n\n' + kubectl cluster-info dump + exit 1 + fi + + echo "Minikube is running" + + for _ in {1..6}; do # Timeout for 60 seconds. + echo "$(sudo -E minikube ip) minikube.local" | sudo tee -a /etc/hosts + ip=$(cat /etc/hosts | grep minikube.local | cut -d' ' -f1 | xargs) + if [ -n "$ip" ]; then + break + fi + sleep 10 + done + + ip=$(cat /etc/hosts | grep minikube.local | cut -d' ' -f1 | xargs) + if [ -n "$ip" ]; then + echo "minikube.local is mapped to $ip" + else + exit 1 + fi +} + +# startMinikubeNone starts real kubernetes minikube with none driver. This requires `sudo`. +function startMinikubeNone() { + export MINIKUBE_WANTUPDATENOTIFICATION=false + export MINIKUBE_WANTREPORTERRORPROMPT=false + export MINIKUBE_HOME=$HOME + export CHANGE_MINIKUBE_NONE_USER=true + + # Troubleshoot problem with Docker build on some CircleCI machines. + if [ -f /proc/sys/net/ipv4/ip_forward ]; then + echo "IP forwarding setting: $(cat /proc/sys/net/ipv4/ip_forward)" + echo "My hostname is:" + hostname + echo "My distro is:" + cat /etc/*-release + echo "Contents of /etc/sysctl.d/" + ls -l /etc/sysctl.d/ || true + echo "Contents of /etc/sysctl.conf" + grep ip_forward /etc/sysctl.conf + echo "Config files setting ip_forward" + find /etc/sysctl.d/ -type f -exec grep ip_forward \{\} \; -print + if [ "$(cat /proc/sys/net/ipv4/ip_forward)" -eq 0 ]; then + whoami + echo "Cannot build images without IPv4 forwarding, attempting to turn on forwarding" + sudo sysctl -w net.ipv4.ip_forward=1 + if [ "$(cat /proc/sys/net/ipv4/ip_forward)" -eq 0 ]; then + echo "Cannot build images without IPv4 forwarding" + exit 1 + fi + fi + fi + + sudo -E minikube config set WantUpdateNotification false + sudo -E minikube config set WantReportErrorPrompt false + sudo -E minikube start --kubernetes-version=${K8S_VER#k8s-} --vm-driver=none +} + +function stopMinikube() { + sudo minikube stop +} + +case "$1" in + start) startMinikubeNone ;; + stop) stopMinikube ;; + wait) waitMinikube ;; +esac diff --git a/test/scripts/pre.sh b/test/scripts/pre.sh new file mode 100755 index 000000000..d2cdbfe79 --- /dev/null +++ b/test/scripts/pre.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +# ---------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------- + +set -ex + +HELMVERSION=$1 +if [[ "${HELMVERSION}" == "" ]]; then + HELMVERSION="helm-v3.0.0-rc.3" +fi + +MINIKUBEVERESION=$2 +if [[ "${MINIKUBEVERESION}" == "" ]]; then + MINIKUBEVERESION="minikube-v1.4.0" +fi + +K8SVERSION=$3 +if [[ "${K8SVERSION}" == "" ]]; then + K8SVERSION="k8s-v1.15.4" +fi + +# Remove strict host checking. The rest of the file is already populated by the 'add_ssh_keys' step. +mkdir -p ~/.ssh +echo -e "\tStrictHostKeyChecking no" >> ~/.ssh/config +echo -e "\tControlMaster auto" >> ~/.ssh/config +echo -e "\tControlPersist 3600" >> ~/.ssh/config +echo -e "\tControlPath ~/.ssh/%r@%h:%p" >> ~/.ssh/config + +# Create directory for logs. +mkdir -p ~/logs + +# create directory for e2e artifacts. +mkdir -p ~/skywalking/test/e2e/artifacts + +curl -sSL https://get.helm.sh/${HELMVERSION}-linux-amd64.tar.gz | \ + sudo tar xz -C /usr/local/bin --strip-components=1 linux-amd64/helm + +sudo mkdir -p /usr/local/bin +curl -sSL "https://storage.googleapis.com/minikube/releases/${MINIKUBEVERESION#minikube-}/minikube-linux-amd64" -o /tmp/minikube +chmod +x /tmp/minikube +sudo mv /tmp/minikube /usr/local/bin/minikube + +curl -sSL "https://storage.googleapis.com/kubernetes-release/release/${K8SVERSION#k8s-}/bin/linux/amd64/kubectl" -o /tmp/kubectl +chmod +x /tmp/kubectl +sudo mv /tmp/kubectl /usr/local/bin/kubectl + +sudo apt-get remove -y --purge man-db +sudo apt-get update +sudo apt-get install -y \ + --no-install-recommends --allow-downgrades --allow-remove-essential --allow-change-held-packages \ + xvfb libgtk-3-0 libnotify4 libgconf-2-4 libnss3 libxss1 libasound2 \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg-agent \ + software-properties-common +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +sudo apt-key fingerprint 0EBFCD88 +sudo add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" +sudo apt-get update +sudo apt-get install -y docker-ce