Skip to content

Commit

Permalink
Merge branch 'main' into tests_recycle
Browse files Browse the repository at this point in the history
  • Loading branch information
grcevski committed Apr 26, 2024
2 parents f2a3d2d + 3fba7b7 commit 1ef42f7
Show file tree
Hide file tree
Showing 17 changed files with 294 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .github/configs/cr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
owner: grafana
git-repo: helm-charts
skip-existing: true
12 changes: 12 additions & 0 deletions .github/configs/ct.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Reference: https://github.com/helm/chart-testing/blob/master/doc/ct_lint-and-install.md
remote: origin
target-branch: main
chart-dirs:
- charts
chart-repos:
- grafana=https://grafana.github.io/helm-charts
validate-chart-schema: true
validate-maintainers: true
validate-yaml: true
exclude-deprecated: true
excluded-charts: []
149 changes: 149 additions & 0 deletions .github/workflows/helm-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: Release Helm chart
on:
workflow_dispatch:

env:
CR_CONFIGFILE: "${{ github.workspace }}/source/.github/configs/cr.yml"
CT_CONFIGFILE: "${{ github.workspace }}/source/.github/configs/ct.yml"
CR_INDEX_PATH: "${{ github.workspace }}/.cr-index"
CR_PACKAGE_PATH: "${{ github.workspace }}/.cr-release-packages"
CR_TOOL_PATH: "${{ github.workspace }}/.cr-tool"
CR_VERSION: "1.5.0"

jobs:
setup:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.list-changed.outputs.changed }}
chartpath: ${{ steps.list-changed.outputs.chartpath }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
path: source

- name: Install chart-testing
uses: helm/chart-testing-action@v2

- name: List changed charts
id: list-changed
run: |
cd source
latest_tag=$( if ! git describe --tags --abbrev=0 --match='helm-chart/*' 2> /dev/null ; then git rev-list --max-parents=0 --first-parent HEAD; fi )
echo "Running: ct list-changed --config ${CT_CONFIGFILE} --since ${latest_tag} --target-branch ${{ github.ref_name }}"
changed=$(ct list-changed --config "${CT_CONFIGFILE}" --since "${latest_tag}" --target-branch "${{ github.ref_name }}")
echo "${changed}"
num_changed=$(wc -l <<< ${changed})
if [[ "${num_changed}" -gt "1" ]] ; then
echo "More than one chart changed, exiting"
exit 1
fi
if [[ -n "${changed}" ]]; then
name=$(yq ".name" < ${changed}/Chart.yaml)
version=$(yq ".version" < ${changed}/Chart.yaml)
tagname="v${version}"
if [ $(git tag -l "${tagname}") ]; then
echo "Tag ${tagname} already exists, skipping release"
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "Releasing ${changed}"
echo "changed=true" >> $GITHUB_OUTPUT
echo "chartpath=${changed}" >> $GITHUB_OUTPUT
fi
else
echo "No charts have changed, skipping release"
echo "changed=false" >> $GITHUB_OUTPUT
fi
release:
needs: [setup]
runs-on: ubuntu-latest
if: needs.setup.outputs.changed == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
path: source

- name: Configure Git
run: |
cd source
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Checkout helm-charts
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: grafana/helm-charts
path: helm-charts
token: "${{ secrets.GH_BOT_ACCESS_TOKEN }}"

- name: Configure Git for helm-charts
run: |
cd helm-charts
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Set up Helm
uses: azure/setup-helm@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Parse Chart.yaml
id: parse-chart
run: |
cd source
changed="${{ needs.setup.outputs.chartpath }}"
description=$(yq ".description" < ${changed}/Chart.yaml)
name=$(yq ".name" < ${changed}/Chart.yaml)
version=$(yq ".version" < ${changed}/Chart.yaml)
echo "chartpath=${changed}" >> $GITHUB_OUTPUT
echo "desc=${description}" >> $GITHUB_OUTPUT
echo "tagname=v${version}" >> $GITHUB_OUTPUT
echo "packagename=${name}-${version}" >> $GITHUB_OUTPUT
- name: Install CR tool
run: |
mkdir "${CR_TOOL_PATH}"
mkdir "${CR_PACKAGE_PATH}"
mkdir "${CR_INDEX_PATH}"
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v${CR_VERSION}/chart-releaser_${CR_VERSION}_linux_amd64.tar.gz"
tar -xzf cr.tar.gz -C "${CR_TOOL_PATH}"
rm -f cr.tar.gz
- name: Create Helm package
run: |
cd source
helm repo add grafana https://grafana.github.io/helm-charts
"${CR_TOOL_PATH}/cr" package "${{ steps.parse-chart.outputs.chartpath }}" --config "${CR_CONFIGFILE}" --package-path "${CR_PACKAGE_PATH}"
# Note that this creates a release in grafana/helm-charts with a new tag.
# The tag name in grafana/helm-charts is <package>-<version>
- name: Make release on Helm Charts
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.parse-chart.outputs.packagename }}
repository: grafana/helm-charts
tag_name: ${{ steps.parse-chart.outputs.packagename }}
token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
body: |
${{ steps.parse-chart.outputs.desc }}
Source commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
Tag on source: https://github.com/${{ github.repository }}/releases/tag/${{ steps.parse-chart.outputs.tagname }}
files: |
${{ env.CR_PACKAGE_PATH }}/${{ steps.parse-chart.outputs.packagename }}.tgz
- name: Update helm-charts index.yaml
run: |
cd helm-charts
"${CR_TOOL_PATH}/cr" index --config "${CR_CONFIGFILE}" --token "${{ secrets.GH_BOT_ACCESS_TOKEN }}" --index-path "${CR_INDEX_PATH}" --package-path "${CR_PACKAGE_PATH}" --push
65 changes: 65 additions & 0 deletions .github/workflows/helm-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Test

on:
push:
branches: [ "main" ]
pull_request:

workflow_call:
inputs:
filter_regex_include:
description: this sets the scope of the super linter
default: ".*"
required: false
type: string

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
CT_CONFIGFILE: "${{ github.workspace }}/.github/configs/ct.yml"

jobs:
lint-helm-chart:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # required for chart-testing to work

- name: Regenerate docs
run: |
docker run --rm \
-v "$(pwd)/deployments/helm:/helm-docs" \
-u "$(id -u)" \
jnorwood/helm-docs
if ! git diff --exit-code; then
echo "Helm chart documentation is not up to date. Please run 'helm-docs' and commit changes!" >&2
exit 1
fi
- name: Lint Code Base with super-linter
uses: docker://github/super-linter:v3.12.0
env:
FILTER_REGEX_EXCLUDE: .*(README\.md|Chart\.yaml|NOTES.txt).*
FILTER_REGEX_INCLUDE: ${{ inputs.filter_regex_include }}
VALIDATE_ALL_CODEBASE: false
VALIDATE_KUBERNETES_KUBEVAL: false
VALIDATE_YAML: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Linting with chart-testing
uses: helm/chart-testing-action@v2.1.0

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config "${CT_CONFIGFILE}")
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Linting with chart-testing
run: ct lint --config "${CT_CONFIGFILE}"
7 changes: 7 additions & 0 deletions charts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Contributing to Beyla helm chart

To make sure that the helm docs are properly generated, run this after your changes:

```
docker run --rm --volume "$(pwd):/helm-docs" -u "$(id -u)" jnorwood/helm-docs:v1.13.1
```
File renamed without changes.
21 changes: 21 additions & 0 deletions charts/beyla/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: beyla
version: 1.0.0
appVersion: 1.5.2
description: eBPF-based autoinstrumentation HTTP, HTTP2 and gRPC services, as well as network metrics.
home: https://grafana.com/oss/beyla-ebpf/
icon: https://grafana.com/static/img/logos/beyla-logo.svg
sources:
- https://github.com/grafana/beyla
type: application
keywords:
- observability
- autoinstrumentation
- eBPF-based
maintainers:
- name: mariomac
url: https://github.com/mariomac
- name: grcevski
url: https://github.com/grcevski
- name: marctc
url: https://github.com/marctc
20 changes: 16 additions & 4 deletions deployments/helm/README.md → charts/beyla/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# beyla

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

eBPF-based autoinstrumentation of HTTP and HTTPS services
eBPF-based autoinstrumentation HTTP, HTTP2 and gRPC services, as well as network metrics.

**Homepage:** <https://grafana.com/oss/beyla-ebpf/>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| mariomac | | <https://github.com/mariomac> |
| grcevski | | <https://github.com/grcevski> |
| marctc | | <https://github.com/marctc> |

## Source Code

Expand Down Expand Up @@ -34,6 +44,7 @@ eBPF-based autoinstrumentation of HTTP and HTTPS services
| podLabels | object | `{}` | Adds custom labels to the Beyla Pods. |
| podSecurityContext | object | `{}` | |
| preset | string | `"application"` | Preconfigures some default properties for network or application observability. Accepted values are "network" or "application". |
| priorityClassName | string | `""` | |
| rbac.create | bool | `true` | Whether to create RBAC resources for Belya |
| rbac.extraClusterRoleRules | list | `[]` | Extra custer roles to be created for Belya |
| resources | object | `{}` | |
Expand All @@ -47,7 +58,7 @@ eBPF-based autoinstrumentation of HTTP and HTTPS services
| service.loadBalancerIP | string | `""` | loadbalancer IP |
| service.loadBalancerSourceRanges | list | `[]` | source ranges for loadbalancer |
| service.port | int | `80` | service port |
| service.portName | string | `"service"` | name of the port for internal metrics service. |
| service.portName | string | `"metrics"` | name of the port for internal metrics. |
| service.targetPort | int | `9090` | targetPort has to be configured based on the values of `BEYLA_INTERNAL_METRICS_PROMETHEUS_PORT` environment variable or the value of `prometheus_export.port` from beyla configuration file. see more at https://grafana.com/docs/beyla/latest/configure/options/#internal-metrics-reporter |
| service.type | string | `"ClusterIP"` | type of the service |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
Expand All @@ -57,7 +68,8 @@ eBPF-based autoinstrumentation of HTTP and HTTPS services
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| tolerations | list | `[]` | Tolerations allow pods to be scheduled on nodes with specific taints |
| updateStrategy.type | string | `"RollingUpdate"` | update strategy type |
| priorityClassName | string|`""` | priorityClassName for pods |
| volumeMounts | list | `[]` | Additional volumeMounts on the output Deployment definition. |
| volumes | list | `[]` | Additional volumes on the output daemonset definition. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1)
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Allow the release namespace to be overridden for multi-namespace deployments in
{{- end }}
{{- end }}


{{/*
Create chart name and version as used by the chart label.
*/}}
Expand Down Expand Up @@ -76,7 +75,6 @@ Create the name of the service account to use
{{- end }}
{{- end }}


{{/*
Calculate name of image ID to use for "beyla".
*/}}
Expand All @@ -92,4 +90,4 @@ Calculate name of image ID to use for "beyla".
{{- else }}
{{- printf ":%s" .Chart.AppVersion }}
{{- end }}
{{- end }}
{{- end }}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ spec:
securityContext:
privileged: true
ports:
- containerPort: {{ .Values.service.targetPort }}
- name: {{ .Values.service.portName }}
containerPort: {{ .Values.service.targetPort }}
protocol: TCP
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
env:
- name: BEYLA_CONFIG_PATH
value: "/etc/beyla/config/beyla-config.yml"
Expand All @@ -63,14 +68,14 @@ spec:
volumeMounts:
- mountPath: /etc/beyla/config
name: beyla-config
{{- if or .Values.global.image.pullSecrets .Values.image.pullSecrets }}
imagePullSecrets:
{{- if .Values.global.image.pullSecrets }}
{{- toYaml .Values.global.image.pullSecrets | nindent 4 }}
{{- else }}
{{- toYaml .Values.image.pullSecrets | nindent 4 }}
{{- end }}
{{- if or .Values.global.image.pullSecrets .Values.image.pullSecrets }}
imagePullSecrets:
{{- if .Values.global.image.pullSecrets }}
{{- toYaml .Values.global.image.pullSecrets | nindent 4 }}
{{- else }}
{{- toYaml .Values.image.pullSecrets | nindent 4 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand All @@ -86,4 +91,4 @@ spec:
volumes:
- name: beyla-config
configMap:
name: {{ default (include "beyla.fullname" .) .Values.config.name }}
name: {{ default (include "beyla.fullname" .) .Values.config.name }}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ spec:
{{- end }}
selector:
{{- include "beyla.selectorLabels" . | nindent 4 }}
{{- end }}
{{- end }}
File renamed without changes.
Loading

0 comments on commit 1ef42f7

Please sign in to comment.