diff --git a/charts/developer-portal-fe/.helmignore b/charts/developer-portal-fe/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/developer-portal-fe/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/developer-portal-fe/Chart.lock b/charts/developer-portal-fe/Chart.lock new file mode 100644 index 0000000..b39c2f5 --- /dev/null +++ b/charts/developer-portal-fe/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 12.12.10 +digest: sha256:c3d1e1b7e4e1f5f5e4a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 +generated: "2024-03-23T09:28:00Z" diff --git a/charts/developer-portal-fe/Chart.yaml b/charts/developer-portal-fe/Chart.yaml new file mode 100644 index 0000000..fc992f6 --- /dev/null +++ b/charts/developer-portal-fe/Chart.yaml @@ -0,0 +1,15 @@ +apiVersion: v2 +name: developer-portal-fe +description: A Helm chart for API7 Developer Portal Frontend +type: application +version: 0.1.0 +appVersion: "0.5.7" +maintainers: + - name: API7 + email: support@api7.ai + url: https://api7.ai +dependencies: + - name: postgresql + condition: postgresql.builtin + version: "12.12.10" + repository: "https://charts.bitnami.com/bitnami" diff --git a/charts/developer-portal-fe/README.md b/charts/developer-portal-fe/README.md new file mode 100644 index 0000000..7789107 --- /dev/null +++ b/charts/developer-portal-fe/README.md @@ -0,0 +1,91 @@ +# developer-portal-fe + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.5.7](https://img.shields.io/badge/AppVersion-0.5.7-informational?style=flat-square) + +A Helm chart for API7 Developer Portal Frontend + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| API7 | | | + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | postgresql | 12.12.10 | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| app.baseURL | string | `"http://localhost"` | | +| app.trustedOrigins[0] | string | `"http://localhost"` | | +| auth.existingSecret | string | `""` | | +| auth.existingSecretKey | string | `"auth-secret"` | | +| auth.secret | string | `""` | | +| db.existingSecret | string | `""` | | +| db.existingSecretKey | string | `"db-url"` | | +| db.url | string | `"postgres://portal:portal123@developer-portal-fe-postgresql:5432/portal"` | | +| developerPortal.extraEnvVars | list | `[]` | | +| developerPortal.extraVolumeMounts | list | `[]` | | +| developerPortal.extraVolumes | list | `[]` | | +| developerPortal.image.pullPolicy | string | `"IfNotPresent"` | | +| developerPortal.image.repository | string | `"api7/api7-ee-developer-portal-fe"` | | +| developerPortal.image.tag | string | `"v0.5.7"` | | +| developerPortal.livenessProbe.failureThreshold | int | `10` | | +| developerPortal.livenessProbe.initialDelaySeconds | int | `30` | | +| developerPortal.livenessProbe.path | string | `"/"` | | +| developerPortal.livenessProbe.periodSeconds | int | `10` | | +| developerPortal.podAnnotations | object | `{}` | | +| developerPortal.podLabels | object | `{}` | | +| developerPortal.readinessProbe.failureThreshold | int | `3` | | +| developerPortal.readinessProbe.initialDelaySeconds | int | `10` | | +| developerPortal.readinessProbe.path | string | `"/"` | | +| developerPortal.readinessProbe.periodSeconds | int | `5` | | +| developerPortal.replicaCount | int | `1` | | +| developerPortal.resources | object | `{}` | | +| developerPortal.tlsRejectUnauthorized | bool | `true` | | +| developerPortal.topologySpreadConstraints | list | `[]` | | +| fullnameOverride | string | `""` | | +| imagePullSecret | string | `""` | | +| ingress.annotations | object | `{}` | | +| ingress.className | string | `""` | | +| ingress.enabled | bool | `false` | | +| ingress.hosts[0].host | string | `"developer-portal.local"` | | +| ingress.hosts[0].paths[0].path | string | `"/"` | | +| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | | +| ingress.tls | list | `[]` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podSecurityContext | object | `{}` | | +| portal.existingSecret | string | `""` | | +| portal.existingSecretKey | string | `"portal-token"` | | +| portal.token | string | `""` | | +| portal.url | string | `"https://api7-developer-portal:4321"` | | +| postgresql.auth.database | string | `"portal"` | | +| postgresql.auth.password | string | `"portal123"` | | +| postgresql.auth.username | string | `"portal"` | | +| postgresql.builtin | bool | `true` | | +| postgresql.fullnameOverride | string | `"developer-portal-fe-postgresql"` | | +| postgresql.image.registry | string | `"docker.io"` | | +| postgresql.image.repository | string | `"api7/postgresql"` | | +| postgresql.image.tag | string | `"15.4.0-debian-11-r45"` | | +| postgresql.primary.persistence.enabled | bool | `true` | | +| postgresql.primary.persistence.size | string | `"10Gi"` | | +| postgresql.primary.service.ports.postgresql | int | `5432` | | +| resources | object | `{}` | | +| securityContext | object | `{}` | | +| service.annotations | object | `{}` | | +| service.containerPort | int | `3001` | | +| service.port | int | `80` | | +| service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `""` | | +| tolerations | list | `[]` | | +| topologySpreadConstraints | list | `[]` | | + diff --git a/charts/developer-portal-fe/charts/postgresql-12.12.10.tgz b/charts/developer-portal-fe/charts/postgresql-12.12.10.tgz new file mode 100644 index 0000000..89bcc97 Binary files /dev/null and b/charts/developer-portal-fe/charts/postgresql-12.12.10.tgz differ diff --git a/charts/developer-portal-fe/templates/NOTES.txt b/charts/developer-portal-fe/templates/NOTES.txt new file mode 100644 index 0000000..d476df3 --- /dev/null +++ b/charts/developer-portal-fe/templates/NOTES.txt @@ -0,0 +1,41 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "developer-portal-fe.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "developer-portal-fe.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "developer-portal-fe.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "developer-portal-fe.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} + +2. Configuration notes: + - Portal API URL: {{ .Values.portal.url }} + - Database: {{ if .Values.postgresql.builtin }}Built-in PostgreSQL{{ else }}External database{{ end }} + - Base URL: {{ .Values.app.baseURL }} + +3. Important security notes: + {{- if not .Values.portal.existingSecret }} + - Portal token is stored in plain text in the secret. For production, use portal.existingSecret. + {{- end }} + {{- if not .Values.auth.existingSecret }} + - Auth secret is stored in plain text in the secret. For production, use auth.existingSecret. + {{- end }} + {{- if not .Values.db.existingSecret }} + - Database URL is stored in plain text in the secret. For production, use db.existingSecret. + {{- end }} + {{- if not .Values.developerPortal.tlsRejectUnauthorized }} + - TLS verification is disabled (NODE_TLS_REJECT_UNAUTHORIZED=0). This should only be used in development. + {{- end }} diff --git a/charts/developer-portal-fe/templates/_helpers.tpl b/charts/developer-portal-fe/templates/_helpers.tpl new file mode 100644 index 0000000..4af258d --- /dev/null +++ b/charts/developer-portal-fe/templates/_helpers.tpl @@ -0,0 +1,82 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "developer-portal-fe.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "developer-portal-fe.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "developer-portal-fe.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "developer-portal-fe.labels" -}} +helm.sh/chart: {{ include "developer-portal-fe.chart" . }} +{{ include "developer-portal-fe.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "developer-portal-fe.selectorLabels" -}} +app.kubernetes.io/name: {{ include "developer-portal-fe.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "developer-portal-fe.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "developer-portal-fe.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Renders a value that contains template. +Usage: +{{ include "developer-portal-fe.tplvalues.render" (dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "developer-portal-fe.tplvalues.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else}} + {{- tpl (.value | toYaml) .context }} + {{- end}} +{{- end -}} + +{{/* +Get the chart-managed secret name +*/}} +{{- define "developer-portal-fe.secretName" -}} +{{- include "developer-portal-fe.fullname" . }}-secrets +{{- end }} diff --git a/charts/developer-portal-fe/templates/configmap.yaml b/charts/developer-portal-fe/templates/configmap.yaml new file mode 100644 index 0000000..41cf350 --- /dev/null +++ b/charts/developer-portal-fe/templates/configmap.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "developer-portal-fe.fullname" . }}-config + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "developer-portal-fe.labels" . | nindent 4 }} +data: + config.yaml: | + # Portal API connection configuration + portal: + url: {{ .Values.portal.url | quote }} + token: ${PORTAL_TOKEN} + + # Database configuration + db: + url: ${DB_URL} + + # Authentication configuration + auth: + secret: ${AUTH_SECRET} + + # Application configuration + app: + name: "Developer Portal" + baseURL: {{ .Values.app.baseURL | quote }} + trustedOrigins: + {{- toYaml .Values.app.trustedOrigins | nindent 8 }} diff --git a/charts/developer-portal-fe/templates/deployment.yaml b/charts/developer-portal-fe/templates/deployment.yaml new file mode 100644 index 0000000..cb3af01 --- /dev/null +++ b/charts/developer-portal-fe/templates/deployment.yaml @@ -0,0 +1,128 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "developer-portal-fe.fullname" . }} + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "developer-portal-fe.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.developerPortal.replicaCount }} + selector: + matchLabels: + {{- include "developer-portal-fe.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: developer-portal-fe + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.developerPortal.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "developer-portal-fe.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: developer-portal-fe + {{- if .Values.developerPortal.podLabels }} + {{- range $key, $value := $.Values.developerPortal.podLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + spec: + {{- if .Values.imagePullSecret }} + imagePullSecrets: + - name: {{ .Values.imagePullSecret }} + {{- end }} + serviceAccountName: {{ include "developer-portal-fe.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + - name: config + configMap: + name: {{ include "developer-portal-fe.fullname" . }}-config + {{- if .Values.developerPortal.extraVolumes }} + {{- include "developer-portal-fe.tplvalues.render" (dict "value" .Values.developerPortal.extraVolumes "context" $) | nindent 8 }} + {{- end }} + containers: + - name: developer-portal-fe + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.developerPortal.image.repository }}:{{ .Values.developerPortal.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.developerPortal.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.containerPort }} + protocol: TCP + livenessProbe: + httpGet: + path: {{ .Values.developerPortal.livenessProbe.path | default "/" }} + port: http + initialDelaySeconds: {{ .Values.developerPortal.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.developerPortal.livenessProbe.periodSeconds }} + failureThreshold: {{ .Values.developerPortal.livenessProbe.failureThreshold }} + readinessProbe: + httpGet: + path: {{ .Values.developerPortal.readinessProbe.path | default "/" }} + port: http + initialDelaySeconds: {{ .Values.developerPortal.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.developerPortal.readinessProbe.periodSeconds }} + failureThreshold: {{ .Values.developerPortal.readinessProbe.failureThreshold }} + resources: + {{- if .Values.developerPortal.resources }} + {{- toYaml .Values.developerPortal.resources | nindent 12 }} + {{- else }} + {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + env: + - name: NODE_ENV + value: "production" + - name: PORT + value: {{ .Values.service.containerPort | quote }} + - name: HOSTNAME + value: "0.0.0.0" + - name: NODE_TLS_REJECT_UNAUTHORIZED + value: {{ if .Values.developerPortal.tlsRejectUnauthorized }}"1"{{ else }}"0"{{ end }} + - name: PORTAL_TOKEN + valueFrom: + secretKeyRef: + name: {{ if .Values.portal.existingSecret }}{{ .Values.portal.existingSecret }}{{ else }}{{ include "developer-portal-fe.secretName" . }}{{ end }} + key: {{ .Values.portal.existingSecretKey }} + - name: DB_URL + valueFrom: + secretKeyRef: + name: {{ if .Values.db.existingSecret }}{{ .Values.db.existingSecret }}{{ else }}{{ include "developer-portal-fe.secretName" . }}{{ end }} + key: {{ .Values.db.existingSecretKey }} + - name: AUTH_SECRET + valueFrom: + secretKeyRef: + name: {{ if .Values.auth.existingSecret }}{{ .Values.auth.existingSecret }}{{ else }}{{ include "developer-portal-fe.secretName" . }}{{ end }} + key: {{ .Values.auth.existingSecretKey }} + {{- if .Values.developerPortal.extraEnvVars }} + {{- include "developer-portal-fe.tplvalues.render" (dict "value" .Values.developerPortal.extraEnvVars "context" $) | nindent 12 }} + {{- end }} + volumeMounts: + - name: config + mountPath: /app/apps/site/config.yaml + subPath: config.yaml + {{- if .Values.developerPortal.extraVolumeMounts }} + {{- include "developer-portal-fe.tplvalues.render" (dict "value" .Values.developerPortal.extraVolumeMounts "context" $) | nindent 12 }} + {{- end }} + + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with or .Values.developerPortal.topologySpreadConstraints .Values.topologySpreadConstraints }} + topologySpreadConstraints: + {{- tpl (. | toYaml) $ | nindent 8 }} + {{- end }} diff --git a/charts/developer-portal-fe/templates/ingress.yaml b/charts/developer-portal-fe/templates/ingress.yaml new file mode 100644 index 0000000..c822f6f --- /dev/null +++ b/charts/developer-portal-fe/templates/ingress.yaml @@ -0,0 +1,57 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "developer-portal-fe.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "developer-portal-fe.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/developer-portal-fe/templates/secret.yaml b/charts/developer-portal-fe/templates/secret.yaml new file mode 100644 index 0000000..745ef81 --- /dev/null +++ b/charts/developer-portal-fe/templates/secret.yaml @@ -0,0 +1,32 @@ +{{- if or (not .Values.portal.existingSecret) (not .Values.db.existingSecret) (not .Values.auth.existingSecret) }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "developer-portal-fe.fullname" . }}-secrets + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "developer-portal-fe.labels" . | nindent 4 }} +type: Opaque +data: + {{- if not .Values.portal.existingSecret }} + {{- if .Values.portal.token }} + portal-token: {{ .Values.portal.token | b64enc | quote }} + {{- else }} + portal-token: "" + {{- end }} + {{- end }} + {{- if not .Values.auth.existingSecret }} + {{- if .Values.auth.secret }} + auth-secret: {{ .Values.auth.secret | b64enc | quote }} + {{- else }} + auth-secret: "" + {{- end }} + {{- end }} + {{- if not .Values.db.existingSecret }} + {{- if .Values.db.url }} + db-url: {{ .Values.db.url | b64enc | quote }} + {{- else }} + db-url: "" + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/developer-portal-fe/templates/service.yaml b/charts/developer-portal-fe/templates/service.yaml new file mode 100644 index 0000000..2c38212 --- /dev/null +++ b/charts/developer-portal-fe/templates/service.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "developer-portal-fe.fullname" . }} + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "developer-portal-fe.labels" . | nindent 4 }} + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "developer-portal-fe.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: developer-portal-fe diff --git a/charts/developer-portal-fe/templates/serviceaccount.yaml b/charts/developer-portal-fe/templates/serviceaccount.yaml new file mode 100644 index 0000000..9cbf057 --- /dev/null +++ b/charts/developer-portal-fe/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "developer-portal-fe.serviceAccountName" . }} + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "developer-portal-fe.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/developer-portal-fe/values.yaml b/charts/developer-portal-fe/values.yaml new file mode 100644 index 0000000..e32744c --- /dev/null +++ b/charts/developer-portal-fe/values.yaml @@ -0,0 +1,250 @@ +# ============================================================ +# Application Configuration +# ============================================================ +developerPortal: + # Number of replicas + replicaCount: 1 + + # Container image configuration + image: + repository: api7/api7-ee-developer-portal-fe + pullPolicy: IfNotPresent + tag: "v0.5.7" + + # Resource limits and requests + resources: {} + # limits: + # cpu: 500m + # memory: 512Mi + # requests: + # cpu: 250m + # memory: 256Mi + + # Extra environment variables + extraEnvVars: [] + # - name: CUSTOM_VAR + # value: "custom-value" + + # Extra volumes + extraVolumes: [] + # - name: custom-volume + # emptyDir: {} + + # Extra volume mounts + extraVolumeMounts: [] + # - name: custom-volume + # mountPath: /custom/path + + # Additional labels for pods + podLabels: {} + + # Additional annotations for pods + podAnnotations: {} + + # Topology spread constraints + topologySpreadConstraints: [] + # - maxSkew: 1 + # topologyKey: kubernetes.io/hostname + # whenUnsatisfiable: DoNotSchedule + # labelSelector: + # matchLabels: + # app.kubernetes.io/name: developer-portal-fe + + # Skip TLS verification for Portal API (only for dev/self-signed certs) + # Set to false to enable NODE_TLS_REJECT_UNAUTHORIZED=0 + tlsRejectUnauthorized: true + + # Liveness probe configuration + livenessProbe: + path: / + initialDelaySeconds: 30 + periodSeconds: 10 + failureThreshold: 10 + + # Readiness probe configuration + readinessProbe: + path: / + initialDelaySeconds: 10 + periodSeconds: 5 + failureThreshold: 3 + +# ============================================================ +# Portal API Connection Configuration +# ============================================================ +portal: + # Portal API endpoint (the developer portal backend from api7 chart) + url: "https://api7-developer-portal:4321" + + # Portal token (plain text, lower priority than existingSecret) + token: "" + + # Reference to existing secret containing portal token (recommended for production) + existingSecret: "" + existingSecretKey: "portal-token" + +# ============================================================ +# Database Configuration +# ============================================================ +db: + # PostgreSQL connection string + # Format: postgres://username:password@host:port/database + url: "postgres://portal:portal123@developer-portal-fe-postgresql:5432/portal" + + # Reference to existing secret containing database URL (recommended for production) + existingSecret: "" + existingSecretKey: "db-url" + +# ============================================================ +# Authentication Configuration +# ============================================================ +auth: + # Better Auth secret key (at least 32 characters) + # Generate with: openssl rand -base64 32 + secret: "" + + # Reference to existing secret containing auth secret (recommended for production) + existingSecret: "" + existingSecretKey: "auth-secret" + +# ============================================================ +# Application URL Configuration +# ============================================================ +app: + # Base URL for the application + baseURL: "http://localhost" + + # Trusted origins for CORS + trustedOrigins: + - "http://localhost" + +# ============================================================ +# Service Configuration +# ============================================================ +service: + # Service type (ClusterIP, NodePort, LoadBalancer) + type: ClusterIP + + # Service port (exposed to the cluster) + port: 80 + + # Container port (the port the application listens on) + containerPort: 3001 + + # Service annotations + annotations: {} + +# ============================================================ +# Ingress Configuration +# ============================================================ +ingress: + # Enable ingress + enabled: false + + # Ingress class name + className: "" + + # Ingress annotations + annotations: {} + # kubernetes.io/ingress.class: nginx + # cert-manager.io/cluster-issuer: letsencrypt-prod + + # Ingress hosts configuration + hosts: + - host: developer-portal.local + paths: + - path: / + pathType: ImplementationSpecific + + # TLS configuration + tls: [] + # - secretName: developer-portal-tls + # hosts: + # - developer-portal.local + +# ============================================================ +# Built-in PostgreSQL Configuration +# ============================================================ +postgresql: + # Enable built-in PostgreSQL (set to false to use external database) + builtin: true + + # Override the full name of the PostgreSQL deployment + fullnameOverride: "developer-portal-fe-postgresql" + + # Authentication settings + auth: + username: portal + password: portal123 + database: portal + + # PostgreSQL image configuration (use api7's image for compatibility) + image: + registry: docker.io + repository: api7/postgresql + tag: 15.4.0-debian-11-r45 + + # Primary node configuration + primary: + # Persistence configuration + persistence: + enabled: true + size: 10Gi + + # Service configuration + service: + ports: + postgresql: 5432 + +# ============================================================ +# Common Configuration +# ============================================================ +# Image pull secret name +imagePullSecret: "" + +# Override the name of the chart +nameOverride: "" + +# Override the full name of the release +fullnameOverride: "" + +# Service account configuration +serviceAccount: + # Create a service account + create: true + + # Annotations for the service account + annotations: {} + + # Name of the service account (generated if not set) + name: "" + +# Pod annotations (global) +podAnnotations: {} + +# Pod security context (global) +podSecurityContext: {} + # fsGroup: 2000 + +# Container security context (global) +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +# Node selector (global) +nodeSelector: {} + +# Tolerations (global) +tolerations: [] + +# Affinity (global) +affinity: {} + +# Topology spread constraints (global) +topologySpreadConstraints: [] + +# Global resource limits and requests +resources: {}