Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions charts/shc/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,23 @@ data:
ALLOW_SECURE_COOKIES: {{ .Values.community.config.authjwt.allowSecureCookies | quote }}

# URLs and Frontend Config
VITE_BASE_URL: {{ .Values.community.config.urls.base | quote }}
VITE_SHORTCODE_BASE_URL: {{ .Values.community.config.urls.shortcode | quote }}
VITE_ADMIN_URL: {{ .Values.community.config.urls.admin | quote }}
VITE_BACKEND_GQL_URL: {{ .Values.community.config.urls.backend.gql | quote }}
VITE_BACKEND_WS_URL: {{ .Values.community.config.urls.backend.ws | quote }}
VITE_BACKEND_API_URL: {{ .Values.community.config.urls.backend.api | quote }}
REDIRECT_URL: {{ .Values.community.config.urls.redirect | quote }}
WHITELISTED_ORIGINS: {{ .Values.community.config.urls.whitelistedOrigins | quote }}
{{ $protocol := .Values.community.config.urls.https | ternary "https" "http" -}}
{{ $wsprotocol := .Values.community.config.urls.https | ternary "wss" "ws" -}}
{{- $base_url := printf "%s://%s" $protocol .Values.service.ingress.mainHost -}}
{{- $admin_url := printf "%s://%s" $protocol ( .Values.community.config.community.enableSubpathBasedAccess | ternary (printf "%s/admin" .Values.service.ingress.mainHost) .Values.service.ingress.adminHost ) -}}
{{- $backend_url := .Values.community.config.community.enableSubpathBasedAccess | ternary (printf "%s/backend" .Values.service.ingress.mainHost) .Values.service.ingress.backendHost -}}
{{- $http_backend_url := printf "%s://%s" $protocol $backend_url -}}
{{- $url_underscore := (.Values.service.ingress.mainHost | replace "." "_") -}}
{{- $app_url := printf "app://%s,http://app.%s" $url_underscore $url_underscore -}}

VITE_BASE_URL: {{ .Values.community.config.urls.base | default $base_url | quote }}
VITE_SHORTCODE_BASE_URL: {{ .Values.community.config.urls.shortcode | default $base_url | quote }}
REDIRECT_URL: {{ .Values.community.config.urls.base | default $base_url | quote }}
VITE_ADMIN_URL: {{ .Values.community.config.urls.admin | default $admin_url | quote }}
VITE_BACKEND_GQL_URL: {{ .Values.community.config.urls.backend.gql | default (printf "%s/graphql" $http_backend_url) | quote }}
VITE_BACKEND_WS_URL: {{ .Values.community.config.urls.backend.ws | default (printf "%s://%s/graphql" $wsprotocol $backend_url) | quote }}
VITE_BACKEND_API_URL: {{ .Values.community.config.urls.backend.api | default (printf "%s/v1" $http_backend_url) | quote }}
WHITELISTED_ORIGINS: {{ printf "%s,%s,%s,%s,%s" $base_url $admin_url $http_backend_url $app_url (.Values.community.config.urls.whitelistedOrigins | default "") | quote }}

# community Config
VITE_ALLOWED_AUTH_PROVIDERS: {{ .Values.community.config.auth.allowedProviders | quote }}
Expand Down
14 changes: 7 additions & 7 deletions charts/shc/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.service.name }}
name: {{ .Release.Name }}-community
namespace: {{ .Values.global.namespace | default .Release.Namespace }}
annotations:
{{- toYaml .Values.service.ingress.annotations | nindent 4 }}
Expand Down Expand Up @@ -38,21 +38,21 @@ spec:
pathType: Prefix
backend:
service:
name: {{ .Values.service.name }}
name: {{ .Release.Name }}-community
port:
number: {{ .Values.service.ports.subpath.port }}
- path: /backend
pathType: Prefix
backend:
service:
name: {{ .Values.service.name }}
name: {{ .Release.Name }}-community
port:
number: {{ .Values.service.ports.subpath.port }}
- path: /admin
pathType: Prefix
backend:
service:
name: {{ .Values.service.name }}
name: {{ .Release.Name }}-community
port:
number: {{ .Values.service.ports.subpath.port }}
{{- else }}
Expand All @@ -64,7 +64,7 @@ spec:
pathType: Prefix
backend:
service:
name: {{ .Values.service.name }}
name: {{ .Release.Name }}-community
port:
number: 3000

Expand All @@ -75,7 +75,7 @@ spec:
pathType: Prefix
backend:
service:
name: {{ .Values.service.name }}
name: {{ .Release.Name }}-community
port:
number: 3100

Expand All @@ -86,7 +86,7 @@ spec:
pathType: Prefix
backend:
service:
name: {{ .Values.service.name }}
name: {{ .Release.Name }}-community
port:
number: 3170
{{- end }}
Expand Down
40 changes: 20 additions & 20 deletions charts/shc/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
# templates/service.yaml
apiVersion: {{ .Values.service.apiVersion }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.service.name }}
name: {{ .Release.Name }}-community
namespace: {{ .Values.global.namespace | default .Release.Namespace }}
labels:
app: {{ .Values.service.app }}
app: {{ .Release.Name }}-community
annotations:
{{- toYaml .Values.service.annotations | nindent 4 }}
spec:
type: {{ ternary "ClusterIP" "LoadBalancer" .Values.service.ingress.enabled }}
{{- if not .Values.service.ingress.enabled }}
type: {{ .Values.service.type }}

{{- if eq .Values.service.type "LoadBalancer" }}
loadBalancerIP: {{ .Values.global.externalIP }}
externalTrafficPolicy: Cluster
{{- end }}

ports:
{{- if .Values.community.config.community.enableSubpathBasedAccess }}
- port: {{ .Values.service.ports.subpath.port }}
targetPort: {{ .Values.service.ports.subpath.targetPort }}
- name: subpath
protocol: TCP
name: {{ .Values.service.ports.subpath.name }}
port: {{ .Values.service.ports.subpath.port }}
targetPort: {{ .Values.service.ports.subpath.targetPort }}
{{- else }}
- port: {{ .Values.service.ports.frontend.port }}
- name: frontend
protocol: TCP
port: {{ .Values.service.ports.frontend.port }}
targetPort: {{ .Values.service.ports.frontend.targetPort }}
protocol: {{ .Values.service.ports.frontend.protocol }}
name: {{ .Values.service.ports.frontend.name }}

- port: {{ .Values.service.ports.admin.port }}
- name: admin
protocol: TCP
port: {{ .Values.service.ports.admin.port }}
targetPort: {{ .Values.service.ports.admin.targetPort }}
protocol: {{ .Values.service.ports.admin.protocol }}
name: {{ .Values.service.ports.admin.name }}

- port: {{ .Values.service.ports.backend.port }}
- name: backend
protocol: TCP
port: {{ .Values.service.ports.backend.port }}
targetPort: {{ .Values.service.ports.backend.targetPort }}
protocol: {{ .Values.service.ports.backend.protocol }}
name: {{ .Values.service.ports.backend.name }}
{{- end }}

selector:
app: {{ .Values.service.selector.app }}
app: {{ .Release.Name }}-community
31 changes: 9 additions & 22 deletions charts/shc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ community:
dataEncryptionKey: "data encryption key with 32 char"

urls:
base: "http://frontend.example.com"
shortcode: "http://frontend.example.com"
admin: "http://admin.example.com"
https: true
base: "" # "http://frontend.example.com"
shortcode: "" # "http://frontend.example.com"
admin: "" # "http://admin.example.com"
backend:
gql: "http://backend.example.com/graphql"
ws: "ws://backend.example.com/graphql"
api: "http://backend.example.com/v1"
redirect: "http://frontend.example.com"
whitelistedOrigins: "http://backend.example.com,http://frontend.example.com,http://admin.example.com"
gql: "" # "http://backend.example.com/graphql"
ws: "" # "ws://backend.example.com/graphql"
api: "" # "http://backend.example.com/v1"
redirect: "" # "http://frontend.example.com"
whitelistedOrigins: "" # "http://backend.example.com,http://frontend.example.com,http://admin.example.com"

auth:
allowedProviders: "EMAIL" # "GOOGLE,MICROSOFT,GITHUB,EMAIL"
Expand Down Expand Up @@ -114,10 +115,6 @@ serviceAccount:

# Service configuration
service:
apiVersion: v1
name: hoppscotch-community
app: hoppscotch-community
# Dynamically set based on ingress
type: "{{ .Values.service.ingress.enabled | ternary \"ClusterIP\" \"LoadBalancer\" }}"
# Only set externalTrafficPolicy for LoadBalancer
externalTrafficPolicy: "{{ .Values.service.ingress.enabled | ternary \"\" \"Cluster\" }}"
Expand All @@ -126,25 +123,15 @@ service:
backend:
port: 3170
targetPort: 3170
protocol: TCP
name: backend
frontend:
port: 3000
targetPort: 3000
protocol: TCP
name: frontend
admin:
port: 3100
targetPort: 3100
protocol: TCP
name: admin
subpath:
port: 80
targetPort: 80
protocol: TCP
name: subpath
selector:
app: hoppscotch-community

# Ingress Configuration
ingress:
Expand Down