Skip to content

Commit 4ddf880

Browse files
authored
Merge pull request #26 from crandles/new-chart
feat: [v2] add new chart
2 parents c8b2c29 + ffdd347 commit 4ddf880

22 files changed

Lines changed: 722 additions & 1473 deletions

.github/workflows/release.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release Chart(s)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
permissions:
11+
contents: read
12+
packages: write # needed for ghcr access
13+
id-token: write # needed for keyless signing
14+
attestations: write
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout Code
18+
uses: actions/checkout@v4
19+
- name: Set up Helm
20+
uses: azure/setup-helm@v4
21+
with:
22+
version: v3.12.0
23+
- name: Login to GitHub Container Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
- name: Push charts to GHCR
30+
run: |
31+
make publish

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Helm chart automated files
22
/charts/*/charts
33
/charts/*/requirements.lock
4+
charts/*.tgz

Makefile

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
TRICKSTER_ORG ?= trickstercache
2+
IMAGE_REPO ?= ghcr.io/$(TRICKSTER_ORG)/trickster
3+
IMAGE_TAG ?= main
4+
SHELL := /bin/bash
5+
6+
.PHONY: uninstall
7+
uninstall:
8+
helm uninstall trickster || true
9+
10+
.PHONY: install
11+
install: uninstall
12+
helm upgrade trickster charts/trickster --install --set image.repository=$(IMAGE_REPO) --set image.tag=$(IMAGE_TAG) --set service.serviceNodePort=31209 --set service.type=NodePort
13+
14+
.PHONY: install-with-pvc
15+
install-with-pvc: uninstall
16+
helm upgrade trickster charts/trickster --install --set image.repository=$(IMAGE_REPO) --set image.tag=$(IMAGE_TAG) --set service.serviceNodePort=31209 --set service.type=NodePort --set persistentVolume.enabled=true --set persistentVolume.storageClass=openebs-hostpath
17+
18+
.PHONY: install-with-ingress
19+
install-with-ingress: uninstall
20+
helm upgrade trickster charts/trickster --install --set image.repository=$(IMAGE_REPO) --set image.tag=$(IMAGE_TAG) --set ingress.enabled=true
21+
22+
.PHONY: query
23+
query:
24+
open http://localhost:31209/query
25+
26+
# NOTE: must set trickster.local in /etc/host to 127.0.0.1
27+
.PHONY: query-ingress
28+
query-ingress:
29+
open http://trickster.local/query
30+
31+
.PHONY: logs
32+
logs:
33+
kubectl logs -f deploy/trickster-trickster
34+
35+
.PHONY: install-prom
36+
install-prom:
37+
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
38+
helm repo update
39+
helm install prometheus prometheus-community/prometheus
40+
41+
.PHONY: install-nginx
42+
install-nginx:
43+
kubectl apply -f https://kind.sigs.k8s.io/examples/ingress/deploy-ingress-nginx.yaml
44+
45+
.PHONY: install-openebs
46+
install-openebs:
47+
helm repo add openebs https://openebs.github.io/charts
48+
helm repo update
49+
helm install openebs --namespace openebs openebs/openebs --create-namespace
50+
51+
.PHONY: setup-kind
52+
setup-kind:
53+
kind delete cluster --name trickster || true
54+
kind create cluster --config kind-config.yaml
55+
$(MAKE) install-nginx install-prom install-openebs
56+
57+
.PHONY: package
58+
package:
59+
helm package charts/trickster --destination charts
60+
61+
GITHUB_REPOSITORY_OWNER ?= $(TRICKSTER_ORG)
62+
GHCR_REPO ?= ghcr.io/$(GITHUB_REPOSITORY_OWNER)/charts
63+
.PHONY: publish
64+
publish: package
65+
@for pkg in charts/*.tgz; do \
66+
echo "Publishing $${pkg} to $(GHCR_REPO)"; \
67+
helm push "$${pkg}" "oci://$(GHCR_REPO)"; \
68+
done

README.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,42 @@ This functionality is in beta and is subject to change. The code is provided as-
77

88
## Usage
99

10+
Note: the `trickster` helm chart should be compatible with any Trickster v2.x release.
11+
1012
[Helm](https://helm.sh) must be installed to use the charts.
1113
Please refer to Helm's [documentation](https://helm.sh/docs/) to get started.
1214

13-
Once Helm is set up properly, add the repo as follows:
14-
15+
Once Helm is set up properly, query for the latest (v1.x) trickster helm chart:
1516
```console
16-
$ helm repo add tricksterproxy https://helm.tricksterproxy.io/
17+
helm show chart oci://ghcr.io/trickstercache/charts/trickster --version '^2'
18+
```
19+
Install trickster via:
20+
```console
21+
# install latest chart
22+
helm install trickster oci://ghcr.io/trickstercache/charts/trickster
23+
# install the latest (via semver query)
24+
helm install trickster oci://ghcr.io/trickstercache/charts/trickster --version '^2'
25+
# install a specific version of the trickster chart
26+
helm install trickster oci://ghcr.io/trickstercache/charts/trickster:2.0.0
1727
```
18-
19-
You can then run `helm search repo tricksterproxy` to see the charts.
2028

2129
## Contributing
2230

2331
We'd love to have you contribute! Please refer to our [contribution guidelines](CONTRIBUTING.md) for details.
2432

33+
### Makefile Targets
34+
35+
To facilitate development and testing, we've included a Makefile with a few common targets.
36+
37+
1. Set up local kubernetes cluster via kind: `make setup-kind`
38+
* Installs [prometheus](https://github.com/prometheus/prometheus), [nginx](https://github.com/nginx/nginx), and [openebs](https://github.com/openebs/openebs) into a new [kind](https://github.com/kubernetes-sigs/kind) cluster.
39+
40+
2. Install trickster: `make install`
41+
42+
3. Open a web browser to trickster (proxying Prometheus' query endpoint): `make query`
43+
44+
4. Point your grafana instance at `http://localhost:31209`
45+
2546
## License
2647

2748
[Apache 2.0 License](./LICENSE).

charts/trickster/.helmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
*.swp
1515
*.bak
1616
*.tmp
17+
*.orig
1718
*~
1819
# Various IDEs
1920
.project
2021
.idea/
2122
*.tmproj
23+
.vscode/

charts/trickster/Chart.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
apiVersion: v1
2-
appVersion: "1.1"
3-
description: Trickster is an HTTP Reverse Proxy Cache and time series query accelerator.
1+
apiVersion: v2
42
name: trickster
5-
version: 1.5.6
6-
home: https://github.com/tricksterproxy/trickster
7-
icon: https://helm.tricksterproxy.io/img/trickster-horizontal.png
8-
sources:
9-
- https://github.com/tricksterproxy/trickster
10-
engine: gotpl
11-
tillerVersion: ">=2.8.0"
3+
description: A Helm chart for managing a Trickster Deployment
4+
type: application
5+
# version of the chart
6+
# Note:
7+
# - Starting at 2.0.0 so that chart release is not confused with chart built for v1.x release
8+
# - This version is the chart version and is different from the trickster application version
9+
version: 2.0.0
10+
# trickster application version this chart is compatible with
11+
# Note:
12+
# - This chart should be compatible with any trickster v2.x release.
13+
# - Specify a trickster release version at install time: helm install ... --set image.tag=2.3.4
14+
appVersion: "2"
1215
maintainers:
1316
- name: jranson
1417
- name: LimitlessEarth

charts/trickster/OWNERS

Lines changed: 0 additions & 8 deletions
This file was deleted.

charts/trickster/README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
# trickster
1+
# trickster helm chart
22

3-
[Trickster](https://github.com/tricksterproxy/trickster) is an HTTP Reverse Proxy Cache and time series query accelerator.
3+
## Chart goals / guidelines
4+
- Should support latest Kubernetes version (Starting with 1.30+)
5+
- Should support the latest major version of Trickster
6+
- Should support the latest minor version of Trickster
7+
- Should not overly abstract Trickster configuration file
48

5-
## Introduction
6-
7-
This chart bootstraps a [Trickster](https://github.com/tricksterproxy/trickster) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
8-
9-
## Configuration
10-
11-
values.yaml in this directory is well-documented for all configuration values
12-
13-
## Releases
14-
15-
Releases are automatically generated and published using GitHub Actions. To trigger the action and publish a release, a project maintainer will push the targeted release to a branch named for the release (e.g., `trickster-charts-v1.5.0`).
9+
## Chart capabilities
10+
- Simple integration with Prometheus Operator or Prometheus Annotation-based Service Discovery
11+
- Arbitrary YAML may be included via the `extraYaml` key within a `values.yaml`
Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1-
Trickster can be accessed via port {{ .Values.service.servicePort }} on the following DNS name from within your cluster:
2-
{{ template "trickster.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
3-
4-
{{ if .Values.ingress.enabled -}}
5-
From outside the cluster, the URL(s) are:
6-
{{- range .Values.ingress.hosts }}
7-
http://{{ . }}
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
87
{{- end }}
9-
{{- else }}
10-
Get the trickster URL by running these commands in the same shell:
11-
{{- if contains "NodePort" .Values.service.type }}
12-
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "trickster.fullname" . }})
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "trickster.fullname" . }})
1310
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
1411
echo http://$NODE_IP:$NODE_PORT
1512
{{- else if contains "LoadBalancer" .Values.service.type }}
16-
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
17-
You can watch the status of by running 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "trickster.fullname" . }}'
18-
19-
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "trickster.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "trickster.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "trickster.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
2016
echo http://$SERVICE_IP:{{ .Values.service.servicePort }}
21-
{{- else if contains "ClusterIP" .Values.service.type }}
22-
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "trickster.name" . }},component={{ template "trickster.name" . }}" -o jsonpath="{.items[0].metadata.name}")
23-
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 9090
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "trickster.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:8080 to use your application"
21+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
2422
{{- end }}
25-
{{- end }}
Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,82 @@
1-
{{/* vim: set filetype=mustache: */}}
21
{{/*
32
Expand the name of the chart.
43
*/}}
54
{{- define "trickster.name" -}}
6-
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7-
{{- end -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
87

98
{{/*
109
Create a default fully qualified app name.
1110
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
1211
If release name contains chart name it will be used as a full name.
1312
*/}}
1413
{{- define "trickster.fullname" -}}
15-
{{- if .Values.fullnameOverride -}}
16-
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17-
{{- else -}}
18-
{{- $name := default .Chart.Name .Values.nameOverride -}}
19-
{{- if contains $name .Release.Name -}}
20-
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21-
{{- else -}}
22-
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23-
{{- end -}}
24-
{{- end -}}
25-
{{- end -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
2625

2726
{{/*
2827
Create chart name and version as used by the chart label.
2928
*/}}
3029
{{- define "trickster.chart" -}}
31-
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32-
{{- end -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
3332

34-
{{/* Generate basic labels */}}
35-
{{- define "trickster.labels" }}
36-
app.kubernetes.io/component: trickster-infra
37-
app.kubernetes.io/instance: {{ .Release.Name }}
38-
app.kubernetes.io/managed-by: {{ .Release.Service }}
39-
app.kubernetes.io/name: {{ template "trickster.name" . }}
40-
app.kubernetes.io/part-of: {{ template "trickster.name" . }}
41-
app.kubernetes.io/version: "{{ .Chart.Version }}"
42-
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
43-
tricksterproxy.io/version: "{{ .Chart.AppVersion }}"
44-
{{- if .Values.customLabels }}
45-
{{ toYaml .Values.customLabels | indent 4 }}
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "trickster.labels" -}}
37+
helm.sh/chart: {{ include "trickster.chart" . }}
38+
{{ include "trickster.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
4641
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
4743
{{- end }}
4844

4945
{{/*
50-
Specify default selectors
46+
Selector labels
5147
*/}}
52-
{{- define "trickster.selectors" }}
53-
app.kubernetes.io/name: {{ template "trickster.name" . }}
48+
{{- define "trickster.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "trickster.name" . }}
5450
app.kubernetes.io/instance: {{ .Release.Name }}
5551
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "trickster.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "trickster.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
63+
64+
{{/*
65+
Inject default values into the config.yaml that correspond with other chart values.
66+
*/}}
67+
{{- define "trickster.config" -}}
68+
{{- $fsCache := dict "filesystem" (dict "cache_path" (.Values.persistentVolume.mountPath | default "/data")) -}}
69+
{{- $bbCache := dict "bbolt" (dict "filename" (printf "%s/trickster.db" (.Values.persistentVolume.mountPath | default "/data"))) -}}
70+
{{- $bdCache := dict "badger" (dict "directory" (.Values.persistentVolume.mountPath | default "/data") "value_directory" (.Values.persistentVolume.mountPath | default "/data")) -}}
71+
{{- $default := merge (merge $fsCache $bbCache) $bdCache -}}
72+
{{- $config := merge (dict "caches" (dict "default" $default)) .Values.config -}}
73+
{{- $config | toYaml -}}
74+
{{- end }}
75+
76+
{{- define "trickster.proxyPort" -}}
77+
{{- $.Values.config.frontend.listen_port }}
78+
{{- end }}
79+
80+
{{- define "trickster.metricsPort" -}}
81+
{{- $.Values.config.metrics.listen_port }}
82+
{{- end}}

0 commit comments

Comments
 (0)