|
| 1 | +--- |
| 2 | +title: Image Policy API (v1alpha1) |
| 3 | +content_type: tool-reference |
| 4 | +package: imagepolicy.k8s.io/v1alpha1 |
| 5 | +--- |
| 6 | + |
| 7 | +<!-- |
| 8 | +## Resource Types |
| 9 | +--> |
| 10 | +## 资源类型 {#resource-types} |
| 11 | + |
| 12 | +- [ImageReview](#imagepolicy-k8s-io-v1alpha1-ImageReview) |
| 13 | + |
| 14 | +## `ImageReview` {#imagepolicy-k8s-io-v1alpha1-ImageReview} |
| 15 | + |
| 16 | +<!-- |
| 17 | +<p>ImageReview checks if the set of images in a pod are allowed.</p> |
| 18 | +--> |
| 19 | +<p>ImageReview 检查某个 Pod 中是否可以使用某些镜像。</p> |
| 20 | + |
| 21 | +<table class="table"> |
| 22 | +<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead> |
| 23 | +<tbody> |
| 24 | + |
| 25 | +<tr><td><code>apiVersion</code><br/>string</td><td><code>imagepolicy.k8s.io/v1alpha1</code></td></tr> |
| 26 | +<tr><td><code>kind</code><br/>string</td><td><code>ImageReview</code></td></tr> |
| 27 | + |
| 28 | +<tr><td><code>metadata</code><br/> |
| 29 | +<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#objectmeta-v1-meta"><code>meta/v1.ObjectMeta</code></a> |
| 30 | +</td> |
| 31 | +<td> |
| 32 | + <!-- |
| 33 | + <p>Standard object's metadata. |
| 34 | +More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata</p> |
| 35 | +Refer to the Kubernetes API documentation for the fields of the <code>metadata</code> field.</td> |
| 36 | + --> |
| 37 | + <p>标准的对象元数据。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata</p> |
| 38 | + 参阅 Kubernetes API 文档了解 <code>metadata</code> 字段的内容。 |
| 39 | +</td> |
| 40 | + |
| 41 | +</tr> |
| 42 | +<tr><td><code>spec</code> <B>[必需]</B><br/> |
| 43 | +<a href="#imagepolicy-k8s-io-v1alpha1-ImageReviewSpec"><code>ImageReviewSpec</code></a> |
| 44 | +</td> |
| 45 | +<td> |
| 46 | + <!-- |
| 47 | + <p>Spec holds information about the pod being evaluated</p> |
| 48 | + --> |
| 49 | + <p>spec 中包含与被评估的 Pod 相关的信息。</p> |
| 50 | +</td> |
| 51 | +</tr> |
| 52 | +<tr><td><code>status</code><br/> |
| 53 | +<a href="#imagepolicy-k8s-io-v1alpha1-ImageReviewStatus"><code>ImageReviewStatus</code></a> |
| 54 | +</td> |
| 55 | +<td> |
| 56 | + <!-- |
| 57 | + <p>Status is filled in by the backend and indicates whether the pod should be allowed.</p> |
| 58 | + --> |
| 59 | + <p>status 由后台负责填充,用来标明 Pod 是否会被准入。</p> |
| 60 | +</td> |
| 61 | +</tr> |
| 62 | +</tbody> |
| 63 | +</table> |
| 64 | + |
| 65 | +## `ImageReviewContainerSpec` {#imagepolicy-k8s-io-v1alpha1-ImageReviewContainerSpec} |
| 66 | + |
| 67 | +<!-- |
| 68 | +**Appears in:** |
| 69 | +--> |
| 70 | +**出现在:** |
| 71 | + |
| 72 | +- [ImageReviewSpec](#imagepolicy-k8s-io-v1alpha1-ImageReviewSpec) |
| 73 | + |
| 74 | +<!-- |
| 75 | +<p>ImageReviewContainerSpec is a description of a container within the pod creation request.</p> |
| 76 | +--> |
| 77 | +<p>ImageReviewContainerSpec 是对 Pod 创建请求中的某容器的描述。</p> |
| 78 | + |
| 79 | + |
| 80 | +<table class="table"> |
| 81 | +<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead> |
| 82 | +<tbody> |
| 83 | + |
| 84 | +<tr><td><code>image</code><br/> |
| 85 | +<code>string</code> |
| 86 | +</td> |
| 87 | +<td> |
| 88 | + <!-- |
| 89 | + <p>This can be in the form image:tag or image@SHA:012345679abcdef.</p> |
| 90 | + --> |
| 91 | + <p>此字段的格式可以是 image:tag 或 image@SHA:012345679abcdef。</p> |
| 92 | +</td> |
| 93 | +</tr> |
| 94 | +</tbody> |
| 95 | +</table> |
| 96 | + |
| 97 | +## `ImageReviewSpec` {#imagepolicy-k8s-io-v1alpha1-ImageReviewSpec} |
| 98 | + |
| 99 | +<!-- |
| 100 | +**Appears in:** |
| 101 | +--> |
| 102 | +**出现在:** |
| 103 | + |
| 104 | +- [ImageReview](#imagepolicy-k8s-io-v1alpha1-ImageReview) |
| 105 | + |
| 106 | +<!-- |
| 107 | +<p>ImageReviewSpec is a description of the pod creation request.</p> |
| 108 | +--> |
| 109 | +<p>ImageReviewSpec 是对 Pod 创建请求的描述。</p> |
| 110 | + |
| 111 | +<table class="table"> |
| 112 | +<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead> |
| 113 | +<tbody> |
| 114 | + |
| 115 | +<tr><td><code>containers</code><br/> |
| 116 | +<a href="#imagepolicy-k8s-io-v1alpha1-ImageReviewContainerSpec"><code>[]ImageReviewContainerSpec</code></a> |
| 117 | +</td> |
| 118 | +<td> |
| 119 | + <!-- |
| 120 | + <p>Containers is a list of a subset of the information in each container of the Pod being created.</p> |
| 121 | + --> |
| 122 | + <p>containers 是一个列表,其中包含正被创建的 Pod 中各容器的信息子集。</p> |
| 123 | +</td> |
| 124 | +</tr> |
| 125 | +<tr><td><code>annotations</code><br/> |
| 126 | +<code>map[string]string</code> |
| 127 | +</td> |
| 128 | +<td> |
| 129 | + <!-- |
| 130 | + <p>Annotations is a list of key-value pairs extracted from the Pod's annotations. |
| 131 | +It only includes keys which match the pattern <code>*.image-policy.k8s.io/*</code>. |
| 132 | +It is up to each webhook backend to determine how to interpret these annotations, if at all.</p> |
| 133 | + --> |
| 134 | + <p>annotations 是一个键值对列表,内容抽取自 Pod 的注解(annotations)。 |
| 135 | +其中仅包含与模式 <code>*.image-policy.k8s.io/*</code> 匹配的键。 |
| 136 | +每个 Webhook 后端要负责决定如何解释这些注解(如果有的话)。</p> |
| 137 | + |
| 138 | +</td> |
| 139 | +</tr> |
| 140 | +<tr><td><code>namespace</code><br/> |
| 141 | +<code>string</code> |
| 142 | +</td> |
| 143 | +<td> |
| 144 | + <!-- |
| 145 | + <p>Namespace is the namespace the pod is being created in.</p> |
| 146 | + --> |
| 147 | + <p>namespace 是 Pod 创建所针对的名字空间。</p> |
| 148 | +</td> |
| 149 | +</tr> |
| 150 | +</tbody> |
| 151 | +</table> |
| 152 | + |
| 153 | +## `ImageReviewStatus` {#imagepolicy-k8s-io-v1alpha1-ImageReviewStatus} |
| 154 | + |
| 155 | +<!-- |
| 156 | +**Appears in:** |
| 157 | +--> |
| 158 | +**出现在:** |
| 159 | + |
| 160 | +- [ImageReview](#imagepolicy-k8s-io-v1alpha1-ImageReview) |
| 161 | + |
| 162 | +<!-- |
| 163 | +<p>ImageReviewStatus is the result of the review for the pod creation request.</p> |
| 164 | +--> |
| 165 | +<p>ImageReviewStatus 是针对 Pod 创建请求所作的评估结果。</p> |
| 166 | + |
| 167 | +<table class="table"> |
| 168 | +<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead> |
| 169 | +<tbody> |
| 170 | + |
| 171 | +<tr><td><code>allowed</code> <B>[必需]</B><br/> |
| 172 | +<code>bool</code> |
| 173 | +</td> |
| 174 | +<td> |
| 175 | + <!-- |
| 176 | + <p>Allowed indicates that all images were allowed to be run.</p> |
| 177 | + --> |
| 178 | + <p>allowed 表明所有镜像都可以被运行。</p> |
| 179 | +</td> |
| 180 | +</tr> |
| 181 | +<tr><td><code>reason</code><br/> |
| 182 | +<code>string</code> |
| 183 | +</td> |
| 184 | +<td> |
| 185 | + <!-- |
| 186 | + <p>Reason should be empty unless Allowed is false in which case it |
| 187 | +may contain a short description of what is wrong. Kubernetes |
| 188 | +may truncate excessively long errors when displaying to the user.</p> |
| 189 | + --> |
| 190 | + <p>若 <code>allowed</code> 不是 false,<code>reason</code> 应该为空。 |
| 191 | +否则其中应包含出错信息的简短描述。Kubernetes 在向用户展示此信息时可能会截断过长的错误文字。</p> |
| 192 | +</td> |
| 193 | +</tr> |
| 194 | +<tr><td><code>auditAnnotations</code><br/> |
| 195 | +<code>map[string]string</code> |
| 196 | +</td> |
| 197 | +<td> |
| 198 | + <!-- |
| 199 | + <p>AuditAnnotations will be added to the attributes object of the |
| 200 | +admission controller request using 'AddAnnotation'. The keys should |
| 201 | +be prefix-less (i.e., the admission controller will add an |
| 202 | +appropriate prefix).</p> |
| 203 | + --> |
| 204 | + <p>auditAnnotations 会被通过 <code>AddAnnotation</code> 添加到准入控制器的 attributes 对象上。 |
| 205 | +注解键应该不含前缀,换言之,准入控制器会添加合适的前缀。</p> |
| 206 | +</td> |
| 207 | +</tr> |
| 208 | +</tbody> |
| 209 | +</table> |
| 210 | + |
0 commit comments