Using an Image Snapshot
You can use an image snapshot to create a pod in either of the following ways:
- Automatic matching
   The optimal image is selected from all available image snapshots based on the following: - Image matching degree: The images in the image snapshots are matched with those for the pod, and the mostly matched image snapshot is preferred.
- Time when image snapshots were created: Image snapshots that were created later are preferred.
 
 
 
  If you create a pod using both the specified and automatically matched image snapshots, and the two image snapshots conflict, 400 will be returned.
Automatic Matching
When creating a pod, you can add the following annotations to enable automatic image snapshot matching.
| Key | Example Value | Description | 
|---|---|---|
| cci.io/image-snapshot-auto-match | "true" | Whether to enable automatic image snapshot matching. | 
| cci.io/image-snapshot-usage-strategy | "size" | Automatic matching policy for image snapshots. The default value is size. 
 | 
In the following example, a Deployment will be created.
apiVersion: cci/v2
kind: Deployment
metadata:
  name: deployment-test
  namespace: ns-test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis
  template:
    metadata:
      labels:
        app: redis
      annotations:
        cci.io/image-snapshot-auto-match: "true"
    spec:
      containers:
        - image: redis
          name: container-0
          resources:
            limits:
              cpu: 500m
              memory: 1024Mi
            requests:
              cpu: 500m
              memory: 1024Mi
      imagePullSecrets:
        - name: imagepull-secret
 Specifying an Image Snapshot
When creating a pod, you can add the following annotations to specify the image snapshot and interception policy.
| Key | Example Value | Description | 
|---|---|---|
| cci.io/image-snapshot-specified-name | "my-imagesnapshot" | Name of the specified image snapshot. | 
| cci.io/image-snapshot-reject-if-not-available | "true" | If the specified image snapshot does not exist or is unavailable, the image is pulled from the image repository by default. To intercept pod creation, set the value to "true". | 
In the following example, a Deployment will be created.
apiVersion: cci/v2
kind: Deployment
metadata:
  name: deployment-test
  namespace: ns-test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis
  template:
    metadata:
      labels:
        app: redis
      annotations:
        cci.io/image-snapshot-specified-name: "my-imagesnapshot"
        cci.io/image-snapshot-reject-if-not-available: "true"
    spec:
      containers:
        - image: redis
          name: container-0
          resources:
            limits:
              cpu: 500m
              memory: 1024Mi
            requests:
              cpu: 500m
              memory: 1024Mi
      imagePullSecrets:
        - name: imagepull-secret
 Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot 
    