Skip to content

Commit

Permalink
Add otel for install
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzhiguo committed Nov 26, 2024
1 parent be4f8b9 commit eb0ddbc
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
repo ?= ghcr.io/jd-opensource
version:=1.2.0-$(shell git rev-parse --short HEAD)
version:=1.2.1-$(shell git rev-parse --short HEAD)

ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
Expand Down
146 changes: 145 additions & 1 deletion deploy/all-cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,50 @@ data:
</configuration>
---
# Source: joylive-injector/templates/otel.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: otel-collector-conf
labels:
app: opentelemetry
component: otel-collector-conf
data:
otel-collector-config: |
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
batch:
memory_limiter:
# 80% of maximum memory up to 2G
limit_mib: 1500
# 25% of limit up to 2G
spike_limit_mib: 512
check_interval: 5s
extensions:
zpages: {}
exporters:
prometheus:
endpoint: 0.0.0.0:8889
namespace: ''
logging: {}
service:
extensions: [zpages]
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [logging]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [logging, prometheus]
---
# Source: joylive-injector/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down Expand Up @@ -547,6 +591,35 @@ roleRef:
kind: ClusterRole
name: joylive-injector
---
# Source: joylive-injector/templates/otel.yaml
apiVersion: v1
kind: Service
metadata:
name: otel-collector
labels:
app.kubernetes.io/managed-by: paas
app.kubernetes.io/name: opentelemetry
app: opentelemetry
component: otel-collector
spec:
ports:
- name: otlp-grpc # Default endpoint for OpenTelemetry gRPC receiver.
port: 4317
protocol: TCP
targetPort: 4317
- name: otlp-http # Default endpoint for OpenTelemetry HTTP receiver.
port: 4318
protocol: TCP
targetPort: 4318
- name: metrics # Default endpoint for querying metrics.
port: 8888
- name: prometheus
port: 8889

type: NodePort
selector:
component: otel-collector
---
# Source: joylive-injector/templates/service.yaml
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -592,7 +665,7 @@ spec:
- name: JOYLIVE_NAMESPACE
value: joylive
name: joylive-injector
image: ghcr.m.daocloud.io/jd-opensource/joylive-injector:v1.2.0
image: ghcr.m.daocloud.io/jd-opensource/joylive-injector:v1.2.1
imagePullPolicy: Always
args:
- --cert=/etc/kubernetes/ssl/dac.pem
Expand Down Expand Up @@ -627,6 +700,77 @@ spec:
secret:
secretName: dynamic-admission-control-certs
---
# Source: joylive-injector/templates/otel.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: otel-collector
labels:
app: opentelemetry
component: otel-collector
spec:
selector:
matchLabels:
app: opentelemetry
component: otel-collector
minReadySeconds: 5
progressDeadlineSeconds: 120
replicas: 2
template:
metadata:
labels:
app: opentelemetry
component: otel-collector
spec:
containers:
- command:
- "/otelcol"
- "--config=/conf/otel-collector-config.yaml"
image: otel/opentelemetry-collector:0.100.0
name: otel-collector
resources:
limits:
cpu: 1
memory: 2Gi
requests:
cpu: 200m
memory: 400Mi
ports:
- containerPort: 55679 # Default endpoint for ZPages.
- containerPort: 4317 # Default endpoint for OpenTelemetry receiver.
- containerPort: 14250 # Default endpoint for Jaeger gRPC receiver.
- containerPort: 14268 # Default endpoint for Jaeger HTTP receiver.
- containerPort: 9411 # Default endpoint for Zipkin receiver.
- containerPort: 8888 # Default endpoint for querying metrics.
- containerPort: 8889 # Default endpoint for Prometheus.
env:
- name: MY_POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: GOMEMLIMIT
value: 1600MiB
volumeMounts:
- name: otel-collector-config-vol
mountPath: /conf
# - name: otel-collector-secrets
# mountPath: /secrets
volumes:
- configMap:
name: otel-collector-conf
items:
- key: otel-collector-config
path: otel-collector-config.yaml
name: otel-collector-config-vol
# - secret:
# name: otel-collector-secrets
# items:
# - key: cert.pem
# path: cert.pem
# - key: key.pem
# path: key.pem
---
# Source: joylive-injector/templates/mutatingwebhook.yaml
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
Expand Down
4 changes: 2 additions & 2 deletions deploy/joylive-injector/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.3.4
version: 1.3.5

keywords:
- joylive
Expand All @@ -26,4 +26,4 @@ home: https://github.com/jd-opensource/joylive-injector
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v1.2.0"
appVersion: "v1.2.1"
141 changes: 141 additions & 0 deletions deploy/joylive-injector/templates/otel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: otel-collector-conf
labels:
app: opentelemetry
component: otel-collector-conf
data:
otel-collector-config: |
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
batch:
memory_limiter:
# 80% of maximum memory up to 2G
limit_mib: 1500
# 25% of limit up to 2G
spike_limit_mib: 512
check_interval: 5s
extensions:
zpages: {}
exporters:
prometheus:
endpoint: 0.0.0.0:8889
namespace: ''
logging: {}
service:
extensions: [zpages]
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [logging]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [logging, prometheus]
---
apiVersion: v1
kind: Service
metadata:
name: otel-collector
labels:
app.kubernetes.io/managed-by: paas
app.kubernetes.io/name: opentelemetry
app: opentelemetry
component: otel-collector
spec:
ports:
- name: otlp-grpc # Default endpoint for OpenTelemetry gRPC receiver.
port: 4317
protocol: TCP
targetPort: 4317
- name: otlp-http # Default endpoint for OpenTelemetry HTTP receiver.
port: 4318
protocol: TCP
targetPort: 4318
- name: metrics # Default endpoint for querying metrics.
port: 8888
- name: prometheus
port: 8889

type: NodePort
selector:
component: otel-collector
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: otel-collector
labels:
app: opentelemetry
component: otel-collector
spec:
selector:
matchLabels:
app: opentelemetry
component: otel-collector
minReadySeconds: 5
progressDeadlineSeconds: 120
replicas: {{ .Values.otel.replicas }}
template:
metadata:
labels:
app: opentelemetry
component: otel-collector
spec:
containers:
- command:
- "/otelcol"
- "--config=/conf/otel-collector-config.yaml"
image: {{ .Values.otel.image.repository }}:{{ .Values.otel.image.tag }}
name: otel-collector
resources:
limits:
cpu: 1
memory: 2Gi
requests:
cpu: 200m
memory: 400Mi
ports:
- containerPort: 55679 # Default endpoint for ZPages.
- containerPort: 4317 # Default endpoint for OpenTelemetry receiver.
- containerPort: 14250 # Default endpoint for Jaeger gRPC receiver.
- containerPort: 14268 # Default endpoint for Jaeger HTTP receiver.
- containerPort: 9411 # Default endpoint for Zipkin receiver.
- containerPort: 8888 # Default endpoint for querying metrics.
- containerPort: 8889 # Default endpoint for Prometheus.
env:
- name: MY_POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: GOMEMLIMIT
value: 1600MiB
volumeMounts:
- name: otel-collector-config-vol
mountPath: /conf
# - name: otel-collector-secrets
# mountPath: /secrets
volumes:
- configMap:
name: otel-collector-conf
items:
- key: otel-collector-config
path: otel-collector-config.yaml
name: otel-collector-config-vol
# - secret:
# name: otel-collector-secrets
# items:
# - key: cert.pem
# path: cert.pem
# - key: key.pem
# path: key.pem
8 changes: 7 additions & 1 deletion deploy/joylive-injector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ image:
repository: ghcr.m.daocloud.io/jd-opensource/joylive-injector
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: v1.2.0
tag: v1.2.1

configMapName: joylive-injector-config

Expand Down Expand Up @@ -59,6 +59,12 @@ agent:
lane: false
flowcontrol: true

otel:
replicas: 2
image:
repository: otel/opentelemetry-collector
tag: 0.100.0

#caBundle: $ {CA_BUNDLE}
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUdKRENDQkF5Z0F3SUJBZ0lVU3VsRVQxWGhqSk5jeDJBdFVCa3ZtSlBBNDRJd0RRWUpLb1pJaHZjTkFRRU4KQlFBd2dha3hDekFKQmdOVkJBWVRBa05PTVJBd0RnWURWUVFJRXdkQ1pXbHFhVzVuTVJBd0RnWURWUVFIRXdkQwpaV2xxYVc1bk1TSXdJQVlEVlFRS0V4bEVlVzVoYldsaklFRmtiV2x6YzJsdmJpQkRiMjUwY205c01Tc3dLUVlEClZRUUxFeUpFZVc1aGJXbGpJRUZrYldsemMybHZiaUJEYjI1MGNtOXNJRk5sWTNWeWFYUjVNU1V3SXdZRFZRUUQKRXh4RWVXNWhiV2xqSUVGa2JXbHpjMmx2YmlCRGIyNTBjbTlzSUVOQk1CNFhEVEkwTURZeE1qQTRNekV3TUZvWApEVE0wTURZeE1EQTRNekV3TUZvd2dha3hDekFKQmdOVkJBWVRBa05PTVJBd0RnWURWUVFJRXdkQ1pXbHFhVzVuCk1SQXdEZ1lEVlFRSEV3ZENaV2xxYVc1bk1TSXdJQVlEVlFRS0V4bEVlVzVoYldsaklFRmtiV2x6YzJsdmJpQkQKYjI1MGNtOXNNU3N3S1FZRFZRUUxFeUpFZVc1aGJXbGpJRUZrYldsemMybHZiaUJEYjI1MGNtOXNJRk5sWTNWeQphWFI1TVNVd0l3WURWUVFERXh4RWVXNWhiV2xqSUVGa2JXbHpjMmx2YmlCRGIyNTBjbTlzSUVOQk1JSUNJakFOCkJna3Foa2lHOXcwQkFRRUZBQU9DQWc4QU1JSUNDZ0tDQWdFQXpDRStnZWorUkF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U0liM0RRRUIKRFFVQUE0SUNBUUFlS2FVcm1TMWdOeXp0dzM1a3FzYU9sWGV0ekJwUFlIc2F4azVHV1JjR0lQSUZmd212ZzZKUAptanRiLzI3Y0FXY0V3QTZlQUpFYmw2Nm9Ic3lOWUNkcmZheUg0M010Y1lTaUV3RVhCS2JhU3dBVWdXZi9CelNaCkFEa3daMEo4bWZXSnQ3NE1BTHl0Mk56VXJpUjJKcmhoS2p4TWJMN2pMZnRJaGZyRGJ1NnJXb2FUNWZMUUFMSEgKa3kveXNaZlJYcVJ1MXJTdldva1VUY201cGIwWVljRE84aWs4Y041VkJmWENRYjYvUkhVUjI2OUNpdllYU0tHLwpTdjdCTkpmckV0U3U0V01ya01nVmo0NmZvQUpiMGFKdFhzLyt0bzBjWDlaSG5hMXR2OFlXZ2JScWJPRnJhSk44ClFPTHNtcW55Yk1Tcjdnd0o0Q3B6c3VMNWh4TEtZZnozQWJlek5scXFiNzZkbE1mYlA4bzJRL1lITXptS2JkWmcKS2JzeTBzSmFBZEtURkYrRzluYlpBbEI3V3RkazNLOTFGNGRxUUpOUzZyZVBKVE9QSWZaajFmS3N2eXRmd3YzcwpPYjNyY2tPeTE2WXFVZEtsNVB5SzI0RjVZMXRhQlp3T0MzODdxcWpaRS9JNGhHdFhFZVp5aTUwWmpWS1VkZkhCCnNYc1VzcmNtQ3h2cXViRDF0K1R2UmVqNHBpMkZLem1MWFFRTXVJNTlJWHRlN3dSYUxDVENNWVdvcGZHeXZBdDQKM1hHSm4rKzZ4UVV4V01qcUhMbUdyQWFNU1ZhWnYvL3dzVzBFanJsdFVPcXI5NkJkNXllOFFXRmdlV21EUlVvUgpWMlZZZWhRelVOT1NaN0VZeU5NckxlWXJXcXBSeXgxaDRNV2kzem5XNVBqNEZjTGhaTWd0blE9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==

Expand Down
Binary file added deploy/packages/joylive-injector-1.3.5.tgz
Binary file not shown.

0 comments on commit eb0ddbc

Please sign in to comment.