Commit b529180
committed
Add configurable container resource requests and limits via CR spec
Container resource requirements (CPU/memory requests and limits) were
previously hardcoded inline across controller files, making it impossible
for users to tune resources for their workloads. This is particularly
important for llama-stack, where memory usage can grow unpredictably
with bring-your-own-key (BYOK) deployments.
This adds a `spec.resources` field to the OpenStackLightspeed CR that
accepts per-container `corev1.ResourceRequirements` overrides following
the same pattern used by other openstack-k8s-operators (e.g. test-operator).
Defaults are declared via kubebuilder:default markers on the API types,
so the API server sets them automatically — no fallback logic needed in
the controllers.
All 7 containers are configurable: llamaStack, lightspeedService,
dataverseExporter, vectorDatabaseInit, postgres, okp, and consolePlugin.
Implementation details:
- Add ContainerResourcesSpec struct with kubebuilder:default markers
encoding the previous hardcoded values for each container
- Controllers read instance.Spec.Resources directly — no nil checks
or resolve helpers needed since the API server guarantees defaults
- Add kuttl e2e tests for custom resource application across all
deployments
- Update sample CR with commented-out resource override examples
- Regenerate CRD manifests and deepcopy methods1 parent e770335 commit b529180
22 files changed
Lines changed: 1323 additions & 125 deletions
File tree
- api/v1beta1
- bundle/manifests
- config
- crd/bases
- samples
- internal/controller
- test/kuttl/tests/custom-container-resources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
94 | 141 | | |
95 | 142 | | |
96 | 143 | | |
| |||
105 | 152 | | |
106 | 153 | | |
107 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
108 | 163 | | |
109 | 164 | | |
110 | 165 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments