Skip to content

Commit 0e0d139

Browse files
committed
feat: add design docs for including additional objects in bundles
1 parent afd2348 commit 0e0d139

File tree

3 files changed

+150
-0
lines changed

3 files changed

+150
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Adding Pod Disruption Budgets
2+
3+
## Description
4+
5+
OLM supports users including `PodDisruptionBudget` (PDB) objects in their bundle alongside their operator manifests. `PodDisruptionBudgets`
6+
are used to provide detailed information to the kube-scheduler about how many pods in a collection can be available or unavailable at given time.
7+
For more info, see the docs at https://kubernetes.io/docs/tasks/run-application/configure-pdb/#protecting-an-application-with-a-poddisruptionbudget.
8+
9+
## Caveats
10+
11+
PDBs are useful for configuring how many operator replicas or operands should run at any given time. However, it's important
12+
to set reasonable values for any PDBs included in the bundle and carefully consider how the PDB can affect the lifecycle of other resources
13+
in the cluster, such as nodes, to ensure cluster autoscaling and cluster upgrades are able to proceed if they are enabled.
14+
15+
PDBs are namespaced resources that only affect certain pods selected by the pod selector. However,
16+
setting `maxUnavailable` to 0 or 0% (or `minAvailable` to 100%) on the PDB means zero voluntary evictions.
17+
This can make a node impossible to drain and block important lifecycle actions like operator upgrades or even cluster upgrades.
18+
19+
Multiple PDBs can exist in one namespace- this can cause conflicts. For example, a PDB with the same name may already exist in the namespace.
20+
PDBs should target a unique collection of pods and not overlap with existing pods in the namespace.
21+
Be sure to know of existing PDBs in the namespace in which your operator and operands will exist in the cluster.
22+
23+
PDBs for pods controlled by operators have additional restrictions around them. See https://kubernetes.io/docs/tasks/run-application/configure-pdb/#arbitrary-controllers-and-selectors
24+
for additional details - PDBs for operands managed by OLM-installed operators will fall into these restrictions.
25+
26+
## Technical Details
27+
28+
PDB yaml manifests can be placed in the bundle alongside existing manifests in the `/manifests` directory. The PDB manifest will be stored
29+
in the bundle image.
30+
31+
When OLM attempts to install the bundle, it will see the PDB and create it on-cluster. Since PDBs are namespace-scoped resources,
32+
it will be created in the same namespace as the `InstallPlan` associated with the operator. The PDB will be visible in the `InstallPlan`
33+
and if the PDB fails to be installed OLM will provide a descriptive error in the `InstallPlan`.
34+
35+
OLM installs additional objects in the bundle after installing the CRDs and the CSV, to ensure proper owner references between the objects
36+
and the CSV. Therefore, there may be an initial period where additional objects are not available to the operator.
37+
38+
When the operator is removed, the PDB will be removed as well via the kubernetes garbage collector. The PDB will be updated when installing a newer version of the operator -
39+
the existing PDB will be updated to the new PDB on-cluster. An upgrade to an operator bundle which does not include a PDB will remove the existing PDB from the cluster.
40+
41+
Prior versions of OLM (pre-0.16.0) do not support PDBs. If a PDB is present in a bundle attempting to be installed on-cluster, OLM will throw an invalid installplan error
42+
specifying that the resource is unsupported.
43+
44+
## Limitations on Pod Disruption Budgets
45+
46+
No limitations are placed on the contents of a PDB at this time when installing on-cluster, but that may change as OLM develops
47+
an advanced strategy to ensure installed objects do not compromise the cluster.
48+
49+
However, the following are suggested guidelines to follow when including PDB objects in a bundle.
50+
51+
* `maxUnavailable` field cannot be set to 0 or 0%.
52+
* This can make a node impossible to drain and block important lifecycle actions like operator upgrades or even cluster upgrades.
53+
* `minAvailable` field cannot be set to 100%.
54+
* This can make a node impossible to drain and block important lifecycle actions like operator upgrades or even cluster upgrades.

doc/design/adding-priority-classes.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Adding Priority Classes
2+
3+
## Description
4+
5+
OLM supports users including `PriorityClass` objects in their bundle alongside their operator manifests. `PriorityClass`
6+
is used to establish a priority, or weight, to a collection of pods in order to aid the kube-scheduler when assigning pods
7+
to nodes. For more info, see the docs at https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass.
8+
9+
## Caveats
10+
11+
`PriorityClasses` are useful but also potentially far-reaching in nature. Be sure to understand the state of your cluster and
12+
your scheduling requirements before including one in your bundle alongside your operator. Best practice would be to
13+
include a `PriorityClass` that only affects pods like your operator deployment and the respective operands.
14+
15+
`PriorityClass` objects are clusterwide in scope, meaning they can affect the scheduling of pods in all namespaces. Operators that specify a PriorityClass can affect other tenants on a multi-tenant cluster.
16+
All pods have a default priority of zero, and only those pods explicitly selected by the `PriorityClass` object will be given a priority when created.
17+
Existing pods running on the cluster are not affected by a new `PriorityClass`, but since clusters are dynamic and pods can be
18+
rescheduled as nodes cycle in and out, a `PriorityClass` can have an impact on the long term behavior of the cluster.
19+
20+
Only one `PriorityClass` object in the cluster is allowed to have the `globalDefault` setting set to true. Attempting to install a `PriorityClass` with `globalDefault` set to true when one
21+
with `globalDefault` already exists on-cluster will result in a Forbidden error from the api-server. Setting `globalDefault` on a `PriorityClass` means that all pods in the cluster
22+
without an explicit priority class will use this default `PriorityClass`.
23+
24+
Pods with higher priorities can preempt pods with lower priorities when they are being scheduled onto nodes: preemption can result in lower-priority pods being evicted to make room for the higher priority pod.
25+
If the `PriorityClass` of the pod is extremely high (higher than the priority of core components) scheduling the pod can potentially disrupt core components running in the cluster.
26+
27+
Once a `PriorityClass` is removed, no further pods can be created that reference the deleted `PriorityClass`.
28+
29+
## Technical Details
30+
31+
`PriorityClass` yaml manifests can be placed in the bundle alongside existing manifests in the `/manifests` directory. The `PriorityClass` manifest will be present
32+
in the bundle image.
33+
34+
`PriorityClass` objects are clusterwide in scope, and will be applied by OLM directly to the cluster. The `PriorityClass` object will have
35+
a label referencing the operator that it is associated with.
36+
37+
OLM installs additional objects in the bundle after installing the CRDs and the CSV, to ensure proper owner references between the objects
38+
and the CSV. Therefore, there may be an initial period where additional objects are not available to the operator.
39+
40+
Prior versions of OLM (pre-0.16.0) do not support `PriorityClass` objects. If a `PriorityClass` is present in a bundle attempting to be installed on-cluster, OLM will throw an invalid installplan error
41+
specifying that the resource is unsupported.
42+
43+
## Limitations on Priority Classes
44+
45+
No limitations are placed on the contents of a `PriorityClass` manifest at this time when installing on-cluster, but that may change as OLM develops
46+
an advanced strategy to ensure installed objects do not compromise the cluster.
47+
48+
However, the following is a suggested guideline to follow when including `PriorityClass` objects in a bundle.
49+
* `globalDefault` should always be `false` on a `PriorityClass` included in a bundle.
50+
* Setting `globalDefault` on a `PriorityClass` means that all pods in the cluster without an explicit priority class will use this default `PriorityClass`.
51+
This can unintentionally affect other pods running in the cluster.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Adding Vertical Pod Autoscaler
2+
3+
## Description
4+
5+
OLM supports users including `VerticalPodAutoscaler` (VPA) objects in their bundle alongside their operator manifests. `VerticalPodAutoscalers`
6+
objects are used to configure the VerticalPodAutoscaler controller to dynamically allocate resources to pods based on their usage of CPU, memory,
7+
and other custom metrics. VPAs allow for more efficient use of cluster resources as pod resource needs are continually evaluated and adjusted by the VPA controller.
8+
For more info, see the docs at https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler.
9+
10+
## Caveats
11+
12+
Adding a VPA object in your bundle can lead to more efficient use of resource in your cluster. Best practices include limiting
13+
the VPA to only the objects associated with your bundle. Consider your existing autoscaling setup in the cluster before adding
14+
VPA objects to a bundle and installing the bundle on the cluster.
15+
16+
`VerticalPodAutoscaler` objects watch a controller reference, such as deployment, to find a collection of pods to resize. Be sure to pass
17+
the appropriate reference to your operator or operands depending on which you would like the VPA to watch.
18+
19+
The VerticalPodAutoscaler controller must be enabled and active in the cluster for the VPA objects included in the bundle to have an effect.
20+
Alternatively, the installing operator could also add the VPA as a required API to ensure the VPA operator is present in the cluster.
21+
22+
The VPA will continually terminate pods and adjust the resource limits as needed - be sure your application is tolerant of restarts
23+
before including a VPA alongside it.
24+
25+
Note: at this time it is not recommended for the VPA to run alongside the HorizontalPodAutoscaler (HPA) on the same set of pods.
26+
VPA can however be used with an HPA that is configured to use either external or custom metrics.
27+
28+
## Technical Details
29+
30+
VPA yaml manifests can be placed in the bundle alongside existing manifests in the `/manifests` directory. The VPA manifest will be present
31+
in the bundle image.
32+
33+
VPA objects are clusterwide in scope, and will be applied by OLM directly to the cluster. The VPA object will have
34+
a label referencing the operator that it is associated with.
35+
36+
OLM installs additional objects in the bundle after installing the CRDs and the CSV, to ensure proper owner references between the objects
37+
and the CSV. Therefore, there may be an initial period where additional objects are not available to the operator.
38+
39+
Prior versions of OLM (pre-0.16.0) do not support VPA objects. If a VPA is present in a bundle attempting to be installed on-cluster, OLM will throw an invalid installplan error
40+
specifying that the resource is unsupported.
41+
42+
## Limitations on Vertical Pod Autoscalers
43+
44+
No limitations are placed on the contents of a VPA manifest at this time when installing on-cluster, but that may change as OLM develops
45+
an advanced strategy to ensure installed objects do not compromise the cluster.

0 commit comments

Comments
 (0)