diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index cedc7ef..dccb890 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -63,8 +63,13 @@ jobs: export LAST_TAG=$(git describe --tags $LAST_TAGGED_COMMIT) echo "version=${LAST_TAG#v}" >> $GITHUB_OUTPUT + - # Add support for more platforms with QEMU (optional) + # https://github.com/docker/setup-qemu-action + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 with: platforms: linux/amd64,linux/arm64 @@ -84,6 +89,7 @@ jobs: - name: Build and Push uses: docker/build-push-action@v4 with: + platforms: linux/amd64,linux/arm64 context: ./ file: ./Dockerfile push: true @@ -92,3 +98,12 @@ jobs: ${{ steps.dockerinfo.outputs.taglatest }} ${{ steps.dockerinfo.outputs.tag }} + - name: Build installer + run: | + make build-installer IMG=ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }} + + - name: Upload installer + uses: actions/upload-artifact@v4 + with: + name: ollama-operator-installer-${{ steps.version.outputs.version }} + path: dist/install.yaml diff --git a/.github/workflows/unstable-build.yml b/.github/workflows/unstable-build.yml new file mode 100644 index 0000000..fd05aad --- /dev/null +++ b/.github/workflows/unstable-build.yml @@ -0,0 +1,89 @@ +name: Unstable Build + +on: + workflow_dispatch: + +jobs: +# hub_build: +# name: Build for Docker Hub +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 + +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v2 +# with: +# platforms: linux/amd64,linux/arm64 + +# - name: Sign in to Docker Hub +# uses: docker/login-action@v2 +# with: +# username: ${{ github.repository_owner }} +# password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + +# - name: Create image tags +# id: dockerinfo +# run: | +# echo "tagunstable=${{ github.repository_owner }}/insights-bot:unstable" >> $GITHUB_OUTPUT + +# - name: Build and Push +# uses: docker/build-push-action@v4 +# with: +# context: ./ +# file: ./Dockerfile +# push: true +# no-cache: false +# tags: | +# ${{ steps.dockerinfo.outputs.tagunstable }} + + ghcr_build: + name: Build for GitHub Container Registry + permissions: + packages: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - # Add support for more platforms with QEMU (optional) + # https://github.com/docker/setup-qemu-action + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64,linux/arm64 + + - name: Sign in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create image tags + id: dockerinfo + run: | + echo "tagunstable=ghcr.io/${{ github.repository }}:unstable" >> $GITHUB_OUTPUT + + - name: Build and Push + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64,linux/arm64 + context: ./ + file: ./Dockerfile + push: true + no-cache: false + tags: | + ${{ steps.dockerinfo.outputs.tagunstable }} + + - name: Build installer + run: | + make build-installer IMG=ghcr.io/${{ github.repository }}:unstable + + - name: Upload installer + uses: actions/upload-artifact@v4 + with: + name: ollama-operator-installer-unstable + path: dist/install.yaml + diff --git a/README.md b/README.md index 70f8b99..885870e 100644 --- a/README.md +++ b/README.md @@ -128,14 +128,14 @@ The detailed resources it creates, and the relationships between them are shown - + ## Contributing diff --git a/cmd/main.go b/cmd/main.go index a19d1c5..11d5573 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -102,11 +102,10 @@ func main() { SecureServing: secureMetrics, TLSOpts: tlsOpts, }, - WebhookServer: webhookServer, - HealthProbeBindAddress: probeAddr, - LeaderElection: enableLeaderElection, - LeaderElectionID: "300b498d.ayaka.io", - LeaderElectionNamespace: "ollama-system", + WebhookServer: webhookServer, + HealthProbeBindAddress: probeAddr, + LeaderElection: enableLeaderElection, + LeaderElectionID: "300b498d.ayaka.io", // LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily // when the Manager ends. This requires the binary to immediately end when the // Manager is stopped, otherwise, this setting is unsafe. Setting this significantly diff --git a/docs/pages/en/index.md b/docs/pages/en/index.md index 80a555e..e6509ba 100644 --- a/docs/pages/en/index.md +++ b/docs/pages/en/index.md @@ -82,7 +82,7 @@ kubectl apply -f https://raw.githubusercontent.com/nekomeowww/ollama-operator/ma 2. Wait for the operator to be ready: ```shell -kubectl wait --for=jsonpath='{.status.replicas}'=2 deployment/ollama-operator-controller-manager -n ollama-operator-system +kubectl wait --for=jsonpath='{.status.readyReplicas}'=1 deployment/ollama-operator-controller-manager -n ollama-operator-system ``` 3. Create one `Model` CRD to rule them all. diff --git a/docs/pages/zh-CN/guide/getting-started.md b/docs/pages/zh-CN/guide/getting-started.md index 6bd5297..ef30f12 100644 --- a/docs/pages/zh-CN/guide/getting-started.md +++ b/docs/pages/zh-CN/guide/getting-started.md @@ -37,7 +37,13 @@ kind create cluster --config kind-config.yaml kubectl apply -f https://raw.githubusercontent.com/nekomeowww/ollama-operator/main/dist/install.yaml ``` -2. 创建一个 `Model` 类型的 CRD 资源 +2. 等待 Operator 就绪: + +```shell +kubectl wait --for=jsonpath='{.status.readyReplicas}'=1 deployment/ollama-operator-controller-manager -n ollama-operator-system +``` + +3. 创建一个 `Model` 类型的 CRD 资源 ::: tip 什么是 CRD? @@ -92,7 +98,6 @@ EOF 或者您可以创建自己的文件: - ::: code-group ```yaml [ollama-model-phi.yaml] @@ -106,25 +111,25 @@ spec: # [!code ++] ::: -1. 将 `Model` CRD 应用到 Kubernetes 集群: +4. 将 `Model` CRD 应用到 Kubernetes 集群: ```shell kubectl apply -f ollama-model-phi.yaml ``` -1. 等待模型就绪: +5. 等待模型就绪: ```shell kubectl wait --for=jsonpath='{.status.readyReplicas}'=1 deployment/ollama-model-phi ``` -5. 准备就绪!现在让我们转发访问模型的端口到本地: +6. 准备就绪!现在让我们转发访问模型的端口到本地: ```shell kubectl port-forward svc/ollama-model-phi ollama ``` -1. 直接与模型交互: +7. 直接与模型交互: ```shell ollama run phi diff --git a/docs/pages/zh-CN/index.md b/docs/pages/zh-CN/index.md index 999ab8e..815c9b2 100644 --- a/docs/pages/zh-CN/index.md +++ b/docs/pages/zh-CN/index.md @@ -82,7 +82,7 @@ kubectl apply -f https://raw.githubusercontent.com/nekomeowww/ollama-operator/ma 2. 等待 Operator 就绪: ```shell -kubectl wait --for=jsonpath='{.status.replicas}'=2 deployment/ollama-operator-controller-manager -n ollama-operator-system +kubectl wait --for=jsonpath='{.status.readyReplicas}'=1 deployment/ollama-operator-controller-manager -n ollama-operator-system ``` 3. 创建一个 `Model` 类型的 CRD 资源 diff --git a/pkg/model/pod.go b/pkg/model/pod.go index 5daf0e2..35acf89 100644 --- a/pkg/model/pod.go +++ b/pkg/model/pod.go @@ -8,7 +8,7 @@ import ( ) const ( - OllamaBaseImage = "m.daocloud.io/docker.io/ollama/ollama" + OllamaBaseImage = "ollama/ollama" ) func NewOllamaServerContainer(readOnly bool) corev1.Container {