Skip to content

Commit c693d87

Browse files
authored
Merge pull request #7933 from killianmuldoon/docs/add-runtime-extension-settings
📖 Add documentation of RuntimeExtension settings
2 parents 314d98e + 64163a8 commit c693d87

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

docs/book/src/tasks/experimental-features/runtime-sdk/implement-extensions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,16 @@ controllers processing those resource that might impact system stability.
292292

293293
</aside>
294294

295+
### Settings
296+
297+
Settings can be added to the ExtensionConfig object in the form of a map with string keys and values. These settings are
298+
sent with each request to hooks registered by that ExtensionConfig. Extension developers can implement behavior in their
299+
extensions to alter behavior based on these settings. Settings should be well documented by extension developers so that
300+
ClusterClass authors can understand usage and expected behaviour.
301+
302+
Settings can be provided for individual external patches by providing them in the ClusterClass `.spec.patches[*].external.settings`.
303+
This can be used to overwrite settings at the ExtensionConfig level for that patch.
304+
295305
### Error management
296306

297307
In case a Runtime Extension returns an error, the error will be handled according to the corresponding failure policy

docs/book/src/tasks/experimental-features/runtime-sdk/implement-lifecycle-hooks.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ determine/prepare add-ons for the Cluster and block the creation of those object
4646
```yaml
4747
apiVersion: hooks.runtime.cluster.x-k8s.io/v1alpha1
4848
kind: BeforeClusterCreateRequest
49+
settings: <Runtime Extension settings>
4950
cluster:
5051
apiVersion: cluster.x-k8s.io/v1beta1
5152
kind: Cluster
@@ -84,6 +85,7 @@ possible once the Control Plane is available. This hook does not block any furth
8485
```yaml
8586
apiVersion: hooks.runtime.cluster.x-k8s.io/v1alpha1
8687
kind: AfterControlPlaneInitializedRequest
88+
settings: <Runtime Extension settings>
8789
cluster:
8890
apiVersion: cluster.x-k8s.io/v1beta1
8991
kind: Cluster
@@ -118,6 +120,7 @@ can use this hook to execute pre-upgrade add-on tasks and block upgrades of the
118120
```yaml
119121
apiVersion: hooks.runtime.cluster.x-k8s.io/v1alpha1
120122
kind: BeforeClusterUpgradeRequest
123+
settings: <Runtime Extension settings>
121124
cluster:
122125
apiVersion: cluster.x-k8s.io/v1beta1
123126
kind: Cluster
@@ -160,6 +163,7 @@ until everything is ready.
160163
```yaml
161164
apiVersion: hooks.runtime.cluster.x-k8s.io/v1alpha1
162165
kind: AfterControlPlaneUpgradeRequest
166+
settings: <Runtime Extension settings>
163167
cluster:
164168
apiVersion: cluster.x-k8s.io/v1beta1
165169
kind: Cluster
@@ -196,6 +200,7 @@ This hook does not block any further changes or upgrades to the Cluster.
196200
```yaml
197201
apiVersion: hooks.runtime.cluster.x-k8s.io/v1alpha1
198202
kind: AfterClusterUpgradeRequest
203+
settings: <Runtime Extension settings>
199204
cluster:
200205
apiVersion: cluster.x-k8s.io/v1beta1
201206
kind: Cluster
@@ -231,6 +236,7 @@ cleanup tasks for the add-ons and block deletion of the Cluster and descendant o
231236
```yaml
232237
apiVersion: hooks.runtime.cluster.x-k8s.io/v1alpha1
233238
kind: BeforeClusterDeleteRequest
239+
settings: <Runtime Extension settings>
234240
cluster:
235241
apiVersion: cluster.x-k8s.io/v1beta1
236242
kind: Cluster

docs/book/src/tasks/experimental-features/runtime-sdk/implement-topology-mutation-hook.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ templates, the global variables and the template-specific variables. The respons
8888
```yaml
8989
apiVersion: hooks.runtime.cluster.x-k8s.io/v1alpha1
9090
kind: GeneratePatchesRequest
91+
settings: <Runtime Extension settings>
9192
variables:
9293
- name: <variable-name>
9394
value: <variable-value>
@@ -151,6 +152,7 @@ contains the result of the validation.
151152
```yaml
152153
apiVersion: hooks.runtime.cluster.x-k8s.io/v1alpha1
153154
kind: ValidateTopologyRequest
155+
settings: <Runtime Extension settings>
154156
variables:
155157
- name: <variable-name>
156158
value: <variable-value>

docs/proposals/20220221-runtime-SDK.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ spec:
310310
# NamespaceSelector decides whether to run the webhook on a Cluster based on whether the namespace for that Cluster matches the selector.
311311
# If not specified, the WebHook runs for all the namespaces.
312312
namespaceSelector: {}
313+
# settings is a map[string]string which is sent with each request to a Runtime Extension. These settings can be used by
314+
# to modify the behaviour of a Runtime Extension.
315+
settings: {}
313316
```
314317
315318
Once the extension is registered the [discovery hook](#discovery-hook) is called and the above CR is updated with the list

docs/proposals/20220330-topology-mutation-hook.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ Once the extension is registered the discovery hook is called and the Extension
140140
141141
A ClusterClass author can use an External Patch Extension by referencing it in a ClusterClass and adding the corresponding variable definitions.
142142
143-
A ClusterClass can have external patches, inline patches or both. The patches will then be applied in the order in which they are defined. The extension fields of the external patch must match the unique name of RuntimeExtensions assigned during discovery.
143+
A ClusterClass can have external patches, inline patches or both. The patches will then be applied in the order in which
144+
they are defined. The extension fields of the external patch must match the unique name of RuntimeExtensions assigned during discovery.
145+
External patches can provide settings in map with key and string values. Settings and their usage are defined by GeneratePatch hook authors.
144146
145147
```yaml
146148
apiVersion: cluster.x-k8s.io/v1beta1
@@ -154,7 +156,10 @@ spec:
154156
external:
155157
generateExtension: "http-proxy.my-awesome-patch"
156158
validateExtension: "http-proxy-validate.my-awesome-patch"
157-
# inline patch
159+
settings:
160+
firstSetting: "red"
161+
secondSettings: "blue"
162+
# inline patch
158163
- name: region
159164
definitions:
160165
...

0 commit comments

Comments
 (0)