Skip to content

Commit

Permalink
Add skywalking satellite support (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrproliu authored Nov 29, 2021
1 parent 0f3ec68 commit 9f42abf
Show file tree
Hide file tree
Showing 32 changed files with 1,211 additions and 176 deletions.
136 changes: 39 additions & 97 deletions .github/workflows/e2e.ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,114 +27,56 @@ on:
env:
SKIP_TEST: true
ISTIO_VERSION: 1.7.1
TAG: ${{ github.sha }}
SCRIPTS_DIR: main/test/e2e-mesh/e2e-istio/scripts
SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
OAP_TAG: cef4f6dcac5b14cd67f51a64ad08052bbc046653
OAP_REPO: ghcr.io/apache/skywalking/oap
UI_TAG: cef4f6dcac5b14cd67f51a64ad08052bbc046653
UI_REPO: ghcr.io/apache/skywalking/ui
SATELLITE_TAG: v64f1938e118e95b8d8f50756f666e4777ce6aca2
SATELLITE_REPO: ghcr.io/apache/skywalking-satellite/skywalking-satellite

jobs:
als:
runs-on: ubuntu-latest
timeout-minutes: 60
name: Istio+Envoy Access Log Service
strategy:
matrix:
images:
- name: recent
oap-repo: ghcr.io/apache/skywalking/oap
oap-tag: cef4f6dcac5b14cd67f51a64ad08052bbc046653
ui-repo: ghcr.io/apache/skywalking/ui
ui-tag: cef4f6dcac5b14cd67f51a64ad08052bbc046653
- name: 8.6.0
oap-repo: skywalking.docker.scarf.sh/apache/skywalking-oap-server
oap-tag: 8.6.0-es6
ui-repo: skywalking.docker.scarf.sh/apache/skywalking-ui
ui-tag: 8.6.0
name: Istio+Envoy Access Log Service(${{ matrix.images.name }})
env:
OAP_TAG: ${{ matrix.images.oap-tag }}
OAP_REPO: ${{ matrix.images.oap-repo }}
UI_TAG: ${{ matrix.images.ui-tag }}
UI_REPO: ${{ matrix.images.ui-repo }}
SATELLITE_TAG: v64f1938e118e95b8d8f50756f666e4777ce6aca2
SATELLITE_REPO: ghcr.io/apache/skywalking-satellite/skywalking-satellite
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: apache/skywalking
submodules: true
path: main
ref: 6228d450e1b0792dd9875ad68984c89c81ece742

- uses: actions/cache@v2
- name: Setup go
uses: actions/setup-go@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: Build Docker Image
run: cd main && make docker && cd ..

- name: Prepare envrionment
run: bash ${SCRIPTS_DIR}/pre.sh

- name: Install Minikube
run: bash ${SCRIPTS_DIR}/minikube.sh start

- name: Install Istio
run: bash ${SCRIPTS_DIR}/istio.sh --set profile=demo --set meshConfig.defaultConfig.envoyAccessLogService.address=skywalking-oap.istio-system:11800 --set meshConfig.enableEnvoyAccessLogService=true

- name: Install SkyWalking
run: |
cd chart
helm dep up skywalking
helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
--set elasticsearch.minimumMasterNodes=1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.env.SW_ENVOY_METRIC_ALS_TCP_ANALYSIS=k8s-mesh \
--set oap.env.K8S_SERVICE_NAME_RULE='e2e::${service.metadata.name}' \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
--set ui.image.repository=skywalking/ui \
--set ui.image.tag=$TAG \
--set oap.image.repository=skywalking/oap \
--set oap.image.tag=$TAG \
--set oap.storageType=elasticsearch
kubectl -n istio-system get pods
sleep 3
kubectl -n istio-system wait --for=condition=available deployments/skywalking-oap --timeout=1200s
kubectl get pods -A -o wide --show-labels
kubectl get services -A -o wide
- name: Deploy demo services
run: |
bash ${SCRIPTS_DIR}/demo.sh
# Enable TCP services
kubectl apply -f https://raw.githubusercontent.com/istio/istio/$ISTIO_VERSION/samples/bookinfo/platform/kube/bookinfo-ratings-v2.yaml
kubectl apply -f https://raw.githubusercontent.com/istio/istio/$ISTIO_VERSION/samples/bookinfo/platform/kube/bookinfo-db.yaml
kubectl apply -f https://raw.githubusercontent.com/istio/istio/$ISTIO_VERSION/samples/bookinfo/networking/destination-rule-all.yaml
kubectl apply -f https://raw.githubusercontent.com/istio/istio/$ISTIO_VERSION/samples/bookinfo/networking/virtual-service-ratings-db.yaml
- name: Cluster Info
if: ${{ failure() }}
run: |
df -h
minikube logs
minikube status
- name: Set up Minikube tunnel
run: |
mkdir /tmp/minikube-tunnel
minikube tunnel > /tmp/minikube-tunnel/a.log &
export POD_NAME=$(kubectl get pods -n istio-system -l "app=skywalking,release=skywalking,component=ui" -o jsonpath="{.items[0].metadata.name}")
echo $POD_NAME
kubectl -n istio-system port-forward $POD_NAME 8080:8080 > /tmp/minikube-tunnel/b.log &
- name: Run E2E test
run: |
export GATEWAY_HOST=$(minikube ip)
export GATEWAY_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export WEBAPP_HOST=127.0.0.1
export WEBAPP_PORT=8080
cd main
./mvnw -q -DskipTests install
./mvnw -q -f apm-application-toolkit -DskipTests -am install
SW_VERSION=$(./mvnw -q -DforceStdout -N org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version)
./mvnw -q --batch-mode -f test/e2e/pom.xml -am -DfailIfNoTests=false -Dsw.version=${SW_VERSION} verify -Dit.test=org.apache.skywalking.e2e.mesh.ALSE2E
- name: Logs
go-version: '1.16'
- name: Run E2E Test
uses: apache/skywalking-infra-e2e@45584853d6f660102c523b1e9cb5815d12ae55d3
with:
e2e-file: $GITHUB_WORKSPACE/test/e2e/e2e.yaml
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
run: |
kubectl -n istio-system logs --tail=10000 -l "app=skywalking,release=skywalking,component=ui"
kubectl -n istio-system logs --tail=10000 -l "app=skywalking,release=skywalking,component=oap"
cat /tmp/minikube-tunnel/*
name: Upload Logs
with:
name: logs
path: "${{ env.SW_INFRA_E2E_LOG_DIR }}"

- name: Clean up
if: ${{ always() }}
run: minikube delete

build:
runs-on: ubuntu-latest
Expand Down
103 changes: 25 additions & 78 deletions .github/workflows/e2e.compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,93 +23,40 @@ on:

env:
ISTIO_VERSION: 1.7.1
SCRIPTS_DIR: main/test/e2e-mesh/e2e-istio/scripts
SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
SATELLITE_TAG: v4b97fd255b6459fe9d3fc4f88c0d8f682fc2a364
SATELLITE_REPO: ghcr.io/apache/skywalking-satellite/skywalking-satellite

jobs:
als:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
tag:
- 8.3.0-es6
images:
- oap-repo: skywalking.docker.scarf.sh/apache/skywalking-oap-server
oap-tag: 8.6.0-es6
ui-repo: skywalking.docker.scarf.sh/apache/skywalking-ui
ui-tag: 8.6.0
env:
TAG: ${{ matrix.tag }}
name: ${{ matrix.tag }}
OAP_TAG: ${{ matrix.images.oap-tag }}
OAP_REPO: ${{ matrix.images.oap-repo }}
UI_TAG: ${{ matrix.images.ui-tag }}
UI_REPO: ${{ matrix.images.ui-repo }}
name: als_${{ matrix.images.oap-tag }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: apache/skywalking
submodules: true
path: main
ref: 5e4b16cbfc96f80bd86eb6a98ddcf60f0959c9b1

- name: Prepare envrionment
run: bash ${SCRIPTS_DIR}/pre.sh

- name: Install Minikube
run: bash ${SCRIPTS_DIR}/minikube.sh start

- name: Install Istio
run: bash ${SCRIPTS_DIR}/istio.sh --set profile=demo --set meshConfig.defaultConfig.envoyAccessLogService.address=skywalking-oap.istio-system:11800 --set meshConfig.enableEnvoyAccessLogService=true

- name: Install SkyWalking
run: |
cd chart
helm dep up skywalking
helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
--set elasticsearch.minimumMasterNodes=1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
--set ui.image.tag=${TAG//-es*} \
--set oap.image.tag=$TAG \
--set oap.storageType=elasticsearch
kubectl -n istio-system get pods
sleep 3
kubectl -n istio-system wait --for=condition=available deployments/skywalking-oap --timeout=1200s
kubectl get pods -A -o wide --show-labels
kubectl get services -A -o wide
- name: Deploy demo services
run: bash ${SCRIPTS_DIR}/demo.sh

- name: Cluster Info
if: ${{ failure() }}
run: |
df -h
minikube logs
minikube status
- name: Set up Minikube tunnel
run: |
mkdir /tmp/minikube-tunnel
minikube tunnel > /tmp/minikube-tunnel/a.log &
export POD_NAME=$(kubectl get pods -n istio-system -l "app=skywalking,release=skywalking,component=ui" -o jsonpath="{.items[0].metadata.name}")
echo $POD_NAME
kubectl -n istio-system port-forward $POD_NAME 8080:8080 > /tmp/minikube-tunnel/b.log &
- name: Run E2E test
run: |
export GATEWAY_HOST=$(minikube ip)
export GATEWAY_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export WEBAPP_HOST=127.0.0.1
export WEBAPP_PORT=8080
cd main && ./mvnw --batch-mode -f test/e2e/pom.xml -am -DfailIfNoTests=false verify -Dit.test=org.apache.skywalking.e2e.mesh.ALSE2E
- name: Logs
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: '1.16'
- name: Run E2E Test
uses: apache/skywalking-infra-e2e@45584853d6f660102c523b1e9cb5815d12ae55d3
with:
e2e-file: $GITHUB_WORKSPACE/test/e2e/e2e.yaml
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
run: |
kubectl -n istio-system logs --tail=10000 -l "app=skywalking,release=skywalking,component=ui"
kubectl -n istio-system logs --tail=10000 -l "app=skywalking,release=skywalking,component=oap"
cat /tmp/minikube-tunnel/*
- name: Clean up
if: ${{ always() }}
run: minikube delete
name: Upload Logs
with:
name: logs
path: "${{ env.SW_INFRA_E2E_LOG_DIR }}"
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ helm install "${SKYWALKING_RELEASE_NAME}" ${REPO}/skywalking -n "${SKYWALKING_RE
-f ./skywalking/values-my-es.yaml
```

## Install SkyWalking with Satellite

Enable the satellite as gateway, and set the satellite image tag.

```shell script
helm install "${SKYWALKING_RELEASE_NAME}" ${REPO}/skywalking -n "${SKYWALKING_RELEASE_NAMESPACE}" \
--set satellite.enabled=true \
--set satellite.image.tag=v0.3.0
```

After satellite have been installed, you should replace the `oap` address to the `satellite` address, the address from agent or `istio`, such as `skywalking-satellite.istio-system:11800`.

## Customization

- Use your own configuration files
Expand Down
16 changes: 16 additions & 0 deletions chart/skywalking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ The following table lists the configurable parameters of the Skywalking chart an
| `elasticsearch.keystore` | Allows you map Kubernetes secrets into the keystore. See the [config example](/elasticsearch/examples/config/values.yaml) and [how to use the keystore](#how-to-use-the-keystore) | `[]` |
| `elasticsearch.rbac` | Configuration for creating a role, role binding and service account as part of this helm chart with `create: true`. Also can be used to reference an external service account with `serviceAccountName: "externalServiceAccountName"`. | `create: false`<br>`serviceAccountName: ""` |
| `elasticsearch.podSecurityPolicy` | Configuration for create a pod security policy with minimal permissions to run this Helm chart with `create: true`. Also can be used to reference an external pod security policy with `name: "externalPodSecurityPolicy"` | `create: false`<br>`name: ""` |
| `satellite.name` | Satellite deployment name | `satellite` |
| `satellite.replicas` | Satellite k8s deployment replicas | `1` |
| `satellite.enabled` | Is enable Satellite | `false` |
| `satellite.image.repository` | Satellite container image name | `skywalking.docker.scarf.sh/apache/skywalking-satellite` |
| `satellite.image.tag` | Satellite container image tag | `v0.3.0` |
| `satellite.image.pullPolicy` | Satellite container image pull policy | `IfNotPresent` |
| `satellite.antiAffinity` | Satellite anti-affinity policy | `soft` |
| `satellite.nodeAffinity` | Satellite node affinity policy | `{}` |
| `satellite.nodeSelector` | Satellite labels for pod assignment | `{}` |
| `satellite.tolerations` | Satellite tolerations | `[]` |
| `satellite.service.type` | Satellite svc type | `ClusterIP` |
| `satellite.ports.grpc` | Satellite grpc port for tracing, metrics, logs, events | `11800` |
| `satellite.ports.prometheus` | Satellite http port for Prometheus monitoring | `1234` |
| `satellite.resources` | Satellite node resources requests & limits | `{} - cpu limit must be an integer` |
| `satellite.podAnnotations` | Configurable [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) applied to all Satellite pods | `{}` |
| `satellite.env` | Satellite environment variables | `[]` |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

Expand Down
22 changes: 22 additions & 0 deletions chart/skywalking/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{ template "skywalking.fullname" . }}-{{ .Values.oap.name }}
{{- end -}}

{{/*
Create a oap full labels value.
*/}}
{{- define "skywalking.oap.labels" -}}
app={{ template "skywalking.name" . }},release={{ .Release.Name }},component={{ .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).
Expand All @@ -56,13 +63,28 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{ template "skywalking.fullname" . }}-{{ .Values.ui.name }}
{{- end -}}

{{/*
Create a default fully qualified satellite name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "skywalking.satellite.fullname" -}}
{{ template "skywalking.fullname" . }}-{{ .Values.satellite.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 -}}

{{/*
Create the name of the service account to use for the satellite cluster
*/}}
{{- define "skywalking.serviceAccountName.satellite" -}}
{{ default (include "skywalking.satellite.fullname" .) .Values.serviceAccounts.satellite }}
{{- end -}}

{{- define "skywalking.containers.wait-for-es" -}}
- name: wait-for-elasticsearch
image: {{ .Values.initContainer.image }}:{{ .Values.initContainer.tag }}
Expand Down
2 changes: 1 addition & 1 deletion chart/skywalking/templates/oap-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ spec:
value: "60"
{{- end }}
- name: SW_CLUSTER_K8S_LABEL
value: "app={{ template "skywalking.name" . }},release={{ .Release.Name }},component={{ .Values.oap.name }}"
value: "{{ template "skywalking.oap.labels" . }}"
- name: SKYWALKING_COLLECTOR_UID
valueFrom:
fieldRef:
Expand Down
Loading

0 comments on commit 9f42abf

Please sign in to comment.