goversionv1.21.0+dockerversion17.03+.kubectlversionv1.11.3+.- Access to a Kubernetes
v1.11.3+cluster (Either kind, minikube is suitable for local development).
We have pre-defined kind configurations in the hack directory to help you get started with the development environment.
Note
Install kind if you haven't already. You can install it using the following command:
go install sigs.k8s.io/kind@latestTo create a kind cluster with the configurations defined in hack/kind-config.yaml, run the following command:
kind create cluster --config hack/kind-config.yamlmake manifests && make installmake runkubectl apply -f hack/ollama-model-phi-kind-cluster.yamlkubectl describe modelsBuild and push your image to the location specified by IMG:
make docker-build docker-push IMG=<some-registry>/ollama-operator:tagNote
This image ought to be published in the personal registry you specified. And it is required to have access to pull the image from the working environment. Make sure you have the proper permission to the registry if the above commands don’t work.
Install the CRDs into the cluster:
make installDeploy the Manager to the cluster with the image specified by IMG:
make deploy IMG=<some-registry>/ollama-operator:tagNote
If you encounter RBAC errors, you may need to grant yourself cluster-admin privileges or be logged in as admin.
Create instances of your solution You can apply the samples (examples) from the config/sample:
kubectl apply -k config/samples/Note
Ensure that the samples has default values to test it out.
Delete the instances (CRs) from the cluster:
kubectl delete -k config/samples/Delete the APIs(CRDs) from the cluster:
make uninstallUnDeploy the controller from the cluster:
make undeployNote
Run make help for more information on all potential make targets
Developers should test their builds locally before pushing the changes to the repository.
This reporsitory has been configured to build and release by using GoReleaser:
Note
Install GoReleaser if you haven't already by going through the steps in GoReleaser Install
goreleaser release --snapshot --cleanTo build the image for ollama-operator locally, run the following command:
docker buildx build --platform linux/amd64,linux/arm64 .Please replace <Your Tag> with the tag you want to release.
docker run -v $(pwd)/.krew.yaml:/tmp/template-file.yaml ghcr.io/rajatjindal/krew-release-bot:v0.0.46 krew-release-bot template --tag <Your Tag> --template-file /tmp/template-file.yamlFollowing are the steps to build the installer and distribute this project to users.
- Build the installer for the image built and published in the registry:
make build-installer IMG=<some-registry>/ollama-operator:tagNOTE: The makefile target mentioned above generates an 'install.yaml' file in the dist directory. This file contains all the resources built with Kustomize, which are necessary to install this project without its dependencies.
- Using the installer
Users can just run kubectl apply -f <URL for YAML BUNDLE> to install the project, i.e.:
kubectl apply -f https://raw.githubusercontent.com/<org>/ollama-operator/<tag or branch>/dist/install.yaml