全部产品
Search
文档中心

弹性容器实例:kubernetes ImageCache API

更新时间:Dec 27, 2022

本文提供ImageCache API供您参考使用。

数据类型

ImageCacheList

字段

类型

描述

apiVersion

String

API版本。取值为eci.alibabacloud.com/v1。

kind

String

资源类别。取值为ImageCacheList。

metadata

ListMeta

元数据列表(Standard list metadata)。

Items

ImageCache[]

镜像缓存列表。

ImageCache

字段

类型

描述

apiVersion

String

API版本。取值为eci.alibabacloud.com/v1。

kind

String

资源类别。取值为ImageCache。

metadata

ObjectMeta

对象metadata。

spec

ImageCacheSpec

镜像缓存详细信息。

status

ImageCacheStatus

镜像缓存状态信息。

ImageCacheSpec

字段

类型

是否必选

描述

images

String[]

镜像缓存的镜像列表。

imagePullSecrets

String[]

私有镜像仓库对应的Secret列表,格式:namespace:secretName。

imageCacheSize

Int

镜像缓存的大小,取值范围为20~32768,单位为GB。默认为20 GB。

retentionDays

Int

镜像缓存保留时间,取值范围为1~65536,单位为天,默认永不过期。

ImageCacheStatus

字段

类型

描述

phase

String

镜像缓存状态。

progress

String

镜像缓存的制作进度。

imageCacheId

String

镜像缓存ID。

startTime

Time

镜像缓存创建时间。

lastUpdatedTime

Time

镜像缓存最后更新时间。

events

Event[]

创建镜像缓存过程中的事件信息。

expireDateTime

Time

镜像缓存的过期时间。包括以下两种来源:

  • 创建镜像缓存时设置的retentionDays。

  • 创建失败的镜像缓存将自动在24小时后过期。

CreateImageCache

本接口用于创建镜像缓存。

HTTP request

POST /apis/eci.alibabacloud.com/v1/imagecaches

curl request example

curl -X POST -H 'Content-Type: application/yaml' --data '
apiVersion: eci.alibabacloud.com/v1
kind: ImageCache
metadata:
  name: imagecache-secrets-test
spec:
  images:
  - registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0
  imagePullSecrets:
  - default:acr-test
' http://127.0.0.1:8001/apis/eci.alibabacloud.com/v1/imagecaches

curl response example

{
  "apiVersion": "eci.alibabacloud.com/v1",
  "kind": "ImageCache",
  "metadata": {
    "creationTimestamp": "2019-10-10T03:50:47Z",
    "generation": 1,
    "name": "imagecache-secrets-test",
    "resourceVersion": "647052328",
    "selfLink": "/apis/eci.alibabacloud.com/v1/imagecaches/imagecache-secrets-test11",
    "uid": "2506ba37-eb11-11e9-9576-f2ef49bf****"
  },
  "spec": {
    "imagePullSecrets": [
      "default:acr-test"
    ],
    "images": [
      "registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0"
    ]
  }
}

ListImageCache

本接口用于获取镜像缓存列表。

HTTP request

GET /apis/eci.alibabacloud.com/v1/imagecaches

curl request example

curl -X GET 'http://127.0.0.1:8001/apis/eci.alibabacloud.com/v1/imagecaches'

curl response example

{
  "apiVersion": "eci.alibabacloud.com/v1",
  "items": [
    {
      "apiVersion": "eci.alibabacloud.com/v1",
      "kind": "ImageCache",
      "metadata": {
        "annotations": {
          "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"eci.alibabacloud.com/v1\",\"kind\":\"ImageCache\",\"metadata\":{\"annotations\":{},\"name\":\"imagecache-secrets-test\"},\"spec\":{\"imagePullSecrets\":[\"default:acr-test\"],\"images\":[\"registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0\"]}}\n"
        },
        "creationTimestamp": "2019-10-10T01:43:48Z",
        "generation": 1,
        "name": "imagecache-secrets-test",
        "resourceVersion": "646375979",
        "selfLink": "/apis/eci.alibabacloud.com/v1/imagecaches/imagecache-secrets-test",
        "uid": "67460461-eaff-11e9-9774-b2c06862****"
      },
      "spec": {
        "imagePullSecrets": [
          "default:acr-test"
        ],
        "images": [
          "registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0"
        ]
      },
      "status": {
        "imageCacheId": "imc-2ze5xnx4yiply807****",
        "lastUpdatedTime": "2019-10-10T01:47:14Z",
        "phase": "Ready",
        "progress": "100%",
        "startTime": "2019-10-10T01:43:49Z"
      }
    }
  ],
  "kind": "ImageCacheList",
  "metadata": {
    "continue": "",
    "resourceVersion": "647062964",
    "selfLink": "/apis/eci.alibabacloud.com/v1/imagecaches"
  }
}

GetImageCache

本接口用于获取某一个镜像缓存的相关信息。

HTTP request

GET /apis/eci.alibabacloud.com/v1/imagecaches/{name}

curl request example

curl -X GET 'http://127.0.0.1:8001/apis/eci.alibabacloud.com/v1/imagecaches/imagecache-secrets-test'

curl response example

{
  "apiVersion": "eci.alibabacloud.com/v1",
  "kind": "ImageCache",
  "metadata": {
    "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"eci.alibabacloud.com/v1\",\"kind\":\"ImageCache\",\"metadata\":{\"annotations\":{},\"name\":\"imagecache-secrets-test\"},\"spec\":{\"imagePullSecrets\":[\"default:acr-test\"],\"images\":[\"registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0\"]}}\n"
    },
    "creationTimestamp": "2019-10-10T01:43:48Z",
    "generation": 1,
    "name": "imagecache-secrets-test",
    "resourceVersion": "646375979",
    "selfLink": "/apis/eci.alibabacloud.com/v1/imagecaches/imagecache-secrets-test",
    "uid": "67460461-eaff-11e9-9774-b2c06862****"
  },
  "spec": {
    "imagePullSecrets": [
      "default:acr-test"
    ],
    "images": [
      "registry.cn-shanghai.aliyuncs.com/baz/nginx:1.0"
    ]
  },
  "status": {
    "imageCacheId": "imc-2ze5xnx4yiply807****",
    "lastUpdatedTime": "2019-10-10T01:47:14Z",
    "phase": "Ready",
    "progress": "100%",
    "startTime": "2019-10-10T01:43:49Z"
  }
}
                        

DeleteImageCache

本接口用于删除镜像缓存。

HTTP request

DELETE /apis/eci.alibabacloud.com/v1/imagecaches/{name}

curl request example

curl -X DELETE -H 'Content-Type: application/yaml' 'http://127.0.0.1:8001/apis/eci.alibabpacloud.com/v1/imagecaches/imagecache-secrets-test'

curl response example

{
	"kind": "Status",
	"apiVersion": "v1",
	"metadata": {},
	"status": "Success",
	"details": {
		"name": "imagecache-secrets-test",
		"group": "eci.alibabacloud.com",
		"kind": "imagecaches",
		"uid": "67460461-eaff-11e9-9774-b2c06862****"
	}
}