Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Docker registry to new default #413

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/actions/run-integ-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
serverImage:
description: "Override server image used in the test file"
required: false
GITHUB_TOKEN:
description: "GitHub Token (used by Helm action)"
required: false
default: ""

runs:
using: "composite"
Expand Down Expand Up @@ -48,6 +52,8 @@ runs:
- name: Install Helm
uses: azure/setup-helm@v3
id: install_helm
with:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
- name: Download cass-operator image
uses: actions/download-artifact@v2
with:
Expand All @@ -66,9 +72,9 @@ runs:
- name: Load image on the nodes of the cluster
shell: bash
run: |
kind load docker-image --name=kind k8ssandra/cass-operator:latest
kind load docker-image --name=kind k8ssandra/system-logger:latest
kind load docker-image --name=kind artifacts.k8ssandra.io/k8ssandra/images/cass-operator:latest
kind load docker-image --name=kind artifacts.k8ssandra.io/k8ssandra/images/system-logger:latest
- name: Run integration test ( ${{ inputs.integration_test }} )
shell: bash
run: |
IMG=k8ssandra/cass-operator:latest make integ-test
IMG=artifacts.k8ssandra.io/k8ssandra/images/cass-operator:latest make integ-test
11 changes: 7 additions & 4 deletions .github/workflows/kindIntegTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
file: Dockerfile
context: .
push: false
tags: k8ssandra/cass-operator:latest
tags: |
artifacts.k8ssandra.io/k8ssandra/images/cass-operator:latest
platforms: linux/amd64
outputs: type=docker,dest=/tmp/k8ssandra-cass-operator.tar
cache-from: type=local,src=/tmp/.buildx-cache
Expand All @@ -39,7 +40,8 @@ jobs:
with:
file: logger.Dockerfile
push: false
tags: k8ssandra/system-logger:latest
tags: |
artifacts.k8ssandra.io/k8ssandra/images/system-logger:latest
outputs: type=docker,dest=/tmp/k8ssandra-system-logger.tar
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
Expand Down Expand Up @@ -137,9 +139,9 @@ jobs:
- "4.0.3"
include:
- version: 3.11.7
serverImage: k8ssandra/cass-management-api:3.11.7-v0.1.24 # k8ssandra 1.1
serverImage: artifacts.k8ssandra.io/k8ssandra/images/cass-management-api:3.11.7-v0.1.24 # k8ssandra 1.1
- version: 4.0.0
serverImage: k8ssandra/cass-management-api:4.0.0-v0.1.28 # k8ssandra 1.3
serverImage: artifacts.k8ssandra.io/k8ssandra/images/cass-management-api:4.0.0-v0.1.28 # k8ssandra 1.3
fail-fast: true
runs-on: ubuntu-latest
env:
Expand All @@ -157,6 +159,7 @@ jobs:
- uses: ./.github/actions/run-integ-test
with:
integration_test: smoke_test_oss
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive k8s logs
if: ${{ failure() }}
uses: actions/upload-artifact@v2
Expand Down
40 changes: 35 additions & 5 deletions .github/workflows/operatorBuildAndDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,22 @@ jobs:
runs-on: ubuntu-latest
needs: testing
if: github.ref == 'refs/heads/master'
# Add "id-token" with the intended permissions.
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
workload_identity_provider: 'projects/945064329182/locations/global/workloadIdentityPools/github-pool/providers/github'
service_account: '[email protected]'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'
- name: Cache Docker layers
uses: actions/cache@v2
with:
Expand All @@ -73,20 +84,33 @@ jobs:
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
# Log in to Google Cloud Artifact Registry
- name: Login to GCP Artifact Registry
uses: 'docker/login-action@v1'
with:
registry: 'artifacts.k8ssandra.io'
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
- name: Set git parsed values
id: vars
run: |
echo ::set-output name=sha_short::$(git rev-parse --short=8 ${{ github.sha }})
echo ::set-output name=tag_name::${GITHUB_REF#refs/tags/}
echo ::set-output name=version::$(make version)
- name: Build and push
- name: Build and Push - Cass Operator
id: docker_build_cass_operator
uses: docker/build-push-action@v2
with:
file: Dockerfile
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: k8ssandra/cass-operator:${{ steps.vars.outputs.sha_short }}, k8ssandra/cass-operator:latest, k8ssandra/cass-operator:${{ steps.vars.outputs.version }}
tags: |
k8ssandra/cass-operator:${{ steps.vars.outputs.sha_short }}
k8ssandra/cass-operator:latest
k8ssandra/cass-operator:${{ steps.vars.outputs.version }}
artifacts.k8ssandra.io/k8ssandra/images/cass-operator:${{ steps.vars.outputs.sha_short }}
artifacts.k8ssandra.io/k8ssandra/images/cass-operator:latest
artifacts.k8ssandra.io/k8ssandra/images/cass-operator:${{ steps.vars.outputs.version }}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Expand All @@ -96,13 +120,17 @@ jobs:
with:
file: logger.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: k8ssandra/system-logger:${{ steps.vars.outputs.sha_short }}, k8ssandra/system-logger:latest
tags: |
k8ssandra/system-logger:${{ steps.vars.outputs.sha_short }}
k8ssandra/system-logger:latest
artifacts.k8ssandra.io/k8ssandra/images/system-logger:${{ steps.vars.outputs.sha_short }}
artifacts.k8ssandra.io/k8ssandra/images/system-logger:latest
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Create bundle
run: |
make IMG=k8ssandra/cass-operator:${{ steps.vars.outputs.version }} VERSION=${{ steps.vars.outputs.version }} CHANNEL=dev bundle
make VERSION=${{ steps.vars.outputs.version }} CHANNEL=dev bundle
- name: Build and push cass-operator-bundle
id: docker_build_cass-operator_bundle
uses: docker/build-push-action@v2
Expand All @@ -112,7 +140,9 @@ jobs:
VERSION=${{ steps.vars.outputs.version }}
context: .
push: ${{ !env.ACT }}
tags: k8ssandra/cass-operator-bundle:v${{ steps.vars.outputs.version }}
tags: |
k8ssandra/cass-operator-bundle:v${{ steps.vars.outputs.version }}
artifacts.k8ssandra.io/k8ssandra/images/cass-operator-bundle:v${{ steps.vars.outputs.version }}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Expand Down
40 changes: 32 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
go-version: 1.18
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
workload_identity_provider: 'projects/945064329182/locations/global/workloadIdentityPools/github-pool/providers/github'
service_account: '[email protected]'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'
- name: Cache Docker layers
uses: actions/cache@v2
if: ${{ !env.ACT }}
Expand All @@ -34,6 +41,13 @@ jobs:
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
# Log in to Google Cloud Artifact Registry
- name: Login to GCP Artifact Registry
uses: 'docker/login-action@v1'
with:
registry: 'artifacts.k8ssandra.io'
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
- name: Set git parsed values
id: vars
shell: bash
Expand All @@ -50,7 +64,9 @@ jobs:
VERSION=${{ env.TARGET_VERSION }}
context: .
load: true
tags: k8ssandra/system-logger:${{ steps.vars.outputs.tag_name}}
tags: |
k8ssandra/system-logger:${{ steps.vars.outputs.tag_name}}
artifacts.k8ssandra.io/k8ssandra/images/system-logger:${{ steps.vars.outputs.tag_name}}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Expand All @@ -63,7 +79,9 @@ jobs:
VERSION=${{ env.TARGET_VERSION }}
context: .
load: true
tags: k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}}
tags: |
k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}}
artifacts.k8ssandra.io/k8ssandra/images/cass-operator:${{ steps.vars.outputs.tag_name}}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Expand All @@ -76,7 +94,9 @@ jobs:
VERSION=${{ env.TARGET_VERSION }}
context: .
push: ${{ !env.ACT }}
tags: k8ssandra/system-logger:${{ steps.vars.outputs.tag_name}}
tags: |
k8ssandra/system-logger:${{ steps.vars.outputs.tag_name}}
artifacts.k8ssandra.io/k8ssandra/images/system-logger:${{ steps.vars.outputs.tag_name}}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Expand All @@ -89,7 +109,9 @@ jobs:
VERSION=${{ env.TARGET_VERSION }}
context: .
push: ${{ !env.ACT }}
tags: k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}}
tags: |
k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}}
artifacts.k8ssandra.io/k8ssandra/images/cass-operator:${{ steps.vars.outputs.tag_name}}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Expand All @@ -98,8 +120,8 @@ jobs:
if: ${{ !env.ACT }}
# The double docker login is a workaround for RH's odd login issues
run: |
docker tag k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}} scan.connect.redhat.com/ospid-18783bca-8f79-459c-aa0b-bda4e71c6ec3/cass-operator:${{ steps.vars.outputs.tag_name}}
docker tag k8ssandra/system-logger:${{ steps.vars.outputs.tag_name}} scan.connect.redhat.com/ospid-6138f998fb33d420b79f0af9/system-logger:${{ steps.vars.outputs.tag_name}}
docker tag artifacts.k8ssandra.io/k8ssandra/images/cass-operator:${{ steps.vars.outputs.tag_name}} scan.connect.redhat.com/ospid-18783bca-8f79-459c-aa0b-bda4e71c6ec3/cass-operator:${{ steps.vars.outputs.tag_name}}
docker tag artifacts.k8ssandra.io/k8ssandra/images/system-logger:${{ steps.vars.outputs.tag_name}} scan.connect.redhat.com/ospid-6138f998fb33d420b79f0af9/system-logger:${{ steps.vars.outputs.tag_name}}
docker login -u unused scan.connect.redhat.com -p ${{ secrets.CASS_OPERATOR_CONNECT_SECRET }}
docker push scan.connect.redhat.com/ospid-18783bca-8f79-459c-aa0b-bda4e71c6ec3/cass-operator:${{ steps.vars.outputs.tag_name}}
docker login -u unused scan.connect.redhat.com -p ${{ secrets.SYSTEM_LOGGER_CONNECT_SECRET }}
Expand All @@ -126,7 +148,7 @@ jobs:
shell: bash
if: ${{ !env.ACT }} # Act does not have yq
run: |
make IMG=k8ssandra/cass-operator:${{ steps.vars.outputs.tag_name}} VERSION=${{ env.TARGET_VERSION }} bundle
make VERSION=${{ env.TARGET_VERSION }} bundle
- name: Build and push cass-operator-bundle
id: docker_build_cass-operator_bundle
if: ${{ !env.ACT }}
Expand All @@ -138,7 +160,9 @@ jobs:
context: .
load: true
push: ${{ !env.ACT }}
tags: k8ssandra/cass-operator-bundle:${{ steps.vars.outputs.tag_name}}
tags: |
k8ssandra/cass-operator-bundle:${{ steps.vars.outputs.tag_name}}
artifacts.k8ssandra.io/k8ssandra/images/cass-operator-bundle:${{ steps.vars.outputs.tag_name}}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Changelog for Cass Operator, new PRs should update the `main / unreleased` secti
* [CHANGE] [#354](https://github.com/k8ssandra/cass-operator/issues/354) Remove oldDefunctLabel support since we recreate StS. Fix #335 created-by value to match expected value.
* [CHANGE] [#385](https://github.com/k8ssandra/cass-operator/issues/385) Deprecate CassandraDatacenter's RollingRestartRequested. Use CassandraTask instead.
* [CHANGE] [#397](https://github.com/k8ssandra/cass-operator/issues/397) Remove direct dependency to k8s.io/kubernetes
* [CHANGE] [#414](https://github.com/k8ssandra/cass-operator/issues/414) Use new artifacts.k8ssandra.io repository for pulling images.
* [FEATURE] [#384](https://github.com/k8ssandra/cass-operator/issues/384) Add a new CassandraTask operation "replacenode" that removes the existing PVCs from the pod, deletes the pod and starts a replacement process.
* [FEATURE] [#387](https://github.com/k8ssandra/cass-operator/issues/387) Add a new CassandraTask operation "upgradesstables" that allows to do SSTable upgrades after Cassandra version upgrade.
* [ENHANCEMENT] [#385](https://github.com/k8ssandra/cass-operator/issues/385) Add rolling restart as a CassandraTask action.
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
# This variable is used to construct full image tags for bundle and catalog images.
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# cassandra.datastax.com/cass-oper-bundle:$VERSION and cassandra.datastax.com/cass-oper-catalog:$VERSION.
# k8ssandra/cass-operator-bundle:$VERSION and k8ssandra/cass-operator-catalog:$VERSION.

ORG ?= k8ssandra
ORG ?= artifacts.k8ssandra.io/k8ssandra/images
IMAGE_TAG_BASE ?= $(ORG)/cass-operator

M_INTEG_DIR ?= all
Expand Down Expand Up @@ -161,7 +161,7 @@ run: manifests generate fmt vet ## Run a controller from your host.

.PHONY: docker-build
docker-build: ## Build docker image with the manager.
docker buildx build --build-arg VERSION=${VERSION} -t ${IMG} -t ${IMG_LATEST} . --load
docker buildx build --build-arg VERSION=${VERSION} -t ${IMG} -t k8ssandra/cass-operator:v${VERSION} -t ${IMG_LATEST} -t k8ssandra/cass-operator:latest . --load
bradfordcp marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: docker-kind
docker-kind: docker-build ## Build docker image and load to kind cluster
Expand All @@ -172,15 +172,19 @@ docker-kind: docker-build ## Build docker image and load to kind cluster
docker-push: ## Build and push docker image with the manager.
docker push ${IMG}
docker push ${IMG_LATEST}
docker push k8ssandra/cass-operator:v${VERSION}
docker push k8ssandra/cass-operator:latest

.PHONY: docker-logger-build
docker-logger-build: ## Build system-logger image.
docker buildx build -t ${LOG_IMG} -t ${LOG_IMG_LATEST} --build-arg VERSION=${VERSION} -f logger.Dockerfile . --load
docker buildx build -t ${LOG_IMG} -t ${LOG_IMG_LATEST} --build-arg VERSION=${VERSION} -t k8ssandra/system-logger:v${VERSION} -t k8ssandra/system-logger:latest -f logger.Dockerfile . --load

.PHONY: docker-logger-push
docker-logger-push: ## Push system-logger-image
docker push ${LOG_IMG}
docker push ${LOG_IMG_LATEST}
docker push k8ssandra/system-logger:v${VERSION}
docker push k8ssandra/system-logger:latest

.PHONY: docker-logger-kind
docker-logger-kind: docker-logger-build ## Build system-logger image and load to kind cluster
Expand Down Expand Up @@ -313,11 +317,12 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada

.PHONY: bundle-build
bundle-build: ## Build the bundle image.
docker buildx build -f bundle.Dockerfile -t $(BUNDLE_IMG) . --load
docker buildx build -f bundle.Dockerfile -t $(BUNDLE_IMG) -t k8ssandra/cass-operator-bundle:v$(VERSION) . --load

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
docker push $(BUNDLE_IMG)
docker push k8ssandra/cass-operator-bundle:v$(VERSION)

.PHONY: opm
OPM = ./bin/opm
Expand Down Expand Up @@ -354,8 +359,10 @@ endif
.PHONY: catalog-build
catalog-build: opm ## Build a catalog image.
$(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
docker tag $(CATALOG_IMG) k8ssandra/cass-operator-catalog:v$(VERSION)

# Push the catalog image.
.PHONY: catalog-push
catalog-push: ## Push a catalog image.
docker push $(CATALOG_IMG)
docker push k8ssandra/cass-operator-catalog:v$(VERSION)
4 changes: 2 additions & 2 deletions config/manager/image_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: ImageConfig
metadata:
name: image-config
images:
system-logger: "k8ssandra/system-logger:latest"
system-logger: "artifacts.k8ssandra.io/k8ssandra/images/system-logger:latest"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, won't work in local builds correctly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if you wonder why to my previous question - the repository is different here than anything I would build. In the previous Makefile we build:

us-docker.pkg.dev/k8ssandra/images/system-logger:latest (which itself is problematic, but see another comment), but here we're calling artifacts.k8ssandra.io as prefix. So while your development env will popup, it's not actually loading the correct image, it's loading some historic one from the official repo, which is not what I'm actually developing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, us-docker.pkg.dev and artifacts.k8ssandra.io are the same repository. We want to push all images to us-docker.pkg.dev and pull from artifacts.k8ssandra.io.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that's not the same string - thus if you push there and load from another, you will not load from say local cache (like kind).

config-builder: "datastax/cass-config-builder:1.0.4-ubi7"
# cassandra:
# "4.0.0": "k8ssandra/cassandra-ubi:latest"
Expand All @@ -16,7 +16,7 @@ images:
defaults:
# Note, postfix is ignored if repository is not set
cassandra:
repository: "k8ssandra/cass-management-api"
repository: "artifacts.k8ssandra.io/k8ssandra/images/cass-management-api"
dse:
repository: "datastax/dse-server"
suffix: "-ubi7"
4 changes: 2 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: k8ssandra/cass-operator
newTag: v1.13.0-dev.0bb3086-20220819
newName: artifacts.k8ssandra.io/k8ssandra/images/cass-operator
newTag: latest
2 changes: 1 addition & 1 deletion pkg/images/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
const (
ValidDseVersionRegexp = "6\\.8\\.\\d+"
ValidOssVersionRegexp = "(3\\.11\\.\\d+)|(4\\.\\d+\\.\\d+)"
DefaultCassandraRepository = "k8ssandra/cass-management-api"
DefaultCassandraRepository = "artifacts.k8ssandra.io/k8ssandra/images/cass-management-api"
DefaultDSERepository = "datastax/dse-server"
)

Expand Down
Loading