keventmesh / llm-tool-provider

Teach your LLM to dynamically call your services in Kubernetes
7 stars 3 forks source link

Experience deploying this to Openshift Developer Sandbox #10

Open johwes opened 5 months ago

johwes commented 5 months ago

Sharing some experience getting this up and running on Openshift Developer Sandbox

Since the default namespace is not possible to use, i ended up changing all references to the default namespace.

in the hack/install.sh script (cd tools/knative-text-responder && func deploy) (cd tools/word-length && func deploy)

Both commands failed because it tried to build/push/deploy the function. Since I don't have access to your quay repo, this failed. I ended up changing the func.yaml pointing towards my own quay repo.

Maybe there is a way to tell func binary to not rebuild container and only deploy it but I'm not an experienced knative/function user.

the next step, (cd core/request-proxy && ko apply -f ./config) the command "ko apply -f config/" faied Error: error creating publisher: KO_DOCKER_REPO environment variable is unset

I ended up inspecting your quay repo to find the actual container image and updating the deployment.yaml to, image: quay.io/cali0707/knative/knative-llm-tool-provider-f964953cf391833079bc8b62ce75df53:latest

The chat app, the file, cloudevent_tool.py , by default looks at the default namespace eventtypes = custom_object_api.list_namespaced_custom_object("eventing.knative.dev", "v1beta2", "default", "eventtypes")

I updated this to point to my namespace, I also updated the permissions of your container since in the sandbox you are not allowed to run as root, see my below containerfile, should probably use the GID 0, since that is what all conatiners in openshift run as the effective group user. " FROM quay.io/cali0707/chat-app:latest

WORKDIR /app

COPY cloudevent_tool.py /app/cloudevent_tool.py

RUN chmod -R 777 /app "

With that i also updated the deployment for the chat-app to point to my newly built container.

There is a reference in the deployment to a secret key, TAVILY_API_KEY I ended up getting an API key but if it's not needed I could probably have removed it from the deployement.

matzew commented 5 months ago

@johwes thanks for checking. I have this running on an OCP 4.16 instance (but not Sandbox)

However we updated the app to have a more "realistic" example, and the two tools (knative-text-responder and word-length).

We recently added S2i support for Golang on kn func. I use a binary that was build from the knative/func repo. It will be released w/ the upcoming 1.15 version of Knative later in July.

For the chat app, we added an OCP route: https://github.com/keventmesh/llm-tool-provider/blob/main/core/chat-app/config/openshift/100-chat-route.yaml (to be applied manuall)

And I changed the script to do func deploy as:

diff --git a/hack/install.sh b/hack/install.sh
index 81df3bc..4b7cc63 100755
--- a/hack/install.sh
+++ b/hack/install.sh
@@ -23,10 +23,14 @@ if [[ $FULL_INSTALL ]]; then
        wait_for_deployments "knative-eventing"
 fi

-(cd tools/resource-cost-calculator && func deploy)
-(cd tools/average-resource-consumption && func deploy)
+(cd tools/resource-cost-calculator && func deploy -b=s2i -v --build)
+(cd tools/average-resource-consumption && func deploy -b=s2i -v --build)

 (cd core/request-proxy && ko apply -f ./config)
 kubectl apply -f ./core/chat-app/config

+# if on OCP:
+kubectl apply -f ./core/chat-app/config/openshift/100-chat-route.yaml
+
+
 wait_for_deployments "default"
matzew commented 5 months ago

@johwes FWIW, I was installing both, Serving and Eventing via the Serverless Operator, on Openshift.

so I just executed ./hack/install.sh and did apply the event types before that (and after Operator installation)