Skip to content

Commit 6225650

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

File tree

3 files changed

+137
-0
lines changed

3 files changed

+137
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
No limitations are placed on the contents of a `PodDisruptionBudget` manifest at this time, but that may change as OLM develops
40+
an advanced strategy to ensure installed objects do not compromise the cluster.
41+
42+
## Conclusions
43+
44+
PDBs are useful for configuring how many operator replicas or operands should run at any given time. However, it's important
45+
to set reasonable values for any PDBs included in the bundle and carefully consider how the PDB can affect the lifecycle of other resources
46+
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: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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`. Make sure you understand the effects of setting a global
18+
priority for pods running in the cluster before setting a `PriorityClass` as the `globalDefault`.
19+
20+
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.
21+
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.
22+
23+
Once a `PriorityClass` is removed, no further pods can be created that reference the deleted `PriorityClass`.
24+
25+
## Technical Details
26+
27+
`PriorityClass` yaml manifests can be placed in the bundle alongside existing manifests in the `/manifests` directory. The `PriorityClass` manifest will be present
28+
in the built bundle image and will be placed into the index database when the bundle is added to an index.
29+
30+
`PriorityClass` objects are clusterwide in scope, and will be applied by OLM directly to the cluster. The `PriorityClass` object will have
31+
a label referencing the operator that it is associated with, and will be manually garbage collected by OLM when the operator is removed.
32+
33+
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
34+
specifying that the resource is unsupported.
35+
36+
## Limitations on Priority Classes
37+
38+
No limitations are placed on the contents of a `PriorityClass` manifest at this time, but that may change as OLM develops
39+
an advanced strategy to ensure installed objects do not compromise the cluster.
40+
41+
## Conclusion
42+
43+
`PriorityClasses` are useful but also potentially far-reaching in nature. Be sure to understand the state of your cluster and
44+
your scheduling requirements before including one in your bundle alongside your operator. Best practice would be to
45+
include a `PriorityClass` that only affects pods like your operator deployment and the respective operands. Setting the `globalDefault`
46+
on a `PriorityClass` to true is not advised in the general sense that it affects all pods scheduled in the cluster, whether or not
47+
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)