Skip to content

Commit 7fcc2fb

Browse files
Add objectOverrides concepts page (#807)
* Add objectOverrides concepts page * Update modules/concepts/pages/overrides.adoc Co-authored-by: Malte Sander <[email protected]> * Apply suggestions from code review Co-authored-by: Malte Sander <[email protected]> * Update modules/concepts/pages/overrides.adoc Co-authored-by: Malte Sander <[email protected]> * Reword first sentence according to suggestion * resource -> object --------- Co-authored-by: Malte Sander <[email protected]>
1 parent 6f9819f commit 7fcc2fb

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

modules/concepts/pages/overrides.adoc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,59 @@ They will *not* be applied to:
151151

152152
* Jobs, that are used to setup systems the product depends on e.g. create a database schema for Superset or Airflow.
153153
154+
[#object-overrides]
155+
== Object overrides
156+
157+
Sometimes you need to override Kubernetes objects that are not covered by e.g. `podOverrides` or `configOverrides` like ServiceAccounts or the StatefulSet/Deployment/DaemonSet.
158+
Object overrides let you modify any Kubernetes object that the operator creates as part of its reconciliation loop, which essentially includes all objects associated with a given stacklet.
159+
160+
On every Stackable CRD that is reconciled into a set of Kubernetes objects we provide the field `.spec.objectOverrides`.
161+
This field accepts a list of arbitrary YAML objects, each of which must be a valid Kubernetes object.
162+
163+
For every object it creates, the operator processes the list of overrides from top to bottom.
164+
It first checks if an override matches the object being created by comparing the `apiVersion`, `kind`, `name` and if applicable `namespace` (cluster-scoped objects may omit the namespace).
165+
If an override matches, it is merged using the same mechanism as Pod overrides, using the merge algorithm described in the {k8s-openapi-deepmerge}[k8s-openapi docs{external-link-icon}^], which closely mimics the way Kubernetes applies patches to object.
166+
167+
As a result, you can only modify object created by the operator.
168+
This mechanism does not work to deploy any additional arbitrary Kubernetes object.
169+
170+
[source,yaml]
171+
----
172+
apiVersion: zookeeper.stackable.tech/v1alpha1
173+
kind: ZookeeperCluster
174+
metadata:
175+
name: simple-zk
176+
spec:
177+
# ...
178+
objectOverrides:
179+
- apiVersion: apps/v1
180+
kind: StatefulSet
181+
metadata:
182+
name: simple-zk-server-default
183+
namespace: default
184+
labels:
185+
custom: label
186+
spec:
187+
replicas: 2
188+
podManagementPolicy: Parallel
189+
- apiVersion: v1
190+
kind: ServiceAccount
191+
metadata:
192+
name: simple-zk-serviceaccount
193+
namespace: default
194+
labels:
195+
im-on: AWS
196+
annotations:
197+
custom: AWS
198+
- apiVersion: policy/v1
199+
kind: PodDisruptionBudget
200+
metadata:
201+
name: simple-zk-server
202+
namespace: default
203+
spec:
204+
maxUnavailable: 42
205+
----
206+
154207
[#jvm-argument-overrides]
155208
== JVM argument overrides
156209

0 commit comments

Comments
 (0)