Skip to content
Closed
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
54 changes: 31 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,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 @@ -241,7 +244,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 @@ -840,10 +843,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 @@ -1058,9 +1062,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 @@ -1136,11 +1140,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 @@ -1149,9 +1153,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 -ldflags "$(LDFLAGS) -extldflags '-static'" \
Expand All @@ -1173,7 +1179,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 @@ -1190,16 +1197,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 @@ -1235,13 +1243,13 @@ 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)" $(addprefix docker-push-manifest-,$(ALL_DOCKER_BUILD))
$(MAKE) ALL_ARCH="$(ALL_ARCH)" $(addprefix docker-push-manifest-,$(SYSELF_RELEVANT_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
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,37 @@ 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 -->
# Release/Development (Syself Fork)

1. Create the git tag for the release.
```shell
git tag v1.10.7-syself.8
```

2. Export the release tag.
```shell
export RELEASE_TAG=v1.10.7-syself.8
```

3. Run the release script.
```shell
./hack/release.sh
```
This will create the manifests in the `out/` directory. And push the CAPI controller-image to http://ghcr.io/syself/cluster-api-prod/cluster-api-controller-amd64:v1.10.7-syself.8

4. You can apply the generated `out/operator-configmaps.yaml` and `out/operator-provider-patches.yaml` to the management cluster.
```shell
k apply -f ../cluster-api/out/operator-configmaps.yaml
k apply -f ../cluster-api/out/operator-provider-patches.yaml
```

5. Ensure that the configured `--source` flag in CSO and CSPH deployments is set as `oci`. If its not set as `oci`, edit the same in `addonprovider` for `cso` and `csph`.
```shell
k edit addonproviders.operator.cluster.x-k8s.io -n mgt-system cso
k edit addonproviders.operator.cluster.x-k8s.io -n mgt-system csph
```

6. Ensure that the secret `cluster-stack` containing Github and OCI credentials exist and is same as that of testing-cluster. Otherwise modify it and copy the values from the secret present in testing cluster.
```shell
kubectl-modify-secret -n mgt-system cluster-stack
```
8 changes: 8 additions & 0 deletions api/core/v1beta1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,14 @@ type ControlPlaneTopology struct {
// +optional
Metadata ObjectMeta `json:"metadata,omitempty"`

// class is the name of the ControlPlaneClass used to create the set of control plane nodes.
// This should match one of the control plane classes defined in the ClusterClass object.
// syself new field.
// +optional
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=256
Class string `json:"class,omitempty"`

// replicas is the number of control plane nodes.
// If the value is nil, the ControlPlane object is created without the number of Replicas
// and it's assumed that the control plane controller does not implement support for this field.
Expand Down
36 changes: 36 additions & 0 deletions api/core/v1beta1/clusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ type ClusterClassSpec struct {
// +optional
ControlPlane ControlPlaneClass `json:"controlPlane,omitempty"`

// controlPlaneClasses is a list of named control plane classes that can be referenced
// from the Cluster topology. Each class defines a distinct control plane
// configuration. The class name MUST be unique within this list.
// When classes is defined, the Cluster topology can reference a specific
// control plane class by name.
// syself new field.
// +optional
// +listType=map
// +listMapKey=class
// +kubebuilder:validation:MaxItems=100
ControlPlaneClasses []ControlPlaneClass `json:"controlPlaneClasses,omitempty"`

// workers describes the worker nodes for the cluster.
// It is a collection of node types which can be used to create
// the worker nodes of the cluster.
Expand Down Expand Up @@ -148,6 +160,13 @@ type ControlPlaneClass struct {
// +optional
Metadata ObjectMeta `json:"metadata,omitempty"`

// class denotes a type of control-plane node present in the cluster.
// When used in ControlPlaneTopologyClass.Classes, this name MUST be unique
// within the list and can be referenced from the Cluster topology.
// +optional
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

"syself new field" is missing.

// +default=""
Class string `json:"class,omitempty"`

// LocalObjectTemplate contains the reference to the control plane provider.
LocalObjectTemplate `json:",inline"`

Expand Down Expand Up @@ -1013,6 +1032,12 @@ type PatchSelectorMatch struct {
// +optional
InfrastructureCluster bool `json:"infrastructureCluster,omitempty"`

// controlPlaneClass selects templates referenced in specific ControlPlaneClasses in
// .spec.controlPlane.classes.
// syself new field.
// +optional
ControlPlaneClass *PatchSelectorMatchControlPlaneClass `json:"controlPlaneClass,omitempty"`

// machineDeploymentClass selects templates referenced in specific MachineDeploymentClasses in
// .spec.workers.machineDeployments.
// +optional
Expand All @@ -1024,6 +1049,17 @@ type PatchSelectorMatch struct {
MachinePoolClass *PatchSelectorMatchMachinePoolClass `json:"machinePoolClass,omitempty"`
}

// PatchSelectorMatchControlPlaneClass selects templates referenced
// in specific ControlPlaneClasses in .spec.controlPlane.classes.
type PatchSelectorMatchControlPlaneClass struct {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please add "syself new type"

// names selects templates by class names.
// +optional
// +kubebuilder:validation:MaxItems=100
// +kubebuilder:validation:items:MinLength=1
// +kubebuilder:validation:items:MaxLength=256
Names []string `json:"names,omitempty"`
}

// PatchSelectorMatchMachineDeploymentClass selects templates referenced
// in specific MachineDeploymentClasses in .spec.workers.machineDeployments.
type PatchSelectorMatchMachineDeploymentClass struct {
Expand Down
Loading