Updated on 2025-08-12 GMT+08:00

Images

You can manage images using SWR. This section describes how images are pulled when the CCE Cloud Bursting Engine for CCI add-on is installed in a CCE cluster.

Pulling an Image from SWR on the Console

  • Method 1: Selecting an Image from SWR on the CCE Console
    1. Upload an image to SWR. For details, see the SWR documentation.
    1. Create a workload on the CCE cluster console and select an image.

    2. The image will be pulled from SWR. Ensure that your image has been pushed to SWR. For details, see the SWR documentation.
  • Method 2: Select an SWR Image by Configuring a Node in a CCE Cluster
    1. View the image path in the SWR image repository, for example, swr.cn-north-4.myhuaweicloud.com/cci-test/nginx:1.0.0.x86_64_test.

      cn-north-4 indicates the region, and cci-test is the SWR organization.

    2. Log in to a CCE cluster node.
    3. Configure the YAML file of the workload.
      apiVersion: apps/v1
      kind: Deployment
      metadata:
        name: test
        namespace: default
        labels:
          bursting.cci.io/burst-to-cci: enforce    # Schedules the workload to CCI 2.0.
      spec:
        replicas: 2
        selector:
          matchLabels:
            app: test
        template:
          metadata:
            labels:
              app: test
          spec:
            containers:
              - image: swr.***.com/cci-test/nginx:1.0.0.x86_64_test
                name: container-0
                resources:
                  requests:
                    cpu: 250m
                    memory: 512Mi
                  limits:
                    cpu: 250m
                    memory: 512Mi
                volumeMounts: []
            imagePullSecrets:
              - name: default-secret
    4. Deploy the workload.
      kubectl apply -f  test-deployment.yaml

Using Both SWR and a Third-Party Image Repository

Scenario

In some cases, an image can be pulled from a third-party image repository when you create a workload on the CCE cluster console. The pulled image can be synchronized to SWR so that the workload scheduled to CCI uses the image during traffic spikes. This speeds up image pull.

Procedure

Configure annotations in the YAML file of the workload. The following is an example:

bursting.cci.io/image-replacement: '[
    {"repositoryPrefix":"harbor.domain","replaceWith":"swr.***.com/org1"},
    {"repositoryPrefix":"","replaceWith":"swr.***.com/org1"},
    {"repositoryPrefix":"harbor.domain/a/b/c/d","replaceWith":"swr.***.com/org2"}
]'
  • Replacement policies can be executed in any sequence.
  • Multiple replacement policies can be configured. The value of repositoryPrefix for each policy must be unique.

Replacement Policy Key

Description

Remarks

repositoryPrefix

Image prefix that you want to match and replace.

  • If this field is left empty, all containers whose image values do not contain slashes (/) are matched.
  • If this field is not empty, all containers whose image values have the same prefix and end with slashes (/) are matched.
  • This field cannot end with a slash (/) and is verified the same as the container image name.

replaceWith

Image prefix to be used.

  • The value of this field cannot be the same as that of repositoryPrefix.
  • This field cannot end with a slash (/) and is verified the same as the container image name.
Table 1 Annotations

Annotation

Before Replacement

After Replacement

Description

bursting.cci.io/image-replacement: '[

{"repositoryPrefix":"harbor.domain","replaceWith":"swr.***.com/org1"}

]'

containers:

- name: container-0

image: 'harbor.domain/ubuntu:latest'

containers:

- name: container-0

image: 'swr.***.com/org1/ubuntu:latest'

repositoryPrefix matches the domain name of a third-party repository.

bursting.cci.io/image-replacement: '[

{"repositoryPrefix":"","replaceWith":"swr.***.com/org1"}

]'

containers:

- name: container-1

image: 'nginx:latest'

containers:

- name: container-1

image: 'swr.***.com/org1/nginx:latest'

repositoryPrefix is left empty.

bursting.cci.io/image-replacement: '[

{"repositoryPrefix":"harbor.domain/a/b/c/d","replaceWith":"swr.***.com/org2"}

]'

containers:

- name: container-2

image: 'harbor.domain/a/b/c/d/redis:latest'

containers:

- name: container-2

image: 'swr.***.com/org2/redis:latest'

repositoryPrefix matches the domain name of a third-party repository and the organization directory.