From e13313909b40d6c6eb8d9cd7750ae4d0e031ccf5 Mon Sep 17 00:00:00 2001 From: clux Date: Fri, 7 Feb 2025 22:49:24 +0000 Subject: [PATCH 1/5] Move image from personal dockerhub to ghcr Signed-off-by: clux --- .github/workflows/ci.yml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 917cc45..3f3b3ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,10 @@ on: tags: - '*' +permissions: + contents: read + packages: write + jobs: docker-base: runs-on: ubuntu-latest @@ -22,7 +26,7 @@ jobs: uses: docker/metadata-action@v5 id: meta with: - images: clux/controller + images: ghcr.io/${{ github.repository }} tags: | type=pep440,pattern={{version}} type=raw,value=latest,enable={{is_default_branch}} @@ -30,10 +34,11 @@ jobs: - name: Docker login on main origin uses: docker/login-action@v3 - if: github.event_name != 'pull_request' + # if: github.event_name != 'pull_request' with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - uses: actions/cache@v4 with: @@ -94,7 +99,7 @@ jobs: uses: docker/metadata-action@v5 id: meta with: - images: clux/controller + images: ghcr.io/${{ github.repository }} tags: | type=pep440,pattern={{version}},prefix=otel- type=raw,value=otel,enable={{is_default_branch}} @@ -124,8 +129,9 @@ jobs: uses: docker/login-action@v3 if: github.event_name != 'pull_request' with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Docker buildx and push with telemetry uses: docker/build-push-action@v6 @@ -201,7 +207,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - uses: nolar/setup-k3d-k3s@v1 with: - version: v1.25 + version: v1.31 k3d-name: kube k3d-args: "--no-lb --no-rollback --k3s-arg --disable=traefik,servicelb,metrics-server@server:*" @@ -211,7 +217,7 @@ jobs: run: cargo run --bin crdgen | kubectl apply -f - - name: Run all default features integration library tests run: cargo test --lib --all -- --ignored - + unit: runs-on: ubuntu-latest steps: From 0a7f6e0b48b36579f0f29181f52ad350330535f9 Mon Sep 17 00:00:00 2001 From: clux Date: Fri, 7 Feb 2025 23:11:50 +0000 Subject: [PATCH 2/5] try out with short name Signed-off-by: clux --- .github/workflows/ci.yml | 10 ++++++---- README.md | 4 ++-- charts/doc-controller/values.yaml | 2 +- yaml/deployment.yaml | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f3b3ba..34790c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: uses: docker/metadata-action@v5 id: meta with: - images: ghcr.io/${{ github.repository }} + images: ghcr.io/${{ github.repository_owner }}/controller tags: | type=pep440,pattern={{version}} type=raw,value=latest,enable={{is_default_branch}} @@ -66,7 +66,8 @@ jobs: context: . cache-from: type=gha,scope=base cache-to: type=gha,scope=base,mode=max - push: ${{ github.ref == 'refs/heads/main' }} + # push: ${{ github.ref == 'refs/heads/main' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64 @@ -99,7 +100,7 @@ jobs: uses: docker/metadata-action@v5 id: meta with: - images: ghcr.io/${{ github.repository }} + images: ghcr.io/${{ github.repository_owner }}/controller tags: | type=pep440,pattern={{version}},prefix=otel- type=raw,value=otel,enable={{is_default_branch}} @@ -139,7 +140,8 @@ jobs: context: . cache-from: type=gha,scope=otel cache-to: type=gha,scope=otel,mode=max - push: ${{ github.ref == 'refs/heads/main' }} + # push: ${{ github.ref == 'refs/heads/main' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64 diff --git a/README.md b/README.md index d2058ee..df89c18 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ ## controller-rs [![ci](https://github.com/kube-rs/controller-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/kube-rs/controller-rs/actions/workflows/ci.yml) -[![docker image](https://img.shields.io/docker/pulls/clux/controller.svg)]( -https://hub.docker.com/r/clux/controller/tags/) A rust kubernetes reference controller for a [`Document` resource](https://github.com/kube-rs/controller-rs/blob/main/yaml/crd.yaml) using [kube](https://github.com/kube-rs/kube/), with observability instrumentation. @@ -26,6 +24,8 @@ kubectl wait --for=condition=available deploy/doc-controller --timeout=30s kubectl port-forward service/doc-controller 8080:80 ``` +The helm chart sets up the [container](https://github.com/kube-rs/controller-rs/pkgs/container/controller) built from this repository. + ### Opentelemetry Build and run with `telemetry` feature, or configure it via `helm`: diff --git a/charts/doc-controller/values.yaml b/charts/doc-controller/values.yaml index fb36701..c4a6b9b 100644 --- a/charts/doc-controller/values.yaml +++ b/charts/doc-controller/values.yaml @@ -4,7 +4,7 @@ namespace: "default" version: "" # pin a specific version image: - repository: clux/controller + repository: ghcr.io/kube-rs/controller-rs pullPolicy: IfNotPresent imagePullSecrets: [] diff --git a/yaml/deployment.yaml b/yaml/deployment.yaml index 615819b..71bb06f 100644 --- a/yaml/deployment.yaml +++ b/yaml/deployment.yaml @@ -139,7 +139,7 @@ spec: {} containers: - name: doc-controller - image: clux/controller:0.15.0 + image: ghcr.io/kube-rs/controller-rs:0.15.0 imagePullPolicy: IfNotPresent securityContext: {} From 5ab93e633a309233c0fe90085f5b1d508042acde Mon Sep 17 00:00:00 2001 From: clux Date: Fri, 7 Feb 2025 23:19:48 +0000 Subject: [PATCH 3/5] need login off while we test Signed-off-by: clux --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34790c4..38b8f62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,7 +128,7 @@ jobs: - name: Docker login on main origin uses: docker/login-action@v3 - if: github.event_name != 'pull_request' + #if: github.event_name != 'pull_request' with: registry: ghcr.io username: ${{ github.repository_owner }} From 2498a5cb64ae08b46506a1a2b164cc9925ed336c Mon Sep 17 00:00:00 2001 From: clux Date: Fri, 7 Feb 2025 23:21:44 +0000 Subject: [PATCH 4/5] regen Signed-off-by: clux --- charts/doc-controller/values.yaml | 2 +- yaml/deployment.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/doc-controller/values.yaml b/charts/doc-controller/values.yaml index c4a6b9b..5beef84 100644 --- a/charts/doc-controller/values.yaml +++ b/charts/doc-controller/values.yaml @@ -4,7 +4,7 @@ namespace: "default" version: "" # pin a specific version image: - repository: ghcr.io/kube-rs/controller-rs + repository: ghcr.io/kube-rs/controller pullPolicy: IfNotPresent imagePullSecrets: [] diff --git a/yaml/deployment.yaml b/yaml/deployment.yaml index 71bb06f..c2cb610 100644 --- a/yaml/deployment.yaml +++ b/yaml/deployment.yaml @@ -139,7 +139,7 @@ spec: {} containers: - name: doc-controller - image: ghcr.io/kube-rs/controller-rs:0.15.0 + image: ghcr.io/kube-rs/controller:0.15.0 imagePullPolicy: IfNotPresent securityContext: {} From 3e65ef173303003a14e92b7baec3ee2457a8ea38 Mon Sep 17 00:00:00 2001 From: clux Date: Sat, 8 Feb 2025 00:07:17 +0000 Subject: [PATCH 5/5] guess it's expected for cd to fail first time with this setup Signed-off-by: clux --- .github/workflows/ci.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38b8f62..57f101b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: - name: Docker login on main origin uses: docker/login-action@v3 - # if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -66,8 +66,7 @@ jobs: context: . cache-from: type=gha,scope=base cache-to: type=gha,scope=base,mode=max - # push: ${{ github.ref == 'refs/heads/main' }} - push: true + push: ${{ github.ref == 'refs/heads/main' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64 @@ -128,7 +127,7 @@ jobs: - name: Docker login on main origin uses: docker/login-action@v3 - #if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -140,8 +139,7 @@ jobs: context: . cache-from: type=gha,scope=otel cache-to: type=gha,scope=otel,mode=max - # push: ${{ github.ref == 'refs/heads/main' }} - push: true + push: ${{ github.ref == 'refs/heads/main' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64