Skip to content

Commit 838a688

Browse files
committed
trait:pyroscope
Signed-off-by: Xueliang Yang <[email protected]>
1 parent d969987 commit 838a688

File tree

3 files changed

+282
-0
lines changed

3 files changed

+282
-0
lines changed

addons/trait-pyroscope/README.md

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# pyroscope
2+
3+
This addon is for pyroscope
4+
5+
6+
In this addon, the repo is from https://github.com/pyroscope-io/pyroscope
7+
8+
## install
9+
10+
```shell
11+
vela addon enable pyroscope
12+
```
13+
14+
## uninstall
15+
16+
```shell
17+
vela addon disable pyroscope
18+
```
19+
20+
# Supported workload type
21+
Pyroscope Trait supports following component types: webservice、worker and cloneset.
22+
23+
# How to start
24+
- Use a component typed webservice to start, keep the following to app-demo.yaml, then vela up -f app-demo.yaml
25+
```shell
26+
apiVersion: core.oam.dev/v1beta1
27+
kind: Application
28+
metadata:
29+
name: app-show
30+
namespace: real-new-ns
31+
spec:
32+
components:
33+
- name: web-show
34+
type: webservice
35+
properties:
36+
exposeType: ClusterIP
37+
image: beellzrocks/shippingservice
38+
env:
39+
- name: PORT
40+
value: "50051"
41+
- name: APPLICATION_NAME # Application name shown in the Pyroscope UI
42+
value: "web-show"
43+
- name: SERVER_ADDRESS # To change Pyroscope Server Port change the value, the naming rule is pyroscope-<component name>
44+
value: "http://pyroscope-web-show:4040"
45+
traits:
46+
- type: pyroscope
47+
```
48+
- Check the app status
49+
```shell
50+
vela ls -n real-new-ns
51+
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
52+
app-show web-show webservice pyroscope running healthy Ready:1/1 2022-06-03 19:41:05 +0800 CST
53+
54+
vela status app-show -n real-new-ns
55+
About:
56+
57+
Name: app-show
58+
Namespace: real-new-ns
59+
Created at: 2022-06-03 19:41:05 +0800 CST
60+
Status: running
61+
62+
Workflow:
63+
64+
mode: DAG
65+
finished: true
66+
Suspend: false
67+
Terminated: false
68+
Steps
69+
- id:zsbjvp7fg5
70+
name:web-show
71+
type:apply-component
72+
phase:succeeded
73+
message:
74+
75+
Services:
76+
77+
- Name: web-show
78+
Cluster: local Namespace: real-new-ns
79+
Type: webservice
80+
Healthy Ready:1/1
81+
Traits:
82+
? pyroscope
83+
```
84+
85+
- Use the port-forward to visit the pyroscope UI
86+
```shell
87+
vela port-forward app-show 8080:4040 -n real-new-ns
88+
? You have 3 deployed resources in your app. Please choose one: Cluster: local | Namespace: real-new-ns | Kind: Service | Name: pyroscope-web-show
89+
Forwarding from 127.0.0.1:8080 -> 4040
90+
Forwarding from [::1]:8080 -> 4040
91+
92+
Forward successfully! Opening browser ...
93+
94+
Failed to open browser: exec: "xdg-open": executable file not found in $PATHHandling connection for 8080
95+
Handling connection for 8080
96+
97+
Then you can visit the http://<your ip>:8080 in the browser
98+
```
99+

addons/trait-pyroscope/metadata.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: pyroscope
2+
version: v0.17.1
3+
description: "Continuous Profiling Platform. Debug performance issues down to a single line of code"
4+
icon: "https://user-images.githubusercontent.com/662636/105129037-11334180-5a99-11eb-8951-1d4aaaed50de.png"
5+
url: "https://github.com/pyroscope-io/pyroscope"
6+
7+
tags:
8+
- extended_trait
9+
10+
deployTo:
11+
control_plane: true
12+
13+
dependencies:
14+
- name: fluxcd
15+
16+
invisible: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
pyroscope: {
2+
annotations: {}
3+
attributes: {
4+
appliesToWorkloads: ["*"]
5+
conflictsWith: []
6+
podDisruptive: false
7+
workloadRefPath: ""
8+
}
9+
description: ""
10+
labels: {}
11+
type: "trait"
12+
}
13+
14+
template: {
15+
outputs:
16+
"pyroscope-deployment":{
17+
metadata: {
18+
name: "pyroscope-"+context.name
19+
labels: {
20+
"app.kubernetes.io/instance": "pyroscope-"+context.name
21+
"app.kubernetes.io/name": "pyroscope-"+context.name
22+
"app.kubernetes.io/version": "0.17.1"
23+
}
24+
namespace: context.namespace
25+
}
26+
spec: {
27+
progressDeadlineSeconds: 600
28+
replicas: 1
29+
revisionHistoryLimit: 10
30+
selector: matchLabels: {
31+
"app.kubernetes.io/instance": "pyroscope-"+context.name
32+
"app.kubernetes.io/name": "pyroscope-"+context.name
33+
}
34+
strategy: type: "Recreate"
35+
template: {
36+
metadata: {
37+
labels: {
38+
"app.kubernetes.io/instance": "pyroscope-"+context.name
39+
"app.kubernetes.io/name": "pyroscope-"+context.name
40+
}
41+
creationTimestamp: null
42+
}
43+
spec: {
44+
securityContext: fsGroup: 101
45+
containers: [{
46+
name: "pyroscope-"+context.name
47+
args: ["server", "-config", "/tmp/config.yaml"]
48+
image: "pyroscope/pyroscope:0.17.1"
49+
imagePullPolicy: "IfNotPresent"
50+
livenessProbe: {
51+
failureThreshold: 3
52+
httpGet: {
53+
path: "/healthz"
54+
port: 4040
55+
scheme: "HTTP"
56+
}
57+
initialDelaySeconds: 30
58+
periodSeconds: 15
59+
successThreshold: 1
60+
timeoutSeconds: 30
61+
}
62+
ports: [{
63+
name: "api"
64+
containerPort: 4040
65+
protocol: "TCP"
66+
}]
67+
readinessProbe: {
68+
failureThreshold: 3
69+
httpGet: {
70+
path: "/healthz"
71+
port: 4040
72+
scheme: "HTTP"
73+
}
74+
initialDelaySeconds: 30
75+
periodSeconds: 5
76+
successThreshold: 1
77+
timeoutSeconds: 30
78+
}
79+
resources: {}
80+
securityContext: {}
81+
terminationMessagePath: "/dev/termination-log"
82+
terminationMessagePolicy: "File"
83+
volumeMounts: [{
84+
name: "config"
85+
mountPath: "/tmp/config.yaml"
86+
subPath: "config.yaml"
87+
}]
88+
}]
89+
dnsPolicy: "ClusterFirst"
90+
restartPolicy: "Always"
91+
schedulerName: "default-scheduler"
92+
serviceAccount: "pyroscope-"+context.name
93+
serviceAccountName: "pyroscope-"+context.name
94+
terminationGracePeriodSeconds: 30
95+
volumes: [{
96+
name: "config"
97+
configMap: {
98+
name: "pyroscope-"+context.name
99+
defaultMode: 420
100+
}
101+
}]
102+
}
103+
}
104+
}
105+
apiVersion: "apps/v1"
106+
kind: "Deployment"
107+
}
108+
outputs:
109+
"pyroscope-cm":{
110+
apiVersion: "v1"
111+
data: "config.yaml": """
112+
{}
113+
114+
"""
115+
kind: "ConfigMap"
116+
metadata: {
117+
name: "pyroscope-"+context.name
118+
labels: {
119+
"app.kubernetes.io/instance": "pyroscope-"+context.name
120+
"app.kubernetes.io/name": "pyroscope-"+context.name
121+
}
122+
namespace: context.namespace
123+
}
124+
}
125+
outputs:
126+
"pyroscope-svc":{
127+
apiVersion: "v1"
128+
kind: "Service"
129+
metadata: {
130+
name: "pyroscope-"+context.name
131+
labels: {
132+
"app.kubernetes.io/instance": "pyroscope-"+context.name
133+
"app.kubernetes.io/name": "pyroscope-"+context.name
134+
}
135+
namespace: context.namespace
136+
}
137+
spec: {
138+
ports: [{
139+
name: "http"
140+
port: 4040
141+
protocol: "TCP"
142+
targetPort: "api"
143+
}]
144+
selector: {
145+
"app.kubernetes.io/instance": "pyroscope-"+context.name
146+
"app.kubernetes.io/name": "pyroscope-"+context.name
147+
}
148+
sessionAffinity: "None"
149+
type: "ClusterIP"
150+
}
151+
}
152+
153+
outputs:
154+
"pyroscope-sa": {
155+
apiVersion: "v1"
156+
kind: "ServiceAccount"
157+
metadata: {
158+
name: "pyroscope-"+context.name
159+
labels: {
160+
"app.kubernetes.io/instance": "pyroscope-"+context.name
161+
"app.kubernetes.io/name": "pyroscope-"+context.name
162+
}
163+
namespace: context.namespace
164+
}
165+
}
166+
parameter: {}
167+
}

0 commit comments

Comments
 (0)