go
versionv1.21.0+
docker
version17.03+
.kubectl
versionv1.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@latest
To create a kind
cluster with the configurations defined in hack/kind-config.yaml
, run the following command:
kind create cluster --config hack/kind-config.yaml
make manifests && make install
make run
kubectl apply -f hack/ollama-model-phi-kind-cluster.yaml
kubectl describe models
Build and push your image to the location specified by IMG
:
make docker-build docker-push IMG=<some-registry>/ollama-operator:tag
Note
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 install
Deploy the Manager to the cluster with the image specified by IMG
:
make deploy IMG=<some-registry>/ollama-operator:tag
Note
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 uninstall
UnDeploy the controller from the cluster:
make undeploy
Note
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 --clean
To 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.yaml
Following 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:tag
NOTE: 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