diff --git a/docs/book/src/SUMMARY.md b/docs/book/src/SUMMARY.md index a45c431aed55..d959fde4e9e4 100644 --- a/docs/book/src/SUMMARY.md +++ b/docs/book/src/SUMMARY.md @@ -67,35 +67,36 @@ - [clusterctl Provider Contract](clusterctl/provider-contract.md) - [clusterctl for Developers](clusterctl/developers.md) - [clusterctl Extensions with Plugins](clusterctl/plugins.md) -- [Developer Guide](./developer/guide.md) - - [Repository Layout](./developer/repository-layout.md) - - [Rapid iterative development with Tilt](./developer/tilt.md) - - [Logging](./developer/logging.md) - - [Testing](./developer/testing.md) - - [Developing E2E tests](./developer/e2e.md) - - [Controllers](./developer/architecture/controllers.md) - - [Bootstrap](./developer/architecture/controllers/bootstrap.md) - - [Cluster](./developer/architecture/controllers/cluster.md) - - [Machine](./developer/architecture/controllers/machine.md) - - [MachineSet](./developer/architecture/controllers/machine-set.md) - - [MachineDeployment](./developer/architecture/controllers/machine-deployment.md) - - [MachineHealthCheck](./developer/architecture/controllers/machine-health-check.md) - - [Control Plane](./developer/architecture/controllers/control-plane.md) - - [MachinePool](./developer/architecture/controllers/machine-pool.md) - - [ClusterTopology](./developer/architecture/controllers/cluster-topology.md) - - [ClusterResourceSet](./developer/architecture/controllers/cluster-resource-set.md) - - [Multi-tenancy](./developer/architecture/controllers/multi-tenancy.md) - - [Support multiple instances](./developer/architecture/controllers/support-multiple-instances.md) - - [Tuning controllers](./developer/architecture/controllers/tuning.md) +- [Developer Guide](./developer/getting-started.md) + - [Developing "core" Cluster API](developer/core/overview.md) + - [Rapid iterative development with Tilt](developer/core/tilt.md) + - [Repository Layout](developer/core/repository-layout.md) + - [Controllers](./developer/core/controllers/overview.md) + - [Cluster](./developer/core/controllers/cluster.md) + - [ClusterTopology](./developer/core/controllers/cluster-topology.md) + - [ClusterResourceSet](./developer/core/controllers/cluster-resource-set.md) + - [MachineDeployment](./developer/core/controllers/machine-deployment.md) + - [MachineSet](./developer/core/controllers/machine-set.md) + - [Machine](./developer/core/controllers/machine.md) + - [MachinePool](./developer/core/controllers/machine-pool.md) + - [MachineHealthCheck](./developer/core/controllers/machine-health-check.md) + - [Bootstrap](./developer/core/controllers/bootstrap.md) + - [Control Plane](./developer/core/controllers/control-plane.md) + - [Logging](developer/core/logging.md) + - [Testing](developer/core/testing.md) + - [Developing E2E tests](developer/core/e2e.md) + - [Tuning controllers](./developer/core/tuning.md) + - [Support multiple instances](./developer/core/support-multiple-instances.md) + - [Multi-tenancy](./developer/core/multi-tenancy.md) - [Developing providers](./developer/providers/overview.md) - [Getting started](developer/providers/getting-started/overview.md) - - [Naming](developer/providers/getting-started/naming.md) - - [Initialize Repo and API types](developer/providers/getting-started/initialize-repo-and-api-types.md) - - [Implement API types](developer/providers/getting-started/implement-api-types.md) - - [Webhooks](developer/providers/getting-started/webhooks.md) - - [Controllers and Reconciliation](developer/providers/getting-started/controllers-and-reconciliation.md) - - [Configure the provider manifest](developer/providers/getting-started/configure-the-deployment.md) - - [Building, Running, Testing](developer/providers/getting-started/building-running-and-testing.md) + - [Naming](developer/providers/getting-started/naming.md) + - [Initialize Repo and API types](developer/providers/getting-started/initialize-repo-and-api-types.md) + - [Implement API types](developer/providers/getting-started/implement-api-types.md) + - [Webhooks](developer/providers/getting-started/webhooks.md) + - [Controllers and Reconciliation](developer/providers/getting-started/controllers-and-reconciliation.md) + - [Configure the provider manifest](developer/providers/getting-started/configure-the-deployment.md) + - [Building, Running, Testing](developer/providers/getting-started/building-running-and-testing.md) - [Provider contracts](./developer/providers/contracts.md) - [Cluster Infrastructure](./developer/providers/cluster-infrastructure.md) - [Control Plane](./developer/providers/control-plane.md) diff --git a/docs/book/src/clusterctl/provider-contract.md b/docs/book/src/clusterctl/provider-contract.md index 5904aced2b1f..ec385943907d 100644 --- a/docs/book/src/clusterctl/provider-contract.md +++ b/docs/book/src/clusterctl/provider-contract.md @@ -254,7 +254,7 @@ While defining the Deployment Spec, the container that executes the controller/r For controllers only, the manager MUST support a `--namespace` flag for specifying the namespace where the controller will look for objects to reconcile; however, clusterctl will always install providers watching for all namespaces -(`--namespace=""`); for more details see [support for multiple instances](../developer/architecture/controllers/support-multiple-instances.md) +(`--namespace=""`); for more details see [support for multiple instances](../developer/core/support-multiple-instances.md) for more context. While defining Pods for Deployments, canonical names should be used for images. diff --git a/docs/book/src/developer/architecture/controllers.md b/docs/book/src/developer/architecture/controllers.md deleted file mode 100644 index e6afe348bc87..000000000000 --- a/docs/book/src/developer/architecture/controllers.md +++ /dev/null @@ -1,20 +0,0 @@ -# Controllers - -Cluster API has a number of controllers, both in the core Cluster API and the reference providers, which move the state of the cluster toward some defined desired state. - -Documentation for the CAPI controllers can be found at: -- Bootstrap Provider - - [Bootstrap](./controllers/bootstrap.md) -- ControlPlane Provider - - [ControlPlane](./controllers/control-plane.md) -- Core - - [Cluster](./controllers/cluster.md) - - [Machine](./controllers/machine.md) - - [MachineSet](./controllers/machine-set.md) - - [MachineDeployment](./controllers/machine-deployment.md) - - [MachineHealthCheck](./controllers/machine-health-check.md) - - [MachinePool](./controllers/machine-pool.md) -- ClusterClass - - [Cluster Topology](./controllers/cluster-topology.md) -- AddOns - - [ClusterResourceSet](./controllers/cluster-resource-set.md) diff --git a/docs/book/src/developer/architecture/controllers/bootstrap.md b/docs/book/src/developer/core/controllers/bootstrap.md similarity index 100% rename from docs/book/src/developer/architecture/controllers/bootstrap.md rename to docs/book/src/developer/core/controllers/bootstrap.md diff --git a/docs/book/src/developer/architecture/controllers/cluster-resource-set.md b/docs/book/src/developer/core/controllers/cluster-resource-set.md similarity index 100% rename from docs/book/src/developer/architecture/controllers/cluster-resource-set.md rename to docs/book/src/developer/core/controllers/cluster-resource-set.md diff --git a/docs/book/src/developer/architecture/controllers/cluster-topology.md b/docs/book/src/developer/core/controllers/cluster-topology.md similarity index 100% rename from docs/book/src/developer/architecture/controllers/cluster-topology.md rename to docs/book/src/developer/core/controllers/cluster-topology.md diff --git a/docs/book/src/developer/architecture/controllers/cluster.md b/docs/book/src/developer/core/controllers/cluster.md similarity index 100% rename from docs/book/src/developer/architecture/controllers/cluster.md rename to docs/book/src/developer/core/controllers/cluster.md diff --git a/docs/book/src/developer/architecture/controllers/control-plane.md b/docs/book/src/developer/core/controllers/control-plane.md similarity index 100% rename from docs/book/src/developer/architecture/controllers/control-plane.md rename to docs/book/src/developer/core/controllers/control-plane.md diff --git a/docs/book/src/developer/architecture/controllers/machine-deployment.md b/docs/book/src/developer/core/controllers/machine-deployment.md similarity index 91% rename from docs/book/src/developer/architecture/controllers/machine-deployment.md rename to docs/book/src/developer/core/controllers/machine-deployment.md index 4554e24e48d8..9161e37e2163 100644 --- a/docs/book/src/developer/architecture/controllers/machine-deployment.md +++ b/docs/book/src/developer/core/controllers/machine-deployment.md @@ -1,6 +1,6 @@ # MachineDeployment -A MachineDeployment orchestrates deployments over a fleet of [MachineSets](./machine-set.md). +A MachineDeployment orchestrates deployments over a fleet of MachineSets. Its main responsibilities are: * Adopting matching MachineSets not assigned to a MachineDeployment diff --git a/docs/book/src/developer/architecture/controllers/machine-health-check.md b/docs/book/src/developer/core/controllers/machine-health-check.md similarity index 80% rename from docs/book/src/developer/architecture/controllers/machine-health-check.md rename to docs/book/src/developer/core/controllers/machine-health-check.md index 43f1deb93777..d26eb12c9667 100644 --- a/docs/book/src/developer/architecture/controllers/machine-health-check.md +++ b/docs/book/src/developer/core/controllers/machine-health-check.md @@ -1,6 +1,6 @@ # MachineHealthCheck -A MachineHealthCheck is responsible for remediating unhealthy [Machines](./machine.md). +A MachineHealthCheck is responsible for remediating unhealthy Machines. Its main responsibilities are: * Checking the health of Nodes in the [workload clusters] against a list of unhealthy conditions diff --git a/docs/book/src/developer/architecture/controllers/machine-pool.md b/docs/book/src/developer/core/controllers/machine-pool.md similarity index 100% rename from docs/book/src/developer/architecture/controllers/machine-pool.md rename to docs/book/src/developer/core/controllers/machine-pool.md diff --git a/docs/book/src/developer/architecture/controllers/machine-set.md b/docs/book/src/developer/core/controllers/machine-set.md similarity index 94% rename from docs/book/src/developer/architecture/controllers/machine-set.md rename to docs/book/src/developer/core/controllers/machine-set.md index 58ba11383f1b..52a17c9c5df2 100644 --- a/docs/book/src/developer/architecture/controllers/machine-set.md +++ b/docs/book/src/developer/core/controllers/machine-set.md @@ -1,6 +1,6 @@ # MachineSet -A MachineSet is an abstraction over [Machines](./machine.md). +A MachineSet is an abstraction over Machines. Its main responsibilities are: * Adopting unowned Machines that aren't assigned to a MachineSet diff --git a/docs/book/src/developer/architecture/controllers/machine.md b/docs/book/src/developer/core/controllers/machine.md similarity index 100% rename from docs/book/src/developer/architecture/controllers/machine.md rename to docs/book/src/developer/core/controllers/machine.md diff --git a/docs/book/src/developer/core/controllers/overview.md b/docs/book/src/developer/core/controllers/overview.md new file mode 100644 index 000000000000..1d8e0658ffb6 --- /dev/null +++ b/docs/book/src/developer/core/controllers/overview.md @@ -0,0 +1,18 @@ +# Controllers + +This section of the book provides an overview about "core" controllers in Cluster API. + + diff --git a/docs/book/src/developer/e2e.md b/docs/book/src/developer/core/e2e.md similarity index 96% rename from docs/book/src/developer/e2e.md rename to docs/book/src/developer/core/e2e.md index c5725b22e735..76204f5bd3e9 100644 --- a/docs/book/src/developer/e2e.md +++ b/docs/book/src/developer/core/e2e.md @@ -50,10 +50,10 @@ Using the config file it is possible to: - Define the list of providers to be installed in the management cluster. Most notably, for each provider it is possible to define: - - One or more versions of the providers manifest (built from the sources, or pulled from a - remote location). - - A list of additional files to be added to the provider repository, to be used e.g. - to provide `cluster-templates.yaml` files. + - One or more versions of the providers manifest (built from the sources, or pulled from a + remote location). + - A list of additional files to be added to the provider repository, to be used e.g. + to provide `cluster-templates.yaml` files. - Define the list of variables to be used when doing `clusterctl init` or `clusterctl generate cluster`. - Define a list of intervals to be used in the test specs for defining timeouts for the @@ -135,7 +135,7 @@ defined in the [Cluster API test framework] to check if the operation completed ### Naming the test spec -You can categorize the test with a custom label that can be used to filter a category of E2E tests to be run. Currently, the cluster-api codebase has [these labels](./testing.md#running-specific-tests) which are used to run a focused subset of tests. +You can categorize the test with a custom label that can be used to filter a category of E2E tests to be run. Currently, the cluster-api codebase has [these labels](testing.md#running-specific-tests) which are used to run a focused subset of tests. ## Tear down @@ -189,7 +189,7 @@ The [test E2E package] provides examples of how this can be achieved by implemen test specs for the most common Cluster API use cases. -[Cluster API quick start]: ../user/quick-start.md +[Cluster API quick start]: ../../user/quick-start.md [Cluster API test framework]: https://pkg.go.dev/sigs.k8s.io/cluster-api/test/framework?tab=doc [Apply method]: https://pkg.go.dev/sigs.k8s.io/cluster-api/test/framework?tab=doc#Applier [CAPA E2E tests]: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/main/scripts/ci-e2e.sh diff --git a/docs/book/src/developer/logging.md b/docs/book/src/developer/core/logging.md similarity index 94% rename from docs/book/src/developer/logging.md rename to docs/book/src/developer/core/logging.md index 5ab476189baa..395beb2f0f7f 100644 --- a/docs/book/src/developer/logging.md +++ b/docs/book/src/developer/core/logging.md @@ -16,7 +16,7 @@ In Cluster API we strive to follow three principles while implementing logging: ## Upstream Alignment -Kubernetes defines a set of [logging conventions](https://git.k8s.io/community/contributors/devel/sig-instrumentation/logging.md), +Kubernetes defines a set of [logging conventions](https://git.k8s.io/community/contributors/devel/sig-instrumentation/logging.md), as well as tools and libraries for logging. ## Continuous improvement @@ -28,8 +28,8 @@ The foundational items of Cluster API logging are: - Adding a minimal set of key/value pairs in the logger at the beginning of each reconcile loop, so all the subsequent log entries will inherit them (see [key value pairs](#keyvalue-pairs)). -Starting from the above foundations, then the long tail of small improvements will consist of following activities: - +Starting from the above foundations, then the long tail of small improvements will consist of following activities: + - Improve consistency of additional key/value pairs added by single log entries (see [key value pairs](#keyvalue-pairs)). - Improve log messages (see [log messages](#log-messages)). - Improve consistency of log levels (see [log levels](#log-levels)). @@ -37,7 +37,7 @@ Starting from the above foundations, then the long tail of small improvements wi ## Log Format Controllers MUST provide support for [structured logging](https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1602-structured-logging) -and for the [JSON output format](https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1602-structured-logging#json-output-format); +and for the [JSON output format](https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1602-structured-logging#json-output-format); quoting the Kubernetes documentation, these are the key elements of this approach: - Separate a log message from its arguments. @@ -61,7 +61,7 @@ beginning of the chain are then inherited by all the subsequent log entries crea Contextual logging is also embedded in controller runtime; In Cluster API we use contextual logging via controller runtime's `LoggerFrom(ctx)` and `LoggerInto(ctx, log)` primitives and this ensures that: -- The logger passed to each reconcile call has a unique `reconcileID`, so all the logs being written during a single +- The logger passed to each reconcile call has a unique `reconcileID`, so all the logs being written during a single reconcile call can be easily identified (note: controller runtime also adds other useful key value pairs by default). - The logger has a key value pair identifying the objects being reconciled,e.g. a Machine Deployment, so all the logs impacting this object can be easily identified. @@ -85,10 +85,10 @@ one of the above practices is really important for Cluster API developers - Developers MUST use `klog.KObj` or `klog.KRef` functions when logging key value pairs for Kubernetes objects, thus ensuring a key value pair representing a Kubernetes object is formatted consistently in all the logs. - Developers MUST use consistent log keys: - - kinds should be written in upper camel case, e.g. `MachineDeployment`, `MachineSet` - - Note: we cannot use lower camel case for kinds consistently because there is no way to - automatically calculate the correct log key for provider CRDs like `AWSCluster` - - all other keys should use lower camel case, e.g. `resourceVersion`, `oldReplicas` to align to Kubernetes log conventions + - kinds should be written in upper camel case, e.g. `MachineDeployment`, `MachineSet` + - Note: we cannot use lower camel case for kinds consistently because there is no way to + automatically calculate the correct log key for provider CRDs like `AWSCluster` + - all other keys should use lower camel case, e.g. `resourceVersion`, `oldReplicas` to align to Kubernetes log conventions Please note that, in order to ensure logs can be easily searched it is important to ensure consistency for the following key value pairs (in order of importance): @@ -96,7 +96,7 @@ key value pairs (in order of importance): - Key value pairs identifying the object being reconciled, e.g. a MachineDeployment. - Key value pairs identifying the hierarchy of objects being reconciled, e.g. the Cluster a MachineDeployment belongs to. -- Key value pairs identifying side effects on other objects, e.g. while reconciling a MachineDeployment, the controller +- Key value pairs identifying side effects on other objects, e.g. while reconciling a MachineDeployment, the controller creates a MachineSet. - Other Key value pairs. @@ -117,9 +117,9 @@ for log levels; as a small integration on the above guidelines we would like to - Logs at the lower levels of verbosity (<=3) are meant to document “what happened” by describing how an object status is being changed by controller/reconcilers across subsequent reconciliations; as a rule of thumb, it is reasonable to assume that a person reading those logs has a deep knowledge of how the system works, but it should not be required - for those persons to have knowledge of the codebase. + for those persons to have knowledge of the codebase. - Logs at higher levels of verbosity (>=4) are meant to document “how it happened”, providing insight on thorny parts of - the code; a person reading those logs usually has deep knowledge of the codebase. + the code; a person reading those logs usually has deep knowledge of the codebase. - Don’t use verbosity higher than 5. We are using log level 2 as a default verbosity for all core Cluster API @@ -140,7 +140,7 @@ Our [Tilt](tilt.md) setup offers a batteries-included log suite based on [Promta We are working to continuously improving this experience, allowing Cluster API developers to use logs and improve them as part of their development process. For the best experience exploring the logs using Tilt: -1. Set `--logging-format=json`. +1. Set `--logging-format=json`. 2. Set a high log verbosity, e.g. `v=5`. 3. Enable Promtail, Loki, and Grafana under `deploy_observability`. @@ -168,7 +168,7 @@ extra_args: - "--v=5" - "--logging-format=json" ``` -The above options can be combined with other settings from our [Tilt](tilt.md) setup. Once Tilt is up and running with these settings users will be able to browse logs using the Grafana Explore UI. +The above options can be combined with other settings from our [Tilt](tilt.md) setup. Once Tilt is up and running with these settings users will be able to browse logs using the Grafana Explore UI. This will normally be available on `localhost:3001`. To explore logs from Loki, open the Explore interface for the DataSource 'Loki'. [This link](http://localhost:3001/explore?datasource%22:%22Loki%22) should work as a shortcut with the default Tilt settings. @@ -220,4 +220,3 @@ we encourage providers to adopt and contribute to the guidelines defined in this It is also worth noting that the foundational elements of the approach described in this document are easy to achieve by leveraging default Kubernetes tooling for logging. - diff --git a/docs/book/src/developer/architecture/controllers/multi-tenancy.md b/docs/book/src/developer/core/multi-tenancy.md similarity index 100% rename from docs/book/src/developer/architecture/controllers/multi-tenancy.md rename to docs/book/src/developer/core/multi-tenancy.md diff --git a/docs/book/src/developer/core/overview.md b/docs/book/src/developer/core/overview.md new file mode 100644 index 000000000000..1be8a6ff741b --- /dev/null +++ b/docs/book/src/developer/core/overview.md @@ -0,0 +1,16 @@ +# Developing "core" Cluster API + +This section of the book is about developing "core" Cluster API. + +With "core" Cluster API we refer to the common set of API and controllers that are required to run +any Cluster API provider. + +Please note that in the Cluster API code base, side by side of "core" Cluster API components there +is also a limited number of in-tree providers: + +- Kubeadm bootstrap provider (CAPBK) +- Kubeadm control plane provider (KCP) +- Docker infrastructure provider (CAPD) - The Docker provider is not designed for production use and is intended for development & test only. +- In Memory infrastructure provider (CAPIM) - The In Memory provider is not designed for production use and is intended for development & test only. + +Please refer to [Developing providers](../providers/overview.md) for documentation about in-tree providers (and out of tree providers too). diff --git a/docs/book/src/developer/repository-layout.md b/docs/book/src/developer/core/repository-layout.md similarity index 98% rename from docs/book/src/developer/repository-layout.md rename to docs/book/src/developer/core/repository-layout.md index 69401542c7e1..ae8eed27c1e3 100644 --- a/docs/book/src/developer/repository-layout.md +++ b/docs/book/src/developer/core/repository-layout.md @@ -53,13 +53,13 @@ This folder contains Cluster API bootstrap provider Kubeadm (CABPK) which is a [~/controlplane](https://github.com/kubernetes-sigs/cluster-api/tree/main/controlplane) -This folder contains a reference implementation of a Cluster API Control Plane provider - KubeadmControlPlane. This package contains the API types and controllers required to instantiate and manage a Kubernetes control plane. It is built and deployed as an independent provider alongside the Cluster API controller manager. +This folder contains a reference implementation of a Cluster API Control Plane provider - KubeadmControlPlane. This package contains the API types and controllers required to instantiate and manage a Kubernetes control plane. It is built and deployed as an independent provider alongside the Cluster API controller manager. -### Cluster API Provider Docker +### Cluster API Provider Docker [~/test/infrastructure/docker](https://github.com/kubernetes-sigs/cluster-api/tree/main/test/infrastructure/docker) -This folder contains a reference implementation of an infrastructure provider for the Cluster API project using Docker. This provider is intended for development purposes only. +This folder contains a reference implementation of an infrastructure provider for the Cluster API project using Docker. This provider is intended for development purposes only. ### Clusterctl CLI @@ -77,11 +77,11 @@ Some of the subfolders are: * [~/config/certmanager](https://github.com/kubernetes-sigs/cluster-api/tree/main/config/certmanager) - It contains manifests like self-signed issuer CR and certificate CR useful for cert manager. * [~/config/crd](https://github.com/kubernetes-sigs/cluster-api/tree/main/config/crd) - It contains CRDs generated from types defined in [api](#api) folder - + * [~/config/manager](https://github.com/kubernetes-sigs/cluster-api/tree/main/config/manager) - It contains manifest for the deployment of core Cluster API manager. - + * [~/config/rbac](https://github.com/kubernetes-sigs/cluster-api/tree/main/config/rbac) - Manifests for RBAC resources generated from kubebuilder markers defined in controllers. - + * [~/config/webhook](https://github.com/kubernetes-sigs/cluster-api/tree/main/config/webhook) - Manifest for webhooks generated from the markers defined in the web hook implementations present in [api](#api) folder. Note: Additional `config` containing manifests can be found in the packages for [KubeadmControlPlane](#controlplane), [KubeadmBoostrap](#bootstrap) and [Cluster API Provider Docker](#cluster-api-provider-docker). @@ -148,7 +148,7 @@ The [api](#api) folder contains webhooks consisting of validators and defaults f [~/internal/webhooks](https://github.com/kubernetes-sigs/cluster-api/tree/main/internal/webhooks) -This directory contains the implementation of some of the Cluster API webhooks. The internal implementation means that the methods supplied by this package cannot be imported by external code bases. +This directory contains the implementation of some of the Cluster API webhooks. The internal implementation means that the methods supplied by this package cannot be imported by external code bases. [~/webhooks](https://github.com/kubernetes-sigs/cluster-api/tree/main/webhooks) diff --git a/docs/book/src/developer/architecture/controllers/support-multiple-instances.md b/docs/book/src/developer/core/support-multiple-instances.md similarity index 100% rename from docs/book/src/developer/architecture/controllers/support-multiple-instances.md rename to docs/book/src/developer/core/support-multiple-instances.md diff --git a/docs/book/src/developer/testing.md b/docs/book/src/developer/core/testing.md similarity index 96% rename from docs/book/src/developer/testing.md rename to docs/book/src/developer/core/testing.md index 7c8333566c01..58d1a25d64e2 100644 --- a/docs/book/src/developer/testing.md +++ b/docs/book/src/developer/core/testing.md @@ -27,8 +27,8 @@ if this is not possible, a viable solution is to use mocks (e.g CAPA). ### Generic providers When writing tests core Cluster API contributors should ensure that the code works with any providers, and thus it is required -to not use any specific provider implementation. Instead, the so-called generic providers e.g. "GenericInfrastructureCluster" -should be used because they implement the plain Cluster API contract. This prevents tests from relying on assumptions that +to not use any specific provider implementation. Instead, the so-called generic providers e.g. "GenericInfrastructureCluster" +should be used because they implement the plain Cluster API contract. This prevents tests from relying on assumptions that may not hold true in all cases. Please note that in the long term we would like to improve the implementation of generic providers, centralizing @@ -46,18 +46,18 @@ the test cluster. With this approach it is possible to interact with Cluster API almost like in a real environment, by creating/updating Kubernetes objects and waiting for the controllers to take action. See the [quick reference](#quick-reference) below for more details. -Also in case of integration tests, considerations about [mocking external APIs](#mocking-external-apis) and usage of [generic providers](#generic-providers) apply. +Also in case of integration tests, considerations about [mocking external APIs](#mocking-external-apis) and usage of [generic providers](#generic-providers) apply. ## Fuzzing tests -Fuzzing tests automatically inject randomly generated inputs, often invalid or with unexpected values, into functions to discover vulnerabilities. +Fuzzing tests automatically inject randomly generated inputs, often invalid or with unexpected values, into functions to discover vulnerabilities. Two different types of fuzzing are currently being used on the Cluster API repository: ### Fuzz testing for API conversion Cluster API uses Kubernetes' conversion-gen to automate the generation of functions to convert our API objects between versions. These conversion functions are tested using the [FuzzTestFunc util in our conversion utils package](https://github.com/kubernetes-sigs/cluster-api/blob/1ec0cd6174f1b860dc466db587241ea7edea0b9f/util/conversion/conversion.go#L194). -For more information about these conversions see the API conversion code walkthrough in our [video walkthrough series](./guide.md#videos-explaining-capi-architecture-and-code-walkthroughs). +For more information about these conversions see the API conversion code walkthrough in our [video walkthrough series](../getting-started.md#videos-explaining-capi-architecture-and-code-walkthroughs). ### OSS-Fuzz continuous fuzzing @@ -78,7 +78,7 @@ In light of continuing improving our practice around this ambitious goal, we are Each contribution in growing this set of utilities or their adoption across the codebase is more than welcome! -Another consideration that can help in improving test maintainability is the idea of testing "by layers"; this idea could +Another consideration that can help in improving test maintainability is the idea of testing "by layers"; this idea could apply whenever we are testing "higher-level" functions that internally uses one or more "lower-level" functions; in order to avoid writing/maintaining redundant tests, whenever possible contributors should take care of testing _only_ the logic that is implemented in the "higher-level" function, delegating the test function called internally @@ -149,7 +149,7 @@ The following guidelines should be followed when developing E2E tests: - Use the [Cluster API test framework]. - Define test spec reflecting real user workflow, e.g. [Cluster API quick start]. - Unless you are testing provider specific features, ensure your test can run with - different infrastructure providers (see [Writing Portable Tests](./e2e.md#writing-portable-e2e-tests)). + different infrastructure providers (see [Writing Portable Tests](e2e.md#writing-portable-e2e-tests)). See [e2e development] for more information on developing e2e tests for CAPI and external providers. @@ -243,8 +243,8 @@ Execute the run configuration with `Debug`.