Skip to content

Commit

Permalink
Release 1.0.7
Browse files Browse the repository at this point in the history
Better configuration of the internal reverse proxy. Python is now configurable.
  • Loading branch information
Marco Libanori committed Sep 12, 2023
1 parent 9221e6f commit 45e833f
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 48 deletions.
2 changes: 1 addition & 1 deletion charts/knowage/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

apiVersion: v2
name: knowage
version: 1.0.6
version: 1.0.7
kubeVersion: ">= 1.22.0-0"
description: A Helm chart for Kubernetes Suite
type: application
Expand Down
41 changes: 41 additions & 0 deletions charts/knowage/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,47 @@ Create the name of the config of Hazelcast
{{ printf "%s-%s" (include "knowage.fullname" .) "hazelcast" }}
{{- end }}

{{/*
Create the name of the config of Hazelcast
*/}}
{{- define "knowage.python.config" -}}
{{ printf "%s-%s" (include "knowage.fullname" .) "python" }}
{{- end }}

{{/*
Create the name of the service for the ingress
*/}}
{{- define "knowage.ingress.service" -}}
{{- if eq ( default .Values.knowage.deployCustomReverseProxy false ) true -}}
{{- include "knowage.proxy.service" . -}}
{{ else }}
{{- include "knowage.service" . -}}
{{- end -}}
{{- end }}

{{/*
Create the name of the service for the ingress
*/}}
{{- define "knowage.ingress.port" -}}
{{- if eq ( default .Values.knowage.deployCustomReverseProxy false ) true -}}
80
{{- else -}}
443
{{- end -}}
{{- end }}

{{/*
Create the name of the service for the ingress
*/}}
{{- define "knowage.imagePullPolicy" -}}
{{- if .Values.knowage.imagePullPolicy -}}
{{ print .Values.knowage.imagePullPolicy }}
{{- else -}}
IfNotPresent
{{- end -}}
{{- end }}


{{ default true .Values.knowage.installSampleData }}
{{ default true .Values.knowage.deployMetadataDb }}
{{ default true .Values.knowage.deployCacheDb }}
Expand Down
54 changes: 45 additions & 9 deletions charts/knowage/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ data:
server {
listen 80;
server_name {{ include "knowage.proxy.service" . }};
server_name {{ include "knowage.domain" . }};
# Compression
gzip on;
Expand All @@ -168,24 +168,39 @@ data:
add_header X-Permitted-Cross-Domain-Policies "none" ;
# Created by: https://report-uri.com/home/generate
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; script-src-elem 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://alcdn.msauth.net; style-src 'self' 'unsafe-inline'; style-src-elem 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: http://tile.openstreetmap.org http://*.tile.openstreetmap.org http://www.gravatar.com; font-src 'self' data: https://fonts.gstatic.com; connect-src 'self' https://login.microsoftonline.com; object-src 'self'; frame-src 'self' blob: data:; manifest-src 'self'" ;
set $CSP "" ;
set $CSP "${CSP}default-src 'self'; " ;
set $CSP "${CSP}script-src 'self' 'unsafe-inline' 'unsafe-eval' ; " ;
set $CSP "${CSP}script-src-elem 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://alcdn.msauth.net https://cdn.jsdelivr.net ; " ;
set $CSP "${CSP}style-src 'self' 'unsafe-inline' ; " ;
set $CSP "${CSP}style-src-elem 'self' 'unsafe-inline' https://fonts.googleapis.com ; " ;
set $CSP "${CSP}img-src 'self' data: blob: http://tile.openstreetmap.org http://*.tile.openstreetmap.org http://www.gravatar.com ; " ;
set $CSP "${CSP}font-src 'self' data: https://fonts.gstatic.com ; " ;
set $CSP "${CSP}connect-src 'self' https://login.microsoftonline.com https://gist.githubusercontent.com ; " ;
set $CSP "${CSP}object-src 'self' ; " ;
set $CSP "${CSP}frame-src 'self' blob: data: ; " ;
set $CSP "${CSP}manifest-src 'self' ; " ;
set $CSP "${CSP}worker-src 'self' blob: ; " ;
add_header Content-Security-Policy "${CSP}" ;
add_header Referrer-Policy "no-referrer" ;
# Caching (browser side)
if ($request_uri ~* \.(css|gif|html|js|jpe?g|png|svg|woff2?)$) {
expires 60m;
add_header Cache-Control "public";
}
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://{{ include "knowage.service" . }}:8080;
proxy_pass http://{{ include "knowage.service" . }}:80;
proxy_redirect ~^http://knowage-main(/.+)$ $1;
proxy_connect_timeout 60s ;
proxy_send_timeout 3600s ;
proxy_read_timeout 3600s ;
# Caching (browser side)
if ($request_uri ~* \.(js|css|gif|jpe?g|png|svg|woff2?)) {
expires 1M;
add_header Cache-Control "public";
}
}
}
Expand Down Expand Up @@ -228,3 +243,24 @@ data:
</properties>
</hazelcast>
{{ end }}

{{ if or (eq ( default .Values.knowage.deployPython false ) true) (eq ( default .Values.knowage.python.deploy false ) true) }}
# _______ _________ _ _ ____ _ _
# | __ \ \ / /__ __| | | |/ __ \| \ | |
# | |__) \ \_/ / | | | |__| | | | | \| |
# | ___/ \ / | | | __ | | | | . ` |
# | | | | | | | | | | |__| | |\ |
# |_| |_| |_| |_| |_|\____/|_| \_|
#
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "knowage.python.config" . }}
namespace: {{ .Release.Namespace }}
data:
requirements.txt: |
{{- range $idx, $val := .Values.knowage.python.libraries }}
{{ print $val | indent 4 }}
{{- end }}
{{ end }}
25 changes: 18 additions & 7 deletions charts/knowage/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ metadata:
name: {{ include "knowage.proxy.deployment" . }}
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
replicas: 3
selector:
matchLabels:
knowage-suite.com/app: proxy
Expand Down Expand Up @@ -98,7 +98,7 @@ spec:
containers:
- name: {{ include "knowage.pod" . }}
image: {{ printf "%s:%s" ( default "knowagelabs/knowage-server-docker" .Values.knowage.customImageName ) .Chart.AppVersion | quote }}
imagePullPolicy: IfNotPresent
imagePullPolicy: {{ include "knowage.imagePullPolicy" . }}
env:
- name: DB_USER
valueFrom:
Expand Down Expand Up @@ -426,7 +426,7 @@ spec:
containers:
- name: {{ include "knowage.foodmart.pod" . }}
image: "m20tech/mysql-foodmart"
imagePullPolicy: IfNotPresent
imagePullPolicy: {{ include "knowage.imagePullPolicy" . }}
livenessProbe:
tcpSocket:
port: 3306
Expand All @@ -441,7 +441,7 @@ spec:
protocol: TCP
{{ end }}

{{ if eq ( default .Values.knowage.deployPython false ) true }}
{{ if or (eq ( default .Values.knowage.deployPython false ) true) (eq ( default .Values.knowage.python.deploy false ) true) }}
# _______ _________ _ _ ____ _ _
# | __ \ \ / /__ __| | | |/ __ \| \ | |
# | |__) \ \_/ / | | | |__| | | | | \| |
Expand Down Expand Up @@ -470,7 +470,7 @@ spec:
containers:
- name: {{ include "knowage.python.pod" . }}
image: "knowagelabs/knowage-python-docker:{{ .Chart.AppVersion }}"
imagePullPolicy: IfNotPresent
imagePullPolicy: {{ include "knowage.imagePullPolicy" . }}
env:
- name: HMAC_KEY
valueFrom:
Expand All @@ -495,9 +495,20 @@ spec:
- name: http
containerPort: 5000
protocol: TCP
volumeMounts:
- name: requirements
mountPath: /app/requirements.txt
subPath: requirements.txt
volumes:
- name: requirements
configMap:
name: {{ include "knowage.python.config" . }}
items:
- key: requirements.txt
path: requirements.txt
{{ end }}

{{ if eq ( default .Values.knowage.deployR false ) true }}
{{ if or (eq ( default .Values.knowage.deployR false ) true) (eq ( default .Values.knowage.r.deploy false ) true) }}
---
# _____
# | __ \
Expand Down Expand Up @@ -526,7 +537,7 @@ spec:
containers:
- name: {{ include "knowage.r.pod" . }}
image: "knowagelabs/knowage-r-docker:{{ .Chart.AppVersion }}"
imagePullPolicy: IfNotPresent
imagePullPolicy: {{ include "knowage.imagePullPolicy" . }}
env:
- name: HMAC_KEY
valueFrom:
Expand Down
52 changes: 26 additions & 26 deletions charts/knowage/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,93 +39,93 @@ spec:
# we expected.
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowage
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowage-api
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowage-data-preparation
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowage-vue
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowagebirtreportengine
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowagecockpitengine
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowagegeoreportengine
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowagejasperreportengine
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowagekpiengine
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowagemeta
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowageqbeengine
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowagesvgviewerengine
pathType: Prefix
- backend:
service:
name: {{ include "knowage.service" . }}
name: {{ include "knowage.ingress.service" . }}
port:
number: 443
number: {{ include "knowage.ingress.port" . }}
path: /knowagewhatifengine
pathType: Prefix
tls:
Expand Down
19 changes: 14 additions & 5 deletions charts/knowage/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ knowage:

deployCustomReverseProxy: false

deployPython: true

deployR: true

deployHazelcast: false

#
Expand Down Expand Up @@ -154,4 +150,17 @@ knowage:
if ($request_uri ~* \.(js|css|gif|jpe?g|png|svg|woff2?)) {
expires 1M;
add_header Cache-Control "public";
}
}

deployPython: true # DEPRECATED
python:
deploy: true
libraries:
- scikit-learn==1.2.2
- pandas==2.0.1

deployR: true # DEPRECATED
r:
deploy: true

imagePullPolicy: IfNotPresent

0 comments on commit 45e833f

Please sign in to comment.