Profile creation was moved outside the descheduling cycle in b214c147,
but reconcileInClusterSAToken() still runs only in runFnc(), after
newDescheduler() returns. This leaves the prometheus client nil when
LowNodeUtilization's New() runs, causing "prometheus client not
initialized" at startup.
Avoid failing at plugin creation time if the prometheus
client is not yet available. Instead, usageClientForMetrics() is now
called at the start of every extension point via a resetUsageClient()
helper, so each descheduling cycle picks up the latest client regardless
of when the SA token is reconciled or rotated.
Fixes: https://github.com/kubernetes-sigs/descheduler/issues/1840
Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
Automated cherry pick of #1836: Synchronize helm clusterrole RBAC with base yaml
#1826: Add init containers support to Helm chart
#1838: Change icon URL in Chart.yaml
#1842: fix: resolve detected data races
#1847: fix(ci): upgrade codeql-action to v4 and clean up security
#1848: update go dependencies
#1844: Extend PodLifeTime with condition, exit code, owner kind,
Move container waiting/terminated state checking from PodLifeTime and
RemovePodsHavingTooManyRestarts into podutil as separate exported helpers:
HasMatchingContainerWaitingState and HasMatchingContainerTerminatedState.
Each plugin composes only the helpers it needs.
CodeQL Action v1 and v2 have been deprecated. Update
upload-sarif to v4, remove unnecessary strategy block
(missing required matrix property), and remove invalid
exit-code input from the upload-sarif step.
This commit adds support for init containers in the descheduler Helm chart,
allowing users to run initialization tasks before the main descheduler
container starts.
Changes:
- Add initContainers field to values.yaml with example usage
- Update deployment.yaml template to render init containers
- Update cronjob.yaml template to render init containers
- Bump chart version from 0.34.0 to 0.34.1
Init containers can be used for various purposes such as:
- Pre-loading configuration from external sources
- Waiting for dependencies to be ready
- Setting up required files or permissions
- Running security scans or compliance checks
Example usage in values.yaml:
initContainers:
- name: init-config
image: busybox:1.28
command: ['sh', '-c', 'echo Initializing && sleep 5']
Signed-off-by: kjoshi <kjoshi@egnyte.com>
I noticed in v0.35.
```
E0219 23:53:57.761596 1 reflector.go:204] "Failed to watch" err="failed to list *v1.PersistentVolumeClaim: persistentvolumeclaims is forbidden: User \"system:serviceaccount:kube-system:descheduler\" cannot list resource \"persistentvolumeclaims\" in API group \"\" at the cluster scope" logger="UnhandledError" reflector="k8s.io/client-go/informers/factory.go:161" type="*v1.PersistentVolumeClaim"
```
I saw it in rbac.yaml bec9cd38d0/kubernetes/base/rbac.yaml (L38-L40)
So I figured this just needed a bump
The helm-unittest plugin install was failing with:
error unmarshaling JSON: while decoding JSON: json: unknown field "platformHooks"
Pin helm-unittest to v1.0.3 and bump chart-testing-action to v2.8.0.