Skip to content
Merged
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
43 changes: 5 additions & 38 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: Create Release
name: Push Release Tags

on:
push:
branches:
- main
tags:
- 'v*.*.*'
paths:
- 'CHANGELOG/*.md'

permissions:
contents: write # Allow to push a tag, create a release branch and publish a draft release.
contents: write # Allow to push a tag and create a release branch.

jobs:
push_release_tags:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.release-version.outputs.release_version }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # tag=v6.0.2
Expand Down Expand Up @@ -78,37 +79,3 @@ jobs:
git push origin ${RELEASE_VERSION}
git push origin test/${RELEASE_VERSION}
echo "Created tags $RELEASE_VERSION and test/${RELEASE_VERSION}"
release:
name: create draft release
runs-on: ubuntu-latest
needs: push_release_tags
steps:
- name: Set env
run: echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
env:
RELEASE_TAG: ${{needs.push_release_tags.outputs.release_tag}}
- name: checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # tag=v6.0.2
with:
fetch-depth: 0
ref: ${{ env.RELEASE_TAG }}
- name: Calculate go version
run: echo "go_version=$(make go-version)" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # tag=v6.4.0
with:
go-version: ${{ env.go_version }}
- name: generate release artifacts
run: |
make release
- name: get release notes
run: |
curl -L "https://raw.githubusercontent.com/${{ github.repository }}/main/CHANGELOG/${{ env.RELEASE_TAG }}.md" \
-o "${{ env.RELEASE_TAG }}.md"
- name: Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # tag=v2.6.1
with:
draft: true
files: out/*
body_path: ${{ env.RELEASE_TAG }}.md
tag_name: ${{ env.RELEASE_TAG }}
103 changes: 103 additions & 0 deletions .github/workflows/tag-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Create Release

on:
push:
tags:
- "v*"

permissions:
contents: write
packages: write

jobs:
push_release_images:
name: build and push ${{ matrix.arch }} images
runs-on: ubuntu-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
arch: [amd64, arm, arm64, ppc64le, s390x]
env:
REGISTRY: ghcr.io/syself
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2
with:
fetch-depth: 0
- name: Calculate go version
id: vars
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # tag=v5.3.0
with:
go-version: ${{ steps.vars.outputs.go_version }}
- name: Build images
run: |
make REGISTRY="${REGISTRY}" TAG="${GITHUB_REF_NAME}" ARCH="${{ matrix.arch }}" docker-build
- name: Log in to ghcr.io
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # tag=v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Push images
run: |
make REGISTRY="${REGISTRY}" TAG="${GITHUB_REF_NAME}" ARCH="${{ matrix.arch }}" docker-push

push_release_image_manifests:
name: push multi-arch manifests
runs-on: ubuntu-latest
timeout-minutes: 30
needs: push_release_images
env:
REGISTRY: ghcr.io/syself
ALL_ARCH: amd64 arm arm64 ppc64le s390x
ALL_DOCKER_BUILD: core
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2
with:
fetch-depth: 0
- name: Calculate go version
id: vars
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # tag=v5.3.0
with:
go-version: ${{ steps.vars.outputs.go_version }}
- name: Log in to ghcr.io
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # tag=v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Push multi-arch manifests
run: |
make REGISTRY="${REGISTRY}" TAG="${GITHUB_REF_NAME}" ALL_ARCH="${ALL_ARCH}" ALL_DOCKER_BUILD="${ALL_DOCKER_BUILD}" docker-push-manifests

release:
name: create draft release
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
- name: Calculate go version
run: echo "go_version=$(make go-version)" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # tag=v5.3.0
with:
go-version: ${{ env.go_version }}
- name: generate release artifacts
run: |
make release RELEASE_TAG=${{ github.ref_name }}
- name: Release
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # tag=v2.2.1
with:
draft: true
files: out/*
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
56 changes: 34 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,14 @@ TILT_PREPARE_BIN := tilt-prepare
TILT_PREPARE := $(abspath $(TOOLS_BIN_DIR)/$(TILT_PREPARE_BIN))

# Define Docker related variables. Releases should modify and double check these vars.
REGISTRY ?= gcr.io/$(shell gcloud config get-value project)
REGISTRY ?= gcr.io/xxxxxx

# For string inside YAML files (in "out" directory)
PROD_REGISTRY ?= registry.k8s.io/cluster-api

# For string inside YAML files (in "out" directory)
STAGING_REGISTRY ?= gcr.io/k8s-staging-cluster-api
STAGING_BUCKET ?= k8s-staging-cluster-api
#STAGING_BUCKET ?= k8s-staging-cluster-api

# core
IMAGE_NAME ?= cluster-api-controller
Expand Down Expand Up @@ -260,7 +263,7 @@ CAPI_KIND_CLUSTER_NAME ?= capi-test

TAG ?= dev
ARCH ?= $(shell go env GOARCH)
ALL_ARCH ?= amd64 arm arm64 ppc64le s390x
ALL_ARCH ?= amd64

# Allow overriding the imagePullPolicy
PULL_POLICY ?= Always
Expand Down Expand Up @@ -830,10 +833,11 @@ docker-build-%:

# Choice of images to build/push
ALL_DOCKER_BUILD ?= core kubeadm-bootstrap kubeadm-control-plane docker-infrastructure test-extension clusterctl
SYSELF_RELEVANT_DOCKER_BUILD ?= core

.PHONY: docker-build
docker-build: docker-pull-prerequisites ## Run docker-build-* targets for all the images
$(MAKE) ARCH=$(ARCH) $(addprefix docker-build-,$(ALL_DOCKER_BUILD))
$(MAKE) ARCH=$(ARCH) $(addprefix docker-build-,$(SYSELF_RELEVANT_DOCKER_BUILD))

ALL_DOCKER_BUILD_E2E = core kubeadm-bootstrap kubeadm-control-plane docker-infrastructure test-extension

Expand Down Expand Up @@ -1056,9 +1060,9 @@ $(RELEASE_NOTES_DIR):

.PHONY: release
release: clean-release ## Build and push container images using the latest git tag for the commit
@if [ -z "${RELEASE_TAG}" ]; then echo "RELEASE_TAG is not set"; exit 1; fi
@if ! [ -z "$$(git status --porcelain)" ]; then echo "Your local git repository contains uncommitted changes, use git clean before proceeding."; exit 1; fi
git checkout "${RELEASE_TAG}"
#@if [ -z "${RELEASE_TAG}" ]; then echo "RELEASE_TAG is not set"; exit 1; fi
#@if ! [ -z "$$(git status --porcelain)" ]; then echo "Your local git repository contains uncommitted changes, use git clean before proceeding."; exit 1; fi
#git checkout "${RELEASE_TAG}"
# Build binaries first.
GIT_VERSION=$(RELEASE_TAG) $(MAKE) release-binaries
# Set the manifest images to the staging/production bucket and Builds the manifests to publish with a release.
Expand Down Expand Up @@ -1134,11 +1138,11 @@ release-manifests-dev: $(RELEASE_DIR) $(KUSTOMIZE) ## Build the development mani
.PHONY: release-binaries
release-binaries: ## Build the binaries to publish with a release
RELEASE_BINARY=clusterctl-linux-amd64 BUILD_PATH=./cmd/clusterctl GOOS=linux GOARCH=amd64 $(MAKE) release-binary
RELEASE_BINARY=clusterctl-linux-arm64 BUILD_PATH=./cmd/clusterctl GOOS=linux GOARCH=arm64 $(MAKE) release-binary
RELEASE_BINARY=clusterctl-darwin-amd64 BUILD_PATH=./cmd/clusterctl GOOS=darwin GOARCH=amd64 $(MAKE) release-binary
RELEASE_BINARY=clusterctl-darwin-arm64 BUILD_PATH=./cmd/clusterctl GOOS=darwin GOARCH=arm64 $(MAKE) release-binary
RELEASE_BINARY=clusterctl-windows-amd64.exe BUILD_PATH=./cmd/clusterctl GOOS=windows GOARCH=amd64 $(MAKE) release-binary
RELEASE_BINARY=clusterctl-linux-ppc64le BUILD_PATH=./cmd/clusterctl GOOS=linux GOARCH=ppc64le $(MAKE) release-binary
# RELEASE_BINARY=clusterctl-linux-arm64 BUILD_PATH=./cmd/clusterctl GOOS=linux GOARCH=arm64 $(MAKE) release-binary
# RELEASE_BINARY=clusterctl-darwin-amd64 BUILD_PATH=./cmd/clusterctl GOOS=darwin GOARCH=amd64 $(MAKE) release-binary
# RELEASE_BINARY=clusterctl-darwin-arm64 BUILD_PATH=./cmd/clusterctl GOOS=darwin GOARCH=arm64 $(MAKE) release-binary
# RELEASE_BINARY=clusterctl-windows-amd64.exe BUILD_PATH=./cmd/clusterctl GOOS=windows GOARCH=amd64 $(MAKE) release-binary
# RELEASE_BINARY=clusterctl-linux-ppc64le BUILD_PATH=./cmd/clusterctl GOOS=linux GOARCH=ppc64le $(MAKE) release-binary

.PHONY: release-binary
release-binary: $(RELEASE_DIR)
Expand All @@ -1147,9 +1151,11 @@ release-binary: $(RELEASE_DIR)
-e CGO_ENABLED=0 \
-e GOOS=$(GOOS) \
-e GOARCH=$(GOARCH) \
-e GOCACHE=/tmp/ \
-e GOCACHE=/go/build-cache/ \
--user $$(id -u):$$(id -g) \
-v "$$(pwd):/workspace$(DOCKER_VOL_OPTS)" \
-v "$$(go env GOMODCACHE):/go/pkg/mod" \
-v "$$(go env GOCACHE):/go/build-cache" \
-w /workspace \
golang:$(GO_VERSION) \
go build -a -trimpath -gcflags "$(GCFLAGS)" -ldflags "$(LDFLAGS) -extldflags '-static'" \
Expand All @@ -1171,7 +1177,8 @@ release-staging: ## Build and push container images to the staging bucket
$(MAKE) release-manifests-dev
# Example manifest location: https://storage.googleapis.com/k8s-staging-cluster-api/components/main/core-components.yaml
# Please note that these files are deleted after a certain period, at the time of this writing 60 days after file creation.
gsutil cp $(RELEASE_DIR)/* gs://$(STAGING_BUCKET)/components/$(RELEASE_ALIAS_TAG)

##gsutil cp $(RELEASE_DIR)/* gs://$(STAGING_BUCKET)/components/$(RELEASE_ALIAS_TAG)

.PHONY: release-staging-nightly
release-staging-nightly: ## Tag and push container images to the staging bucket. Example image tag: cluster-api-controller:nightly_main_20210121
Expand All @@ -1188,16 +1195,17 @@ release-staging-nightly: ## Tag and push container images to the staging bucket.
$(MAKE) release-manifests-dev
# Example manifest location: https://storage.googleapis.com/k8s-staging-cluster-api/components/nightly_main_20240425/core-components.yaml
# Please note that these files are deleted after a certain period, at the time of this writing 60 days after file creation.
gsutil cp $(RELEASE_DIR)/* gs://$(STAGING_BUCKET)/components/$(NEW_RELEASE_ALIAS_TAG)
#gsutil cp $(RELEASE_DIR)/* gs://$(STAGING_BUCKET)/components/$(NEW_RELEASE_ALIAS_TAG)

.PHONY: release-alias-tag
release-alias-tag: ## Add the release alias tag to the last build tag
gcloud container images add-tag $(CONTROLLER_IMG):$(TAG) $(CONTROLLER_IMG):$(RELEASE_ALIAS_TAG)
gcloud container images add-tag $(KUBEADM_BOOTSTRAP_CONTROLLER_IMG):$(TAG) $(KUBEADM_BOOTSTRAP_CONTROLLER_IMG):$(RELEASE_ALIAS_TAG)
gcloud container images add-tag $(KUBEADM_CONTROL_PLANE_CONTROLLER_IMG):$(TAG) $(KUBEADM_CONTROL_PLANE_CONTROLLER_IMG):$(RELEASE_ALIAS_TAG)
gcloud container images add-tag $(CLUSTERCTL_IMG):$(TAG) $(CLUSTERCTL_IMG):$(RELEASE_ALIAS_TAG)
gcloud container images add-tag $(CAPD_CONTROLLER_IMG):$(TAG) $(CAPD_CONTROLLER_IMG):$(RELEASE_ALIAS_TAG)
gcloud container images add-tag $(TEST_EXTENSION_IMG):$(TAG) $(TEST_EXTENSION_IMG):$(RELEASE_ALIAS_TAG)
echo "Syself: skipping"
# gcloud container images add-tag $(CONTROLLER_IMG):$(TAG) $(CONTROLLER_IMG):$(RELEASE_ALIAS_TAG)
# gcloud container images add-tag $(KUBEADM_BOOTSTRAP_CONTROLLER_IMG):$(TAG) $(KUBEADM_BOOTSTRAP_CONTROLLER_IMG):$(RELEASE_ALIAS_TAG)
# gcloud container images add-tag $(KUBEADM_CONTROL_PLANE_CONTROLLER_IMG):$(TAG) $(KUBEADM_CONTROL_PLANE_CONTROLLER_IMG):$(RELEASE_ALIAS_TAG)
# gcloud container images add-tag $(CLUSTERCTL_IMG):$(TAG) $(CLUSTERCTL_IMG):$(RELEASE_ALIAS_TAG)
# gcloud container images add-tag $(CAPD_CONTROLLER_IMG):$(TAG) $(CAPD_CONTROLLER_IMG):$(RELEASE_ALIAS_TAG)
# gcloud container images add-tag $(TEST_EXTENSION_IMG):$(TAG) $(TEST_EXTENSION_IMG):$(RELEASE_ALIAS_TAG)

.PHONY: release-notes-tool
release-notes-tool:
Expand Down Expand Up @@ -1233,13 +1241,17 @@ docker-image-verify: ## Verifies all built images to contain the correct binary

.PHONY: docker-push-all
docker-push-all: $(addprefix docker-push-,$(ALL_ARCH)) ## Push the docker images to be included in the release for all architectures + related multiarch manifests
$(MAKE) ALL_ARCH="$(ALL_ARCH)" docker-push-manifests

.PHONY: docker-push-manifests
docker-push-manifests: ## Push only the related multiarch manifests for all docker images
$(MAKE) ALL_ARCH="$(ALL_ARCH)" $(addprefix docker-push-manifest-,$(ALL_DOCKER_BUILD))

docker-push-%:
$(MAKE) ARCH=$* docker-push

.PHONY: docker-push
docker-push: $(addprefix docker-push-,$(ALL_DOCKER_BUILD)) ## Push the docker images to be included in the release
docker-push: $(addprefix docker-push-,$(SYSELF_RELEVANT_DOCKER_BUILD)) ## Push the docker images to be included in the release

.PHONY: docker-push-core
docker-push-core: ## Push the core docker image
Expand Down
79 changes: 78 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,81 @@ Participation in the Kubernetes community is governed by the [Kubernetes Code of
[Good first issue]: https://github.com/kubernetes-sigs/cluster-api/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22
[Help wanted]: https://github.com/kubernetes-sigs/cluster-api/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+

<!-- ANCHOR_END: Community -->
# Development (Syself Fork)

## Enabling Multiple Control Plane Classes on top of CAPI v1.13.1

This repository maintains a fork of Cluster API to support **multiple control plane classes**, a feature not available in upstream.

Every time a new upstream release is adopted, the fork must be rebased and the feature reapplied.

## Workflow: Updating the Fork to a New Cluster API Release

Follow the steps below to update the fork to a new upstream version (example: `v1.13.1`):

1. **Configure upstream (if not already configured)**

```sh
git remote add upstream https://github.com/kubernetes-sigs/cluster-api.git
```

2. **Fetch latest tags from upstream**

```sh
git fetch upstream --tags
```

3. **Create a tracking branch from the upstream release tag**

```sh
git checkout -b syself-1.13.1 v1.13.1
```

This branch represents a clean base aligned with the upstream release.

4. **Push the tracking branch to origin**

```sh
git push origin syself-1.13.1
```

5. **Create a feature branch for applying Syself-specific changes**

```sh
git checkout -b 1-13-1-cp-classes
```

6. **Reapply the multiple control plane classes feature**

Cherry-pick the relevant commit(s) from the previous release branch:

```sh
git cherry-pick <commit-hash>
```

> [!NOTE] Resolve any conflicts carefully, especially around API changes between versions.

7. **Create a pull request**

Open a pull request from your feature branch to the tracking branch (`syself-1.13.1`).

# Release (Syself Fork)

```console
export RELEASE_TAG=v1.11.6-syself.XX && git tag -a $RELEASE_TAG -m $RELEASE_TAG && git push origin $RELEASE_TAG
```

Then a Github Action starts and builds a draft release.

You can get notified when the action is finished like this:

```console
gh run watch -i 20 ; music
```

Then open Git repo `autopilot`. Use branch `main` for deploy to prod and branch `syself/oci` for
deploy to testing-cluster.

Update the capi version.

Follow the Autpilot release docs: [autopilot README](https://github.com/syself/autopilot/).
Loading
Loading