Skip to content

Commit 0024c77

Browse files
committed
internal-gateway: add njs scripts
1 parent 7854b58 commit 0024c77

File tree

5 files changed

+51
-3
lines changed

5 files changed

+51
-3
lines changed

charts/internal-gateway/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: v0.0.0
33
description: A Helm chart for Codefresh Internal Gateway
44
name: internal-gateway
5-
version: 0.9.0
5+
version: 0.10.0
66
home: https://github.com/codefresh-io/helm-charts
77
keywords:
88
- codefresh
@@ -13,4 +13,4 @@ maintainers:
1313
dependencies:
1414
- name: cf-common
1515
repository: oci://quay.io/codefresh/charts
16-
version: "0.16.0"
16+
version: "0.21.0"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function account_name(r) {
2+
const auth_entity = r.variables["auth_entity"];
3+
const b64decoded = Buffer.from(auth_entity, 'base64');
4+
const json = JSON.parse(b64decoded);
5+
const account_name = json.authenticatedEntity.activeAccount.name;
6+
7+
return account_name;
8+
}
9+
10+
export default {account_name};

charts/internal-gateway/templates/_components/_configmap.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ data:
1919
pid /tmp/nginx.pid;
2020
worker_rlimit_nofile {{ $nginxConfig.workerRlimitNofile }};
2121

22+
{{- with $nginxConfig.rootSnippet }}
23+
{{ . | nindent 4 }}
24+
{{- end }}
25+
26+
{{- range $key, $val := $nginxConfig.rootDirectives }}
27+
{{ printf "%s %s;" $key $val }}
28+
{{- end }}
29+
2230
events {
2331
worker_connections {{ $nginxConfig.workerConnections }};
2432
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if not .Values.libraryMode }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ .Release.Name }}-njs-scritps
6+
namespace: {{ .Release.Namespace }}
7+
data:
8+
{{- $rootContext := . }}
9+
{{- range $globPattern := $rootContext.Values.nginx.scriptFilesPatterns }}
10+
{{- range $path, $_ := $rootContext.Files.Glob $globPattern }}
11+
{{ base $path }}: {{ $rootContext.Files.Get $path | toYaml | nindent 4 }}
12+
{{- end }}
13+
{{- end }}
14+
{{- end }}

charts/internal-gateway/values.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Defines if library mode is used for the chart. No templates are generated when using this mode.
22
# Added to support usage in Codefresh On-Premise Helm chart
3-
libraryMode: true
3+
libraryMode: false
44

55
# -- Codefresh platform settings
66
# List of services endpoints and port
@@ -128,6 +128,11 @@ nginx:
128128
errorLogLevel: error
129129
# -- Enables NGINX access logs
130130
accessLogEnabled: true
131+
# -- Allows appending custom directives to the root block (map)
132+
rootSnippet: ""
133+
# -- Allows appending custom directives to the root block (map)
134+
rootDirectives:
135+
load_module: modules/ngx_http_js_module.so
131136
# -- Allows appending custom configuration to the server block (string)
132137
serverSnippet: ""
133138
# -- Allows appending custom directives to the server block (map)
@@ -148,6 +153,8 @@ nginx:
148153
# !! Moved into separate template at `templates/nginx/configmap.yaml`
149154
# @default -- See below
150155
file: ""
156+
scriptFilesPatterns:
157+
- files/njs/**
151158

152159
# -- Misc signadot configuration
153160
signadot: false
@@ -193,6 +200,9 @@ container:
193200
config:
194201
path:
195202
- mountPath: /etc/nginx
203+
njs-scripts:
204+
path:
205+
- mountPath: /etc/nginx/scripts
196206

197207
resources:
198208
requests:
@@ -260,6 +270,9 @@ volumes:
260270
config:
261271
enabled: true
262272
type: configMap
273+
njs-scripts:
274+
enabled: true
275+
type: configMap
263276

264277
# -- HPA parameters
265278
# @default -- See below
@@ -301,3 +314,6 @@ serviceAccount:
301314
# @default -- See below
302315
rbac:
303316
enabled: false
317+
318+
keda:
319+
enabled: false

0 commit comments

Comments
 (0)