mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #92897 from MikeSpreitzer/fix92895
Fix description of conversion generator
This commit is contained in:
commit
ef33126cc7
@ -30,21 +30,33 @@ limitations under the License.
|
|||||||
// ones named
|
// ones named
|
||||||
// autoConvert_<pkg1>_<type>_To_<pkg2>_<type>
|
// autoConvert_<pkg1>_<type>_To_<pkg2>_<type>
|
||||||
// for each such pair of types --- both with (pkg1,pkg2) =
|
// for each such pair of types --- both with (pkg1,pkg2) =
|
||||||
// (internal,external) and (pkg1,pkg2) = (external,internal).
|
// (internal,external) and (pkg1,pkg2) = (external,internal). The
|
||||||
// Additionally: if the destination package does not contain one in a
|
// generated conversion functions recurse on the structure of the data
|
||||||
// non-generated file then a function named
|
// types. For structs, source and destination fields are matched up
|
||||||
|
// according to name; if a source field has no corresponding
|
||||||
|
// destination or there is a fundamental mismatch in the type of the
|
||||||
|
// field then the generated autoConvert_... function has just a
|
||||||
|
// warning comment about that field. The generated conversion
|
||||||
|
// functions use standard value assignment wherever possible. For
|
||||||
|
// compound types, the generated conversion functions call the
|
||||||
|
// `Convert...` functions for the subsidiary types.
|
||||||
|
//
|
||||||
|
// For each pair of types `conversion-gen` will also generate a
|
||||||
|
// function named
|
||||||
// Convert_<pkg1>_<type>_To_<pkg2>_<type>
|
// Convert_<pkg1>_<type>_To_<pkg2>_<type>
|
||||||
// is also generated and it simply calls the `autoConvert...`
|
// if both of two conditions are met: (1) the destination package does
|
||||||
// function. The generated conversion functions use standard value
|
// not contain a function of that name in a non-generated file and (2)
|
||||||
// assignment wherever possible. For compound types, the generated
|
// the generation of the corresponding autoConvert_... function did
|
||||||
// conversion functions call the `Convert...` functions for the
|
// not run into trouble with a missing or fundamentally differently
|
||||||
// subsidiary types. Thus developers can override the behavior for
|
// typed field. A generated Convert_... function simply calls the
|
||||||
// selected types. For a top-level object type (i.e., the type of an
|
// corresponding `autoConvert...` function. `conversion_gen` also
|
||||||
// object that will be input to an apiserver), for such an override to
|
// generates a function that updates a given `runtime.Scheme` by
|
||||||
// be used by the apiserver the developer-maintained conversion
|
// registering all the Convert_... functions found and generated.
|
||||||
// functions must also be registered by invoking the
|
// Thus developers can override the generated behavior for selected
|
||||||
// `AddConversionFunc`/`AddGeneratedConversionFunc` method of the
|
// type pairs by putting the desired Convert_... functions in
|
||||||
// relevant `Scheme` object from k8s.io/apimachinery/pkg/runtime.
|
// non-generated files. Further, developers are practically required
|
||||||
|
// to override the generated behavior when there are missing or
|
||||||
|
// fundamentally differently typed fields.
|
||||||
//
|
//
|
||||||
// `conversion-gen` will scan its `--input-dirs`, looking at the
|
// `conversion-gen` will scan its `--input-dirs`, looking at the
|
||||||
// package defined in each of those directories for comment tags that
|
// package defined in each of those directories for comment tags that
|
||||||
|
Loading…
Reference in New Issue
Block a user