forked from kubernetes-sigs/kubebuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
翻译1.5.1 A Brief Aside: What's the rest of this stuff?
- Loading branch information
Showing
2 changed files
with
19 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,22 @@ | ||
# A Brief Aside: What's the rest of this stuff? | ||
# 简要说明: 剩下文件的作用? | ||
|
||
If you've taken a peek at the rest of the files in the | ||
[`api/v1/`](https://sigs.k8s.io/kubebuilder/docs/book/src/cronjob-tutorial/testdata/project/api/v1) | ||
directory, you might have noticed two additional files beyond | ||
`cronjob_types.go`: `groupversion_info.go` and `zz_generated.deepcopy.go`. | ||
如果你在 [`api/v1/`](https://sigs.k8s.io/kubebuilder/docs/book/src/cronjob-tutorial/testdata/project/api/v1) 目录下看到了其他文件, | ||
你可能会注意到除了 `cronjob_types.go` 这个文件外,还有两个文件:`groupversion_info.go` 和 `zz_generated.deepcopy.go`。 | ||
|
||
Neither of these files ever needs to be edited (the former stays the same | ||
and the latter is autogenerated), but it's useful to know what's in them. | ||
|
||
虽然这些文件都不需要编辑(前者保持原样,而后者是自动生成的),但是如果知道这些文件的内容,那么将是非常有用的。 | ||
|
||
## `groupversion_info.go` | ||
|
||
`groupversion_info.go` contains common metadata about the group-version: | ||
`groupversion_info.go` 包含了关于 group-version 的一些元数据: | ||
|
||
{{#literatego ./testdata/project/api/v1/groupversion_info.go}} | ||
|
||
## `zz_generated.deepcopy.go` | ||
|
||
`zz_generated.deepcopy.go` contains the autogenerated implementation of | ||
the aforementioned `runtime.Object` interface, which marks all of our root | ||
types as representing Kinds. | ||
`zz_generated.deepcopy.go` 包含了前述 `runtime.Object` 接口的自动实现,这些实现标记了代表 `Kinds` 的所有根类型。 | ||
|
||
The core of the `runtime.Object` interface is a deep-copy method, | ||
`DeepCopyObject`. | ||
`runtime.Object` 接口的核心是一个深拷贝方法,即 `DeepCopyObject`。 | ||
|
||
The `object` generator in controller-tools also generates two other handy | ||
methods for each root type and all its sub-types: `DeepCopy` and | ||
`DeepCopyInto`. | ||
controller-tools 中的 `object` 生成器也能够为每一个根类型以及其子类型生成另外两个易用的方法:`DeepCopy` 和 | ||
`DeepCopyInto`。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters