Skip to content

Commit

Permalink
Add R3 to showcase (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
kezhenxu94 authored Jan 23, 2024
1 parent 90746f6 commit bd44ad8
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,8 @@ GRAFANA_IMAGE ?= grafana/grafana:9.5.2
OTEL_COLLECTOR_IMAGE ?= otel/opentelemetry-collector
OTEL_COLLECTOR_IMAGE_TAG ?= 0.72.0

SW_R3_IMAGE ?= ghcr.io/skyapm/r3
SW_R3_IMAGE_TAG ?= 0.1.0

# ALL variables should be listed above ^^
EXPORTED_VARS := $(filter-out <%,$(.VARIABLES))
8 changes: 7 additions & 1 deletion deploy/platform/kubernetes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ HELM_OPTIONS := $(HELM_OPTIONS) --set features.javaAgentInjector.agentImage=$(SW
HELM_OPTIONS := $(HELM_OPTIONS) --set features.rover.image=$(SW_ROVER_IMAGE)
HELM_OPTIONS := $(HELM_OPTIONS) --set features.grafana.image=$(GRAFANA_IMAGE)
HELM_OPTIONS := $(HELM_OPTIONS) --set skywalking.grafana.plugin.version=$(SW_GRAFANA_PLUGIN_VERSION)
HELM_OPTIONS := $(HELM_OPTIONS) --set features.r3.image=$(SW_R3_IMAGE):$(SW_R3_IMAGE_TAG)

ifeq ($(DEBUG),true)
HELM_OPTIONS := $(HELM_OPTIONS) --dry-run --debug
Expand Down Expand Up @@ -99,7 +100,7 @@ feature-istiod-monitor:
.PHONY: feature-als
feature-als:
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set features.als.enabled=true)
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set istio.enabled=true)
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set istio.enabled=true --set istiod.global.istioNamespace=$(NAMESPACE) --set base.global.istioNamespace=$(NAMESPACE))
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set istiod.meshConfig.defaultConfig.tracing.zipkin.address=$(RELEASE)-oap.$(NAMESPACE).svc:9411)
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set istiod.meshConfig.defaultConfig.envoyMetricsService.address=$(BACKEND_SERVICE))
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set istiod.meshConfig.defaultConfig.envoyAccessLogService.address=$(BACKEND_SERVICE))
Expand Down Expand Up @@ -171,6 +172,11 @@ feature-grafana:
feature-mesh-with-agent:
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set features.meshWithAgent.enabled=true)

.PHONY: feature-r3
feature-r3:
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set features.r3.enabled=true)
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set skywalking.oap.env.SW_AI_PIPELINE_URI_RECOGNITION_SERVER_ADDR=r3)

.PHONY: deploy
deploy: $(features)
helm dep up .
Expand Down
2 changes: 1 addition & 1 deletion deploy/platform/kubernetes/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ SAMPLE_SERVICES_NAMESPACE ?= sample-services
RELEASE ?= demo
AGENTLESS ?= false

FEATURE_FLAGS ?= java-agent-injector,cluster,elasticsearch,kubernetes-monitor,so11y,vm-monitor,als,event,istiod-monitor,satellite,rover,trace-profiling,mysql-monitor,postgresql-monitor,nginx-monitor,apisix-monitor,grafana,elasticsearch-monitor,rabbitmq-monitor,mongodb-monitor
FEATURE_FLAGS ?= java-agent-injector,cluster,elasticsearch,kubernetes-monitor,so11y,vm-monitor,als,event,istiod-monitor,satellite,rover,trace-profiling,mysql-monitor,postgresql-monitor,nginx-monitor,apisix-monitor,grafana,elasticsearch-monitor,rabbitmq-monitor,mongodb-monitor,r3
83 changes: 83 additions & 0 deletions deploy/platform/kubernetes/templates/feature-r3/resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# 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.features.r3.enabled }}
apiVersion: v1
kind: Service
metadata:
name: r3
spec:
selector:
app: r3
ports:
- protocol: TCP
port: 17128
name: r3-port

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: r3-deployment
labels:
app: r3
spec:
replicas: 1
selector:
matchLabels:
app: r3
template:
metadata:
labels:
app: r3
annotations:
sidecar.istio.io/inject: "false"
spec:
containers:
- name: r3
image: {{ .Values.features.r3.image }}
ports:
- containerPort: 17128

---
apiVersion: batch/v1
kind: CronJob
metadata:
name: r3-load
namespace: {{ .Values.sampleServices.namespace }}
labels:
app: r3-load
spec:
schedule: "0,10,20,30,40,50 * * * *"
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
shareProcessNamespace: true
containers:
- name: r3-load
image: curlimages/curl
command: ["/bin/sh"]
args: ["-c", "for i in $(seq 1 200); do curl http://rating/songs/$i/reviews/$((i+1)); sleep 1; done; curl -X POST http://localhost:15000/quitquitquit;"]
securityContext:
capabilities:
add:
- SYS_PTRACE
restartPolicy: Never
{{- end }}
8 changes: 8 additions & 0 deletions deploy/platform/kubernetes/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ skywalking:
SW_STORAGE_ES_SUPER_DATASET_INDEX_SHARDS_FACTOR: "2"
SW_RECEIVER_ZIPKIN: default
SW_QUERY_ZIPKIN: default
# @feature: r3; some basic settings for R3
SW_CORE_ENABLE_ENDPOINT_NAME_GROUPING_BY_OPENAPI: "false"
SW_CORE_MAX_HTTP_URIS_NUMBER_PER_SVR: "3000"
SW_AI_PIPELINE_URI_RECOGNITION_SERVER_PORT: "17128"

config:
metadata-service-mapping.yaml: |
Expand Down Expand Up @@ -343,3 +347,7 @@ features:
javaAgentInjector:
enabled: false
agentImage: ~

r3:
enabled: false
image: ~
1 change: 1 addition & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Currently, the features supported are:
| `apisix-monitor` | Deploy OpenTelemetry and export APISIX metrics to SkyWalking for analysis and display on UI | |
| `mesh-with-agent` | Deploy services with java agent in the service mesh environment. | Only support deployment in the Kubernetes environment, docker is not supported. |
| `grafana` | Deploy a Grafana to show SkyWalking metrics and logs on the Grafana UI. | Feel free to modify the Grafana config when deploy your own environment. |
| `r3` | Deploy [R3](https://github.com/SkyAPM/R3) as RESTful URL recognition service. | |

### Kubernetes

Expand Down

0 comments on commit bd44ad8

Please sign in to comment.