You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by mi...@apache.org on 2023/03/09 08:12:44 UTC
[shardingsphere-on-cloud] branch main updated: Update Helm charts of ShardingSphere Proxy to support metrics agent (#252)
This is an automated email from the ASF dual-hosted git repository.
miaoliyao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shardingsphere-on-cloud.git
The following commit(s) were added to refs/heads/main by this push:
new 49612a0 Update Helm charts of ShardingSphere Proxy to support metrics agent (#252)
49612a0 is described below
commit 49612a0a811ab95c8dccf98d84ffd3f0c37f0e7f
Author: moomman <85...@users.noreply.github.com>
AuthorDate: Thu Mar 9 16:12:37 2023 +0800
Update Helm charts of ShardingSphere Proxy to support metrics agent (#252)
* test push
* back init
* add agent to depolyment and value.yaml
* enable metrics and add agent jar,fix by inject
* Update Helm charts of ShardingSphere Proxy to support metrics agent
---------
Co-authored-by: moonman <ag...@163.com>
---
.../templates/configmap.yaml | 13 +++++++++
.../templates/deployment.yaml | 31 ++++++++++++++++++++++
.../apache-shardingsphere-proxy-charts/values.yaml | 18 ++++++++++++-
3 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/charts/apache-shardingsphere-proxy-charts/templates/configmap.yaml b/charts/apache-shardingsphere-proxy-charts/templates/configmap.yaml
index c205d30..6b191da 100644
--- a/charts/apache-shardingsphere-proxy-charts/templates/configmap.yaml
+++ b/charts/apache-shardingsphere-proxy-charts/templates/configmap.yaml
@@ -53,3 +53,16 @@ data:
</root>
</configuration>
+
+
+
+{{- if .Values.compute.agent.enabled}}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: add-metrics
+data:
+ agent.yaml: |-
+ {{- include "common.tplvalues.render" (dict "value" .Values.compute.agent.agentConfig "context" $) | nindent 4 }}
+ {{- end}}
diff --git a/charts/apache-shardingsphere-proxy-charts/templates/deployment.yaml b/charts/apache-shardingsphere-proxy-charts/templates/deployment.yaml
index c7e14d7..157187f 100644
--- a/charts/apache-shardingsphere-proxy-charts/templates/deployment.yaml
+++ b/charts/apache-shardingsphere-proxy-charts/templates/deployment.yaml
@@ -54,6 +54,16 @@ spec:
- name: mysql-connect-jar
mountPath: /opt/shardingsphere-proxy/ext-lib
{{- end }}
+ {{- if .Values.compute.agent.enabled }}
+ - name: agent-metrics-jar
+ image: busybox:1.35.0
+ command: ["sh","-c","wget https://archive.apache.org/dist/shardingsphere/{{ .Values.compute.image.tag | default .Chart.AppVersion }}/apache-shardingsphere-{{ .Values.compute.image.tag | default .Chart.AppVersion }}-shardingsphere-agent-bin.tar.gz;
+ mkdir /opt/shardingsphere-proxy/agent;
+ tar -zxvf apache-shardingsphere-{{ .Values.compute.image.tag | default .Chart.AppVersion }}-shardingsphere-agent-bin.tar.gz -C /opt/shardingsphere-proxy/agent"]
+ volumeMounts:
+ - name: metrics-jar
+ mountPath: /opt/shardingsphere-proxy/agent
+ {{- end}}
containers:
- image: "{{ .Values.compute.image.repository }}:{{ .Values.compute.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.compute.image.pullPolicy }}
@@ -63,6 +73,7 @@ spec:
port: {{ .Values.compute.startPort }}
failureThreshold: 6
periodSeconds: 10
+
livenessProbe:
periodSeconds: 5
tcpSocket:
@@ -74,6 +85,10 @@ spec:
env:
- name: PORT
value: "{{ .Values.compute.startPort }}"
+ {{- if .Values.compute.agent.enabled}}
+ - name: "JAVA_TOOL_OPTIONS"
+ value: "-javaagent:/opt/shardingsphere-proxy/agent/apache-shardingsphere-{{ .Values.compute.image.tag | default .Chart.AppVersion }}-shardingsphere-agent-bin/shardingsphere-agent-{{ .Values.compute.image.tag | default .Chart.AppVersion }}.jar"
+ {{- end }}
ports:
- name: start-port
containerPort: {{ .Values.compute.startPort }}
@@ -87,6 +102,12 @@ spec:
- name: mysql-connect-jar
mountPath: /opt/shardingsphere-proxy/ext-lib
{{- end }}
+ {{- if .Values.compute.agent.enabled}}
+ - name: metrics-jar
+ mountPath: /opt/shardingsphere-proxy/agent
+ - name: agent-config
+ mountPath: /opt/shardingsphere-proxy/agent/apache-shardingsphere-{{ .Values.compute.image.tag | default .Chart.AppVersion }}-shardingsphere-agent-bin/conf
+ {{- end }}
imagePullSecrets:
{{- toYaml .Values.compute.imagePullSecrets | nindent 8 }}
volumes:
@@ -97,3 +118,13 @@ spec:
- name: mysql-connect-jar
emptyDir: { }
{{- end}}
+ {{- if .Values.compute.agent.enabled}}
+ - name: metrics-jar
+ emptyDir: { }
+ - name: agent-config
+ configMap:
+ name: add-metrics
+ items:
+ - key: agent.yaml
+ path: agent.yaml
+ {{- end}}
diff --git a/charts/apache-shardingsphere-proxy-charts/values.yaml b/charts/apache-shardingsphere-proxy-charts/values.yaml
index 24c454d..dfcf443 100644
--- a/charts/apache-shardingsphere-proxy-charts/values.yaml
+++ b/charts/apache-shardingsphere-proxy-charts/values.yaml
@@ -151,9 +151,25 @@ compute:
namespace: governance_ds
operationTimeoutMilliseconds: 5000
retryIntervalMilliseconds: 500
- server-lists: "{{ printf \"%s-zookeeper.%s:2181\" .Release.Name .Release.Namespace }}"
+ server-lists: "{{ printf \"%s-zookeeper.%s:2181\" .Release.Name .Release.Namespace }}"
timeToLiveSeconds: 60
## @param compute.serverConfig.props.proxy-frontend-database-protocol-type proxy frontend database protocol type. Only support: PostgreSQL,openGauss,MariaDB,MySQL
##
props:
proxy-frontend-database-protocol-type: MySQL
+
+ ### agent configuration
+ agent:
+ enabled: true
+ agentConfig:
+ plugins:
+ logging:
+ File:
+ props:
+ level: "INFO"
+ metrics:
+ Prometheus:
+ host: "localhost"
+ port: 9090
+ props:
+ jvm-information-collector-enabled: "true"