Skip to content

Commit f95d5c5

Browse files
authoredFeb 20, 2025··
feat: adds codegate-helm chart (#1)
* feat: adds codegate-helm chart Signed-off-by: ChrisJBurns <[email protected]> * adds dependabot Signed-off-by: ChrisJBurns <[email protected]> * typo workflows folder name Signed-off-by: ChrisJBurns <[email protected]> --------- Signed-off-by: ChrisJBurns <[email protected]>
1 parent 64cbaa6 commit f95d5c5

17 files changed

+599
-0
lines changed
 

‎.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release Charts
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "charts/**"
9+
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
contents: write
17+
packages: write
18+
id-token: write
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Configure Git
27+
run: |
28+
git config user.name "$GITHUB_ACTOR"
29+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
30+
31+
- name: Run chart-releaser
32+
uses: helm/chart-releaser-action@3e001cb8c68933439c7e721650f20a07a1a5c61e # pin@v1.6.0
33+
with:
34+
config: cr.yaml
35+
env:
36+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
37+
38+
- name: Login to GitHub Container Registry
39+
uses: docker/login-action@327cd5a69de6c009b9ce71bce8395f28e651bf99 #pin@v3.3.0
40+
with:
41+
registry: ghcr.io
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Install Cosign
46+
uses: sigstore/cosign-installer@c56c2d3e59e4281cc41dea2217323ba5694b171e #pin@v3.7.0
47+
48+
- name: Publish and Sign OCI Charts
49+
run: |
50+
for chart in `find .cr-release-packages -name '*.tgz' -print`; do
51+
helm push ${chart} oci://ghcr.io/${GITHUB_REPOSITORY} |& tee helm-push-output.log
52+
file_name=${chart##*/}
53+
chart_name=${file_name%-*}
54+
digest=$(awk -F "[, ]+" '/Digest/{print $NF}' < helm-push-output.log)
55+
cosign sign -y "ghcr.io/${GITHUB_REPOSITORY}/${chart_name}@${digest}"
56+
done
57+
env:
58+
COSIGN_EXPERIMENTAL: 1
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Test Charts
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- charts/**
7+
8+
jobs:
9+
check-readme:
10+
runs-on: ubuntu-latest
11+
env:
12+
GO111MODULE: on
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
16+
17+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
18+
with:
19+
python-version: '3.x'
20+
21+
- uses: actions/setup-go@5a083d0e9a84784eb32078397cf5459adecb4c40 # pin@v3
22+
with:
23+
go-version: ^1
24+
25+
test:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Set up Helm
34+
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # pin@v4.2.0
35+
36+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
37+
with:
38+
python-version: '3.x'
39+
40+
- name: Set up chart-testing
41+
uses: helm/chart-testing-action@v2.7.0
42+
43+
- name: Run chart-testing (lint)
44+
run: ct lint --config ct.yaml
45+
46+
- name: Create KIND Cluster
47+
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # pin@v1.12.0
48+
49+
- name: Run chart-testing (install)
50+
run: ct install --config ct.yaml

‎charts/codegate/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

‎charts/codegate/Chart.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: codegate
3+
description: A Helm chart for deploying Codegate onto Kubernetes
4+
type: application
5+
version: 0.0.1
6+
appVersion: "v0.1.22"

‎charts/codegate/README.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Codegate
2+
3+
![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.1.22](https://img.shields.io/badge/AppVersion-2.112.0-informational?style=flat-square)
4+
5+
CodeGate is a local gateway that makes AI agents and coding assistants safer.
6+
7+
## TL;DR
8+
9+
```console
10+
helm repo add codegate []
11+
12+
helm install codegate/codegate
13+
```
14+
15+
## Usage
16+
17+
The Codegate Chart is available in the following formats:
18+
- [Chart Repository](https://helm.sh/docs/topics/chart_repository/)
19+
- [OCI Artifacts](https://helm.sh/docs/topics/registries/)
20+
21+
### Installing from Chart Repository
22+
23+
The following command can be used to add the chart repository:
24+
25+
```console
26+
helm repo add codegate []
27+
```
28+
29+
Once the chart has been added, install one of the available charts:
30+
31+
```console
32+
helm install codegate/codegate
33+
```
34+
35+
### Installing from an OCI Registry
36+
37+
Charts are also available in OCI format. The list of available charts can be found [here](https://github.com/stacklok/codegate-helm/charts).
38+
Install one of the available charts:
39+
40+
```shell
41+
helm upgrade -i <release_name> oci://ghcr.io/stacklok/codegate-helm/codegate --version=<version>
42+
```
43+
44+
## Source Code
45+
46+
* <https://github.com/stacklok/codegate-helm>
47+
48+
## Values
49+
50+
<!-- TODO: Auto generate these -->
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
volumePersistence:
2+
storageClassName: standard
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "codegate.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "codegate.fullname" -}}
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 }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "codegate.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "codegate.labels" -}}
37+
helm.sh/chart: {{ include "codegate.chart" . }}
38+
{{ include "codegate.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "codegate.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "codegate.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "codegate.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "codegate.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "codegate.fullname" . }}
5+
namespace: {{ .Release.Namespace | quote }}
6+
labels:
7+
{{- include "codegate.labels" . | nindent 4 }}
8+
spec:
9+
{{- if not .Values.autoscaling.enabled }}
10+
# we hardcode to 1 at the moment as there is only a single file sqlite database
11+
replicas: 1
12+
{{- end }}
13+
selector:
14+
matchLabels:
15+
{{- include "codegate.selectorLabels" . | nindent 6 }}
16+
template:
17+
metadata:
18+
{{- with .Values.podAnnotations }}
19+
annotations:
20+
{{- toYaml . | nindent 8 }}
21+
{{- end }}
22+
labels:
23+
{{- include "codegate.labels" . | nindent 8 }}
24+
{{- with .Values.podLabels }}
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
27+
spec:
28+
{{- with .Values.imagePullSecrets }}
29+
imagePullSecrets:
30+
{{- toYaml . | nindent 8 }}
31+
{{- end }}
32+
serviceAccountName: {{ include "codegate.serviceAccountName" . }}
33+
securityContext:
34+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
35+
containers:
36+
- name: {{ .Chart.Name }}
37+
securityContext:
38+
{{- toYaml .Values.securityContext | nindent 12 }}
39+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag}}"
40+
imagePullPolicy: {{ .Values.image.pullPolicy }}
41+
ports:
42+
- name: http
43+
containerPort: {{ .Values.service.port }}
44+
protocol: TCP
45+
livenessProbe:
46+
{{- toYaml .Values.livenessProbe | nindent 12 }}
47+
readinessProbe:
48+
{{- toYaml .Values.readinessProbe | nindent 12 }}
49+
resources:
50+
{{- toYaml .Values.resources | nindent 12 }}
51+
{{- with .Values.volumeMounts }}
52+
volumeMounts:
53+
{{- toYaml . | nindent 12 }}
54+
{{- end }}
55+
{{- with .Values.volumes }}
56+
volumes:
57+
{{- toYaml . | nindent 8 }}
58+
{{- end }}
59+
{{- with .Values.nodeSelector }}
60+
nodeSelector:
61+
{{- toYaml . | nindent 8 }}
62+
{{- end }}
63+
{{- with .Values.affinity }}
64+
affinity:
65+
{{- toYaml . | nindent 8 }}
66+
{{- end }}
67+
{{- with .Values.tolerations }}
68+
tolerations:
69+
{{- toYaml . | nindent 8 }}
70+
{{- end }}

‎charts/codegate/templates/hpa.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ include "codegate.fullname" . }}
6+
namespace: {{ .Release.Namespace | quote }}
7+
labels:
8+
{{- include "codegate.labels" . | nindent 4 }}
9+
spec:
10+
scaleTargetRef:
11+
apiVersion: apps/v1
12+
kind: Deployment
13+
name: {{ include "codegate.fullname" . }}
14+
minReplicas: {{ .Values.autoscaling.minReplicas }}
15+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
16+
metrics:
17+
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
18+
- type: Resource
19+
resource:
20+
name: cpu
21+
target:
22+
type: Utilization
23+
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
24+
{{- end }}
25+
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
26+
- type: Resource
27+
resource:
28+
name: memory
29+
target:
30+
type: Utilization
31+
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
32+
{{- end }}
33+
{{- end }}
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{{- if .Values.ingress.enabled -}}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: {{ include "codegate.fullname" . }}
6+
namespace: {{ .Release.Namespace | quote }}
7+
labels:
8+
{{- include "codegate.labels" . | nindent 4 }}
9+
{{- with .Values.ingress.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
spec:
14+
{{- with .Values.ingress.className }}
15+
ingressClassName: {{ . }}
16+
{{- end }}
17+
{{- if .Values.ingress.tls }}
18+
tls:
19+
{{- range .Values.ingress.tls }}
20+
- hosts:
21+
{{- range .hosts }}
22+
- {{ . | quote }}
23+
{{- end }}
24+
secretName: {{ .secretName }}
25+
{{- end }}
26+
{{- end }}
27+
rules:
28+
{{- range .Values.ingress.hosts }}
29+
- host: {{ .host | quote }}
30+
http:
31+
paths:
32+
{{- range .paths }}
33+
- path: {{ .path }}
34+
{{- with .pathType }}
35+
pathType: {{ . }}
36+
{{- end }}
37+
backend:
38+
service:
39+
name: {{ include "codegate.fullname" $ }}
40+
port:
41+
number: {{ $.Values.service.port }}
42+
{{- end }}
43+
{{- end }}
44+
{{- end }}

‎charts/codegate/templates/pvc.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- if .Values.volumePersistence.enabled }}
2+
apiVersion: v1
3+
kind: PersistentVolumeClaim
4+
metadata:
5+
name: {{ .Values.volumePersistence.pvcName }}
6+
namespace: {{ .Release.Namespace | quote }}
7+
spec:
8+
accessModes:
9+
- ReadWriteOnce
10+
resources:
11+
requests:
12+
storage: {{ .Values.volumePersistence.resources.requests.storage }}
13+
storageClassName: {{ .Values.volumePersistence.storageClassName }}
14+
volumeMode: {{ .Values.volumePersistence.volumeMode }}
15+
{{- end }}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "codegate.fullname" . }}
5+
namespace: {{ .Release.Namespace | quote }}
6+
labels:
7+
{{- include "codegate.labels" . | nindent 4 }}
8+
spec:
9+
type: {{ .Values.service.type }}
10+
ports:
11+
- port: {{ .Values.service.port }}
12+
targetPort: {{ .Values.service.port }}
13+
protocol: TCP
14+
name: http-api
15+
{{- with .Values.extraServicePorts }}
16+
{{- toYaml . | nindent 6 }}
17+
{{- end }}
18+
selector:
19+
{{- include "codegate.selectorLabels" . | nindent 4 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "codegate.serviceAccountName" . }}
6+
namespace: {{ .Release.Namespace | quote }}
7+
labels:
8+
{{- include "codegate.labels" . | nindent 4 }}
9+
{{- with .Values.serviceAccount.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
14+
{{- end }}

‎charts/codegate/values.yaml

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# This is to override the chart name.
2+
nameOverride: ""
3+
fullnameOverride: ""
4+
5+
# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
6+
image:
7+
repository: ghcr.io/stacklok/codegate
8+
# This sets the pull policy for images.
9+
pullPolicy: IfNotPresent
10+
# Overrides the image tag whose default is the chart appVersion.
11+
tag: "v0.1.22"
12+
13+
# This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
14+
imagePullSecrets: []
15+
16+
# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
17+
replicaCount: 1
18+
19+
# This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/
20+
serviceAccount:
21+
# Specifies whether a service account should be created
22+
create: true
23+
# Automatically mount a ServiceAccount's API credentials?
24+
automount: true
25+
# Annotations to add to the service account
26+
annotations: {}
27+
# The name of the service account to use.
28+
# If not set and create is true, a name is generated using the fullname template
29+
name: "codegate"
30+
31+
# This is for setting Kubernetes Annotations to a Pod.
32+
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
33+
podAnnotations: {}
34+
# This is for setting Kubernetes Labels to a Pod.
35+
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
36+
podLabels: {}
37+
38+
podSecurityContext: {}
39+
# fsGroup: 2000
40+
41+
securityContext: {}
42+
# capabilities:
43+
# drop:
44+
# - ALL
45+
# readOnlyRootFilesystem: true
46+
# runAsNonRoot: true
47+
# runAsUser: 1000
48+
49+
# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/
50+
service:
51+
# This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
52+
type: ClusterIP
53+
# This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports
54+
port: 8989
55+
56+
extraServicePorts:
57+
- port: 9090
58+
targetPort: 9090
59+
protocol: TCP
60+
name: http-dashboard
61+
- port: 8990
62+
targetPort: 8990
63+
protocol: TCP
64+
name: http-copilot-proxy
65+
66+
# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/
67+
ingress:
68+
enabled: false
69+
className: ""
70+
annotations: {}
71+
# kubernetes.io/ingress.class: nginx
72+
# kubernetes.io/tls-acme: "true"
73+
hosts:
74+
- host: chart-example.local
75+
paths:
76+
- path: /
77+
pathType: ImplementationSpecific
78+
tls: []
79+
# - secretName: chart-example-tls
80+
# hosts:
81+
# - chart-example.local
82+
83+
resources: {}
84+
# We usually recommend not to specify default resources and to leave this as a conscious
85+
# choice for the user. This also increases chances charts run on environments with little
86+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
87+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
88+
# limits:
89+
# cpu: 100m
90+
# memory: 128Mi
91+
# requests:
92+
# cpu: 100m
93+
# memory: 128Mi
94+
95+
# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
96+
livenessProbe:
97+
httpGet:
98+
path: /health
99+
port: http
100+
readinessProbe:
101+
httpGet:
102+
path: /health
103+
port: http
104+
105+
# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
106+
autoscaling:
107+
enabled: false
108+
minReplicas: 1
109+
maxReplicas: 100
110+
targetCPUUtilizationPercentage: 80
111+
# targetMemoryUtilizationPercentage: 80
112+
113+
# Additional volumes on the output Deployment definition.
114+
volumes:
115+
- name: codegate-volume
116+
persistentVolumeClaim:
117+
claimName: codegate-0
118+
119+
# Additional volumeMounts on the output Deployment definition.
120+
volumeMounts:
121+
- mountPath: /app/codegate-volume
122+
name: codegate-volume
123+
124+
# Creates a PVC for a PV volume for persisting codegate data
125+
# Only 1 PV will be created because codegate is not a statefulset
126+
volumePersistence:
127+
enabled: true
128+
pvcName: codegate-0
129+
resources:
130+
requests:
131+
storage: 10Gi
132+
storageClassName: gp2
133+
volumeMode: Filesystem
134+
135+
136+
nodeSelector: {}
137+
138+
tolerations: []
139+
140+
affinity: {}

‎cr.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
generate-release-notes: true
2+
charts_dir: charts

‎ct.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
chart-dirs:
2+
- charts
3+
validate-maintainers: false
4+
remote: origin
5+
target-branch: main

0 commit comments

Comments
 (0)
Please sign in to comment.