diff --git a/modules/concepts/pages/overrides.adoc b/modules/concepts/pages/overrides.adoc index 94a497bfa..8a98abf1c 100644 --- a/modules/concepts/pages/overrides.adoc +++ b/modules/concepts/pages/overrides.adoc @@ -151,6 +151,58 @@ They will *not* be applied to: * Jobs, that are used to setup systems the product depends on e.g. create a database schema for Superset or Airflow. +[#object-overrides] +== Object overrides + +Sometimes you need to override Kubernetes objects other than the generated Pods, e.g. ServiceAccounts or the StatefulSet/Deployment/DaemonSet. +Object overrides let you modify any Kubernetes resource that the operator creates as part of its reconciliation loop, which essentially includes all objects associated with a given stacklet. + +On every Stackable CRD that is reconciled into a set of Kubernetes objects we provide the field `.spec.objectOverrides`. +This field accepts a list of arbitrary YAML objects, each of which must be a valid Kubernetes resource. + +For every resource it creates, the operator processes the list of overrides from top to bottom. +It first checks if an override matches the resource being created by comparing the `apiVersion`, `kind`, `name` and if applicable `namespace` (cluster-scoped resources may omit the namespace). +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 resources. + +As a result, you can only modify resources created by the operator. This mechanism does not work to deploy any additional arbitrary Kubernetes resources. + +[source,yaml] +---- +apiVersion: zookeeper.stackable.tech/v1alpha1 +kind: ZookeeperCluster +metadata: + name: simple-zk +spec: + # ... + objectOverrides: + - apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: simple-zk-server-default + namespace: default + labels: + custom: label + spec: + replicas: 2 + podManagementPolicy: Parallel + - apiVersion: v1 + kind: ServiceAccount + metadata: + name: simple-zk-serviceaccount + namespace: default + labels: + im-on: AWS + annotations: + custom: AWS + - apiVersion: policy/v1 + kind: PodDisruptionBudget + metadata: + name: simple-zk-server + namespace: default + spec: + maxUnavailable: 42 +---- + [#jvm-argument-overrides] == JVM argument overrides