Skip to content

Commit 2a67dc7

Browse files
committed
Update kubernetes templates to make certain property values configurable from values.yaml
Signed-off-by: Andres Tobon <andrest2455@gmail.com>
1 parent 84c38ad commit 2a67dc7

File tree

9 files changed

+38
-14
lines changed

9 files changed

+38
-14
lines changed

.github/workflows/mega-linter.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
# MegaLinter
3333
- name: MegaLinter
3434
id: ml
35-
# Use the Documentation flavor.
36-
uses: oxsecurity/megalinter/flavors/documentation@5a91fb06c83d0e69fbd23756d47438aa723b4a5a # 8.7.0
35+
# Use the Go flavor.
36+
uses: oxsecurity/megalinter/flavors/go@5a91fb06c83d0e69fbd23756d47438aa723b4a5a # 8.7.0
3737
env:
3838
# All available variables are described in documentation
3939
# https://megalinter.io/configuration/

.mega-linter.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ DISABLE_LINTERS:
1818
# yamllint is sufficient for us.
1919
- YAML_PRETTIER
2020
DISABLE_ERRORS_LINTERS:
21-
# Include grammar checks only as warnings.
22-
- SPELL_PROSELINT
23-
- SPELL_VALE
2421
# This may be informative but doesn't need to break the build.
2522
- COPYPASTE_JSCPD
2623
# TBD! Need to work through these.

charts/lfx-v2-project-service/templates/ingressroute.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Copyright The Linux Foundation and each contributor to LFX.
22
# SPDX-License-Identifier: MIT
33
---
4+
# TODO: use the newer Gateway API instead of a IngressRoute resource
5+
# https://doc.traefik.io/traefik/routing/providers/kubernetes-gateway/
46
apiVersion: traefik.io/v1alpha1
57
kind: IngressRoute
68
metadata:
@@ -17,7 +19,9 @@ spec:
1719
(Path(`/projects`) || PathPrefix(`/projects/`) || Path(`/livez`) || Path(`/readyz`))
1820
priority: 10
1921
middlewares:
22+
{{- if .Values.heimdall.enabled }}
2023
- name: heimdall
24+
{{- end }}
2125
services:
2226
- kind: Service
2327
name: lfx-v2-project-service
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# Copyright The Linux Foundation and each contributor to LFX.
22
# SPDX-License-Identifier: MIT
33
---
4+
{{- if .Values.nats.projects_kv_bucket.creation }}
45
apiVersion: jetstream.nats.io/v1beta2
56
kind: KeyValue
67
metadata:
78
name: projects
89
namespace: lfx
910
spec:
10-
bucket: projects
11-
history: 20
12-
storage: file
13-
maxValueSize: 10485760 # 10MB
14-
maxBytes: 1073741824 # 1GB
15-
compression: true
11+
bucket: {{ .Values.nats.projects_kv_bucket.name }}
12+
history: {{ .Values.nats.projects_kv_bucket.history }}
13+
storage: {{ .Values.nats.projects_kv_bucket.storage }}
14+
maxValueSize: {{ .Values.nats.projects_kv_bucket.maxValueSize }}
15+
maxBytes: {{ .Values.nats.projects_kv_bucket.maxBytes }}
16+
compression: {{ .Values.nats.projects_kv_bucket.compression }}
17+
{{- end }}

charts/lfx-v2-project-service/values.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,29 @@ ingress:
99
nats:
1010
# url is the URL of the NATS server
1111
url: nats://nats.lfx.svc.cluster.local:4222
12-
projects_kv_bucket_name: projects
12+
13+
# projects_kv_bucket is the configuration for the KV bucket for storing projects
14+
projects_kv_bucket:
15+
# creation is a boolean to determine if the KV bucket should be created via the helm chart.
16+
# set it to false if you want to use an existing KV bucket.
17+
creation: false
18+
# name is the name of the KV bucket for storing projects
19+
name: projects
20+
# history is the number of history entries to keep for the KV bucket
21+
history: 20
22+
# storage is the storage type for the KV bucket
23+
storage: file
24+
# maxValueSize is the maximum size of a value in the KV bucket
25+
maxValueSize: 10485760 # 10MB
26+
# maxBytes is the maximum number of bytes in the KV bucket
27+
maxBytes: 1073741824 # 1GB
28+
# compression is a boolean to determine if the KV bucket should be compressed
29+
compression: true
1330

1431
# heimdall is the configuration for the heimdall middleware
1532
heimdall:
33+
enabled: true
34+
1635
env:
1736
CLIENT_SECRET:
1837
secretKeyRef:

cmd/project-api/service_endpoint.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,8 @@ func (s *ProjectsService) Livez(_ context.Context) ([]byte, error) {
529529
func (s *ProjectsService) JWTAuth(ctx context.Context, bearerToken string, _ *security.JWTScheme) (context.Context, error) {
530530
// Parse the Heimdall-authorized principal from the token.
531531
principal, _ := s.auth.parsePrincipal(ctx, bearerToken, s.logger)
532-
// TODO: handle error
532+
// TODO: handle error once we have figured out why it fails when running the service locally outside of the helm chart deployment
533+
// Error: failed to deserialize token claims: error getting the keys from the key func: could not decode jwks: EOF
533534
// if err != nil {
534535
// return ctx, err
535536
// }
File renamed without changes.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ func main() {
283283

284284
// Load mock data
285285
if err := client.LoadMockData(ctx, config.NumProjects); err != nil {
286-
log.Fatalf("Failed to load mock data: %v", err)
286+
log.Printf("Failed to load mock data: %v", err)
287+
return
287288
}
288289

289290
log.Println("Mock data loading completed successfully!")

0 commit comments

Comments
 (0)