Skip to content

Commit

Permalink
Helm Chart Alignment (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
EliavLunar authored Jan 10, 2025
1 parent fd9729d commit b9d93b6
Show file tree
Hide file tree
Showing 6 changed files with 285 additions and 55 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
/charts/lunar-proxy/flows
/charts/lunar-proxy/quotas
/charts/lunar-proxy/root
/charts/lunar-proxy/certs
/charts/lunar-proxy/path_params
/charts/lunar-proxy/policies.yaml
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"cSpell.words": ["datadoghq", "openmetrics"]
"cSpell.words": ["datadoghq", "nindent", "openmetrics", "spoe"]
}
71 changes: 45 additions & 26 deletions charts/lunar-proxy/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,89 +1,108 @@
# Policies support
{{- if not .Values.lunarStreamsEnabled }}
{{- if .Values.configMapNames.policies }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: policies.yaml
name: lunar-gateway-policies
namespace: {{ default .Release.Namespace }}
labels:
app: "{{ include "lunar-proxy.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
data:
{{- if .Values.configMapNames.policies }}
# No need to define data here; it will be provided via the external ConfigMap
{{- else }}
policies.yaml: |
---
{{- toYaml .Values.policies | nindent 4 }}
{{- end}}
{{- toYaml .Values.configFiles.policies | nindent 4 }}
immutable: false
{{- end }}
{{- end -}}

# Flows support start
{{- if .Values.lunarStreamsEnabled }}
{{- if not .Values.configMapNames.flows }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: flows
name: lunar-gateway-flows
namespace: {{ default .Release.Namespace }}
labels:
app: "{{ include "lunar-proxy.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
data:
{{- if .Values.configMapNames.flows }}
# No need to define data here; it will be provided via the external ConfigMap
{{- else }}
{{- range $key, $value := .Values.flows }}
{{- range $key, $value := .Values.configFiles.flows }}
{{ $key }}: |
{{ $value | nindent 4 }}
{{- end }}
{{- end }}
immutable: false
{{- end }}

{{- if not .Values.configMapNames.quotas }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: quotas
name: lunar-gateway-quotas
namespace: {{ default .Release.Namespace }}
labels:
app: "{{ include "lunar-proxy.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
data:
{{- if .Values.configMapNames.quotas }}
# No need to define data here; it will be provided via the external ConfigMap
{{- else }}
{{- range $key, $value := .Values.quotas }}
{{- range $key, $value := .Values.configFiles.quotas }}
{{ $key }}: |
{{ $value | nindent 4 }}
{{- end }}
{{- end }}
immutable: false
{{- end }}

{{- if not .Values.configMapNames.pathParams }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: metrics.yaml
name: lunar-gateway-path-params
namespace: {{ default .Release.Namespace }}
labels:
app: "{{ include "lunar-proxy.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
data:
{{- if .Values.configMapNames.metrics }}
# No need to define data here; it will be provided via the external ConfigMap
{{- else }}
metrics.yaml: |
---
{{- toYaml .Values.metrics | nindent 4 }}
{{- end}}
{{- range $key, $value := .Values.configFiles.pathParams }}
{{ $key }}: |
{{ $value | nindent 4 }}
{{- end }}
immutable: false
{{- end }}

{{- if not .Values.configMapNames.root }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: lunar-gateway-root
namespace: {{ default .Release.Namespace }}
labels:
app: "{{ include "lunar-proxy.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
data:
{{- range $key, $value := .Values.configFiles.root }}
{{ $key }}: |
{{ $value | nindent 4 }}
{{- end }}
immutable: false
{{- end }}

# Flows support end
{{- end }}
151 changes: 133 additions & 18 deletions charts/lunar-proxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ spec:
value: {{ toString .Values.lunarFlushSeconds | quote }}
- name: LUNAR_TELEMETRY
value: {{ toString .Values.telemetryEnabled | quote }}
- name: REDIS_USE_CLUSTER
value: {{ toString .Values.redisUseCluster | quote }}
{{- if .Values.env }}
- name: ENV
value: {{ .Values.env }}
Expand All @@ -97,14 +95,6 @@ spec:
- name: LUNAR_MANAGED
value: {{ .Values.lunarManaged }}
{{- end }}
{{- if .Values.redisPrefix }}
- name: REDIS_PREFIX
value: {{ .Values.redisPrefix }}
{{- end }}
{{- if .Values.redisUrl }}
- name: REDIS_URL
value: {{ .Values.redisUrl }}
{{- end }}
{{- if .Values.lunarHubURL }}
- name: LUNAR_HUB_URL
value: {{ .Values.lunarHubURL }}
Expand All @@ -123,14 +113,116 @@ spec:
- name: LUNAR_STREAMS_ENABLED
value: {{ toString .Values.lunarStreamsEnabled | quote }}
{{- end }}

{{- if .Values.telemetryLogLevel }}
- name: LUNAR_TELEMETRY_LOG_LEVEL
value: {{ .Values.telemetryLogLevel }}
{{- end}}

# Timeouts
{{- if .Values.timeouts.spoe.processingTimeoutSec }}
- name: LUNAR_SPOE_PROCESSING_TIMEOUT_SEC
value: {{ toString .Values.timeouts.spoe.processingTimeoutSec | quote }}
{{- end }}
{{- if .Values.timeouts.spoe.helloTimeoutMillis }}
- name: LUNAR_SPOE_HELLO_TIMEOUT_MS
value: {{ toString .Values.timeouts.spoe.helloTimeoutMillis | quote }}
{{- end }}

{{- if .Values.timeouts.proxy.connectTimeoutSec }}
- name: LUNAR_CONNECT_TIMEOUT_SEC
value: {{ toString .Values.timeouts.proxy.connectTimeoutSec | quote }}
{{- end }}
{{- if .Values.timeouts.proxy.clientTimeoutSec }}
- name: LUNAR_CLIENT_TIMEOUT_SEC
value: {{ toString .Values.timeouts.proxy.clientTimeoutSec | quote }}
{{- end }}
{{- if .Values.timeouts.proxy.serverTimeoutSec }}
- name: LUNAR_SERVER_TIMEOUT_SEC
value: {{ toString .Values.timeouts.proxy.serverTimeoutSec | quote }}
{{- end }}
{{- if .Values.timeouts.retryRequestTimeoutSec }}
- name: LUNAR_RETRY_REQUEST_TIMEOUT_SEC
value: {{ toString .Values.timeouts.retryRequestTimeoutSec | quote }}
{{- end }}

# Redis
{{- if .Values.redis.url }}
- name: REDIS_URL
value: {{ .Values.redis.url }}
{{- end }}
{{- if .Values.redis.useCluster }}
- name: REDIS_USE_CLUSTER
value: {{ toString .Values.redis.useCluster | quote }}
{{- end }}
{{- if .Values.redis.prefix }}
- name: REDIS_PREFIX
value: {{ .Values.redis.prefix }}
{{- end }}

{{- if .Values.redis.useCaCert }}
- name: REDIS_USE_CA_CERT
value: {{ toString .Values.redis.useCaCert | quote }}
{{- end }}
{{- if .Values.redis.caCertPath }}
- name: REDIS_CA_CERT_PATH
value: {{ .Values.redis.caCertPath }}
{{- end }}
{{- if .Values.redis.useClientCert }}
- name: REDIS_USE_CLIENT_CERT
value: {{ toString .Values.redis.useClientCert | quote }}
{{- end }}
{{- if .Values.redis.clientCertPath }}
- name: REDIS_CLIENT_CERT_PATH
value: {{ .Values.redis.clientCertPath }}
{{- end }}
{{- if .Values.redis.clientKeyPath }}
- name: REDIS_CLIENT_KEY_PATH
value: {{ .Values.redis.clientKeyPath }}
{{- end }}

# Gateway
{{- if .Values.gateway.maxConn }}
- name: LUNAR_MAXCONN
value: {{ toString .Values.gateway.maxConn | quote }}
{{- end }}
{{- if .Values.gateway.bufferSize }}
- name: GATEWAY_BUFFER_SIZE
value: {{ toString .Values.gateway.bufferSize | quote }}
{{- end }}
{{- if .Values.gateway.accessLogOutput }}
- name: LUNAR_ACCESS_LOGS_OUTPUT
value: {{ .Values.gateway.accessLogOutput }}
{{- end }}
{{- if .Values.gateway.doctorReportIntervalMinutes }}
- name: DOCTOR_REPORT_INTERVAL_MINUTES
value: {{ toString .Values.gateway.doctorReportIntervalMinutes | quote }}
{{- end }}

{{- if .Values.tlsPassthrough }}
- name: TLS_PASSTHROUGH_ON
value: {{ toString .Values.tlsPassthrough | quote }}
{{- end }}


volumeMounts:
{{- if .Values.lunarStreamsEnabled }}
- mountPath: /etc/lunar-proxy
name: metrics
name: root
- mountPath: /etc/lunar-proxy/flows
name: flows
- mountPath: /etc/lunar-proxy/quotas
name: quotas
- mountPath: /etc/lunar-proxy/path_params
name: path-params
{{- if .Values.secretNames.tlsCerts }}
- mountPath: /etc/lunar-proxy/certs/tls
name: tls-certs
{{- end }}
{{- if .Values.secretNames.mtlsCerts }}
- mountPath: /etc/lunar-proxy/certs/mtls
name: mtls-certs
{{- end }}
{{- else }}
- mountPath: /etc/lunar-proxy
name: policies
Expand All @@ -155,7 +247,7 @@ spec:
name: flows
{{- else }}
- configMap:
name: flows
name: lunar-gateway-flows
name: flows
{{- end }}
{{- if .Values.configMapNames.quotas }}
Expand All @@ -164,18 +256,41 @@ spec:
name: quotas
{{- else }}
- configMap:
name: quotas
name: lunar-gateway-quotas
name: quotas
{{- end }}
{{- if .Values.configMapNames.metrics }}

{{- if .Values.configMapNames.pathParams }}
- configMap:
name: {{ .Values.configMapNames.metrics }}
name: metrics
name: {{ .Values.configMapNames.pathParams }}
name: path-params
{{- else }}
- configMap:
name: metrics
name: metrics
name: lunar-gateway-path-params
name: path-params
{{- end }}

{{- if .Values.configMapNames.root }}
- configMap:
name: {{ .Values.configMapNames.root }}
name: root
{{- else }}
- configMap:
name: lunar-gateway-root
name: root
{{- end }}

{{- if .Values.secretNames.tlsCerts }}
- secret:
secretName: {{ .Values.secretNames.tlsCerts }}
name: tls-certs
{{- end }}
{{- if .Values.secretNames.mtlsCerts }}
- secret:
secretName: {{ .Values.secretNames.mtlsCerts }}
name: mtls-certs
{{- end }}

{{- else }} # i.e. lunarStreamsEnabled is false
{{- if .Values.configMapNames.policies }}
- configMap:
Expand Down
Loading

0 comments on commit b9d93b6

Please sign in to comment.