Skip to content

Commit

Permalink
Merge pull request #83 from kube-logging/helm-chart
Browse files Browse the repository at this point in the history
feat(charts): create helm chart for telemetry controller
  • Loading branch information
kristofgyuracz authored Sep 11, 2024
2 parents 499ee0a + edd4d31 commit a3f2b02
Show file tree
Hide file tree
Showing 17 changed files with 24,927 additions and 55 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ on:
container-image-ref:
description: Container image ref
value: ${{ jobs.container-image.outputs.ref }}
helm-chart-name:
description: Helm chart OCI name
value: ${{ jobs.helm-chart.outputs.name }}
helm-chart-tag:
description: Helm chart tag
value: ${{ jobs.helm-chart.outputs.tag }}
helm-chart-package:
description: Helm chart package name
value: ${{ jobs.helm-chart.outputs.package }}

permissions:
contents: read
Expand Down Expand Up @@ -142,3 +151,93 @@ jobs:
uses: github/codeql-action/upload-sarif@b7cec7526559c32f1616476ff32d17ba4c59b2d6 # v3.25.5
with:
sarif_file: trivy-results.sarif
helm-chart:
name: Helm chart
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
id-token: write
security-events: write

outputs:
name: ${{ steps.oci-chart-name.outputs.value }}
tag: ${{ steps.version.outputs.value }}
package: ${{ steps.build.outputs.package }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Helm
uses: azure/[email protected]

- name: Set chart name
id: chart-name
run: echo "value=${{ github.event.repository.name }}" >> "$GITHUB_OUTPUT"

- name: Set OCI registry name
id: oci-registry-name
run: echo "value=ghcr.io/${{ github.repository_owner }}/helm-charts" >> "$GITHUB_OUTPUT"

- name: Set OCI chart name
id: oci-chart-name
run: echo "value=${{ steps.oci-registry-name.outputs.value }}/${{ steps.chart-name.outputs.value }}" >> "$GITHUB_OUTPUT"

- name: Helm lint
run: helm lint charts/${{ steps.chart-name.outputs.value }}

- name: Determine raw version
uses: haya14busa/action-cond@94f77f7a80cd666cb3155084e428254fea4281fd # v1.2.1
id: version
with:
cond: ${{ inputs.release }}
if_true: ${{ github.ref_name }}
if_false: 0.0.0

- name: Helm package
id: build
run: |
helm package charts/${{ steps.chart-name.outputs.value }} --version ${{ steps.version.outputs.value }} --app-version ${{ steps.version.outputs.value }}
echo "package=${{ steps.chart-name.outputs.value }}-${{ steps.version.outputs.value }}.tgz" >> "$GITHUB_OUTPUT"
- name: Upload chart as artifact
uses: actions/upload-artifact@v4
with:
name: "[${{ github.job }}] Helm chart"
path: ${{ steps.build.outputs.package }}

- name: Login to GitHub Container Registry
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
if: inputs.publish && inputs.release

- name: Helm push
run: helm push ${{ steps.build.outputs.package }} oci://${{ steps.oci-registry-name.outputs.value }}
env:
HELM_REGISTRY_CONFIG: ~/.docker/config.json
if: inputs.publish && inputs.release

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 # 0.24.0
with:
scan-type: config
scan-ref: charts/${{ steps.chart-name.outputs.value }}
format: sarif
output: trivy-results.sarif

- name: Upload Trivy scan results as artifact
uses: actions/upload-artifact@v4
with:
name: "[${{ github.job }}] Trivy scan results"
path: trivy-results.sarif
retention-days: 5

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
with:
sarif_file: trivy-results.sarif
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ crddir

.DS_Store

go.work.sum
go.work.sum
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ KIND_CLUSTER ?= kind
CI_MODE_ENABLED := ""
NO_KIND_CLEANUP := ""

IMG ?= controller:latest
IMG ?= ghcr.io/kube-logging/telemetry-controller:0.0.10
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.28.0

Expand All @@ -25,11 +25,7 @@ else
GOBIN=$(shell go env GOBIN)
endif

ifeq ($(go env GOOS),darwin)
TIMEOUT_CMD=gtimeout
else
TIMEOUT_CMD=timeout
endif
TIMEOUT_CMD=timeout


# CONTAINER_TOOL defines the container tool to be used for building images.
Expand Down Expand Up @@ -148,7 +144,6 @@ endif

.PHONY: install-deps
install-deps: ## Install dependencies into the actual K8s cluster
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.4/cert-manager.yaml
kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/download/v0.104.0/opentelemetry-operator.yaml

.PHONY: install
Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,18 @@ minikube start --container-runtime=containerd

### Deployment steps for users

Install dependencies (cert-manager and opentelemetry-operator):
```sh
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.4/cert-manager.yaml
kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/download/v0.104.0/opentelemetry-operator.yaml
```

Deploy latest telemetry-controller:
```sh
kubectl apply -k github.com/kube-logging/telemetry-controller/config/default --server-side
# Install telemetry-controller, and opentelemetry-operator as a sub-chart
helm upgrade --install --wait --create-namespace --namespace telemetry-controller-system telemetry-controller oci://ghcr.io/kube-logging/helm-charts/telemetry-controller
```

### Deployment steps for devs

#### Install deps, CRDs and RBAC

```sh
# Install dependencies (cert-manager and opentelemtry-operator):
# Install dependencies (opentelemtry-operator):
make install-deps

# Install the CRDs and RBAC into the cluster:
Expand Down
23 changes: 23 additions & 0 deletions charts/telemetry-controller/.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/
6 changes: 6 additions & 0 deletions charts/telemetry-controller/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: opentelemetry-operator
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
version: 0.68.1
digest: sha256:39aeb55ab857b7c6aed36ed56825444dd8143b772288c7dcfeb4227cd19d6461
generated: "2024-09-02T16:06:49.084247+02:00"
13 changes: 13 additions & 0 deletions charts/telemetry-controller/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
name: telemetry-controller
description: A Helm chart for deploying telemetry-controller

type: application

version: 0.0.0
appVersion: latest

dependencies:
- name: opentelemetry-operator
version: 0.68.1
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
Binary file not shown.
Loading

0 comments on commit a3f2b02

Please sign in to comment.