Updated on 2026-07-15 GMT+08:00

Constraints on OBS Bucket Mounting

CCI uses an additional container (sidecar container) of a pod to mount an OBS path and then shares the path with the main container of the pod, as shown in Figure 1.

Figure 1 Sidecar container

Constraints

The constraints on OBS mounting are as follows:

  • When creating a pod, add the annotations field: obssidecar-injector-webhook/inject: 'true'
    • obssidecar-injector-webhook/inject: 'true': indicates that the obssidecar container needs to be created to mount OBS.
  • To mount OBS parallel file systems, the obssidecar container must reserve certain memory to ensure service reliability and prevent the container from exiting abnormally due to insufficient resources. When a single OBS parallel file system is mounted to a service container, the recommended CPU and memory specifications are as follows:

    "obssidecar-injector-webhook/cpu": "500m",

    "obssidecar-injector-webhook/memory": "1024Mi"

    When multiple OBS parallel file systems are mounted to a service container, the CPU and memory specifications increase exponentially with the number of OBS parallel file systems.
    • obssidecar-injector-webhook/cpu: CPU specifications of the obssidecar container.
    • obssidecar-injector-webhook/memory: memory specifications of the obssidecar container.
  • When mounting an OBS parallel file system, you can use umask to restrict file or directory permissions.
    • obssidecar-injector-webhook/umask: a mask that controls the permissions to mount an OBS parallel file system to the obssidecar container
Constraints on startup commands:
  • The bash mode is recommended when the YAML file is used to configure container startup commands.

    trap '[ -d /obssidecar/terminate ] && echo > /obssidecar/terminate/0' EXIT && sleep 10

    Example:
    {
        "command": [
            "/bin/sh",
            "-c",
            "trap '[ -d /obssidecar/terminate ] && echo > /obssidecar/terminate/0' EXIT && sleep 10"
        ]
    }
  • You do not need to configure startup commands if user containers have been embedded with startup commands or containers will not exit.

    For containers that have been embedded with startup commands, make sure that the containers write any file to /obssidecar/terminate/ when they exit. In this way, sidecar containers can detect the exit of the user containers.

Example:
{
    "apiVersion": "batch/v1",
    "kind": "Job",
    "metadata": {
        "annotations": {
            "description": ""
        },
        "enable": true,
        "name": "obs-casoffinder",
        "namespace": "cci-namespace-tibgpu",
        "labels": {}
    },
    "spec": {
        "template": {
            "metadata": {
                "enable": true,
                "name": "obs-casoffinder",
                "annotations": {
                    "obssidecar-injector-webhook/inject": "true",
                    "obssidecar-injector-webhook/cpu": "500m",
                    "obssidecar-injector-webhook/memory": "2048Mi",
                    "cri.cci.io/gpu-driver": "gpu-418.126"
                }
            },
            "spec": {
                "containers": [
                    {
                        "image": "swr.cn-north-1.myhuaweicloud.com/aeocdc/opencl1:v1",
                        "name": "casoffinder-obs",
                        "terminationMessagePolicy": "File",
                        "resources": {
                            "limits": {
                                "cpu": "4",
                                "memory": "32Gi",
                                "nvidia.com/gpu-tesla-v100-32GB":"1"
                            },
                            "requests": {
                                "cpu": "4",
                                "memory": "32Gi",
                                "nvidia.com/gpu-tesla-v100-32GB":"1"
                            }
                        },
                        "command": [
                            "/bin/sh",
                            "-c",
                            "/tmp/obs0/gBIG/cas-offinder /tmp/obs0/gBIG/off_targetInput.txt G /tmp/obs0/gBIG/off_targetOutput.txt  && echo >/obssidecar/terminate/0"
                        ],
                        "lifecycle": {},
                        "volumeMounts": [
                            {
                                "name": "cci-obs-import-jzt9g50x-tunn",
                                "mountPath": "/tmp/obs0"
                            }
                        ]
                    }
                ],
                "imagePullSecrets": [
                    {
                        "name": "imagepull-secret"
                    }
                ],
                "restartPolicy": "Never",
                "volumes": [
                    {
                        "persistentVolumeClaim": {
                            "claimName": "cci-obs-import-jzt9g50x-tunn"
                        },
                        "name": "cci-obs-import-jzt9g50x-tunn"
                    }
                ]
            }
        },
        "activeDeadlineSeconds": 200
    }
}