Skip to content

Commit

Permalink
Merge branch 'main' into fix-weekly-update-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
chandankumar4 authored Jan 12, 2024
2 parents a4bd4f5 + ec2abf8 commit 9b340b3
Show file tree
Hide file tree
Showing 84 changed files with 804 additions and 574 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@56284d80811fb5963a972b438f2870f175e5b7c8 # tag=v40.2.3
uses: tj-actions/changed-files@716b1e13042866565e00e85fd4ec490e186c4a2f # tag=v41.0.1
- name: Get release version
id: release-version
run: |
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- [Proposal process (CAEP)](#proposal-process-caep)
- [Triaging E2E test failures](#triaging-e2e-test-failures)
- [Reviewing a Patch](#reviewing-a-patch)
- [Reviews](#reviews)
- [Reviews](#reviews)
- [Approvals](#approvals)
- [Features and bugs](#features-and-bugs)
- [Experiments](#experiments)
Expand Down Expand Up @@ -314,7 +314,7 @@ In case you want to run E2E test locally, please refer to the [Testing](https://

## Reviewing a Patch

## Reviews
### Reviews

> Parts of the following content have been adapted from https://google.github.io/eng-practices/review.
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1098,15 +1098,19 @@ release-alias-tag: ## Add the release alias tag to the last build tag

.PHONY: release-notes-tool
release-notes-tool:
go build -o bin/notes -tags tools sigs.k8s.io/cluster-api/hack/tools/release/notes
go build -C hack/tools -o $(ROOT_DIR)/bin/notes -tags tools sigs.k8s.io/cluster-api/hack/tools/release/notes

.PHONY: release-notes
release-notes: release-notes-tool
./bin/notes --release $(RELEASE_TAG) > CHANGELOG/$(RELEASE_TAG).md

.PHONY: test-release-notes-tool
test-release-notes-tool:
go test -v -tags tools,integration sigs.k8s.io/cluster-api/hack/tools/release/notes
go test -C hack/tools -v -tags tools,integration sigs.k8s.io/cluster-api/hack/tools/release/notes

.PHONY: release-weekly-update-tool
release-weekly-update-tool:
go build -o bin/weekly -tags tools sigs.k8s.io/cluster-api/hack/tools/release/weekly
go build -C hack/tools -o $(ROOT_DIR)/bin/weekly -tags tools sigs.k8s.io/cluster-api/hack/tools/release/weekly

.PHONY: promote-images
promote-images: $(KPROMO)
Expand Down Expand Up @@ -1246,6 +1250,7 @@ clean-tilt: clean-charts clean-kind ## Remove all files generated by Tilt
rm -rf ./controlplane/kubeadm/.tiltbuild
rm -rf ./bootstrap/kubeadm/.tiltbuild
rm -rf ./test/infrastructure/docker/.tiltbuild
rm -rf ./test/infrastructure/inmemory/.tiltbuild

.PHONY: clean-charts
clean-charts: ## Remove all local copies of Helm charts in ./hack/observability
Expand Down
2 changes: 1 addition & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def enable_provider(name, debug):
k8s_yaml(p.get("context") + "/" + resource)
additional_objs = additional_objs + decode_yaml_stream(read_file(p.get("context") + "/" + resource))

if p.get("kustomize_config", True):
if p.get("apply_provider_yaml", True):
yaml = read_file("./.tiltbuild/yaml/{}.provider.yaml".format(name))
k8s_yaml(yaml, allow_duplicates = True)
objs = decode_yaml_stream(yaml)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func (r *KubeadmConfigReconciler) Reconcile(ctx context.Context, req ctrl.Reques
patchOpts = append(patchOpts, patch.WithStatusObservedGeneration{})
}
if err := patchHelper.Patch(ctx, config, patchOpts...); err != nil {
rerr = kerrors.NewAggregate([]error{rerr, errors.Wrapf(err, "failed to patch %s", klog.KObj(config))})
rerr = kerrors.NewAggregate([]error{rerr, err})
}
}()

Expand Down Expand Up @@ -416,7 +416,7 @@ func (r *KubeadmConfigReconciler) handleClusterNotInitialized(ctx context.Contex
if scope.Config.Spec.InitConfiguration == nil {
scope.Config.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{
TypeMeta: metav1.TypeMeta{
APIVersion: "kubeadm.k8s.io/v1beta1",
APIVersion: "kubeadm.k8s.io/v1beta3",
Kind: "InitConfiguration",
},
}
Expand All @@ -431,7 +431,7 @@ func (r *KubeadmConfigReconciler) handleClusterNotInitialized(ctx context.Contex
if scope.Config.Spec.ClusterConfiguration == nil {
scope.Config.Spec.ClusterConfiguration = &bootstrapv1.ClusterConfiguration{
TypeMeta: metav1.TypeMeta{
APIVersion: "kubeadm.k8s.io/v1beta1",
APIVersion: "kubeadm.k8s.io/v1beta3",
Kind: "ClusterConfiguration",
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ func TestKubeadmConfigReconciler_TestSecretOwnerReferenceReconciliation(t *testi

config := newKubeadmConfig(metav1.NamespaceDefault, "cfg")
config.SetOwnerReferences(util.EnsureOwnerRef(config.GetOwnerReferences(), metav1.OwnerReference{
APIVersion: machine.APIVersion,
Kind: machine.Kind,
APIVersion: clusterv1.GroupVersion.String(),
Kind: "Machine",
Name: machine.Name,
UID: machine.UID,
}))
Expand Down Expand Up @@ -207,8 +207,8 @@ func TestKubeadmConfigReconciler_TestSecretOwnerReferenceReconciliation(t *testi

actual.SetOwnerReferences([]metav1.OwnerReference{
{
APIVersion: machine.APIVersion,
Kind: machine.Kind,
APIVersion: clusterv1.GroupVersion.String(),
Kind: "Machine",
Name: machine.Name,
UID: machine.UID,
Controller: ptr.To(true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ func (s *semaphore) setMetadata(cluster *clusterv1.Cluster) {
},
OwnerReferences: []metav1.OwnerReference{
{
APIVersion: cluster.APIVersion,
Kind: cluster.Kind,
APIVersion: clusterv1.GroupVersion.String(),
Kind: "Cluster",
Name: cluster.Name,
UID: cluster.UID,
},
Expand Down
7 changes: 2 additions & 5 deletions cmd/clusterctl/client/cluster/mover.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ func pauseClusterClass(ctx context.Context, proxy Proxy, n *node, pause bool, mu

patchHelper, err := patch.NewHelper(clusterClass, cFrom)
if err != nil {
return errors.Wrapf(err, "error creating patcher for ClusterClass %s/%s", n.identity.Namespace, n.identity.Name)
return err
}

// Update the annotation to the desired state
Expand All @@ -759,11 +759,8 @@ func pauseClusterClass(ctx context.Context, proxy Proxy, n *node, pause bool, mu

// Update the ClusterClass with the new annotations.
clusterClass.SetAnnotations(ccAnnotations)
if err := patchHelper.Patch(ctx, clusterClass); err != nil {
return errors.Wrapf(err, "error patching ClusterClass %s/%s", n.identity.Namespace, n.identity.Name)
}

return nil
return patchHelper.Patch(ctx, clusterClass)
}

// ensureNamespaces ensures all the expected target namespaces are in place before creating objects.
Expand Down
4 changes: 2 additions & 2 deletions controlplane/kubeadm/internal/control_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func NewControlPlane(ctx context.Context, managementCluster ManagementCluster, c
for _, machine := range ownedMachines {
patchHelper, err := patch.NewHelper(machine, client)
if err != nil {
return nil, errors.Wrapf(err, "failed to create patch helper for machine %s", machine.Name)
return nil, err
}
patchHelpers[machine.Name] = patchHelper
}
Expand Down Expand Up @@ -271,7 +271,7 @@ func (c *ControlPlane) PatchMachines(ctx context.Context) error {
controlplanev1.MachineEtcdPodHealthyCondition,
controlplanev1.MachineEtcdMemberHealthyCondition,
}}); err != nil {
errList = append(errList, errors.Wrapf(err, "failed to patch machine %s", machine.Name))
errList = append(errList, err)
}
continue
}
Expand Down
13 changes: 6 additions & 7 deletions controlplane/kubeadm/internal/controllers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ func (r *KubeadmControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.
// Patch ObservedGeneration only if the reconciliation completed successfully
patchOpts := []patch.Option{patch.WithStatusObservedGeneration{}}
if err := patchHelper.Patch(ctx, kcp, patchOpts...); err != nil {
log.Error(err, "Failed to patch KubeadmControlPlane to add finalizer")
return ctrl.Result{}, err
return ctrl.Result{}, errors.Wrapf(err, "failed to add finalizer")
}

return ctrl.Result{}, nil
Expand Down Expand Up @@ -627,7 +626,7 @@ func (r *KubeadmControlPlaneReconciler) syncMachines(ctx context.Context, contro
// TODO: This should be cleaned-up to have a more streamline way of constructing and using patchHelpers.
patchHelper, err := patch.NewHelper(updatedMachine, r.Client)
if err != nil {
return errors.Wrapf(err, "failed to create patch helper for Machine %s", klog.KObj(updatedMachine))
return err
}
patchHelpers[machineName] = patchHelper

Expand Down Expand Up @@ -812,7 +811,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileCertificateExpiries(ctx context
log.V(2).Info(fmt.Sprintf("Setting certificate expiry to %s", expiry))
patchHelper, err := patch.NewHelper(kubeadmConfig, r.Client)
if err != nil {
return errors.Wrapf(err, "failed to reconcile certificate expiry for Machine/%s: failed to create PatchHelper for KubeadmConfig/%s", m.Name, kubeadmConfig.Name)
return errors.Wrapf(err, "failed to reconcile certificate expiry for Machine/%s", m.Name)
}

if annotations == nil {
Expand All @@ -822,7 +821,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileCertificateExpiries(ctx context
kubeadmConfig.SetAnnotations(annotations)

if err := patchHelper.Patch(ctx, kubeadmConfig); err != nil {
return errors.Wrapf(err, "failed to reconcile certificate expiry for Machine/%s: failed to patch KubeadmConfig/%s", m.Name, kubeadmConfig.Name)
return errors.Wrapf(err, "failed to reconcile certificate expiry for Machine/%s", m.Name)
}
}

Expand Down Expand Up @@ -950,7 +949,7 @@ func (r *KubeadmControlPlaneReconciler) ensureCertificatesOwnerRef(ctx context.C

patchHelper, err := patch.NewHelper(c.Secret, r.Client)
if err != nil {
return errors.Wrapf(err, "failed to create patchHelper for Secret %s", klog.KObj(c.Secret))
return err
}

controller := metav1.GetControllerOf(c.Secret)
Expand All @@ -971,7 +970,7 @@ func (r *KubeadmControlPlaneReconciler) ensureCertificatesOwnerRef(ctx context.C
c.Secret.SetOwnerReferences(util.EnsureOwnerRef(c.Secret.GetOwnerReferences(), owner))
}
if err := patchHelper.Patch(ctx, c.Secret); err != nil {
return errors.Wrapf(err, "failed to patch Secret %s with ownerReference %s", klog.KObj(c.Secret), owner.String())
return errors.Wrapf(err, "failed to set ownerReference")
}
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions controlplane/kubeadm/internal/controllers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ func (r *KubeadmControlPlaneReconciler) reconcileKubeconfig(ctx context.Context,
func (r *KubeadmControlPlaneReconciler) adoptKubeconfigSecret(ctx context.Context, configSecret *corev1.Secret, kcp *controlplanev1.KubeadmControlPlane) (reterr error) {
patchHelper, err := patch.NewHelper(configSecret, r.Client)
if err != nil {
return errors.Wrap(err, "failed to create patch helper for the kubeconfig secret")
return err
}
defer func() {
if err := patchHelper.Patch(ctx, configSecret); err != nil {
reterr = errors.Wrap(err, "failed to patch the kubeconfig secret")
reterr = kerrors.NewAggregate([]error{reterr, err})
}
}()
controller := metav1.GetControllerOf(configSecret)
Expand Down
12 changes: 2 additions & 10 deletions controlplane/kubeadm/internal/controllers/remediation.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C
m.DeletionTimestamp.IsZero() {
patchHelper, err := patch.NewHelper(m, r.Client)
if err != nil {
errList = append(errList, errors.Wrapf(err, "failed to get PatchHelper for machine %s", m.Name))
errList = append(errList, err)
continue
}

Expand All @@ -64,7 +64,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C
if err := patchHelper.Patch(ctx, m, patch.WithOwnedConditions{Conditions: []clusterv1.ConditionType{
clusterv1.MachineOwnerRemediatedCondition,
}}); err != nil {
errList = append(errList, errors.Wrapf(err, "failed to patch machine %s", m.Name))
errList = append(errList, err)
}
}
}
Expand Down Expand Up @@ -346,14 +346,6 @@ func (r *KubeadmControlPlaneReconciler) checkRetryLimits(log logr.Logger, machin
return remediationInProgressData, true, nil
}

// max calculates the maximum duration.
func max(x, y time.Duration) time.Duration {
if x < y {
return y
}
return x
}

// canSafelyRemoveEtcdMember assess if it is possible to remove the member hosted on the machine to be remediated
// without loosing etcd quorum.
//
Expand Down
7 changes: 7 additions & 0 deletions docs/book/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ additional-css = ["theme/css/custom.css"]

[output.html.redirect]
"/tasks/upgrade.html" = "/tasks/upgrading-cluster-api-versions.html"
"/agenda.html" = "/agenda/2024.html"
"/agenda/2024.html" = "https://docs.google.com/document/d/1X5_qNUvoY0Tk3BwXODWHAl72L-APM_GiA-IE4WoitYY"
"/agenda/2023.html" = "https://docs.google.com/document/d/1Ov_rbxOV_O4HeAuwTev1lSwkiLJoBc_HDS1NyI93AcY"
"/agenda/2022.html" = ""
"/agenda/2021.html" = ""
"/agenda/2020.html" = ""
"/agenda/2019.html" = "https://docs.google.com/document/d/1Ys-DOR5UsgbMEeciuG0HOgDQc8kZsaWIWJeKJ1-UfbY"

[preprocessor.tabulate]
command = "./util-tabulate.sh"
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/developer/e2e.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ The following recommendations should be followed to write portable E2E tests:

- Create different [E2E config file], one for each target infrastructure provider,
providing different sets of env variables and timeout intervals.
- Use the [InitManagementCluster method] for setting up the management cluster.
- Use the [InitManagementClusterAndWatchControllerLogs method] for setting up the management cluster.
- Use the [ClusterTemplate method] and the [Apply method]
for creating objects in the cluster using `cluster-templates.yaml` files instead
of hard coding object creation.
Expand Down
10 changes: 10 additions & 0 deletions docs/book/src/developer/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ To test another iteration, you'll need to follow the steps to build, push, updat

**Additional ClusterAPI KubeCon talks**

* [SIG Cluster Lifecycle Intro & Future - November 2023](https://www.youtube.com/watch?v=MM0YPhIel2M)
* [Cluster API Deep Dive: Improving Performance up to 2k Clusters - November 2023](https://www.youtube.com/watch?v=bRPfmviTi3s)
* [Leveraging Cluster-API for Production-Ready Multi-Regional Infrastructures - November 2023](https://www.youtube.com/watch?v=BDjhGEVJ0Gs)
* [The Stars Look Very Different Today”: Kubernetes and Cloud Native at the SKA Observatory - November 2023](https://www.youtube.com/watch?v=quW8FbW1fVM)
* [15,000 Minecraft Players Vs One K8s Cluster. Who Wins? - November 2023](https://www.youtube.com/watch?v=4YNp2vb9NTA)
* [Cluster API Providers: Intro, Deep Dive, and Community! - April 2023](https://www.youtube.com/watch?v=QA4OhqLKJn4)
* [Ephemeral Clusters as a Service with ClusterAPI and GitOps - April 2023](https://www.youtube.com/watch?v=cXIo8C7yWvg)
* [The Power of Self-Managing Clusters - April 2023](https://www.youtube.com/watch?v=tNUH_8MFyTc)
* [How to Turn Release Management from Duty to Fun - April 2023](https://www.youtube.com/watch?v=sgP3tyGJ5tQ)
* [Tilt Your World! Lessons Learned in Improving Dev Productivity with Tilt - April 2023](https://www.youtube.com/watch?v=h6llT5Bg97g)
* [How Adobe Planned For Scale With Argo CD, Cluster API, And VCluster - October 2022](https://www.youtube.com/watch?v=p8BluR5WT5w)
* [Bare-Metal Chronicles: Intertwinement Of Tinkerbell, Cluster API And GitOps - October 2022](https://www.youtube.com/watch?v=NCFUUjTw6hA)
* [Running Isolated VirtualClusters With Kata & Cluster API - October 2022](https://www.youtube.com/watch?v=T6w3YrExorY)
Expand Down
2 changes: 2 additions & 0 deletions docs/book/src/developer/providers/migrations/v1.6-to-v1.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ maintainers of providers and consumers of our Go API.

### Other

* Patch helper now return error with enough error context (https://github.com/kubernetes-sigs/cluster-api/pull/9946). It is recommended to remove redundant error context on call sites if applicable.

### Suggested changes for providers
8 changes: 7 additions & 1 deletion docs/book/src/developer/tilt.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,13 @@ COPY --from=tilt-helper /usr/bin/docker /usr/bin/docker
COPY --from=tilt-helper /go/kubernetes/client/bin/kubectl /usr/bin/kubectl
```

**kustomize_config** (Bool, default=true): Whether or not running kustomize on the ./config folder of the provider.
**kustomize_folder** (String, default=config/default): The folder where the kustomize file for a provider
is defined; the path is relative to the provider root folder.

**kustomize_options** ([]String, default=[]): Options to be applied when running kustomize for generating the
yaml manifest for a provider. e.g. `"kustomize_options": [ "--load-restrictor=LoadRestrictionsNone" ]`

**apply_provider_yaml** (Bool, default=true): Whether to apply the provider yaml.
Set to `false` if your provider does not have a ./config folder or you do not want it to be applied in the cluster.

**go_main** (String, default="main.go"): The go main file if not located at the root of the folder
Expand Down
3 changes: 3 additions & 0 deletions docs/book/src/reference/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ updated info about which API version they are supporting.
- [Oracle Cloud Native Environment (OCNE)](https://github.com/verrazzano/cluster-api-provider-ocne)
- [Talos](https://github.com/siderolabs/cluster-api-bootstrap-provider-talos)
- [K3s](https://github.com/cluster-api-provider-k3s/cluster-api-k3s)
- [k0smotron/k0s](https://github.com/k0sproject/k0smotron)

## Control Plane
- [Kubeadm](https://github.com/kubernetes-sigs/cluster-api/tree/main/controlplane/kubeadm)
Expand All @@ -21,6 +22,7 @@ updated info about which API version they are supporting.
- [Talos](https://github.com/siderolabs/cluster-api-control-plane-provider-talos)
- [Kamaji](https://github.com/clastix/cluster-api-control-plane-provider-kamaji)
- [K3s](https://github.com/cluster-api-provider-k3s/cluster-api-k3s)
- [k0smotron/k0s](https://github.com/k0sproject/k0smotron)

## Infrastructure
- [AWS](https://cluster-api-aws.sigs.k8s.io/)
Expand Down Expand Up @@ -51,6 +53,7 @@ updated info about which API version they are supporting.
- [Virtink](https://github.com/smartxworks/cluster-api-provider-virtink)
- [VMware Cloud Director](https://github.com/vmware/cluster-api-provider-cloud-director)
- [vSphere](https://github.com/kubernetes-sigs/cluster-api-provider-vsphere)
- [k0smotron RemoteMachine (SSH)](https://github.com/k0sproject/k0smotron)

## IP Address Management (IPAM)
- [In Cluster](https://github.com/kubernetes-sigs/cluster-api-ipam-provider-in-cluster)
Expand Down
Loading

0 comments on commit 9b340b3

Please sign in to comment.