Skip to content

Commit 362f1dc

Browse files
committed
feat: add design docs for including additional objects in bundles
1 parent 54dd65a commit 362f1dc

File tree

3 files changed

+145
-0
lines changed

3 files changed

+145
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 namespaced resources that only affect certain pods selected by the pod selector. However,
12+
setting `maxUnavailable` to 0 or 0% (or `minAvailable` to 100%) on the PDB means zero voluntary evictions.
13+
This can make a node impossible to drain and block important lifecycle actions like operator upgrades or even cluster upgrades.
14+
15+
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.
16+
PDBs should target a unique collection of pods and not overlap with existing pods in the namespace.
17+
Be sure to know of existing PDBs in the namespace in which your operator and operands will exist in the cluster.
18+
19+
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
20+
for additional details - PDBs for operands managed by OLM-installed operators will fall into these restrictions.
21+
22+
## Technical Details
23+
24+
PDB yaml manifests can be placed in the bundle alongside existing manifests in the `/manifests` directory. The PDB manifest will be present
25+
in the built bundle image and will be placed into the index database when the bundle is added to an index.
26+
27+
When OLM attempts to install the bundle, it will see the PDB and create it on-cluster. Since PDBs are namespace-scoped resources,
28+
it will be created in the same namespace as the `InstallPlan` associated with the operator. The PDB will be visible in the `InstallPlan`
29+
and if the PDB fails to be installed OLM will provide a descriptive error in the `InstallPlan`.
30+
31+
When the operator is removed, the PDB will be removed as well via the kubernetes garbage collector. The PDB will be replaced when installing a newer version of the operator -
32+
the newer PDB will replace the existing PDB on-cluster. An upgrade to an operator bundle which does not include a PDB will remove the existing PDB from the cluster.
33+
34+
Prior versions of OLM (pre-0.16.0) will not support creating PDBs from the bundle. If a PDB is present in the bundle, OLM will throw an invalid installplan error
35+
specifying that the resource is unsupported.
36+
37+
## Limitations on Pod Disruption Budgets
38+
39+
There are certain limitations that OLM places on PDBs when installing the bundle on-cluster, to attempt to ensure the stability of the cluster.
40+
These rules are also available as validation rules in `opm` when building a bundle.
41+
42+
* `maxUnavailable` field cannot be set to 0 or 0%.
43+
* This can make a node impossible to drain and block important lifecycle actions like operator upgrades or even cluster upgrades.
44+
* `minAvailable` field cannot be set to 100%.
45+
* This can make a node impossible to drain and block important lifecycle actions like operator upgrades or even cluster upgrades.
46+
47+
## Conclusions
48+
49+
PDBs are useful for configuring how many operator replicas or operands should run at any given time. However, it's important
50+
to set reasonable values for any PDBs included in the bundle and carefully consider how the PDB can affect the lifecycle of other resources
51+
in the cluster, such as nodes, to ensure cluster autoscaling and cluster upgrades are able to proceed if they are enabled.

doc/design/adding-priority-classes.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
`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.
12+
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.
13+
Existing pods running on the cluster are not affected by a new `PriorityClass`, but since clusters are dynamic and pods can be
14+
rescheduled as nodes cycle in and out, a `PriorityClass` can have an impact on the long term behavior of the cluster.
15+
16+
Exactly one `PriorityClass` object is allowed to have the `globalDefault` setting set to true. Setting `globalDefault` on a `PriorityClass` means that all pods in the cluster
17+
without an explicit priority class will use this default `PriorityClass`.
18+
19+
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.
20+
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.
21+
22+
Once a `PriorityClass` is removed, no further pods can be created that reference the deleted `PriorityClass`.
23+
24+
## Technical Details
25+
26+
`PriorityClass` yaml manifests can be placed in the bundle alongside existing manifests in the `/manifests` directory. The `PriorityClass` manifest will be present
27+
in the built bundle image and will be placed into the index database when the bundle is added to an index.
28+
29+
`PriorityClass` objects are clusterwide in scope, and will be applied by OLM directly to the cluster. The `PriorityClass` object will have
30+
a label referencing the operator that it is associated with, and will be manually garbage collected by OLM when the operator is removed.
31+
32+
Prior versions of OLM (pre-0.16.0) will not support creating `PriorityClass` from the bundle. If a `PriorityClass` is present in the bundle, OLM will throw an invalid installplan error
33+
specifying that the resource is unsupported.
34+
35+
## Limitations on Priority Classes
36+
37+
There are certain limitations that OLM places on `PriorityClass` objects when installing the bundle on-cluster, to attempt to ensure the stability of the cluster.
38+
These rules are also available as validation rules in `opm` when building a bundle.
39+
40+
* `globalDefault` should always be `false` on a `PriorityClass` included in a bundle.
41+
* Setting `globalDefault` on a `PriorityClass` means that all pods in the cluster without an explicit priority class will use this default `PriorityClass`.
42+
This can unintentionally affect other pods running in the cluster.
43+
44+
## Conclusion
45+
46+
`PriorityClasses` are useful but also potentially far-reaching in nature. Be sure to understand the state of your cluster and
47+
your scheduling requirements before including one in your bundle alongside your operator. Best practice would be to
48+
include a `PriorityClass` that only affects pods like your operator deployment and the respective operands. Setting the `globalDefault`
49+
on a `PriorityClass` to true is not advised in the general sense that it affects all pods scheduled in the cluster, whether or not
50+
they are in the scope of your operator bundle.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
`VerticalPodAutoscaler` objects watch a controller reference, such as deployment, to find a collection of pods to resize. Be sure to pass
13+
the appropriate reference to your operator or operands depending on which you would like the VPA to watch.
14+
15+
The VerticalPodAutoscaler controller must be enabled and active in the cluster for the VPA objects included in the bundle to have an effect.
16+
Alternatively, the installing operator could also add the VPA as a required API to ensure the VPA operator is present in the cluster.
17+
18+
The VPA will continually terminate pods and adjust the resource limits as needed - be sure your application is tolerant of restarts
19+
before including a VPA alongside it.
20+
21+
Note: at this time it is not recommended for the VPA to run alongside the HorizontalPodAutoscaler (HPA) on the same set of pods.
22+
VPA can however be used with an HPA that is configured to use either external or custom metrics.
23+
24+
## Technical Details
25+
26+
VPA yaml manifests can be placed in the bundle alongside existing manifests in the `/manifests` directory. The VPA manifest will be present
27+
in the built bundle image and will be placed into the index database when the bundle is added to an index.
28+
29+
VPA objects are clusterwide in scope, and will be applied by OLM directly to the cluster. The VPA object will have
30+
a label referencing the operator that it is associated with, and will be manually garbage collected by OLM when the operator is removed.
31+
32+
Prior versions of OLM (pre-0.16.0) will not support creating VPA from the bundle. If a VPA is present in the bundle, OLM will throw an invalid installplan error
33+
specifying that the resource is unsupported.
34+
35+
## Limitations on Vertical Pod Autoscalers
36+
37+
No limitations are placed on the contents of a VPA manifest at this time, but that may change as OLM develops
38+
an advanced strategy to ensure installed objects do not compromise the cluster.
39+
40+
## Conclusion
41+
42+
Adding a VPA object in your bundle can lead to more efficient use of resource in your cluster. Best practices include limiting
43+
the VPA to only the objects associated with your bundle. Consider your existing autoscaling setup in the cluster before adding
44+
VPA objects to a bundle and installing the bundle on the cluster.

0 commit comments

Comments
 (0)