diff --git a/charts/shc/templates/configmap.yaml b/charts/shc/templates/configmap.yaml index 798c218..691a036 100644 --- a/charts/shc/templates/configmap.yaml +++ b/charts/shc/templates/configmap.yaml @@ -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 }} diff --git a/charts/shc/templates/ingress.yaml b/charts/shc/templates/ingress.yaml index d140ea1..ebaa1ea 100644 --- a/charts/shc/templates/ingress.yaml +++ b/charts/shc/templates/ingress.yaml @@ -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 }} @@ -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 }} @@ -64,7 +64,7 @@ spec: pathType: Prefix backend: service: - name: {{ .Values.service.name }} + name: {{ .Release.Name }}-community port: number: 3000 @@ -75,7 +75,7 @@ spec: pathType: Prefix backend: service: - name: {{ .Values.service.name }} + name: {{ .Release.Name }}-community port: number: 3100 @@ -86,7 +86,7 @@ spec: pathType: Prefix backend: service: - name: {{ .Values.service.name }} + name: {{ .Release.Name }}-community port: number: 3170 {{- end }} diff --git a/charts/shc/templates/service.yaml b/charts/shc/templates/service.yaml index fec7d9c..3d7b9a4 100644 --- a/charts/shc/templates/service.yaml +++ b/charts/shc/templates/service.yaml @@ -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 }} \ No newline at end of file + app: {{ .Release.Name }}-community diff --git a/charts/shc/values.yaml b/charts/shc/values.yaml index 8122c06..8bda49a 100644 --- a/charts/shc/values.yaml +++ b/charts/shc/values.yaml @@ -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" @@ -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\" }}" @@ -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: