This document describes the procedures for building and launching a mock environment to test CoHDI, as well as how to perform CoHDI testing using the mock.
Note:
In the initial version of the Mock, only CDI DRA testing can be performed because actual GPU attach/detach operations are not supported.
This Mock can run in any environment that supports containers.
For information about the CoHDI runtime environment, please refer to the Helm page (coming soon).
Please use this Mock as an alternative for Composable Hardware Disaggregated Infrastructure Manager within the red block below.
With this Mock, we aim to be able to verify CoHDI's operation even on virtual machine environments.
In this procedure, you will work in a directory named mock, created directly under your home directory.
mkdir -p ~/mockcd ~/mock
git clone <URL of the Mock repository>
ls ~/mockThe structure should be as follows:
Dockerfile Makefile app.py in requirements.txt certs
This step generates a server certificate and private key for HTTPS communication with the mock server.
mkdir -p ~/mock/certs
cd ~/mock/certsvi openssl.cnfEnter the following content:
[ req ]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
[ dn ]
C = Default Country
L = Default City
O = Default Company Ltd
CN = cdimgr.localdomain
[ v3_ca ]
basicConstraints = critical, CA:true
keyUsage = critical, keyCertSign, cRLSign
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid:always,issuer
[ v3_req ]
basicConstraints = CA:FALSE
keyUsage = critical, digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth, clientAuthopenssl req -x509 -newkey rsa:2048 -days 365 -keyout ca.key -out ca.crt -config openssl.cnf -extensions v3_ca -nodesopenssl req -new -nodes -newkey rsa:2048 -keyout server.key -out server.csr -config openssl.cnf -extensions v3_reqopenssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 3650 -sha256 -extensions v3_req -extfile openssl.cnfls ~/mock/certsThe structure should be as follows:
ca.crt ca.key ca.srl openssl.cnf server.crt server.csr server.key
cd ~/mock
makeAfter executing the command, a container image named mock_cohdi:test will be created.
docker images | grep mock_cohdiThe output should be as follows:
mock_cohdi test <image UUID> 23 hours ago 133MB
Start a container named mock_cohdi:test.
Here's an example for launching it using Kubernetes (includes pod and service definitions).
When Kubernetes uses containerd as its runtime, you cannot directly use images built with Docker.
In that case, please import the image into containerd using the following commands:
docker save mock_cohdi:test -o mock_cohdi.tar
sudo ctr -n k8s.io images import mock_cohdi.tarAfter running the above commands, verify that the image has been imported successfully with:
sudo crictl images | grep mock_cohdiThe output should be as follows:
docker.io/library/mock_cohdi test <image UUID> 206MB
apiVersion: v1
kind: Pod
metadata:
name: mock-server
labels:
app: mock-server
spec:
containers:
- name: mock-server
image: mock_cohdi:test
ports:
- containerPort: 443
---
apiVersion: v1
kind: Service
metadata:
name: mock-server
spec:
selector:
app: mock-server
type: ClusterIP
ports:
- protocol: TCP
port: 443
targetPort: 443kubectl apply -f mock-server.yamlkubectl get pods -A | grep mockIf the status is Running, the pod has successfully launched.
Please refer to the Helm-based installation method (coming soon).
In the CoHDI configuration, please set the parameters for the CDI management software's ENDPOINT and certificate to point to the mock server's IP address and certificate.
The composable-dra-driver exposes devices as ResourceSlice objects according to the number of resources in the resource pool. To change the number of resources in the pool, do the following:
Log in to the mock container using the following command:
kubectl exec -it mock-server -- bashOpen the file using the following command:
vi /app/in/machines/00000000-0000-0000-0000-000000000001/available.jsonNote: Please rename or edit both the parent directory name
00000000-0000-0000-0000-000000000001of the JSON file to be edited, as well as any occurrences of the string00000000-0000-0000-0000-000000000001within the JSON files under theindirectory, so that they match themachine_uuidspecified in theproviderIDof the Node resource for the node under test.
Modify the value of reserved_res_num_per_fabric.
After making changes, they will be reflected in the following command output within about 1 minute:
kubectl get ResourceSlice -o yamlThis version of the mock does not yet support testing for dynamic scaling.
This version of the mock does not yet support testing for dynamic scaling.