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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG BASE_IMAGE=gcr.io/distroless/static:nonroot
ARG BUILDER_IMAGE=golang:1.23.0
ARG BUILDER_IMAGE=m.daocloud.io/docker.io/library/golang:1.24.0


# Build the manager binary
FROM ${BUILDER_IMAGE} AS builder
Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ginkgo: ## Download ginkgo locally if necessary.

INTEGRATION_TARGET ?= ./test/integration/...

BASE_IMAGE ?= gcr.io/distroless/static:nonroot
BASE_IMAGE ?= m.daocloud.io/gcr.io/distroless/static:nonroot
DOCKER_BUILDX_CMD ?= docker buildx
IMAGE_BUILD_CMD ?= $(DOCKER_BUILDX_CMD) build
IMAGE_BUILD_EXTRA_OPTS ?=
Expand All @@ -67,8 +67,11 @@ IMAGE_NAME ?= llmaz
IMAGE_REPO := $(IMAGE_REGISTRY)/$(IMAGE_NAME)
GIT_TAG ?= $(shell git describe --tags --dirty --always)
GOPROXY=${GOPROXY:-""}
ifeq ($(origin GOPROXY), undefined)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please submit with another PR. It's irrelevant.

unexport GOPROXY
endif
IMG ?= $(IMAGE_REPO):$(GIT_TAG)
BUILDER_IMAGE ?= golang:$(GO_VERSION)
BUILDER_IMAGE ?= m.daocloud.io/docker.io/library/golang:$(GO_VERSION)
KIND_CLUSTER_NAME ?= kind
CGO_ENABLED ?= 0

Expand Down Expand Up @@ -177,7 +180,6 @@ run: manifests generate fmt vet ## Run a controller from your host.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
.PHONY: docker-buildx
docker-buildx: ## Build and push docker image for the manager for cross-platform support
[ -n "$(GOPROXY)" ] && export GOPROXY=$(GOPROXY)
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- $(CONTAINER_TOOL) buildx create --name project-v3-builder
Expand Down Expand Up @@ -226,7 +228,7 @@ endif

.PHONY: install
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply --server-side --force-conflicts -f -
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will --force-conflicts cause other problems? Should be careful here, prefer to keep the server-side only.


.PHONY: uninstall
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
Expand Down
4 changes: 4 additions & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ dependencies:
version: "6.4.0"
repository: "https://helm.openwebui.com/"
condition: open-webui.enabled
- name: envoy-gateway
version: v1.3.2
repository: oci://docker.io/envoyproxy/gateway-helm
condition: envoy-gateway.enabled
107 changes: 107 additions & 0 deletions chart/templates/gateway/envoy-ai-gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{{- if .Values.envoyAIGateway.enabled -}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not include these files in the helm chart I think, let's make them an example instead. Because most of them should be user-defined.

# source : https://github.com/envoyproxy/ai-gateway/blob/main/examples/basic/basic.yaml

# Copyright Envoy AI Gateway Authors
# SPDX-License-Identifier: Apache-2.0
# The full text of the Apache license is available in the LICENSE file at
# the root of the repo.

apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: envoy-ai-gateway-basic
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: envoy-ai-gateway-basic
namespace: default
spec:
gatewayClassName: envoy-ai-gateway-basic
listeners:
- name: http
protocol: HTTP
port: 80
---
apiVersion: aigateway.envoyproxy.io/v1alpha1
kind: AIGatewayRoute
metadata:
name: envoy-ai-gateway-basic
namespace: default
spec:
schema:
name: OpenAI
targetRefs:
- name: envoy-ai-gateway-basic
kind: Gateway
group: gateway.networking.k8s.io
rules:
# - matches:
# - headers:
# - type: Exact
# name: x-ai-eg-model
# value: some-cool-self-hosted-model
# backendRefs:
# - name: envoy-ai-gateway-basic-testupstream
# Below is a testupstream service that can be used to test the AI Gateway
# ---
# apiVersion: aigateway.envoyproxy.io/v1alpha1
# kind: AIServiceBackend
# metadata:
# name: envoy-ai-gateway-basic-testupstream
# namespace: default
# spec:
# schema:
# name: OpenAI
# backendRef:
# name: envoy-ai-gateway-basic-testupstream
# kind: Service
# port: 80
# ---
# apiVersion: apps/v1
# kind: Deployment
# metadata:
# name: envoy-ai-gateway-basic-testupstream
# namespace: default
# spec:
# replicas: 1
# selector:
# matchLabels:
# app: envoy-ai-gateway-basic-testupstream
# template:
# metadata:
# labels:
# app: envoy-ai-gateway-basic-testupstream
# spec:
# containers:
# - name: testupstream
# image: docker.io/envoyproxy/ai-gateway-testupstream:latest
# imagePullPolicy: IfNotPresent
# ports:
# - containerPort: 8080
# env:
# - name: TESTUPSTREAM_ID
# value: test
# readinessProbe:
# httpGet:
# path: /health
# port: 8080
# initialDelaySeconds: 1
# periodSeconds: 1
# ---
# apiVersion: v1
# kind: Service
# metadata:
# name: envoy-ai-gateway-basic-testupstream
# namespace: default
# spec:
# selector:
# app: envoy-ai-gateway-basic-testupstream
# ports:
# - protocol: TCP
# port: 80
# targetPort: 8080
# type: ClusterIP
{{- end }}
94 changes: 94 additions & 0 deletions chart/templates/gateway/envoy-gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{{- if .Values.envoyGateway.enabled -}}
# source: https://github.com/envoyproxy/gateway/blob/main/examples/kubernetes/quickstart.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: eg
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: eg
spec:
gatewayClassName: eg
listeners:
- name: http
protocol: HTTP
port: 80
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: backend
---
apiVersion: v1
kind: Service
metadata:
name: backend
labels:
app: backend
service: backend
spec:
ports:
- name: http
port: 3000
targetPort: 3000
selector:
app: backend
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
spec:
replicas: 1
selector:
matchLabels:
app: backend
version: v1
template:
metadata:
labels:
app: backend
version: v1
spec:
serviceAccountName: backend
containers:
- image: {{ .Values.envoyGateway.image.repository }}:{{ .Values.envoyGateway.image.tag }}
imagePullPolicy: IfNotPresent
name: backend
ports:
- containerPort: 3000
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: backend
spec:
parentRefs:
- name: eg
hostnames:
- "www.example.com"
rules:
- backendRefs:
- group: ""
kind: Service
name: backend
port: 3000
weight: 1
matches:
- path:
type: PathPrefix
value: /
{{- end }}
9 changes: 9 additions & 0 deletions chart/values.global.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,12 @@ open-webui:
enabled: false
redis-cluster:
enabled: false

envoyAIGateway:
enabled: true

envoyGateway:
enabled: true
image:
repository: m.daocloud.io/gcr.io/k8s-staging-gateway-api/echo-basic
tag: v20231214-v1.0.0-140-gf544a46e
6 changes: 6 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
lws "sigs.k8s.io/lws/api/leaderworkerset/v1"

aigv1a1 "github.com/envoyproxy/ai-gateway/api/v1alpha1"
corev1 "github.com/inftyai/llmaz/api/core/v1alpha1"
inferenceapi "github.com/inftyai/llmaz/api/inference/v1alpha1"
"github.com/inftyai/llmaz/pkg/cert"
corecontroller "github.com/inftyai/llmaz/pkg/controller/core"
inferencecontroller "github.com/inftyai/llmaz/pkg/controller/inference"
"github.com/inftyai/llmaz/pkg/webhook"
gwapiv1 "sigs.k8s.io/gateway-api/apis/v1"
//+kubebuilder:scaffold:imports
)

Expand All @@ -56,6 +58,10 @@ func init() {
// Add support for lws.
utilruntime.Must(lws.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme

// Add support for ai-gateway and envoy gateway.
utilruntime.Must(gwapiv1.Install(scheme))
utilruntime.Must(aigv1a1.AddToScheme(scheme))
}

func main() {
Expand Down
Loading
Loading