Skip to content

Commit 496f5c8

Browse files
Refactor the BootstrapConfig contract
1 parent 187f385 commit 496f5c8

File tree

9 files changed

+449
-136
lines changed

9 files changed

+449
-136
lines changed

docs/book/src/SUMMARY.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@
7777
- [MachineSet](./developer/core/controllers/machine-set.md)
7878
- [Machine](./developer/core/controllers/machine.md)
7979
- [MachinePool](./developer/core/controllers/machine-pool.md)
80-
- [MachineHealthCheck](./developer/core/controllers/machine-health-check.md)
81-
- [Bootstrap](./developer/core/controllers/bootstrap.md)
80+
- [MachineHealthCheck](./developer/core/controllers/machine-health-check.md)
8281
- [Control Plane](./developer/core/controllers/control-plane.md)
8382
- [Logging](developer/core/logging.md)
8483
- [Testing](developer/core/testing.md)

docs/book/src/developer/core/controllers/bootstrap.md

-16
This file was deleted.

docs/book/src/developer/core/controllers/machine.md

+13
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ a BootstrapConfig object, e.g. KubeadmBoostrapConfig etc.
2222
The [BootstrapConfig resource contract](../../providers/contracts/bootstrap-config.md) defines a set of rules a provider is expected to comply with in order to allow
2323
the expected interactions with the Machine controller.
2424

25+
Among those rules:
26+
- BootstrapConfig MUST create a [bootstrap data secret](../../providers/contracts/bootstrap-config.md#bootstrapconfig-data-secret) where machines should be placed in
27+
- BootstrapConfig MUST report when Machine's bootstrap data secret is [fully provisioned](../../providers/contracts/bootstrap-config.md#bootstrapconfig-initialization-completed)
28+
- BootstrapConfig SHOULD report [conditions](../../providers/contracts/bootstrap-config.md#bootstrapconfig-conditions)
29+
- BootstrapConfig SHOULD report [terminal failures](../../providers/contracts/bootstrap-config.md#bootstrapconfig-terminal-failures)
30+
- BootstrapConfig SHOULD report [taint Nodes at creation](../../providers/contracts/bootstrap-config.md#taint-nodes-at-creation)
31+
- BootstrapConfig SHOULD create a [sentinel file](../../providers/contracts/bootstrap-config.md#sentinel-file) on machines
32+
2533
Considering all the info above, the Machine controller's main responsibilities are:
2634

2735
* Setting an OwnerReference on the infrastructure object referenced in `Machine.spec.infrastructureRef`.
@@ -44,3 +52,8 @@ The machine controller uses the kubeconfig for the new workload cluster to watch
4452
When a node appears with `Node.Spec.ProviderID` matching `Machine.Spec.ProviderID`, the machine controller
4553
transitions the associated machine into the `Provisioned` state. When the infrastructure ref is also
4654
`Ready`, the machine controller marks the machine as `Running`.
55+
56+
The following schema goes trough machine phases and interactions with InfraMachine and BootstrapConfig
57+
happening at each step.
58+
59+
![](../../../images/machine-phases.png)

docs/book/src/developer/providers/contracts/bootstrap-config.md

+423-110
Large diffs are not rendered by default.

docs/book/src/developer/providers/contracts/infra-cluster.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ and the interaction between the Cluster's controller and the InfraCluster resour
1212
rules defined in this page.
1313

1414
Once contract rules are satisfied by an InfraCluster implementation, other implementation details
15-
could be addressed according to the specific needs (Cluster API in not prescriptive).
15+
could be addressed according to the specific needs (Cluster API is not prescriptive).
1616

1717
Nevertheless, it is always recommended to take a look at Cluster API controllers,
1818
in-tree providers, other providers and use them as a reference implementation (unless custom solutions are required
@@ -236,7 +236,7 @@ type APIEndpoint struct {
236236
```
237237

238238
Once `spec.controlPlaneEndpoint` is set on the InfraCluster resource and the [InfraCluster initialization completed],
239-
the Cluster controller will bubble up this info in Cluster's `spec.controlPlaneEndpoint`.
239+
the Cluster controller will surface this info in Cluster's `spec.controlPlaneEndpoint`.
240240

241241
If instead you are developing an infrastructure provider which is NOT responsible to provide a control plane endpoint,
242242
the implementer should exit reconciliation until it sees Cluster's `spec.controlPlaneEndpoint` populated.
@@ -262,7 +262,7 @@ type FooClusterStatus struct {
262262
- `attributes map[string]string`: arbitrary attributes for users to apply to a failure domain.
263263

264264
Once `status.failureDomains` is set on the InfraCluster resource and the [InfraCluster initialization completed],
265-
the Cluster controller will bubble up this info in Cluster's `status.failureDomains`.
265+
the Cluster controller will surface this info in Cluster's `status.failureDomains`.
266266

267267
### InfraCluster: initialization completed
268268

@@ -364,7 +364,7 @@ type FooClusterStatus struct {
364364
```
365365

366366
Once `status.failureReason` and `status.failureMessage` are set on the InfraCluster resource, the Cluster "core" controller
367-
will bubble up those info in the corresponding fields in Cluster's `status`.
367+
will surface those info in the corresponding fields in Cluster's `status`.
368368

369369
Please note that once failureReason/failureMessage is set in Cluster's `status`, the only way to recover is to delete and
370370
recreate the Cluster (it is a terminal failure).

docs/book/src/developer/providers/contracts/infra-machine.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ and the interaction between the Machine's controller and the InfraMachine resour
1212
rules defined in this page.
1313

1414
Once contract rules are satisfied by an InfraMachine implementation, other implementation details
15-
could be addressed according to the specific needs (Cluster API in not prescriptive).
15+
could be addressed according to the specific needs (Cluster API is not prescriptive).
1616

1717
Nevertheless, it is always recommended to take a look at Cluster API controllers,
1818
in-tree providers, other providers and use them as a reference implementation (unless custom solutions are required
@@ -215,7 +215,7 @@ type FooMachineSpec struct {
215215
```
216216

217217
Once `spec.providerID` is set on the InfraMachine resource and the [InfraMachine initialization completed],
218-
the Cluster controller will bubble up this info in Machine's `spec.providerID`.
218+
the Cluster controller will surface this info in Machine's `spec.providerID`.
219219

220220
### InfraMachine: failure domain
221221

@@ -275,7 +275,7 @@ type FooMachineStatus struct {
275275
Each MachineAddress must have a type; accepted types are `Hostname`, `ExternalIP`, `InternalIP`, `ExternalDNS` or `InternalDNS`.
276276

277277
Once `status.addresses` is set on the InfraMachine resource and the [InfraMachine initialization completed],
278-
the Machine controller will bubble up this info in Machine's `status.addresses`.
278+
the Machine controller will surface this info in Machine's `status.addresses`.
279279

280280
### InfraMachine: initialization completed
281281

@@ -377,7 +377,7 @@ type FooMachineStatus struct {
377377
```
378378

379379
Once `status.failureReason` and `status.failureMessage` are set on the InfraMachine resource, the Machine "core" controller
380-
will bubble up those info in the corresponding fields in Machine's `status`.
380+
will surface those info in the corresponding fields in Machine's `status`.
381381

382382
Please note that once failureReason/failureMessage is set in Machine's `status`, the only way to recover is to delete and
383383
recreate the Machine (it is a terminal failure).

docs/book/src/developer/providers/security-guidelines.md

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ There are several critical areas that any infrastructure provider implementer mu
66
- **Ensuring secure access to VMs** for troubleshooting, with proper authentication methods.
77
- **Controlling manual operations** performed on cloud infrastructure targeted by the provider.
88
- **Housekeeping** of the cloud infrastructure, ensuring timely cleanup and garbage collection of unused resources.
9+
- **Securing Machine's bootstrap data** ensuring protection oversensitive data that might be included in it.
910

1011
The following list outlines high-level security recommendations. It is a community-maintained resource, and everyone’s contributions are essential to continuously improve and adapt these best practices. Each provider implementer is responsible for translating these recommendations to fit the context of their specific cloud provider:
1112

@@ -23,3 +24,6 @@ The following list outlines high-level security recommendations. It is a communi
2324

2425
5. **Resource Housekeeping**:
2526
Any cloud resource not linked to a cluster after a fixed configurable period, created by cloud credentials, should be automatically deleted or marked for garbage collection to avoid resource sprawl.
27+
28+
6. **Securing Machine's bootstrap data**:
29+
Bootstrap data are usually stored in machine's metadata, and they might contain sensitive data, like e.g. Cluster secrets, user credentials, ssh certificates etc. It is important to ensure protections of those metadata, or if not possible, to clean up them immediately after machine bootstrap.

0 commit comments

Comments
 (0)