YuniKorn is tested against OpenShift and developers can set up their local environment to test patches against OpenShift. Our recommended local environment uses CodeReady containers.
Download CodeReady Container binaries
Select your OS from the dropdown list then click on “Download” (On a Mac, you‘ll download crc-macos-amd64.tar.xz; on Linux, crc-linux-amd64.tar.xz). You’ll be asked to connect using your Red Hat login. If you don't have one, just click on “Create one now”. You do not need a Red Hat subscription for this.
Once logged in, download CodeReady Containers binary and the pull secret.
Unzip the tar file.
tar -xvzf crc-macos-amd64.tar.xz
Move the crc binary under your path. Like
sudo cp `pwd`/crc-macos-$CRCVERSION-amd64/crc /usr/local/bin
Configure CRC in accordance with your hardware capabilities.
crc config set memory 16000 crc config set cpus 12 crc setup
Start the CRC and open the console.
crc start --pull-secret-file pull-secret.txt crc console
The following steps assume you have a running CRC cluster in your laptop. Note that these steps are not tested against a remote CRC cluster.
Access your environment through the oc
command.
Type in the crc oc-env
command to a shell.
$ crc oc-env export PATH="/Users/<user>/.crc/bin/oc:$PATH" # Run this command to configure your shell: # eval $(crc oc-env)
So you need to type in this to access the oc
comamnd:
eval $(crc oc-env)
Log in to oc
. After the CRC has started it will display a similar message:
To access the cluster, first set up your environment by following 'crc oc-env' instructions. Then you can access it by running 'oc login -u developer -p developer https://api.crc.testing:6443'. To login as an admin, run 'oc login -u kubeadmin -p duduw-yPT9Z-hsUpq-f3pre https://api.crc.testing:6443'. To access the cluster, first set up your environment by following 'crc oc-env' instructions.
Use the oc login -u kubeadmin ...
command.
Get the URL of the local OpenShift cluster's internal private Docker repository by typing the command below.
$ oc get route default-route -n openshift-image-registry --template='{{ .spec.host }}' default-route-openshift-image-registry.apps-crc.testing
By default it should be default-route-openshift-image-registry.apps-crc.testing
. Change the steps above, if the displayed URL is different.
Prepare the Docker images.
You can read more about this at the bottom, in the Using custom images section.
Prepare the helm chart.
If you want to use custom Docker images, replace the images in the chart's values.yaml
config file.
Note that if you manually pushed the Docker image to the default-route-openshift-image-registry.apps-crc.testing
docker registry directly you need to have valid certs to access it. On OpenShift there's service for this: image-registry.openshift-image-registry.svc
, which is easier to use.
For example, if you want to override all of the three Docker images you should use the following configs:
image: repository: image-registry.openshift-image-registry.svc:5000/yunikorn/yunikorn tag: scheduler-latest pullPolicy: Always admission_controller_image: repository: image-registry.openshift-image-registry.svc:5000/yunikorn/yunikorn tag: admission-latest pullPolicy: Always web_image: repository: image-registry.openshift-image-registry.svc:5000/yunikorn/yunikorn-web tag: latest pullPolicy: Always
You can find it in the yunikorn-release repo's helm chart directory.
Install the helm charts.
helm install yunikorn . -n yunikorn
Log in into Podman using the following command.
podman login --tls-verify=false -u kubeadmin -p $(oc whoami -t) default-route-openshift-image-registry.apps-crc.testing
Build the image in the repository e.g. in shim using the generic make image
command.
Verify that the image is present in the repository.
podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/apache/yunikorn admission-latest 19eb41241d64 About a minute ago 53.5 MB localhost/apache/yunikorn scheduler-latest e60e09b424d9 About a minute ago 543 MB
Create the images that you wish to replace.
You can either build new images locally or use official (maybe mix both).
make clean image REGISTRY=default-route-openshift-image-registry.apps-crc.testing/<project>/<name>:<tag>
Note that in OpenShift a project is equivalent a Kubernetes namespace. The yunikorn
project/namespace is recommended.
docker tag
command.docker tag apache/yunikorn:scheduler-latest default-route-openshift-image-registry.apps-crc.testing/yunikorn/yunikorn:scheduler-latest
Login to the Docker repository.
docker login -u kubeadmin -p $(oc whoami -t) default-route-openshift-image-registry.apps-crc.testing
Push the Docker images to the internal Docker repository
docker push default-route-openshift-image-registry.apps-crc.testing/yunikorn/yunikorn:scheduler-latest