Skip to content

Commit

Permalink
Merge pull request #206 from akash4sh/main
Browse files Browse the repository at this point in the history
Add pyroscope chart
  • Loading branch information
jebjohns authored Mar 22, 2024
2 parents a7ae24c + 23fd154 commit ba73f17
Show file tree
Hide file tree
Showing 15 changed files with 843 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/pyroscope/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
9 changes: 9 additions & 0 deletions charts/pyroscope/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
annotations:
artifacthub.io/changes: |
- "✨ update chart to version 0.2.92"
apiVersion: v2
appVersion: 0.37.2
description: A Helm chart for Pyroscope
name: pyroscope
type: application
version: 1.0.0
110 changes: 110 additions & 0 deletions charts/pyroscope/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# pyroscope

![Version: 0.2.92](https://img.shields.io/badge/Version-0.2.92-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.37.2](https://img.shields.io/badge/AppVersion-0.37.2-informational?style=flat-square)

A Helm chart for Pyroscope

## Get the Repo of Pyrscope

```console

helm repo add pyroscope-io https://pyroscope-io.github.io/helm-chart

```

## Installing the Chart

To install the chart with the release name `my-release`:

```console

helm install my-release pyroscope-io/pyroscope

```

## Uninstalling the Chart

To uninstall/delete the my-release deployment:

```console

helm delete my-release

```

## Persistence

The official Pyroscope container image runs pyroscope server process with user ID `101`. The chart uses this value as
default pod security context `fsGroup`. This includes all processes of the container to the supplemental group and makes
kubelet to change the ownership of mounted volumes to this group (recursively; setgid bit is set).

If you restrict pod security (for example, using `SecurityContextConstraints` or `PodSecurityPolicy`), you may need to
override `fsGroup` with a value from the valid range.

## Pyroscope configuration

`pyroscopeConfigs` parameter may include any supported pyroscope server configuration option.
Please refer to [the documentation](https://pyroscope.io/docs/server-configuration) for details.

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity settings for pod assignment |
| deploymentStrategy | object | `{"type":"Recreate"}` | Deployment strategy |
| env | object | `{}` | Extra environment variables |
| extraLabels | object | `{}` | Extra common labels for all resources |
| extraVolumeMounts | list | `[]` | Additional volume mounts for pyroscope server container |
| extraVolumes | list | `[]` | Additional volumes |
| fullnameOverride | string | `""` | Defaults to .Release.Name-.Chart.Name unless .Release.Name contains "pyroscope" |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| image.repository | string | `"pyroscope/pyroscope"` | image to use for deploying |
| image.tag | string | `"0.37.2"` | Tag for pyroscope image to use |
| imagePullSecrets | list | `[]` | Image pull secrets |
| ingress.annotations | object | `{}` | Ingress annotations (values are templated) |
| ingress.className | string | `""` | Ingress class name |
| ingress.enabled | bool | `false` | Enables Ingress |
| ingress.hosts | list | `[{"host":"chart-example.local","paths":[{"path":"/","pathType":"Prefix"}]}]` | Ingress accepted hostnames |
| ingress.rules | list | `[]` | Ingress custom rules. Take precedence over chart built-ins. |
| ingress.tls | list | `[]` | Ingress TLS configuration |
| initContainers | list | `[]` | |
| livenessProbe.enabled | bool | `true` | Enable Pyroscope server liveness |
| livenessProbe.failureThreshold | int | `3` | Pyroscope server liveness check failure threshold |
| livenessProbe.httpGet.path | string | `"/healthz"` | Pyroscope server liveness check path |
| livenessProbe.httpGet.port | int | `4040` | Pyroscope server liveness check port |
| livenessProbe.initialDelaySeconds | int | `30` | Pyroscope server liveness check intial delay in seconds |
| livenessProbe.periodSeconds | int | `15` | Pyroscope server liveness check frequency in seconds |
| livenessProbe.successThreshold | int | `1` | Pyroscope server liveness check success threshold |
| livenessProbe.timeoutSeconds | int | `30` | Pyroscope server liveness check request timeout |
| nameOverride | string | `""` | Defaults to .Chart.Name |
| nodeSelector | object | `{}` | Node labels for pod assignment |
| persistence.accessModes | list | `["ReadWriteOnce"]` | Persistence access modes |
| persistence.enabled | bool | `false` | Use persistent volume to store data |
| persistence.finalizers | list | `["kubernetes.io/pvc-protection"]` | PersistentVolumeClaim finalizers |
| persistence.size | string | `"10Gi"` | Size of persistent volume claim |
| podAnnotations | object | `{}` | Pod annotations |
| podSecurityContext | object | `{"fsGroup":101}` | Pod securityContext |
| pyroscopeConfigs | object | `{}` | Pyroscope server configuration. Please refer to https://pyroscope.io/docs/server-configuration |
| rbac.clusterRole.annotations | object | `{}` | Cluster role annotations |
| rbac.clusterRole.extraRules | list | `[]` | Extra rules for created cluster role |
| rbac.clusterRole.name | string | `""` | Cluster role name. If not set, the fully qualified app name is used |
| rbac.clusterRoleBinding.annotations | object | `{}` | Cluster role binding annotations |
| rbac.clusterRoleBinding.name | string | `""` | Cluster role binding name. If not set, the fully qualified app name is used |
| rbac.create | bool | `false` | Creates Pyroscope cluster role and binds service account to it; requires service account to be created |
| readinessProbe.enabled | bool | `true` | Enable Pyroscope server readiness |
| readinessProbe.failureThreshold | int | `3` | Pyroscope server readiness check failure threshold count |
| readinessProbe.httpGet.path | string | `"/healthz"` | Pyroscope server readiness check path |
| readinessProbe.httpGet.port | int | `4040` | Pyroscope server readiness check port |
| readinessProbe.initialDelaySeconds | int | `30` | Pyroscope server readiness initial delay in seconds |
| readinessProbe.periodSeconds | int | `5` | Pyroscope server readiness check frequency in seconds |
| readinessProbe.successThreshold | int | `1` | Pyroscope server readiness check success threshold count |
| readinessProbe.timeoutSeconds | int | `30` | Pyroscope server readiness check request timeout |
| resources | object | `{}` | CPU/Memory resource requests/limits |
| securityContext | object | `{}` | Deployment securityContext |
| service.annotations | object | `{}` | Service annotations |
| service.port | int | `4040` | Kubernetes port where service is exposed |
| service.type | string | `"ClusterIP"` | Specify a service type |
| serviceAccount.annotations | object | `{}` | ServiceAccount annotations |
| serviceAccount.create | bool | `true` | Create service account |
| serviceAccount.name | string | `""` | Service account name to use, when empty will be set to created account if serviceAccount.create is set else to default |
| tolerations | list | `[]` | Toleration labels for pod assignment |
57 changes: 57 additions & 0 deletions charts/pyroscope/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{ template "chart.header" . }}

{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}

{{ template "chart.description" . }}

{{ template "chart.sourcesSection" . }}

{{ template "chart.requirementsSection" . }}


## Get the Repo of Pyrscope

```console

helm repo add pyroscope-io https://pyroscope-io.github.io/helm-chart

```


## Installing the Chart


To install the chart with the release name `my-release`:


```console

helm install my-release pyroscope-io/pyroscope

```

## Uninstalling the Chart

To uninstall/delete the my-release deployment:

```console

helm delete my-release

```

## Persistence

The official Pyroscope container image runs pyroscope server process with user ID `101`. The chart uses this value as
default pod security context `fsGroup`. This includes all processes of the container to the supplemental group and makes
kubelet to change the ownership of mounted volumes to this group (recursively; setgid bit is set).

If you restrict pod security (for example, using `SecurityContextConstraints` or `PodSecurityPolicy`), you may need to
override `fsGroup` with a value from the valid range.

## Pyroscope configuration

`pyroscopeConfigs` parameter may include any supported pyroscope server configuration option.
Please refer to [the documentation](https://pyroscope.io/docs/server-configuration) for details.

{{ template "chart.valuesSection" . }}
39 changes: 39 additions & 0 deletions charts/pyroscope/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Pyroscope is an open source continuous profiling platform. It will help you:

- Find performance issues in your code
- Resolve issues with high CPU utilization
- Understand the call tree of your application
- Track changes over time

Document Link:
https://pyroscope.io/docs/

Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "pyroscope.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "pyroscope.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "pyroscope.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "pyroscope.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
echo "Visit http://127.0.0.1:8080 to use your application"
{{- end }}

{{ if not .Values.persistence.enabled }}
#################################################################################
###### WARNING: Persistence is disabled!!! You will lose your data when #####
###### the Pyroscope pod is terminated. #####
#################################################################################
{{- end }}
79 changes: 79 additions & 0 deletions charts/pyroscope/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "pyroscope.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "pyroscope.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "pyroscope.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "pyroscope.labels" -}}
helm.sh/chart: {{ include "pyroscope.chart" . }}
{{ include "pyroscope.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{ toYaml .Values.extraLabels }}
{{- end }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "pyroscope.selectorLabels" -}}
app.kubernetes.io/name: {{ include "pyroscope.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "pyroscope.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "pyroscope.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the name of the cluster role to use
*/}}
{{- define "pyroscope.clusterRoleName" -}}
{{- default (include "pyroscope.fullname" .) .Values.rbac.clusterRole.name }}
{{- end }}

{{/*
Create the name of the cluster role binding to use
*/}}
{{- define "pyroscope.clusterRoleBindingName" -}}
{{- default (include "pyroscope.fullname" .) .Values.rbac.clusterRoleBinding.name }}
{{- end }}
28 changes: 28 additions & 0 deletions charts/pyroscope/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "pyroscope.clusterRoleName" . }}
labels:
{{- include "pyroscope.labels" . | nindent 4 }}
{{- with .Values.rbac.clusterRole.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- apiGroups: ['']
resources:
- nodes
- services
- endpoints
- pods
verbs: ['get', 'list', 'watch']
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs: ['get', 'list', 'watch']
{{- if .Values.rbac.clusterRole.extraRules }}
{{ toYaml .Values.rbac.clusterRole.extraRules | indent 0 }}
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/pyroscope/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if and .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "pyroscope.clusterRoleBindingName" . }}
labels:
{{- include "pyroscope.labels" . | nindent 4 }}
{{- with .Values.rbac.clusterRoleBinding.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "pyroscope.clusterRoleName" . }}
subjects:
- kind: ServiceAccount
name: {{ include "pyroscope.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/pyroscope/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "pyroscope.fullname" . }}
labels:
{{- include "pyroscope.labels" . | nindent 4 }}
data:
config.yaml: |
{{- toYaml .Values.pyroscopeConfigs | nindent 4 }}
Loading

0 comments on commit ba73f17

Please sign in to comment.