Skip to content

Commit 7c1b842

Browse files
authored
Merge pull request #3 from linuxfoundation/andrest50/chart
feat: add Helm chart and fix gitignore for charts directory
2 parents 11e8c22 + 51bb495 commit 7c1b842

File tree

8 files changed

+168
-4
lines changed

8 files changed

+168
-4
lines changed

.cspell.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
"stretchr",
6969
"pipefail",
7070
"slsa",
71-
"sigstore"
71+
"sigstore",
72+
"nindent"
7273
],
7374
"overrides": [
7475
{

.github/workflows/ko-build-tag.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979

8080
- name: Publish Chart to GHCR
8181
id: publish-ghcr
82+
# yamllint disable-line rule:line-length
8283
uses: linuxfoundation/lfx-public-workflows/.github/actions/helm-chart-oci-publisher@c465d6571fa0b8be9d551d902955164ea04a00af # main
8384
with:
8485
name: ${{ needs.publish.outputs.chart_name }}

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
*.dll
1010
*.so
1111
*.dylib
12-
fga-sync
13-
lfx-v2-fga-sync
1412

1513
# Go build artifacts
1614
*.test

.yamllint.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# SPDX-License-Identifier: MIT
33
---
44
extends: default
5-
5+
ignore: |
6+
charts/lfx-v2-fga-sync/templates/
67
rules:
78
line-length:
89
max: 120
@@ -14,3 +15,6 @@ rules:
1415
indentation:
1516
spaces: 2
1617
indent-sequences: true
18+
braces:
19+
min-spaces-inside: -1
20+
max-spaces-inside: -1

charts/lfx-v2-fga-sync/Chart.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright The Linux Foundation and each contributor to LFX.
2+
# SPDX-License-Identifier: MIT
3+
---
4+
apiVersion: v2
5+
name: lfx-v2-fga-sync
6+
description: LFX Platform V2 FGA Sync chart
7+
type: application
8+
version: 0.1.0
9+
appVersion: "latest"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copyright The Linux Foundation and each contributor to LFX.
2+
# SPDX-License-Identifier: MIT
3+
---
4+
apiVersion: apps/v1
5+
kind: Deployment
6+
metadata:
7+
name: {{ .Chart.Name }}
8+
namespace: {{ .Release.Namespace }}
9+
spec:
10+
replicas: {{ .Values.application.replicas }}
11+
selector:
12+
matchLabels:
13+
app: {{ .Chart.Name }}
14+
template:
15+
metadata:
16+
labels:
17+
app: {{ .Chart.Name }}
18+
spec:
19+
containers:
20+
- name: app
21+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
22+
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
23+
securityContext:
24+
allowPrivilegeEscalation: false
25+
env:
26+
- name: NATS_URL
27+
value: "{{ .Values.nats.url }}"
28+
- name: FGA_API_URL
29+
value: "{{ .Values.fga.apiUrl }}"
30+
- name: FGA_STORE_ID
31+
value: "{{ .Values.fga.storeId }}"
32+
- name: FGA_MODEL_ID
33+
value: "{{ .Values.fga.modelId }}"
34+
- name: CACHE_BUCKET
35+
value: "{{ .Values.nats.cacheFgaKvBucket.name }}"
36+
- name: DEBUG
37+
value: "{{ .Values.application.debug }}"
38+
- name: USE_CACHE
39+
value: "{{ .Values.application.useCache }}"
40+
ports:
41+
- containerPort: 8080
42+
name: web
43+
livenessProbe:
44+
httpGet:
45+
path: /livez
46+
port: web
47+
failureThreshold: 3
48+
periodSeconds: 15
49+
readinessProbe:
50+
httpGet:
51+
path: /readyz
52+
port: web
53+
failureThreshold: 1
54+
periodSeconds: 10
55+
startupProbe:
56+
httpGet:
57+
path: /readyz
58+
port: web
59+
failureThreshold: 30
60+
periodSeconds: 1
61+
resources:
62+
{{toYaml .Values.application.resources | nindent 12}}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright The Linux Foundation and each contributor to LFX.
2+
# SPDX-License-Identifier: MIT
3+
---
4+
{{- if .Values.nats.cacheFgaKvBucket.creation}}
5+
apiVersion: jetstream.nats.io/v1beta2
6+
kind: KeyValue
7+
metadata:
8+
name: {{ .Values.nats.cacheFgaKvBucket.name }}
9+
namespace: {{ .Release.Namespace }}
10+
{{- if .Values.nats.cacheFgaKvBucket.keep }}
11+
annotations:
12+
"helm.sh/resource-policy": keep
13+
{{- end }}
14+
spec:
15+
bucket: {{ .Values.nats.cacheFgaKvBucket.name }}
16+
history: {{ .Values.nats.cacheFgaKvBucket.history }}
17+
storage: "{{ .Values.nats.cacheFgaKvBucket.storage }}"
18+
maxValueSize: {{ .Values.nats.cacheFgaKvBucket.maxValueSize }}
19+
maxBytes: {{ .Values.nats.cacheFgaKvBucket.maxBytes }}
20+
compression: {{ .Values.nats.cacheFgaKvBucket.compression }}
21+
{{- end }}

charts/lfx-v2-fga-sync/values.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Copyright The Linux Foundation and each contributor to LFX.
2+
# SPDX-License-Identifier: MIT
3+
---
4+
5+
# image is the configuration for the container image
6+
image:
7+
# repository is the container image repository
8+
repository: ghcr.io/linuxfoundation/lfx-v2-fga-sync/lfx-v2-fga-sync
9+
# tag is the container image tag (defaults to appVersion if not specified)
10+
tag: ""
11+
# pullPolicy is the image pull policy
12+
pullPolicy: "IfNotPresent"
13+
14+
# nats is the configuration for the NATS server
15+
nats:
16+
# url is the URL of the NATS server
17+
url: nats://lfx-platform-nats.lfx.svc.cluster.local:4222
18+
19+
# cacheFgaKvBucket is the configuration for the KV bucket for storing FGA cache
20+
cacheFgaKvBucket:
21+
# creation is a boolean to determine if the KV bucket should be created via the helm chart.
22+
# set it to false if you want to use an existing KV bucket.
23+
creation: true
24+
# keep is a boolean to determine if the KV bucket should be preserved during helm uninstall
25+
# set it to false if you want the bucket to be deleted when the chart is uninstalled
26+
keep: true
27+
# name is the name of the KV bucket for storing FGA cache
28+
name: fga-sync-cache
29+
# history is the number of history entries to keep for the KV bucket
30+
history: 20
31+
# storage is the storage type for the KV bucket
32+
storage: file
33+
# maxValueSize is the maximum size of a value in the KV bucket
34+
maxValueSize: 10485760 # 10MB
35+
# maxBytes is the maximum number of bytes in the KV bucket
36+
maxBytes: 1073741824 # 1GB
37+
# compression is a boolean to determine if the KV bucket should be compressed
38+
compression: true
39+
40+
# fga is the configuration for the OpenFGA server
41+
# These values come from the lfx-platform helm chart repo:
42+
# https://github.com/linuxfoundation/lfx-v2-helm/blob/main/docs/openfga.md
43+
fga:
44+
# apiUrl is the URL of the OpenFGA API server
45+
apiUrl: http://lfx-platform-openfga.lfx.svc.cluster.local:8080
46+
# storeId is the ID of the OpenFGA store
47+
storeId: 01K1GTJZW163H839J3YZHD8ZRY
48+
# modelId is the ID of the OpenFGA model
49+
modelId: 01K1H4TFHDSBCZVZ5EP6HHDWE6
50+
51+
# application is the configuration for the application
52+
application:
53+
# debug is a boolean to determine if the application should run in debug mode
54+
debug: false
55+
# useCache is a boolean to determine if the application should use the cache
56+
# Only turn it off if you are developing locally and are writing to the OpenFGA store
57+
# outside of this service (e.g. granting certain access to a test user manually)
58+
useCache: true
59+
# replicas is the number of pod replicas
60+
replicas: 1
61+
# resources is the resource configuration for the pods
62+
resources:
63+
requests:
64+
memory: "64Mi"
65+
cpu: "100m"
66+
limits:
67+
memory: "128Mi"
68+
cpu: "500m"

0 commit comments

Comments
 (0)