dhi.io/kai-scheduler-crd-upgrader
Helm hook image that server-side-applies the KAI Scheduler CRDs before an install or upgrade.
All examples in this guide use the public image. If you've mirrored the repository for your own use (for example, to your Docker Hub namespace), update your commands to reference the mirrored image instead of the public one.
For example:
dhi.io/kai-scheduler-crd-upgrader:<tag><your-namespace>/dhi-kai-scheduler-crd-upgrader:<tag>For the examples, you must first use docker login dhi.io to authenticate to the registry to pull the images.
This image replaces ghcr.io/kai-scheduler/kai-scheduler/crd-upgrader from
KAI Scheduler. The KAI Scheduler Helm chart runs it in four hook Jobs,
each configured by its own values key:
| Values key | Hook | What the Job runs |
|---|---|---|
crdupgrader | pre-install, pre-upgrade | The image's default command, /apply-crds.sh, which applies the six KAI Scheduler CRDs |
topologyMigration | pre-install, pre-upgrade | /bin/bash /scripts/migrate-topologies.sh, which copies Kueue Topology objects to KAI Topology ones |
kaiConfigDeployer | post-install, post-upgrade | /bin/bash -c with kubectl apply --server-side of the kai-config Config object |
postCleanup | post-delete | /bin/sh -c with kubectl delete of the operator-managed Deployments and kai-config |
/apply-crds.sh first runs a server-side dry run of every CRD. If the dry run fails, it changes nothing, prints
CRD preflight failed, no CRD was changed. with remediation steps, and exits with status 1. Otherwise it applies the
CRDs with kubectl apply --server-side=true --force-conflicts, which takes ownership of the CRDs from Helm.
Each tag ships the CRDs of one KAI Scheduler release, so use the tag that matches your chart version:
| KAI Scheduler chart | Debian 13 tags | Alpine 3.24 tag |
|---|---|---|
| v0.16.18 | 0, 0.16, 0.16.18 | 0.16.18-alpine3.24 |
| v0.14.14 | 0.14, 0.14.14 | 0.14.14-alpine3.24 |
| v0.12.29 | 0.12, 0.12.29 | 0.12.29-alpine3.24 |
Tags have no v prefix. FIPS tags end in -fips, for example 0.16.18-fips and 0.16.18-alpine3.24-fips. The
floating 0 tag follows the v0.16 line. KAI Scheduler v0.18 and later charts don't use this image. The v0.12 line is
upstream's LTS release that is supported until December 2026.
The chart builds each hook image reference from a registry, <key>.image.name, and <key>.image.tag. This repository
is named kai-scheduler-crd-upgrader instead of crd-upgrader, and its tags have no v prefix, so set image.name
and image.tag for each hook that should run this image.
The hook Jobs need no other changes. The image keeps upstream's default command, /apply-crds.sh, and runs as the
numeric user 65532, the same as upstream. It writes nothing to its filesystem, so readOnlyRootFilesystem: true and
any non-root UID work, including the runAsUser: 10000 that the chart sets on OpenShift.
Kubernetes nodes don't use your docker login. Create a pull secret in the release namespace from a Docker access token
with read access to the repository:
kubectl create namespace kai-scheduler
kubectl -n kai-scheduler create secret docker-registry dhi-pull-secret \
--docker-server=dhi.io \
--docker-username=<registry user> \
--docker-password=<access token>
On the v0.16 chart, crdupgrader and kaiConfigDeployer accept their own image.registry. Save the following as
values-dhi.yaml:
global:
imagePullSecrets:
- name: dhi-pull-secret
crdupgrader:
image:
registry: dhi.io
name: kai-scheduler-crd-upgrader
tag: 0.16.18
kaiConfigDeployer:
image:
registry: dhi.io
name: kai-scheduler-crd-upgrader
tag: 0.16.18
Install or upgrade the chart with it:
helm upgrade --install kai-scheduler oci://ghcr.io/kai-scheduler/kai-scheduler/kai-scheduler \
--version v0.16.18 --namespace kai-scheduler -f values-dhi.yaml
topologyMigration and postCleanup have no image.registry and always pull from global.registry, so with this file
they keep running the upstream image. To move them as well, mirror the image as described in the next section.
global.registryIf you mirror the KAI Scheduler images into your own registry and point global.registry at it, copy this image next to
them under the name kai-scheduler-crd-upgrader:
docker buildx imagetools create \
--tag registry.example.com/kai-scheduler/kai-scheduler-crd-upgrader:0.16.18 \
dhi.io/kai-scheduler-crd-upgrader:0.16.18
Then set the name and tag for all four hooks. Because global.registry applies to every KAI Scheduler component, the
registry must also hold the upstream images for the other components:
global:
registry: registry.example.com/kai-scheduler
crdupgrader:
image:
name: kai-scheduler-crd-upgrader
tag: 0.16.18
topologyMigration:
image:
name: kai-scheduler-crd-upgrader
tag: 0.16.18
kaiConfigDeployer:
image:
name: kai-scheduler-crd-upgrader
tag: 0.16.18
postCleanup:
image:
name: kai-scheduler-crd-upgrader
tag: 0.16.18
For the v0.14 chart, copy and set the 0.14.14 tag and install with --version v0.14.14. For the v0.12 chart, set the
0.12.29 tag and install with --version v0.12.29. On v0.14 and v0.12, only kaiConfigDeployer accepts
image.registry, so a mirror is the only way to run the other three hooks from this image.
On the v0.16 chart, --set global.fips=true appends -fips to every resolved image tag, including the tags you set.
Keep image.tag at 0.16.18, and the hooks pull 0.16.18-fips. When you mirror, copy the 0.16.18-fips tag.
The v0.14 and v0.12 charts have no global.fips value. Set image.tag to the FIPS tag, for example 0.14.14-fips or
0.12.29-fips.
To apply the CRDs from a workstation, mount a kubeconfig that embeds its credentials and whose API server address is
reachable from the container. --user "$(id -u)" lets the container read a kubeconfig with mode 0600:
docker run --rm --user "$(id -u)" \
-v "$HOME/.kube/config:/kubeconfig:ro" -e KUBECONFIG=/kubeconfig \
dhi.io/kai-scheduler-crd-upgrader:<tag>
To run only the check, without changing any CRD, override the entrypoint with kubectl:
docker run --rm --user "$(id -u)" \
-v "$HOME/.kube/config:/kubeconfig:ro" -e KUBECONFIG=/kubeconfig \
--entrypoint kubectl dhi.io/kai-scheduler-crd-upgrader:<tag> \
apply --server-side --force-conflicts --dry-run=server -f /internal-crds
The image ships a fixed kubectl release for its line: v1.35.10 on the 0.16 and 0.14 tags, and v1.37.2 on the 0.12
tags:
docker run --rm --entrypoint kubectl dhi.io/kai-scheduler-crd-upgrader:<tag> version --client
The Kubernetes version skew policy supports kubectl
1.35 with API servers 1.34, 1.35, and 1.36, and kubectl 1.37 with API servers 1.36, 1.37, and 1.38.
The most common cause is a CRD whose status.storedVersions still lists a version that the new CRD no longer declares.
The Job log then shows an error like:
The CustomResourceDefinition "queues.scheduling.run.ai" is invalid: status.storedVersions[1]: Invalid value: "v1legacy": missing from spec.versions; ...
CRD preflight failed, no CRD was changed. ...
No CRD was changed, so the release is unchanged. With your own kubectl, find the current storage version of that CRD,
re-save its objects so they are stored in that version, and then drop the old version from status.storedVersions:
kubectl get crd queues.scheduling.run.ai -o jsonpath='{.spec.versions[?(@.storage==true)].name}'
kubectl get queues.scheduling.run.ai -A -o yaml | kubectl replace -f -
kubectl patch crd queues.scheduling.run.ai --subresource=status --type=json \
-p='[{"op":"replace","path":"/status/storedVersions","value":["v2"]}]'
Replace queues.scheduling.run.ai and v2 with the CRD and storage version from your error and the first command. Then
run helm upgrade again.
kai-scheduler-crd-upgrader and tags have no v prefix, so the chart's
default image reference doesn't resolve to this image. Set image.name and image.tag as shown above./apply-crds.sh is a symlink to /usr/lib/kai-scheduler-crd-upgrader/apply-crds.sh. The image sets
CRD_DIR=/internal-crds, and the script applies the CRDs in that directory, as upstream's image does.
/internal-crds holds symlinks to the packaged CRDs in /usr/share/kai-scheduler-crd-upgrader/crds, so the default
command applies those unless a directory is mounted at /internal-crds. A mount there replaces the symlinks, and the
default command applies the mounted files, as it does on upstream's image. To apply your own CRD files, mount them at
/internal-crds. A mount at /usr/share/kai-scheduler-crd-upgrader/crds is not read by the default command./internal-crds/embed.go Go source file is not included. The NOTICE file is in
/usr/share/licenses/kai-scheduler-crd-upgrader, next to LICENSE, instead of at /NOTICE.kubectl at /usr/bin/kubectl is v1.35.10 on the 0.16 and 0.14 tags and v1.37.2 on the 0.12 tags, which
is the release upstream's 0.12.29 image ships. Upstream's 0.16 and 0.14 images ship v1.35.0./bin/bash and /bin/sh because the chart's hooks call them, but no package
manager, curl, or jq. /bin/sh is dash on Debian 13 and BusyBox on Alpine.kubectl built with a FIPS 140-3 validated Go cryptographic module, which secures the
TLS connection to the API server, and the OpenSSL FIPS provider.Docker Hardened Images come in different variants depending on their intended use. Image variants are identified by their tag.
Runtime variants are designed to run your application in production. These images are intended to be used either directly or as the FROM image in the final stage of a multi-stage build. These images typically:
Build-time variants typically include dev in the tag name and are intended for use in the first stage of a
multi-stage Dockerfile. These images typically:
FIPS variants include fips in the variant name and tag. They come in both runtime and build-time variants. These
variants use cryptographic modules that have been validated under FIPS 140, a U.S. government standard for secure
cryptographic operations. For example, usage of MD5 fails in FIPS variants.
To view the image variants and get more information about them, select the Tags tab for this repository, and then select a tag.
To migrate your application to a Docker Hardened Image, you must update your Dockerfile. At minimum, you must update the base image in your existing Dockerfile to a Docker Hardened Image. This and a few other common changes are listed in the following table of migration notes.
| Item | Migration note |
|---|---|
| Base image | Replace your base images in your Dockerfile with a Docker Hardened Image. |
| Package management | Non-dev images, intended for runtime, don't contain package managers. Use package managers only in images with a dev tag. |
| Non-root user | By default, non-dev images, intended for runtime, run as the nonroot user. Ensure that necessary files and directories are accessible to the nonroot user. |
| Multi-stage build | Utilize images with a dev tag for build stages and non-dev images for runtime. For binary executables, use a static image for runtime. |
| TLS certificates | Docker Hardened Images contain standard TLS certificates by default. There is no need to install TLS certificates. |
| Ports | Non-dev hardened images run as a nonroot user by default. As a result, applications in these images can't bind to privileged ports (below 1024) when running in Kubernetes or in Docker Engine versions older than 20.10. To avoid issues, configure your application to listen on port 1025 or higher inside the container. |
| Entry point | Docker Hardened Images may have different entry points than images such as Docker Official Images. Inspect entry points for Docker Hardened Images and update your Dockerfile if necessary. |
| No shell | By default, non-dev images, intended for runtime, don't contain a shell. Use dev images in build stages to run shell commands and then copy artifacts to the runtime stage. |
The following steps outline the general migration process.
Find hardened images for your app.
A hardened image may have several variants. Inspect the image tags and find the image variant that meets your needs.
Update the base image in your Dockerfile.
Update the base image in your application's Dockerfile to the hardened image you found in the previous step. For
framework images, this is typically going to be an image tagged as dev because it has the tools needed to install
packages and dependencies.
For multi-stage Dockerfiles, update the runtime image in your Dockerfile.
To ensure that your final image is as minimal as possible, you should use a multi-stage build. All stages in your
Dockerfile should use a hardened image. While intermediary stages will typically use images tagged as dev, your
final runtime stage should use a non-dev image variant.
Install additional packages
Docker Hardened Images contain minimal packages in order to reduce the potential attack surface. You may need to install additional packages in your Dockerfile. Inspect the image variants to identify which packages are already installed.
Only images tagged as dev typically have package managers. You should use a multi-stage Dockerfile to install the
packages. Install the packages in the build stage that uses a dev image. Then, if needed, copy any necessary
artifacts to the runtime stage that uses a non-dev image.
For Alpine-based images, you can use apk to install packages. For Debian-based images, you can use apt-get to
install packages.
The following are common issues that you may encounter during migration.
The hardened images intended for runtime don't contain a shell nor any tools for debugging. The recommended method for debugging applications built with Docker Hardened Images is to use Docker Debug to attach to these containers. Docker Debug provides a shell, common debugging tools, and lets you install other tools in an ephemeral, writable layer that only exists during the debugging session.
By default image variants intended for runtime, run as the nonroot user. Ensure that necessary files and directories are accessible to the nonroot user. You may need to copy files to different directories or change permissions so your application running as the nonroot user can access them.
Non-dev hardened images run as a nonroot user by default. As a result, applications in these images can't bind to
privileged ports (below 1024) when running in Kubernetes or in Docker Engine versions older than 20.10. To avoid issues,
configure your application to listen on port 1025 or higher inside the container, even if you map it to a lower port on
the host. For example, docker run -p 80:8080 my-image will work because the port inside the container is 8080, and
docker run -p 80:81 my-image won't work because the port inside the container is 81.
By default, image variants intended for runtime don't contain a shell. Use dev images in build stages to run shell
commands and then copy any necessary artifacts into the runtime stage. In addition, use Docker Debug to debug containers
with no shell.
Docker Hardened Images may have different entry points than images such as Docker Official Images. Use docker inspect
to inspect entry points for Docker Hardened Images and update your Dockerfile if necessary.