Add baseline feature into Kubernetes (#205)
diff --git a/Makefile.in b/Makefile.in
index de129b0..51b5fa9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -66,5 +66,7 @@
CILIUM_VERSION ?= 1.13.4
CILIUM_CLI_VERSION ?= v0.15.0
+SW_PREDICTOR_IMAGE ?= ghcr.io/skyapm/skypredictor:66cd881d8316e7bd958a2172a99d2fc33f707150
+
# ALL variables should be listed above ^^
EXPORTED_VARS := $(filter-out <%,$(.VARIABLES))
diff --git a/deploy/platform/kubernetes/Makefile b/deploy/platform/kubernetes/Makefile
index 2b03499..96e11d8 100644
--- a/deploy/platform/kubernetes/Makefile
+++ b/deploy/platform/kubernetes/Makefile
@@ -61,6 +61,7 @@
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)
+HELM_OPTIONS := $(HELM_OPTIONS) --set features.baseline.image=$(SW_PREDICTOR_IMAGE)
ifeq ($(DEBUG),true)
HELM_OPTIONS := $(HELM_OPTIONS) --dry-run --debug
@@ -220,6 +221,10 @@
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set features.activemqMonitor.enabled=true)
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set opentelemetry.enabled=true)
+.PHONY: feature-baseline
+feature-baseline:
+ $(eval HELM_OPTIONS := $(HELM_OPTIONS) --set features.baseline.enabled=true --set skywalking.oap.env.SW_API_PIPELINE_BASELINE_SERVICE_HOST=$(RELEASE)-baseline.$(NAMESPACE).svc.cluster.local)
+
.PHONY: cilium
cilium:
ifeq (, $(shell which cilium))
diff --git a/deploy/platform/kubernetes/templates/feature-baseline/deployment.yml b/deploy/platform/kubernetes/templates/feature-baseline/deployment.yml
new file mode 100644
index 0000000..35c2393
--- /dev/null
+++ b/deploy/platform/kubernetes/templates/feature-baseline/deployment.yml
@@ -0,0 +1,92 @@
+# Copyright 2025 SkyAPM org
+#
+# Licensed 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.baseline.enabled }}
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: predictor-data
+spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ # PVC storage size
+ storage: "10Gi"
+
+---
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: skywalking-predictor
+ namespace: {{ .Release.Namespace }}
+spec:
+ selector:
+ matchLabels:
+ name: skywalking-predictor
+ template:
+ metadata:
+ labels:
+ name: skywalking-predictor
+ spec:
+ containers:
+ - name: skywalking-predictor
+ image: {{ .Values.features.baseline.image }}
+ ports:
+ - containerPort: 18080
+ name: grpc
+ - containerPort: 8000
+ name: prometheus
+ env:
+ - name: BASELINE_FETCH_SERVER_ENDPOINT
+ value: {{ template "skywalking.oap.address.http" . }}
+ - name: BASELINE_FETCH_CRON
+ value: "10 */8 * * *"
+ - name: BASELINE_FETCH_METRICS
+ value: "service_resp_time,service_sla,service_cpm,service_percentile,service_apdex"
+ - name: BASELINE_FETCH_SERVER_LAYERS
+ value: "GENERAL,MESH"
+ - name: LOGGING_LEVEL
+ value: DEBUG
+ livenessProbe:
+ initialDelaySeconds: 30
+ periodSeconds: 30
+ tcpSocket:
+ port: grpc
+ timeoutSeconds: 1
+ volumeMounts:
+ - mountPath: /predictor-data
+ name: predictor-data
+ volumes:
+ - name: predictor-data
+ persistentVolumeClaim:
+ claimName: predictor-data
+
+---
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ .Values.skywalking.fullnameOverride }}-baseline
+ namespace: {{ .Release.Namespace }}
+spec:
+ selector:
+ name: skywalking-predictor
+ ports:
+ - port: 18080
+ protocol: TCP
+ targetPort: grpc
+
+{{- end }}
diff --git a/docs/readme.md b/docs/readme.md
index 2b611a3..f3fcfaf 100644
--- a/docs/readme.md
+++ b/docs/readme.md
@@ -116,6 +116,7 @@
| `rabbitmq-monitor` | Deploy OpenTelemetry and export RabbitMQ monitoring metrics to SkyWalking for analysis and display on UI. | |
| `activemq-monitor` | Deploy OpenTelemetry and export [ActiveMQ classic](https://activemq.apache.org/components/classic/) monitoring metrics to SkyWalking for analysis and display on UI. | |
| `cilium` | Deploy Cilium and showcase services in a separate namespace, SkyWalking fetch Cilium Services Traffic to analysis and display on UI. | Only support deployment in the Kubernetes environment, docker is not supported. |
+| `baseline` | Deploy [SkyPredictor](https://github.com/SkyAPM/SkyPredictor) as baseline calculator to predict metrics. | Only support deployment in the Kubernetes environment, docker is not supported. |
### Kubernetes