diff --git a/addons/trait-pyroscope/README.md b/addons/trait-pyroscope/README.md new file mode 100644 index 00000000..762ed721 --- /dev/null +++ b/addons/trait-pyroscope/README.md @@ -0,0 +1,80 @@ +# Supported workload type +Pyroscope Trait supports following component types: webservice态worker and cloneset. + +# How to start +- Use a component typed webservice to start, keep the following to app-demo.yaml, then vela up -f app-demo.yaml +```shell +apiVersion: core.oam.dev/v1beta1 +kind: Application +metadata: + name: app-show + namespace: real-new-ns +spec: + components: + - name: web-show + type: webservice + properties: + exposeType: ClusterIP + image: beellzrocks/shippingservice + env: + - name: PORT + value: "50051" + - name: APPLICATION_NAME # Application name shown in the Pyroscope UI + value: "web-show" + - name: SERVER_ADDRESS # To change Pyroscope Server Port change the value, the naming rule is pyroscope- + value: "http://pyroscope-web-show:4040" + traits: + - type: pyroscope +``` +- Check the app status +```shell +vela ls -n real-new-ns +APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME +app-show web-show webservice pyroscope running healthy Ready:1/1 2022-06-03 19:41:05 +0800 CST + +vela status app-show -n real-new-ns +About: + + Name: app-show + Namespace: real-new-ns + Created at: 2022-06-03 19:41:05 +0800 CST + Status: running + +Workflow: + + mode: DAG + finished: true + Suspend: false + Terminated: false + Steps + - id:zsbjvp7fg5 + name:web-show + type:apply-component + phase:succeeded + message: + +Services: + + - Name: web-show + Cluster: local Namespace: real-new-ns + Type: webservice + Healthy Ready:1/1 + Traits: + ? pyroscope +``` + +- Use the port-forward to visit the pyroscope UI +```shell +vela port-forward app-show 8080:4040 -n real-new-ns +? You have 3 deployed resources in your app. Please choose one: Cluster: local | Namespace: real-new-ns | Kind: Service | Name: pyroscope-web-show +Forwarding from 127.0.0.1:8080 -> 4040 +Forwarding from [::1]:8080 -> 4040 + +Forward successfully! Opening browser ... + +Failed to open browser: exec: "xdg-open": executable file not found in $PATHHandling connection for 8080 +Handling connection for 8080 + +Then you can visit the http://:8080 in the browser +``` + diff --git a/addons/trait-pyroscope/definitions/pyroscope.cue b/addons/trait-pyroscope/definitions/pyroscope.cue new file mode 100644 index 00000000..a5784040 --- /dev/null +++ b/addons/trait-pyroscope/definitions/pyroscope.cue @@ -0,0 +1,167 @@ +pyroscope: { + annotations: {} + attributes: { + appliesToWorkloads: ["webservice","worker","cloneset"] + conflictsWith: [] + podDisruptive: false + workloadRefPath: "" + } + description: "" + labels: {} + type: "trait" +} + +template: { + outputs: + "pyroscope-deployment":{ + metadata: { + name: "pyroscope-"+context.name + labels: { + "app.kubernetes.io/instance": "pyroscope-"+context.name + "app.kubernetes.io/name": "pyroscope-"+context.name + "app.kubernetes.io/version": "0.17.1" + } + namespace: context.namespace + } + spec: { + progressDeadlineSeconds: 600 + replicas: 1 + revisionHistoryLimit: 10 + selector: matchLabels: { + "app.kubernetes.io/instance": "pyroscope-"+context.name + "app.kubernetes.io/name": "pyroscope-"+context.name + } + strategy: type: "Recreate" + template: { + metadata: { + labels: { + "app.kubernetes.io/instance": "pyroscope-"+context.name + "app.kubernetes.io/name": "pyroscope-"+context.name + } + creationTimestamp: null + } + spec: { + securityContext: fsGroup: 101 + containers: [{ + name: "pyroscope-"+context.name + args: ["server", "-config", "/tmp/config.yaml"] + image: "pyroscope/pyroscope:0.17.1" + imagePullPolicy: "IfNotPresent" + livenessProbe: { + failureThreshold: 3 + httpGet: { + path: "/healthz" + port: 4040 + scheme: "HTTP" + } + initialDelaySeconds: 30 + periodSeconds: 15 + successThreshold: 1 + timeoutSeconds: 30 + } + ports: [{ + name: "api" + containerPort: 4040 + protocol: "TCP" + }] + readinessProbe: { + failureThreshold: 3 + httpGet: { + path: "/healthz" + port: 4040 + scheme: "HTTP" + } + initialDelaySeconds: 30 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 30 + } + resources: {} + securityContext: {} + terminationMessagePath: "/dev/termination-log" + terminationMessagePolicy: "File" + volumeMounts: [{ + name: "config" + mountPath: "/tmp/config.yaml" + subPath: "config.yaml" + }] + }] + dnsPolicy: "ClusterFirst" + restartPolicy: "Always" + schedulerName: "default-scheduler" + serviceAccount: "pyroscope-"+context.name + serviceAccountName: "pyroscope-"+context.name + terminationGracePeriodSeconds: 30 + volumes: [{ + name: "config" + configMap: { + name: "pyroscope-"+context.name + defaultMode: 420 + } + }] + } + } + } + apiVersion: "apps/v1" + kind: "Deployment" + } + outputs: + "pyroscope-cm":{ + apiVersion: "v1" + data: "config.yaml": """ + {} + + """ + kind: "ConfigMap" + metadata: { + name: "pyroscope-"+context.name + labels: { + "app.kubernetes.io/instance": "pyroscope-"+context.name + "app.kubernetes.io/name": "pyroscope-"+context.name + } + namespace: context.namespace + } + } + outputs: + "pyroscope-svc":{ + apiVersion: "v1" + kind: "Service" + metadata: { + name: "pyroscope-"+context.name + labels: { + "app.kubernetes.io/instance": "pyroscope-"+context.name + "app.kubernetes.io/name": "pyroscope-"+context.name + } + namespace: context.namespace + } + spec: { + ports: [{ + name: "http" + port: 4040 + protocol: "TCP" + targetPort: "api" + }] + selector: { + "app.kubernetes.io/instance": "pyroscope-"+context.name + "app.kubernetes.io/name": "pyroscope-"+context.name + } + sessionAffinity: "None" + type: "ClusterIP" + } + } + + outputs: + "pyroscope-sa": { + apiVersion: "v1" + kind: "ServiceAccount" + metadata: { + name: "pyroscope-"+context.name + labels: { + "app.kubernetes.io/instance": "pyroscope-"+context.name + "app.kubernetes.io/name": "pyroscope-"+context.name + } + namespace: context.namespace + } + } + parameter: {} +} diff --git a/addons/trait-pyroscope/metadata.yaml b/addons/trait-pyroscope/metadata.yaml new file mode 100644 index 00000000..dbc5e90a --- /dev/null +++ b/addons/trait-pyroscope/metadata.yaml @@ -0,0 +1,13 @@ +name: pyroscope +version: v0.17.1 +description: "Continuous Profiling Platform. Debug performance issues down to a single line of code" +icon: "https://user-images.githubusercontent.com/662636/105129037-11334180-5a99-11eb-8951-1d4aaaed50de.png" +url: "https://github.com/pyroscope-io/pyroscope" + +tags: + - extended_trait + +deployTo: + control_plane: true + +invisible: false diff --git a/addons/vela-prism/README.md b/addons/vela-prism/README.md new file mode 100644 index 00000000..49e646a9 --- /dev/null +++ b/addons/vela-prism/README.md @@ -0,0 +1,18 @@ +# vela-prism + +This addon is for vela-prism + + +In this addon, the repo is from https://charts.kubevela.net/prism + +## install + +```shell +vela addon enable vela-prism +``` + +## uninstall + +```shell +vela addon disable vela-prism +``` diff --git a/addons/vela-prism/metadata.yaml b/addons/vela-prism/metadata.yaml new file mode 100644 index 00000000..2b796310 --- /dev/null +++ b/addons/vela-prism/metadata.yaml @@ -0,0 +1,16 @@ +name: vela-prism +version: v1.4.0 +description: "Prism provides API Extensions to the core KubeVela. It works as a Kubernetes Aggregated API Server." +icon: "https://github.com/kubevela/prism/blob/master/hack/prism-arch.jpg" +url: "https://github.com/kubevela/prism" + +tags: + - vela-prism + +deployTo: + control_plane: true + +dependencies: + - name: fluxcd + +invisible: false diff --git a/addons/vela-prism/resources/parameter.cue b/addons/vela-prism/resources/parameter.cue new file mode 100644 index 00000000..b4e30583 --- /dev/null +++ b/addons/vela-prism/resources/parameter.cue @@ -0,0 +1,4 @@ +parameter: { + "replicacount": *1 | int + "enabled": *true | bool +} diff --git a/addons/vela-prism/resources/vela-prism.cue b/addons/vela-prism/resources/vela-prism.cue new file mode 100644 index 00000000..030ab3b5 --- /dev/null +++ b/addons/vela-prism/resources/vela-prism.cue @@ -0,0 +1,14 @@ +output: { + type: "helm" + properties: { + repoType: "helm" + url: "https://charts.kubevela.net/prism" + chart: "vela-prism" + values: { + replicaCount: parameter["replicacount"] + secureTLS: { + enabled: parameter["enabled"] + } + } + } +} diff --git a/addons/vela-prism/template.yaml b/addons/vela-prism/template.yaml new file mode 100644 index 00000000..740e8809 --- /dev/null +++ b/addons/vela-prism/template.yaml @@ -0,0 +1,6 @@ +apiVersion: core.oam.dev/v1beta1 +kind: Application +metadata: + name: vela-prism + namespace: vela-system +spec: