Skip to content

Commit 26bbe25

Browse files
feat: support annotations for service account in helm chart (#31)
Co-authored-by: Robin Breathe <[email protected]>
1 parent 2d35c3c commit 26bbe25

File tree

6 files changed

+68
-5
lines changed

6 files changed

+68
-5
lines changed

deploy/charts/github-token-manager/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ name: github-token-manager
44
description: A Helm chart for github-token-manager
55

66
type: application
7-
version: 0.1.3
7+
version: 0.1.4
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# GitHub Token Manager Helm Chart
2+
3+
This Helm chart is used to deploy the GitHub Token Manager application.
4+
5+
## Installing the Chart
6+
7+
To install the chart with the release name `my-github-token-manager`:
8+
9+
```sh
10+
helm install my-github-token-manager -f values.yaml oci://ghcr.io/isometry/charts/github-token-manager
11+
```
12+
13+
## Uninstalling the Chart
14+
15+
To uninstall the chart with the release name `my-github-token-manager`:
16+
17+
```sh
18+
helm uninstall my-github-token-manager
19+
```
20+
21+
## Configuration
22+
23+
The following table lists the most relevant configurable parameters of the GitHub Token Manager chart and their default values.
24+
25+
| Parameter | Description | Default |
26+
| --- | --- |-----------------------|
27+
config.app_id | GitHub App ID | `0` |
28+
config.installation_id | GitHub App Installation ID | `0` |
29+
config.provider | GitHub App Private Key Provider | `aws` |
30+
config.key | GitHub App Private Key Path | `alias/github-token-manager` |
31+
rbac.serviceAccount.annotations | Annotations for the service account | `{}` |
32+
commonAnnotations | Common annotations for all resources | `{}` |
33+
34+
The `config.provider` field supported options are:
35+
- `aws`: The GitHub App private key is stored in AWS KMS (asymmetric, RSA_2048, sign and verify key) and the `config.key` field should be set to the alias of this KMS key.
36+
- `file`: The GitHub App private key is embedded by YAML multiline string in the `config.key` field.
37+
- `gcp`: The GitHub App private key is stored in GCP KMS.
38+
- `vault`: The GitHub App private key is stored in HashiCorp Vault.
39+
40+
When using external providers like `aws`, `gcp`, or `vault`, the controller's `ServiceAccount` must be configured with the necessary permissions to access the external store.
41+
42+
### Example values.yaml configuration for aws provider
43+
44+
```yaml
45+
config:
46+
app_id: 12345
47+
installation_id: 67890
48+
provider: aws
49+
key: alias/github-token-manager
50+
# The following annotation is required to allow the GitHub Token Manager to assume the role that has access to the GitHub App private key (IRSA)
51+
serviceAccount:
52+
annotations:
53+
eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/github-token-manager-role
54+
```
55+
56+
The role used requires `kms:DescribeKey` and `kms:Sign` permission on the KMS key.

deploy/charts/github-token-manager/templates/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.config.app_id != 0 }}
1+
{{- if ne (int .Values.config.app_id) 0 }}
22
---
33
apiVersion: v1
44
kind: Secret

deploy/charts/github-token-manager/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ spec:
109109
runAsNonRoot: true
110110
seccompProfile:
111111
type: RuntimeDefault
112-
serviceAccountName: {{ include "chart.fullname" . }}
112+
serviceAccountName: {{ .Values.rbac.serviceAccount.name | default (include "chart.fullname" . ) }}
113113
terminationGracePeriodSeconds: 10
114114
volumes:
115115
- name: config

deploy/charts/github-token-manager/templates/rbac.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
apiVersion: v1
44
kind: ServiceAccount
55
metadata:
6-
name: {{ include "chart.fullname" . }}
7-
{{- with .Values.commonAnnotations | default dict }}
6+
name: {{ .Values.rbac.serviceAccount.name | default (include "chart.fullname" . ) }}
7+
{{- if or .Values.rbac.serviceAccount.annotations .Values.commonAnnotations }}
88
annotations:
9+
{{- with .Values.rbac.serviceAccount.annotations | default dict }}
10+
{{- tpl ( toYaml . ) $ | nindent 4 }}
11+
{{- end }}
12+
{{- with .Values.commonAnnotations | default dict }}
913
{{- range $key, $value := . }}
1014
{{ $key }}: {{ $value | quote }}
1115
{{- end }}
1216
{{- end }}
17+
{{- end }}
1318
labels:
1419
component: rbac
1520
{{- include "labels" . | nindent 4 }}

deploy/charts/github-token-manager/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ crds:
2727
## false: do not create the RBAC resources
2828
rbac:
2929
install: true
30+
serviceAccount:
31+
annotations: {}
3032

3133
## metrics:
3234
## enabled: true | false

0 commit comments

Comments
 (0)