diff --git a/.github/ct.yaml b/.github/ct.yaml new file mode 100644 index 000000000..8ddba1fcc --- /dev/null +++ b/.github/ct.yaml @@ -0,0 +1,5 @@ +chart-dirs: + - charts +target-branch: main +validate-maintainers: false +helm-extra-args: --timeout 900s diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml new file mode 100644 index 000000000..eb3ecf1e0 --- /dev/null +++ b/.github/workflows/helm-chart.yml @@ -0,0 +1,48 @@ +name: Helm chart + +on: + pull_request: + paths: + - "charts/**" + - ".github/ct.yaml" + - ".github/workflows/helm-chart.yml" + push: + branches: [main] + paths: + - "charts/**" + - ".github/ct.yaml" + - ".github/workflows/helm-chart.yml" + +permissions: + contents: read + +jobs: + lint-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: azure/setup-helm@v4 + with: + version: v3.19.0 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - uses: helm/chart-testing-action@v2.8.0 + + - name: Lint + run: ct lint --config .github/ct.yaml --all + + - name: Unit tests + run: | + helm plugin install https://github.com/helm-unittest/helm-unittest --version v1.1.2 + helm unittest charts/deepwiki-open + + - uses: helm/kind-action@v1 + + - name: Install on kind + run: ct install --config .github/ct.yaml --all diff --git a/README.md b/README.md index 806c0f0d4..e1f1916d9 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,21 @@ https://github.com/user-attachments/assets/48d1e60a-eb91-4c05-a5a8-3624ffb79fb1 +## ☸️ Kubernetes (Helm) + +A Helm chart lives in [`charts/deepwiki-open`](charts/deepwiki-open). It runs the published `ghcr.io/asyncfuncai/deepwiki-open` image, reads provider keys from a Secret and keeps `~/.adalflow` on a PersistentVolumeClaim: + +```bash +kubectl create namespace deepwiki +kubectl -n deepwiki create secret generic deepwiki-keys \ + --from-literal=GOOGLE_API_KEY=... --from-literal=OPENAI_API_KEY=... +helm upgrade --install deepwiki ./charts/deepwiki-open -n deepwiki \ + --set secret.existingSecret=deepwiki-keys +kubectl -n deepwiki port-forward svc/deepwiki-deepwiki-open 3000:3000 8001:8001 +``` + +See the [chart README](charts/deepwiki-open/README.md) for Ingress, Gateway API and all values. + ## 🤝 Contributing Contributions are welcome! Feel free to: diff --git a/charts/deepwiki-open/.helmignore b/charts/deepwiki-open/.helmignore new file mode 100644 index 000000000..e4b1827a3 --- /dev/null +++ b/charts/deepwiki-open/.helmignore @@ -0,0 +1,13 @@ +.DS_Store +.git/ +.gitignore +*.swp +*.bak +*.tmp +*.orig +*~ +.idea/ +.vscode/ +/tests/ +/ci/ +README.md.gotmpl diff --git a/charts/deepwiki-open/Chart.yaml b/charts/deepwiki-open/Chart.yaml new file mode 100644 index 000000000..34c0cd775 --- /dev/null +++ b/charts/deepwiki-open/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v2 +name: deepwiki-open +description: DeepWiki-Open generates interactive wikis for GitHub, GitLab and Bitbucket repositories. +type: application +version: 0.1.0 +appVersion: "latest" +kubeVersion: ">=1.25.0-0" +keywords: + - deepwiki + - documentation + - llm + - rag +home: https://github.com/AsyncFuncAI/deepwiki-open +sources: + - https://github.com/AsyncFuncAI/deepwiki-open + - https://github.com/AsyncFuncAI/deepwiki-open/tree/main/charts/deepwiki-open +annotations: + artifacthub.io/license: MIT diff --git a/charts/deepwiki-open/README.md b/charts/deepwiki-open/README.md new file mode 100644 index 000000000..e130bcaca --- /dev/null +++ b/charts/deepwiki-open/README.md @@ -0,0 +1,153 @@ +# deepwiki-open + +![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: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) + +DeepWiki-Open generates interactive wikis for GitHub, GitLab and Bitbucket repositories. + +The chart runs the image published by this repository (`ghcr.io/asyncfuncai/deepwiki-open`), which starts the Python API on port 8001 and the Next.js frontend on port 3000 in the same container. It runs as a single replica: cloned repositories, embeddings and the wiki cache live in `~/.adalflow`, kept on a PersistentVolumeClaim. + +The image has no `USER`, so the chart runs it as UID 1000 with a read-only root filesystem, sets `HOME` to a writable volume and mounts emptyDirs where the app writes (logs, Next.js cache, `/tmp`). + +## Install + +```console +kubectl create namespace deepwiki +kubectl -n deepwiki create secret generic deepwiki-keys \ + --from-literal=GOOGLE_API_KEY=... \ + --from-literal=OPENAI_API_KEY=... + +git clone https://github.com/AsyncFuncAI/deepwiki-open.git +helm upgrade --install deepwiki ./deepwiki-open/charts/deepwiki-open \ + --namespace deepwiki \ + --set secret.existingSecret=deepwiki-keys +``` + +Every key of the Secret becomes an environment variable, so any variable from the main README works there (`OPENROUTER_API_KEY`, `AWS_ACCESS_KEY_ID`, `DASHSCOPE_API_KEY`, `DEEPWIKI_AUTH_CODE`...). Non-secret settings go in `config`: + +```yaml +config: + DEEPWIKI_EMBEDDER_TYPE: ollama + OLLAMA_HOST: http://ollama.ollama:11434 + DEEPWIKI_AUTH_MODE: "true" +``` + +Then forward both ports and open http://localhost:3000: + +```console +kubectl -n deepwiki port-forward svc/deepwiki-deepwiki-open 3000:3000 8001:8001 +``` + +The image tag defaults to `latest`. Pin `image.tag` to a `sha-` tag (or set `image.digest`) to control upgrades. + +## Exposing it + +The frontend builds the chat WebSocket URL in the browser as `:8001`, because `NEXT_PUBLIC_*` variables are fixed when the image is built. With the published image the browser must reach the API on port 8001 of the same hostname as the frontend. Options: + +- `service.type: LoadBalancer`, which exposes 3000 and 8001 like `docker run` does. +- Gateway API with a second listener on port 8001: the chart renders one HTTPRoute for the frontend and, when `httpRoute.api.parentRefs` is set, another one for the API. + + ```yaml + httpRoute: + enabled: true + parentRefs: + - name: public + namespace: gateway-system + sectionName: https + hostnames: [deepwiki.example.com] + api: + parentRefs: + - name: public + namespace: gateway-system + sectionName: api # listener on port 8001 + ``` + +- An image built with `NEXT_PUBLIC_WS_BASE_URL=https://deepwiki.example.com`. The browser then uses the same host and port, and `ingress.apiPaths` (or `httpRoute.apiPaths`) sends `/ws` and `/codemap` to the API: + + ```yaml + image: + repository: registry.example.com/deepwiki-open + tag: my-build + ingress: + enabled: true + className: nginx + hosts: + - host: deepwiki.example.com + paths: + - path: / + apiPaths: [/ws, /codemap] + ``` + +## Tests + +```console +helm lint charts/deepwiki-open +helm unittest charts/deepwiki-open +helm test deepwiki -n deepwiki # after install: calls /health and the frontend proxy +``` + +## Requirements + +Kubernetes: `>=1.25.0-0` + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | Affinity rules. | +| commonLabels | object | `{}` | Extra labels added to every resource. | +| config | object | `{"LOG_LEVEL":"INFO"}` | Non-secret settings rendered into a ConfigMap and loaded as environment variables, for example DEEPWIKI_EMBEDDER_TYPE, OLLAMA_HOST, OPENAI_BASE_URL, AWS_REGION or DEEPWIKI_AUTH_MODE. | +| env | list | `[]` | Extra environment variables. | +| envFrom | list | `[]` | Extra envFrom sources. | +| extraVolumeMounts | list | `[]` | Extra volume mounts. | +| extraVolumes | list | `[]` | Extra volumes, for example a custom CA bundle. | +| fullnameOverride | string | `""` | Overrides the fully qualified resource name. | +| httpRoute.annotations | object | `{}` | HTTPRoute annotations. | +| httpRoute.api.parentRefs | list | `[]` | Gateway listeners for a second HTTPRoute that sends everything to the API, for example a listener on port 8001 for the same hostname. This is what the published image needs for chat over WebSocket. | +| httpRoute.apiPaths | list | `[]` | Path prefixes sent to the API instead of the frontend, same as `ingress.apiPaths`. | +| httpRoute.enabled | bool | `false` | Create a Gateway API HTTPRoute for the frontend. | +| httpRoute.hostnames | list | `["deepwiki.local"]` | Hostnames matched by the route. | +| httpRoute.parentRefs | list | `[{"name":"gateway","sectionName":"http"}]` | Gateways (and listeners) the route attaches to. | +| image.digest | string | `""` | Image digest. When set it takes precedence over the tag. | +| image.pullPolicy | string | `""` | Image pull policy. Left empty, Kubernetes uses Always for `latest` and IfNotPresent otherwise. | +| image.repository | string | `"ghcr.io/asyncfuncai/deepwiki-open"` | Image published by this repository's Docker workflow. It runs the Python API (port 8001) and the Next.js frontend (port 3000) in one container. | +| image.tag | string | `""` | Image tag. Defaults to the chart appVersion. Pin a `sha-` tag or a digest for reproducible installs. | +| imagePullSecrets | list | `[]` | Secrets used to pull the image. | +| ingress.annotations | object | `{}` | Ingress annotations. | +| ingress.apiPaths | list | `[]` | Path prefixes routed to the API on every host, for example `[/ws, /codemap]` with an image built with `NEXT_PUBLIC_WS_BASE_URL` set to the public URL. | +| ingress.className | string | `""` | IngressClass name. | +| ingress.enabled | bool | `false` | Create an Ingress for the frontend. | +| ingress.hosts | list | `[{"host":"deepwiki.local","paths":[{"path":"/","pathType":"Prefix"}]}]` | Hosts and paths routed to the frontend. | +| ingress.tls | list | `[]` | TLS configuration. | +| nameOverride | string | `""` | Overrides the chart name used in resource names and labels. | +| nodeSelector | object | `{}` | Node selector. | +| persistence.accessModes | list | `["ReadWriteOnce"]` | Access modes of the created claim. | +| persistence.annotations | object | `{}` | Annotations of the created claim, for example helm.sh/resource-policy: keep. | +| persistence.enabled | bool | `true` | Persist `~/.adalflow` (cloned repositories, embeddings and the wiki cache). When disabled an emptyDir is used and the data is lost on restart. | +| persistence.existingClaim | string | `""` | Use an existing PersistentVolumeClaim instead of creating one. | +| persistence.size | string | `"10Gi"` | Size of the created claim. | +| persistence.storageClass | string | `""` | StorageClass of the created claim. Empty uses the cluster default. | +| podAnnotations | object | `{}` | Extra annotations added to the pod. | +| podLabels | object | `{}` | Extra labels added to the pod. | +| podSecurityContext | object | `{"fsGroup":1000,"fsGroupChangePolicy":"OnRootMismatch","runAsGroup":1000,"runAsNonRoot":true,"runAsUser":1000,"seccompProfile":{"type":"RuntimeDefault"}}` | Pod security context. The image has no USER, so the chart runs it as an arbitrary non-root UID and points HOME at a writable volume. | +| priorityClassName | string | `""` | Priority class of the pod. | +| probes.liveness | object | `{"enabled":true,"failureThreshold":3,"httpGet":{"path":"/health","port":"api"},"periodSeconds":30,"timeoutSeconds":10}` | Liveness probe on the API health endpoint. | +| probes.readiness | object | `{"enabled":true,"failureThreshold":3,"httpGet":{"path":"/api/auth/status","port":"http"},"periodSeconds":10,"timeoutSeconds":5}` | Readiness probe through the frontend. Next.js proxies this path to the API, so both processes have to be up. | +| probes.startup | object | `{"enabled":true,"failureThreshold":60,"httpGet":{"path":"/health","port":"api"},"periodSeconds":5}` | Startup probe on the API health endpoint. | +| resources | object | `{"limits":{"memory":"6Gi"},"requests":{"cpu":"250m","memory":"2Gi"}}` | CPU and memory. The memory values follow docker-compose.yml (2g reserved, 6g limit); embedding large repositories needs the headroom. | +| revisionHistoryLimit | int | `3` | Revisions kept for rollback. | +| scratchSizeLimit | string | `"1Gi"` | Size limit of the emptyDir volumes used for HOME, logs, the Next.js cache and /tmp. | +| secret.existingSecret | string | `""` | Existing Secret whose keys are loaded as environment variables, for example OPENAI_API_KEY, GOOGLE_API_KEY, OPENROUTER_API_KEY, AWS_ACCESS_KEY_ID or DEEPWIKI_AUTH_CODE. Preferred over `secret.values`. | +| secret.values | object | `{}` | Key/value pairs rendered into a Secret managed by the chart. Empty by default; use it only when the values file is not committed anywhere. | +| securityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true}` | Container security context. Paths the app writes to (HOME, data, logs, Next.js cache, /tmp) are mounted as volumes, so the root filesystem can stay read-only. | +| service.annotations | object | `{}` | Service annotations. | +| service.ports.api | int | `8001` | Port for the Python API. The published frontend opens its chat WebSocket on `:8001`, so keep 8001 when the browser reaches the API directly. | +| service.ports.http | int | `3000` | Port for the Next.js frontend. | +| service.type | string | `"ClusterIP"` | Service type. LoadBalancer exposes both ports the same way `docker run -p 3000:3000 -p 8001:8001` does. | +| serviceAccount.annotations | object | `{}` | ServiceAccount annotations, for example eks.amazonaws.com/role-arn to reach Bedrock with IRSA. | +| serviceAccount.automountServiceAccountToken | bool | `false` | The app does not talk to the Kubernetes API, so the token is not mounted. | +| serviceAccount.create | bool | `true` | Create a dedicated ServiceAccount. | +| serviceAccount.name | string | `""` | Name of the ServiceAccount. Generated when empty. | +| strategy | object | `{"type":"Recreate"}` | Deployment strategy. Recreate is the default because the data volume is ReadWriteOnce and the app keeps local state, so it runs as a single replica. | +| terminationGracePeriodSeconds | int | `30` | Seconds Kubernetes waits after SIGTERM before killing the pod. | +| tests.image | string | `"busybox:1.37"` | Image of the `helm test` pod that calls the API health endpoint. | +| tolerations | list | `[]` | Tolerations. | diff --git a/charts/deepwiki-open/README.md.gotmpl b/charts/deepwiki-open/README.md.gotmpl new file mode 100644 index 000000000..4ad1c1cc9 --- /dev/null +++ b/charts/deepwiki-open/README.md.gotmpl @@ -0,0 +1,90 @@ +{{ template "chart.header" . }} + +{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} + +{{ template "chart.description" . }} + +The chart runs the image published by this repository (`ghcr.io/asyncfuncai/deepwiki-open`), which starts the Python API on port 8001 and the Next.js frontend on port 3000 in the same container. It runs as a single replica: cloned repositories, embeddings and the wiki cache live in `~/.adalflow`, kept on a PersistentVolumeClaim. + +The image has no `USER`, so the chart runs it as UID 1000 with a read-only root filesystem, sets `HOME` to a writable volume and mounts emptyDirs where the app writes (logs, Next.js cache, `/tmp`). + +## Install + +```console +kubectl create namespace deepwiki +kubectl -n deepwiki create secret generic deepwiki-keys \ + --from-literal=GOOGLE_API_KEY=... \ + --from-literal=OPENAI_API_KEY=... + +git clone https://github.com/AsyncFuncAI/deepwiki-open.git +helm upgrade --install deepwiki ./deepwiki-open/charts/deepwiki-open \ + --namespace deepwiki \ + --set secret.existingSecret=deepwiki-keys +``` + +Every key of the Secret becomes an environment variable, so any variable from the main README works there (`OPENROUTER_API_KEY`, `AWS_ACCESS_KEY_ID`, `DASHSCOPE_API_KEY`, `DEEPWIKI_AUTH_CODE`...). Non-secret settings go in `config`: + +```yaml +config: + DEEPWIKI_EMBEDDER_TYPE: ollama + OLLAMA_HOST: http://ollama.ollama:11434 + DEEPWIKI_AUTH_MODE: "true" +``` + +Then forward both ports and open http://localhost:3000: + +```console +kubectl -n deepwiki port-forward svc/deepwiki-deepwiki-open 3000:3000 8001:8001 +``` + +The image tag defaults to `latest`. Pin `image.tag` to a `sha-` tag (or set `image.digest`) to control upgrades. + +## Exposing it + +The frontend builds the chat WebSocket URL in the browser as `:8001`, because `NEXT_PUBLIC_*` variables are fixed when the image is built. With the published image the browser must reach the API on port 8001 of the same hostname as the frontend. Options: + +- `service.type: LoadBalancer`, which exposes 3000 and 8001 like `docker run` does. +- Gateway API with a second listener on port 8001: the chart renders one HTTPRoute for the frontend and, when `httpRoute.api.parentRefs` is set, another one for the API. + + ```yaml + httpRoute: + enabled: true + parentRefs: + - name: public + namespace: gateway-system + sectionName: https + hostnames: [deepwiki.example.com] + api: + parentRefs: + - name: public + namespace: gateway-system + sectionName: api # listener on port 8001 + ``` + +- An image built with `NEXT_PUBLIC_WS_BASE_URL=https://deepwiki.example.com`. The browser then uses the same host and port, and `ingress.apiPaths` (or `httpRoute.apiPaths`) sends `/ws` and `/codemap` to the API: + + ```yaml + image: + repository: registry.example.com/deepwiki-open + tag: my-build + ingress: + enabled: true + className: nginx + hosts: + - host: deepwiki.example.com + paths: + - path: / + apiPaths: [/ws, /codemap] + ``` + +## Tests + +```console +helm lint charts/deepwiki-open +helm unittest charts/deepwiki-open +helm test deepwiki -n deepwiki # after install: calls /health and the frontend proxy +``` + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} diff --git a/charts/deepwiki-open/ci/default-values.yaml b/charts/deepwiki-open/ci/default-values.yaml new file mode 100644 index 000000000..4375f0861 --- /dev/null +++ b/charts/deepwiki-open/ci/default-values.yaml @@ -0,0 +1,8 @@ +resources: + requests: + cpu: 100m + memory: 512Mi + limits: + memory: 4Gi +persistence: + size: 1Gi diff --git a/charts/deepwiki-open/ci/no-persistence-values.yaml b/charts/deepwiki-open/ci/no-persistence-values.yaml new file mode 100644 index 000000000..26c41e7fc --- /dev/null +++ b/charts/deepwiki-open/ci/no-persistence-values.yaml @@ -0,0 +1,14 @@ +persistence: + enabled: false +resources: + requests: + cpu: 100m + memory: 512Mi + limits: + memory: 4Gi +config: + LOG_LEVEL: DEBUG + DEEPWIKI_AUTH_MODE: "true" +secret: + values: + DEEPWIKI_AUTH_CODE: ci-only-code diff --git a/charts/deepwiki-open/templates/NOTES.txt b/charts/deepwiki-open/templates/NOTES.txt new file mode 100644 index 000000000..61abb3125 --- /dev/null +++ b/charts/deepwiki-open/templates/NOTES.txt @@ -0,0 +1,23 @@ +{{ include "deepwiki-open.fullname" . }} ({{ include "deepwiki-open.image" . }}) deployed to {{ .Release.Namespace }}. + +{{- if not (or .Values.secret.existingSecret .Values.secret.values) }} + +No provider keys configured. Create a Secret and point the release at it: + kubectl -n {{ .Release.Namespace }} create secret generic deepwiki-keys \ + --from-literal=GOOGLE_API_KEY=... --from-literal=OPENAI_API_KEY=... + helm upgrade {{ .Release.Name }} --reuse-values --set secret.existingSecret=deepwiki-keys +{{- end }} + +{{- if .Values.httpRoute.enabled }} + +Frontend exposed through the Gateway API on: {{ join ", " .Values.httpRoute.hostnames }} +{{- else if .Values.ingress.enabled }} + +Frontend exposed through the Ingress on: {{ range .Values.ingress.hosts }}{{ .host }} {{ end }} +{{- end }} +{{- if not (or .Values.httpRoute.api.parentRefs .Values.ingress.apiPaths .Values.httpRoute.apiPaths (eq .Values.service.type "LoadBalancer")) }} + +To try it locally, forward both ports (the chat opens a WebSocket on port 8001 of the page host): + kubectl -n {{ .Release.Namespace }} port-forward svc/{{ include "deepwiki-open.fullname" . }} 3000:{{ .Values.service.ports.http }} 8001:{{ .Values.service.ports.api }} +Then open http://localhost:3000 +{{- end }} diff --git a/charts/deepwiki-open/templates/_helpers.tpl b/charts/deepwiki-open/templates/_helpers.tpl new file mode 100644 index 000000000..4610c3559 --- /dev/null +++ b/charts/deepwiki-open/templates/_helpers.tpl @@ -0,0 +1,69 @@ +{{- define "deepwiki-open.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "deepwiki-open.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 -}} + +{{- define "deepwiki-open.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "deepwiki-open.selectorLabels" -}} +app.kubernetes.io/name: {{ include "deepwiki-open.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{- define "deepwiki-open.labels" -}} +helm.sh/chart: {{ include "deepwiki-open.chart" . }} +{{ include "deepwiki-open.selectorLabels" . }} +app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | trunc 63 | quote }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- with .Values.commonLabels }} +{{ toYaml . }} +{{- end }} +{{- end -}} + +{{- define "deepwiki-open.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} +{{- default (include "deepwiki-open.fullname" .) .Values.serviceAccount.name -}} +{{- else -}} +{{- default "default" .Values.serviceAccount.name -}} +{{- end -}} +{{- end -}} + +{{- define "deepwiki-open.image" -}} +{{- if .Values.image.digest -}} +{{- printf "%s@%s" .Values.image.repository .Values.image.digest -}} +{{- else -}} +{{- printf "%s:%s" .Values.image.repository (.Values.image.tag | default .Chart.AppVersion) -}} +{{- end -}} +{{- end -}} + +{{- define "deepwiki-open.claimName" -}} +{{- default (include "deepwiki-open.fullname" .) .Values.persistence.existingClaim -}} +{{- end -}} + +{{/* HOME of the non-root user. ~/.adalflow lives under it. */}} +{{- define "deepwiki-open.home" -}} +/home/deepwiki +{{- end -}} + +{{- define "deepwiki-open.validate" -}} +{{- if and .Values.secret.existingSecret .Values.secret.values -}} +{{- fail "secret: set either existingSecret or values, not both" -}} +{{- end -}} +{{- if and .Values.httpRoute.enabled (not .Values.httpRoute.parentRefs) -}} +{{- fail "httpRoute.enabled requires at least one entry in httpRoute.parentRefs" -}} +{{- end -}} +{{- end -}} diff --git a/charts/deepwiki-open/templates/configmap.yaml b/charts/deepwiki-open/templates/configmap.yaml new file mode 100644 index 000000000..48db8a485 --- /dev/null +++ b/charts/deepwiki-open/templates/configmap.yaml @@ -0,0 +1,12 @@ +{{- if .Values.config }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "deepwiki-open.fullname" . }} + labels: + {{- include "deepwiki-open.labels" . | nindent 4 }} +data: + {{- range $key, $value := .Values.config }} + {{ $key }}: {{ $value | toString | quote }} + {{- end }} +{{- end }} diff --git a/charts/deepwiki-open/templates/deployment.yaml b/charts/deepwiki-open/templates/deployment.yaml new file mode 100644 index 000000000..afa7a98e7 --- /dev/null +++ b/charts/deepwiki-open/templates/deployment.yaml @@ -0,0 +1,150 @@ +{{- include "deepwiki-open.validate" . -}} +{{- $home := include "deepwiki-open.home" . -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "deepwiki-open.fullname" . }} + labels: + {{- include "deepwiki-open.labels" . | nindent 4 }} +spec: + replicas: 1 + revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} + strategy: + {{- toYaml .Values.strategy | nindent 4 }} + selector: + matchLabels: + {{- include "deepwiki-open.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if .Values.config }} + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- end }} + {{- if .Values.secret.values }} + checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + {{- end }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "deepwiki-open.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "deepwiki-open.serviceAccountName" . }} + automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.priorityClassName }} + priorityClassName: {{ . }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} + containers: + - name: deepwiki + image: {{ include "deepwiki-open.image" . }} + {{- with .Values.image.pullPolicy }} + imagePullPolicy: {{ . }} + {{- end }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - name: http + containerPort: 3000 + protocol: TCP + - name: api + containerPort: 8001 + protocol: TCP + env: + - name: HOME + value: {{ $home }} + - name: LOG_FILE_PATH + value: /app/api/logs/application.log + {{- with .Values.env }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- if or .Values.config .Values.secret.existingSecret .Values.secret.values .Values.envFrom }} + envFrom: + {{- if .Values.config }} + - configMapRef: + name: {{ include "deepwiki-open.fullname" . }} + {{- end }} + {{- if or .Values.secret.existingSecret .Values.secret.values }} + - secretRef: + name: {{ .Values.secret.existingSecret | default (include "deepwiki-open.fullname" .) }} + {{- end }} + {{- with .Values.envFrom }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- end }} + {{- with .Values.probes.startup }} + {{- if .enabled }} + startupProbe: + {{- toYaml (omit . "enabled") | nindent 12 }} + {{- end }} + {{- end }} + {{- with .Values.probes.liveness }} + {{- if .enabled }} + livenessProbe: + {{- toYaml (omit . "enabled") | nindent 12 }} + {{- end }} + {{- end }} + {{- with .Values.probes.readiness }} + {{- if .enabled }} + readinessProbe: + {{- toYaml (omit . "enabled") | nindent 12 }} + {{- end }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: scratch + mountPath: {{ $home }} + subPath: home + - name: data + mountPath: {{ $home }}/.adalflow + - name: scratch + mountPath: /app/api/logs + subPath: logs + - name: scratch + mountPath: /app/.next/cache + subPath: next-cache + - name: scratch + mountPath: /app/embedding_cache + subPath: embedding-cache + - name: scratch + mountPath: /tmp + subPath: tmp + {{- with .Values.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + volumes: + - name: scratch + emptyDir: + sizeLimit: {{ .Values.scratchSizeLimit }} + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "deepwiki-open.claimName" . }} + {{- else }} + emptyDir: {} + {{- end }} + {{- with .Values.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- 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 }} diff --git a/charts/deepwiki-open/templates/httproute.yaml b/charts/deepwiki-open/templates/httproute.yaml new file mode 100644 index 000000000..575cef53a --- /dev/null +++ b/charts/deepwiki-open/templates/httproute.yaml @@ -0,0 +1,68 @@ +{{- include "deepwiki-open.validate" . -}} +{{- if .Values.httpRoute.enabled }} +{{- $fullname := include "deepwiki-open.fullname" . -}} +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: {{ $fullname }} + labels: + {{- include "deepwiki-open.labels" . | nindent 4 }} + {{- with .Values.httpRoute.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + parentRefs: + {{- toYaml .Values.httpRoute.parentRefs | nindent 4 }} + {{- with .Values.httpRoute.hostnames }} + hostnames: + {{- toYaml . | nindent 4 }} + {{- end }} + rules: + {{- with .Values.httpRoute.apiPaths }} + - matches: + {{- range . }} + - path: + type: PathPrefix + value: {{ . }} + {{- end }} + backendRefs: + - name: {{ $fullname }} + port: {{ $.Values.service.ports.api }} + {{- end }} + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: {{ $fullname }} + port: {{ .Values.service.ports.http }} +{{- with .Values.httpRoute.api.parentRefs }} +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: {{ $fullname }}-api + labels: + {{- include "deepwiki-open.labels" $ | nindent 4 }} + {{- with $.Values.httpRoute.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + parentRefs: + {{- toYaml . | nindent 4 }} + {{- with $.Values.httpRoute.hostnames }} + hostnames: + {{- toYaml . | nindent 4 }} + {{- end }} + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: {{ $fullname }} + port: {{ $.Values.service.ports.api }} +{{- end }} +{{- end }} diff --git a/charts/deepwiki-open/templates/ingress.yaml b/charts/deepwiki-open/templates/ingress.yaml new file mode 100644 index 000000000..e9558d44d --- /dev/null +++ b/charts/deepwiki-open/templates/ingress.yaml @@ -0,0 +1,47 @@ +{{- if .Values.ingress.enabled }} +{{- $fullname := include "deepwiki-open.fullname" . -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullname }} + labels: + {{- include "deepwiki-open.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- with .Values.ingress.className }} + ingressClassName: {{ . }} + {{- end }} + {{- with .Values.ingress.tls }} + tls: + {{- toYaml . | nindent 4 }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - http: + paths: + {{- range $.Values.ingress.apiPaths }} + - path: {{ . }} + pathType: Prefix + backend: + service: + name: {{ $fullname }} + port: + name: api + {{- end }} + {{- range .paths }} + - path: {{ .path }} + pathType: {{ .pathType | default "Prefix" }} + backend: + service: + name: {{ $fullname }} + port: + name: http + {{- end }} + {{- with .host }} + host: {{ . | quote }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/deepwiki-open/templates/pvc.yaml b/charts/deepwiki-open/templates/pvc.yaml new file mode 100644 index 000000000..6998f5c1e --- /dev/null +++ b/charts/deepwiki-open/templates/pvc.yaml @@ -0,0 +1,21 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "deepwiki-open.fullname" . }} + labels: + {{- include "deepwiki-open.labels" . | nindent 4 }} + {{- with .Values.persistence.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + accessModes: + {{- toYaml .Values.persistence.accessModes | nindent 4 }} + {{- with .Values.persistence.storageClass }} + storageClassName: {{ if eq . "-" }}""{{ else }}{{ . }}{{ end }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size }} +{{- end }} diff --git a/charts/deepwiki-open/templates/secret.yaml b/charts/deepwiki-open/templates/secret.yaml new file mode 100644 index 000000000..43483b24c --- /dev/null +++ b/charts/deepwiki-open/templates/secret.yaml @@ -0,0 +1,13 @@ +{{- if and .Values.secret.values (not .Values.secret.existingSecret) }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "deepwiki-open.fullname" . }} + labels: + {{- include "deepwiki-open.labels" . | nindent 4 }} +type: Opaque +stringData: + {{- range $key, $value := .Values.secret.values }} + {{ $key }}: {{ $value | toString | quote }} + {{- end }} +{{- end }} diff --git a/charts/deepwiki-open/templates/service.yaml b/charts/deepwiki-open/templates/service.yaml new file mode 100644 index 000000000..f960f26ff --- /dev/null +++ b/charts/deepwiki-open/templates/service.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "deepwiki-open.fullname" . }} + labels: + {{- include "deepwiki-open.labels" . | nindent 4 }} + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + selector: + {{- include "deepwiki-open.selectorLabels" . | nindent 4 }} + ports: + - name: http + port: {{ .Values.service.ports.http }} + targetPort: http + protocol: TCP + - name: api + port: {{ .Values.service.ports.api }} + targetPort: api + protocol: TCP diff --git a/charts/deepwiki-open/templates/serviceaccount.yaml b/charts/deepwiki-open/templates/serviceaccount.yaml new file mode 100644 index 000000000..841da37d7 --- /dev/null +++ b/charts/deepwiki-open/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "deepwiki-open.serviceAccountName" . }} + labels: + {{- include "deepwiki-open.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} +{{- end }} diff --git a/charts/deepwiki-open/templates/tests/test-health.yaml b/charts/deepwiki-open/templates/tests/test-health.yaml new file mode 100644 index 000000000..5706a4557 --- /dev/null +++ b/charts/deepwiki-open/templates/tests/test-health.yaml @@ -0,0 +1,40 @@ +apiVersion: v1 +kind: Pod +metadata: + name: {{ include "deepwiki-open.fullname" . }}-test-health + labels: + {{- include "deepwiki-open.labels" . | nindent 4 }} + annotations: + helm.sh/hook: test + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded +spec: + restartPolicy: Never + automountServiceAccountToken: false + securityContext: + runAsNonRoot: true + runAsUser: 65534 + runAsGroup: 65534 + seccompProfile: + type: RuntimeDefault + containers: + - name: health + image: {{ .Values.tests.image }} + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: + - ALL + command: + - sh + - -c + - | + set -e + wget -qO- http://{{ include "deepwiki-open.fullname" . }}:{{ .Values.service.ports.api }}/health + wget -qO- http://{{ include "deepwiki-open.fullname" . }}:{{ .Values.service.ports.http }}/api/auth/status + resources: + requests: + cpu: 10m + memory: 16Mi + limits: + memory: 32Mi diff --git a/charts/deepwiki-open/tests/deployment_test.yaml b/charts/deepwiki-open/tests/deployment_test.yaml new file mode 100644 index 000000000..a12495e08 --- /dev/null +++ b/charts/deepwiki-open/tests/deployment_test.yaml @@ -0,0 +1,188 @@ +suite: deployment +templates: + - deployment.yaml + - configmap.yaml + - secret.yaml +tests: + - it: runs the published image as non-root with a read-only root filesystem + template: deployment.yaml + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: ghcr.io/asyncfuncai/deepwiki-open:latest + - equal: + path: spec.template.spec.securityContext.runAsNonRoot + value: true + - equal: + path: spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem + value: true + - equal: + path: spec.template.spec.containers[0].securityContext.capabilities.drop + value: [ALL] + - equal: + path: spec.template.spec.automountServiceAccountToken + value: false + - notExists: + path: spec.template.spec.containers[0].imagePullPolicy + - it: exposes the frontend and the API ports + template: deployment.yaml + asserts: + - equal: + path: spec.template.spec.containers[0].ports + value: + - name: http + containerPort: 3000 + protocol: TCP + - name: api + containerPort: 8001 + protocol: TCP + - it: probes the API health endpoint and the frontend proxy + template: deployment.yaml + asserts: + - equal: + path: spec.template.spec.containers[0].livenessProbe.httpGet + value: + path: /health + port: api + - equal: + path: spec.template.spec.containers[0].startupProbe.httpGet.path + value: /health + - equal: + path: spec.template.spec.containers[0].readinessProbe.httpGet + value: + path: /api/auth/status + port: http + - it: can disable a probe + template: deployment.yaml + set: + probes.startup.enabled: false + asserts: + - notExists: + path: spec.template.spec.containers[0].startupProbe + - it: keeps ~/.adalflow on the PVC and HOME on a writable volume + template: deployment.yaml + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: HOME + value: /home/deepwiki + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: data + mountPath: /home/deepwiki/.adalflow + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: scratch + mountPath: /app/api/logs + subPath: logs + - equal: + path: spec.template.spec.volumes[1].persistentVolumeClaim.claimName + value: RELEASE-NAME-deepwiki-open + - equal: + path: spec.strategy.type + value: Recreate + - it: uses an existing claim + template: deployment.yaml + set: + persistence.existingClaim: my-data + asserts: + - equal: + path: spec.template.spec.volumes[1].persistentVolumeClaim.claimName + value: my-data + - it: falls back to emptyDir without persistence + template: deployment.yaml + set: + persistence.enabled: false + asserts: + - equal: + path: spec.template.spec.volumes[1] + value: + name: data + emptyDir: {} + - it: loads provider keys from an existing Secret + template: deployment.yaml + set: + secret.existingSecret: deepwiki-keys + asserts: + - contains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: deepwiki-keys + - notExists: + path: spec.template.metadata.annotations["checksum/secret"] + - it: does not reference any Secret by default + template: deployment.yaml + asserts: + - notContains: + path: spec.template.spec.containers[0].envFrom + any: true + content: + secretRef: {} + - it: renders no Secret by default + template: secret.yaml + asserts: + - hasDocuments: + count: 0 + - it: renders inline secret values and rolls the pod when they change + set: + secret.values: + GOOGLE_API_KEY: abc + asserts: + - template: secret.yaml + equal: + path: stringData.GOOGLE_API_KEY + value: abc + - template: deployment.yaml + exists: + path: spec.template.metadata.annotations["checksum/secret"] + - it: refuses existingSecret and inline values together + template: deployment.yaml + set: + secret.existingSecret: deepwiki-keys + secret.values: + GOOGLE_API_KEY: abc + asserts: + - failedTemplate: + errorMessage: "secret: set either existingSecret or values, not both" + - it: renders config as strings + template: configmap.yaml + set: + config: + DEEPWIKI_AUTH_MODE: true + OLLAMA_HOST: http://ollama:11434 + asserts: + - equal: + path: data.DEEPWIKI_AUTH_MODE + value: "true" + - equal: + path: data.OLLAMA_HOST + value: http://ollama:11434 + - it: pins the image by digest + template: deployment.yaml + set: + image.digest: sha256:0000000000000000000000000000000000000000000000000000000000000000 + asserts: + - matchRegex: + path: spec.template.spec.containers[0].image + pattern: "@sha256:0{64}$" + - it: passes scheduling constraints through + template: deployment.yaml + set: + nodeSelector: + kubernetes.io/arch: arm64 + tolerations: + - key: dedicated + operator: Equal + value: deepwiki + effect: NoSchedule + asserts: + - equal: + path: spec.template.spec.nodeSelector["kubernetes.io/arch"] + value: arm64 + - equal: + path: spec.template.spec.tolerations[0].key + value: dedicated diff --git a/charts/deepwiki-open/tests/exposure_test.yaml b/charts/deepwiki-open/tests/exposure_test.yaml new file mode 100644 index 000000000..43a5dc805 --- /dev/null +++ b/charts/deepwiki-open/tests/exposure_test.yaml @@ -0,0 +1,98 @@ +suite: exposure and storage +templates: + - service.yaml + - ingress.yaml + - httproute.yaml + - pvc.yaml +tests: + - it: exposes both ports on the Service + template: service.yaml + asserts: + - equal: + path: spec.ports[0] + value: + name: http + port: 3000 + targetPort: http + protocol: TCP + - equal: + path: spec.ports[1].port + value: 8001 + - it: routes the frontend through the Ingress + template: ingress.yaml + set: + ingress.enabled: true + ingress.className: nginx + asserts: + - equal: + path: spec.ingressClassName + value: nginx + - equal: + path: spec.rules[0].http.paths[0].backend.service.port.name + value: http + - it: sends apiPaths to the API port before the frontend catch-all + template: ingress.yaml + set: + ingress.enabled: true + ingress.apiPaths: [/ws, /codemap] + asserts: + - equal: + path: spec.rules[0].http.paths[0].path + value: /ws + - equal: + path: spec.rules[0].http.paths[0].backend.service.port.name + value: api + - equal: + path: spec.rules[0].http.paths[2].backend.service.port.name + value: http + - it: renders only the frontend HTTPRoute by default + template: httproute.yaml + set: + httpRoute.enabled: true + asserts: + - hasDocuments: + count: 1 + - equal: + path: spec.rules[0].backendRefs[0].port + value: 3000 + - it: adds an API HTTPRoute for a dedicated listener + template: httproute.yaml + set: + httpRoute.enabled: true + httpRoute.api.parentRefs: + - name: gateway + sectionName: api + asserts: + - hasDocuments: + count: 2 + - documentIndex: 1 + equal: + path: metadata.name + value: RELEASE-NAME-deepwiki-open-api + - documentIndex: 1 + equal: + path: spec.rules[0].backendRefs[0].port + value: 8001 + - it: creates a PVC by default + template: pvc.yaml + asserts: + - equal: + path: spec.resources.requests.storage + value: 10Gi + - notExists: + path: spec.storageClassName + - it: skips the PVC with an existing claim + template: pvc.yaml + set: + persistence.existingClaim: my-data + asserts: + - hasDocuments: + count: 0 + - it: requires parentRefs for the HTTPRoute + template: httproute.yaml + set: + httpRoute.enabled: true + httpRoute.parentRefs: null + asserts: + - failedTemplate: + errorMessage: "httpRoute.enabled requires at least one entry in httpRoute.parentRefs" diff --git a/charts/deepwiki-open/values.schema.json b/charts/deepwiki-open/values.schema.json new file mode 100644 index 000000000..b94b6f60b --- /dev/null +++ b/charts/deepwiki-open/values.schema.json @@ -0,0 +1,179 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema#", + "type": "object", + "required": ["image", "service", "persistence", "resources"], + "properties": { + "nameOverride": {"type": "string"}, + "fullnameOverride": {"type": "string"}, + "image": { + "type": "object", + "required": ["repository"], + "properties": { + "repository": {"type": "string", "minLength": 1}, + "tag": {"type": "string"}, + "digest": {"type": "string", "pattern": "^(|sha256:[a-f0-9]{64})$"}, + "pullPolicy": {"type": "string", "enum": ["", "Always", "IfNotPresent", "Never"]} + }, + "additionalProperties": false + }, + "imagePullSecrets": {"type": "array"}, + "revisionHistoryLimit": {"type": "integer", "minimum": 0}, + "strategy": { + "type": "object", + "properties": { + "type": {"type": "string", "enum": ["Recreate", "RollingUpdate"]} + } + }, + "commonLabels": {"type": "object", "additionalProperties": {"type": "string"}}, + "podAnnotations": {"type": "object", "additionalProperties": {"type": "string"}}, + "podLabels": {"type": "object", "additionalProperties": {"type": "string"}}, + "serviceAccount": { + "type": "object", + "properties": { + "create": {"type": "boolean"}, + "name": {"type": "string"}, + "annotations": {"type": "object", "additionalProperties": {"type": "string"}}, + "automountServiceAccountToken": {"type": "boolean"} + }, + "additionalProperties": false + }, + "podSecurityContext": {"type": "object"}, + "securityContext": {"type": "object"}, + "service": { + "type": "object", + "required": ["ports"], + "properties": { + "type": {"type": "string", "enum": ["ClusterIP", "NodePort", "LoadBalancer"]}, + "ports": { + "type": "object", + "required": ["http", "api"], + "properties": { + "http": {"type": "integer", "minimum": 1, "maximum": 65535}, + "api": {"type": "integer", "minimum": 1, "maximum": 65535} + }, + "additionalProperties": false + }, + "annotations": {"type": "object", "additionalProperties": {"type": "string"}} + }, + "additionalProperties": false + }, + "ingress": { + "type": "object", + "properties": { + "enabled": {"type": "boolean"}, + "className": {"type": "string"}, + "annotations": {"type": "object", "additionalProperties": {"type": "string"}}, + "hosts": { + "type": "array", + "items": { + "type": "object", + "required": ["paths"], + "properties": { + "host": {"type": "string"}, + "paths": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": ["path"], + "properties": { + "path": {"type": "string", "pattern": "^/"}, + "pathType": {"type": "string", "enum": ["Prefix", "Exact", "ImplementationSpecific"]} + } + } + } + } + } + }, + "apiPaths": {"type": "array", "items": {"type": "string", "pattern": "^/"}}, + "tls": {"type": "array"} + }, + "additionalProperties": false + }, + "httpRoute": { + "type": "object", + "properties": { + "enabled": {"type": "boolean"}, + "annotations": {"type": "object", "additionalProperties": {"type": "string"}}, + "parentRefs": { + "type": "array", + "items": {"type": "object", "required": ["name"]} + }, + "hostnames": {"type": "array", "items": {"type": "string"}}, + "apiPaths": {"type": "array", "items": {"type": "string", "pattern": "^/"}}, + "api": { + "type": "object", + "properties": { + "parentRefs": { + "type": "array", + "items": {"type": "object", "required": ["name"]} + } + } + } + }, + "if": {"properties": {"enabled": {"const": true}}}, + "then": {"properties": {"parentRefs": {"minItems": 1}}}, + "additionalProperties": false + }, + "secret": { + "type": "object", + "properties": { + "existingSecret": {"type": "string"}, + "values": {"type": "object", "additionalProperties": {"type": ["string", "number", "boolean"]}} + }, + "additionalProperties": false + }, + "config": {"type": "object", "additionalProperties": {"type": ["string", "number", "boolean"]}}, + "env": {"type": "array", "items": {"type": "object", "required": ["name"]}}, + "envFrom": {"type": "array"}, + "persistence": { + "type": "object", + "properties": { + "enabled": {"type": "boolean"}, + "existingClaim": {"type": "string"}, + "storageClass": {"type": "string"}, + "accessModes": { + "type": "array", + "minItems": 1, + "items": {"type": "string", "enum": ["ReadWriteOnce", "ReadWriteOncePod", "ReadWriteMany", "ReadOnlyMany"]} + }, + "size": {"type": "string", "pattern": "^[0-9]+(\\.[0-9]+)?(Ki|Mi|Gi|Ti|Pi|Ei|k|M|G|T|P|E)?$"}, + "annotations": {"type": "object", "additionalProperties": {"type": "string"}} + }, + "additionalProperties": false + }, + "scratchSizeLimit": {"type": "string"}, + "resources": {"type": "object"}, + "probes": { + "type": "object", + "properties": { + "startup": {"$ref": "#/definitions/probe"}, + "liveness": {"$ref": "#/definitions/probe"}, + "readiness": {"$ref": "#/definitions/probe"} + }, + "additionalProperties": false + }, + "terminationGracePeriodSeconds": {"type": "integer", "minimum": 0}, + "priorityClassName": {"type": "string"}, + "nodeSelector": {"type": "object", "additionalProperties": {"type": "string"}}, + "tolerations": {"type": "array"}, + "affinity": {"type": "object"}, + "extraVolumes": {"type": "array"}, + "extraVolumeMounts": {"type": "array"}, + "tests": { + "type": "object", + "properties": { + "image": {"type": "string", "minLength": 1} + } + } + }, + "definitions": { + "probe": { + "type": "object", + "required": ["enabled"], + "properties": { + "enabled": {"type": "boolean"} + } + } + } +} diff --git a/charts/deepwiki-open/values.yaml b/charts/deepwiki-open/values.yaml new file mode 100644 index 000000000..82d935097 --- /dev/null +++ b/charts/deepwiki-open/values.yaml @@ -0,0 +1,196 @@ +# -- Overrides the chart name used in resource names and labels. +nameOverride: "" +# -- Overrides the fully qualified resource name. +fullnameOverride: "" + +image: + # -- Image published by this repository's Docker workflow. It runs the Python API (port 8001) and the Next.js frontend (port 3000) in one container. + repository: ghcr.io/asyncfuncai/deepwiki-open + # -- Image tag. Defaults to the chart appVersion. Pin a `sha-` tag or a digest for reproducible installs. + tag: "" + # -- Image digest. When set it takes precedence over the tag. + digest: "" + # -- Image pull policy. Left empty, Kubernetes uses Always for `latest` and IfNotPresent otherwise. + pullPolicy: "" + +# -- Secrets used to pull the image. +imagePullSecrets: [] + +# -- Revisions kept for rollback. +revisionHistoryLimit: 3 + +# -- Deployment strategy. Recreate is the default because the data volume is ReadWriteOnce and the app keeps local state, so it runs as a single replica. +strategy: + type: Recreate + +# -- Extra labels added to every resource. +commonLabels: {} +# -- Extra annotations added to the pod. +podAnnotations: {} +# -- Extra labels added to the pod. +podLabels: {} + +serviceAccount: + # -- Create a dedicated ServiceAccount. + create: true + # -- Name of the ServiceAccount. Generated when empty. + name: "" + # -- ServiceAccount annotations, for example eks.amazonaws.com/role-arn to reach Bedrock with IRSA. + annotations: {} + # -- The app does not talk to the Kubernetes API, so the token is not mounted. + automountServiceAccountToken: false + +# -- Pod security context. The image has no USER, so the chart runs it as an arbitrary non-root UID and points HOME at a writable volume. +podSecurityContext: + runAsNonRoot: true + runAsUser: 1000 + runAsGroup: 1000 + fsGroup: 1000 + fsGroupChangePolicy: OnRootMismatch + seccompProfile: + type: RuntimeDefault + +# -- Container security context. Paths the app writes to (HOME, data, logs, Next.js cache, /tmp) are mounted as volumes, so the root filesystem can stay read-only. +securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: + - ALL + +service: + # -- Service type. LoadBalancer exposes both ports the same way `docker run -p 3000:3000 -p 8001:8001` does. + type: ClusterIP + ports: + # -- Port for the Next.js frontend. + http: 3000 + # -- Port for the Python API. The published frontend opens its chat WebSocket on `:8001`, so keep 8001 when the browser reaches the API directly. + api: 8001 + # -- Service annotations. + annotations: {} + +ingress: + # -- Create an Ingress for the frontend. + enabled: false + # -- IngressClass name. + className: "" + # -- Ingress annotations. + annotations: {} + # -- Hosts and paths routed to the frontend. + hosts: + - host: deepwiki.local + paths: + - path: / + pathType: Prefix + # -- Path prefixes routed to the API on every host, for example `[/ws, /codemap]` with an image built with `NEXT_PUBLIC_WS_BASE_URL` set to the public URL. + apiPaths: [] + # -- TLS configuration. + tls: [] + +httpRoute: + # -- Create a Gateway API HTTPRoute for the frontend. + enabled: false + # -- HTTPRoute annotations. + annotations: {} + # -- Gateways (and listeners) the route attaches to. + parentRefs: + - name: gateway + sectionName: http + # -- Hostnames matched by the route. + hostnames: + - deepwiki.local + # -- Path prefixes sent to the API instead of the frontend, same as `ingress.apiPaths`. + apiPaths: [] + api: + # -- Gateway listeners for a second HTTPRoute that sends everything to the API, for example a listener on port 8001 for the same hostname. This is what the published image needs for chat over WebSocket. + parentRefs: [] + +secret: + # -- Existing Secret whose keys are loaded as environment variables, for example OPENAI_API_KEY, GOOGLE_API_KEY, OPENROUTER_API_KEY, AWS_ACCESS_KEY_ID or DEEPWIKI_AUTH_CODE. Preferred over `secret.values`. + existingSecret: "" + # -- Key/value pairs rendered into a Secret managed by the chart. Empty by default; use it only when the values file is not committed anywhere. + values: {} + +# -- Non-secret settings rendered into a ConfigMap and loaded as environment variables, for example DEEPWIKI_EMBEDDER_TYPE, OLLAMA_HOST, OPENAI_BASE_URL, AWS_REGION or DEEPWIKI_AUTH_MODE. +config: + LOG_LEVEL: INFO + +# -- Extra environment variables. +env: [] +# -- Extra envFrom sources. +envFrom: [] + +persistence: + # -- Persist `~/.adalflow` (cloned repositories, embeddings and the wiki cache). When disabled an emptyDir is used and the data is lost on restart. + enabled: true + # -- Use an existing PersistentVolumeClaim instead of creating one. + existingClaim: "" + # -- StorageClass of the created claim. Empty uses the cluster default. + storageClass: "" + # -- Access modes of the created claim. + accessModes: + - ReadWriteOnce + # -- Size of the created claim. + size: 10Gi + # -- Annotations of the created claim, for example helm.sh/resource-policy: keep. + annotations: {} + +# -- Size limit of the emptyDir volumes used for HOME, logs, the Next.js cache and /tmp. +scratchSizeLimit: 1Gi + +# -- CPU and memory. The memory values follow docker-compose.yml (2g reserved, 6g limit); embedding large repositories needs the headroom. +resources: + requests: + cpu: 250m + memory: 2Gi + limits: + memory: 6Gi + +probes: + # -- Startup probe on the API health endpoint. + startup: + enabled: true + httpGet: + path: /health + port: api + periodSeconds: 5 + failureThreshold: 60 + # -- Liveness probe on the API health endpoint. + liveness: + enabled: true + httpGet: + path: /health + port: api + periodSeconds: 30 + timeoutSeconds: 10 + failureThreshold: 3 + # -- Readiness probe through the frontend. Next.js proxies this path to the API, so both processes have to be up. + readiness: + enabled: true + httpGet: + path: /api/auth/status + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + +# -- Seconds Kubernetes waits after SIGTERM before killing the pod. +terminationGracePeriodSeconds: 30 + +# -- Priority class of the pod. +priorityClassName: "" +# -- Node selector. +nodeSelector: {} +# -- Tolerations. +tolerations: [] +# -- Affinity rules. +affinity: {} + +# -- Extra volumes, for example a custom CA bundle. +extraVolumes: [] +# -- Extra volume mounts. +extraVolumeMounts: [] + +tests: + # -- Image of the `helm test` pod that calls the API health endpoint. + image: busybox:1.37