diff --git a/apps/base/open-webui/deployment.yaml b/apps/base/open-webui/deployment.yaml new file mode 100644 index 0000000..4c52373 --- /dev/null +++ b/apps/base/open-webui/deployment.yaml @@ -0,0 +1,69 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: open-webui + namespace: open-webui +spec: + replicas: 1 + selector: + matchLabels: + app: open-webui + strategy: + type: Recreate + template: + metadata: + annotations: + reloader.stakater.com/auto: "true" + labels: + app: open-webui + spec: + containers: + - name: open-webui + image: ghcr.io/open-webui/open-webui:main + imagePullPolicy: Always + ports: + - containerPort: 8080 + name: http + protocol: TCP + env: + - name: OPENAI_API_BASE_URL + value: http://litellm-pooler.litellm.svc.cluster.local:4000 + - name: WEBUI_URL + value: https://chat.k8s.syd1.au.unkin.net + envFrom: + - secretRef: + name: open-webui-credentials + livenessProbe: + httpGet: + path: /health + port: 8080 + failureThreshold: 3 + initialDelaySeconds: 30 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 5 + readinessProbe: + httpGet: + path: /health + port: 8080 + failureThreshold: 3 + initialDelaySeconds: 10 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + resources: + limits: + cpu: "2" + memory: 4Gi + requests: + cpu: 250m + memory: 512Mi + volumeMounts: + - mountPath: /app/backend/data + name: data + restartPolicy: Always + volumes: + - name: data + persistentVolumeClaim: + claimName: open-webui-data diff --git a/apps/base/open-webui/gateway.yaml b/apps/base/open-webui/gateway.yaml new file mode 100644 index 0000000..99cb2c9 --- /dev/null +++ b/apps/base/open-webui/gateway.yaml @@ -0,0 +1,37 @@ +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + labels: + traefik.io/instance: external + annotations: + cert-manager.io/cluster-issuer: vault-issuer + cert-manager.io/common-name: chat.k8s.syd1.au.unkin.net + cert-manager.io/private-key-size: "4096" + external-dns.alpha.kubernetes.io/hostname: chat.k8s.syd1.au.unkin.net + external-dns.alpha.kubernetes.io/target: 198.18.200.0 + name: open-webui + namespace: open-webui +spec: + gatewayClassName: traefik-external + listeners: + - allowedRoutes: + namespaces: + from: Same + hostname: chat.k8s.syd1.au.unkin.net + name: http + port: 80 + protocol: HTTP + - allowedRoutes: + namespaces: + from: Same + hostname: chat.k8s.syd1.au.unkin.net + name: https + port: 443 + protocol: HTTPS + tls: + certificateRefs: + - group: "" + kind: Secret + name: open-webui-tls + mode: Terminate diff --git a/apps/base/open-webui/httproute.yaml b/apps/base/open-webui/httproute.yaml new file mode 100644 index 0000000..17f8019 --- /dev/null +++ b/apps/base/open-webui/httproute.yaml @@ -0,0 +1,49 @@ +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: open-webui-http-redirect + namespace: open-webui +spec: + hostnames: + - chat.k8s.syd1.au.unkin.net + parentRefs: + - group: gateway.networking.k8s.io + kind: Gateway + name: open-webui + sectionName: http + rules: + - filters: + - type: RequestRedirect + requestRedirect: + scheme: https + statusCode: 301 + matches: + - path: + type: PathPrefix + value: / +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: open-webui + namespace: open-webui +spec: + hostnames: + - chat.k8s.syd1.au.unkin.net + parentRefs: + - group: gateway.networking.k8s.io + kind: Gateway + name: open-webui + sectionName: https + rules: + - backendRefs: + - group: "" + kind: Service + name: open-webui + port: 8080 + weight: 1 + matches: + - path: + type: PathPrefix + value: / diff --git a/apps/base/open-webui/kustomization.yaml b/apps/base/open-webui/kustomization.yaml new file mode 100644 index 0000000..b52c2f7 --- /dev/null +++ b/apps/base/open-webui/kustomization.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - namespace.yaml + - pvc.yaml + - deployment.yaml + - service.yaml + - gateway.yaml + - httproute.yaml + - vaultauth.yaml + - vaultstaticsecret.yaml diff --git a/apps/base/open-webui/namespace.yaml b/apps/base/open-webui/namespace.yaml new file mode 100644 index 0000000..b399aef --- /dev/null +++ b/apps/base/open-webui/namespace.yaml @@ -0,0 +1,5 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: open-webui diff --git a/apps/base/open-webui/pvc.yaml b/apps/base/open-webui/pvc.yaml new file mode 100644 index 0000000..9069130 --- /dev/null +++ b/apps/base/open-webui/pvc.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: open-webui-data + namespace: open-webui +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + storageClassName: cephrbd-fast-delete diff --git a/apps/base/open-webui/service.yaml b/apps/base/open-webui/service.yaml new file mode 100644 index 0000000..773c7f5 --- /dev/null +++ b/apps/base/open-webui/service.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: open-webui + namespace: open-webui +spec: + internalTrafficPolicy: Cluster + ports: + - name: http + port: 8080 + protocol: TCP + targetPort: http + selector: + app: open-webui + sessionAffinity: None + type: ClusterIP diff --git a/apps/base/open-webui/vaultauth.yaml b/apps/base/open-webui/vaultauth.yaml new file mode 100644 index 0000000..4fa4282 --- /dev/null +++ b/apps/base/open-webui/vaultauth.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: secrets.hashicorp.com/v1beta1 +kind: VaultAuth +metadata: + name: default + namespace: open-webui +spec: + allowedNamespaces: + - open-webui + kubernetes: + audiences: + - vault + role: default + serviceAccount: default + tokenExpirationSeconds: 600 + method: kubernetes + mount: k8s/au/syd1 + vaultConnectionRef: vso-system/default diff --git a/apps/base/open-webui/vaultstaticsecret.yaml b/apps/base/open-webui/vaultstaticsecret.yaml new file mode 100644 index 0000000..ca10d84 --- /dev/null +++ b/apps/base/open-webui/vaultstaticsecret.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: secrets.hashicorp.com/v1beta1 +kind: VaultStaticSecret +metadata: + name: open-webui-credentials + namespace: open-webui +spec: + destination: + create: true + name: open-webui-credentials + overwrite: true + hmacSecretData: true + mount: kv + path: kubernetes/namespace/open-webui/default/open-webui-credentials + refreshAfter: 5m + type: kv-v2 + vaultAuthRef: default diff --git a/apps/overlays/au-syd1/open-webui/kustomization.yaml b/apps/overlays/au-syd1/open-webui/kustomization.yaml new file mode 100644 index 0000000..6716c15 --- /dev/null +++ b/apps/overlays/au-syd1/open-webui/kustomization.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../../base/open-webui diff --git a/argocd/applicationsets/aitooling.yaml b/argocd/applicationsets/aitooling.yaml index 7d0e81b..8869416 100644 --- a/argocd/applicationsets/aitooling.yaml +++ b/argocd/applicationsets/aitooling.yaml @@ -11,6 +11,7 @@ spec: revision: HEAD directories: - path: apps/overlays/*/litellm + - path: apps/overlays/*/open-webui - path: apps/overlays/*/paperclip template: metadata: diff --git a/argocd/projects/aitooling.yaml b/argocd/projects/aitooling.yaml index a60e350..15ad092 100644 --- a/argocd/projects/aitooling.yaml +++ b/argocd/projects/aitooling.yaml @@ -11,6 +11,8 @@ spec: destinations: - namespace: 'litellm' server: https://kubernetes.default.svc + - namespace: 'open-webui' + server: https://kubernetes.default.svc - namespace: 'paperclip' server: https://kubernetes.default.svc clusterResourceWhitelist: