@@ -100,6 +100,7 @@ SIG Architecture for cross-cutting KEPs).
100
100
- [ Implementation History] ( #implementation-history )
101
101
- [ Drawbacks] ( #drawbacks )
102
102
- [ Alternatives] ( #alternatives )
103
+ - [ Possible Future Work] ( #possible-future-work )
103
104
- [ Infrastructure Needed (Optional)] ( #infrastructure-needed-optional )
104
105
<!-- /toc -->
105
106
@@ -221,10 +222,6 @@ That accomplishes goal 1 of leaving serialization / deserialization code unchang
221
222
All of these steps can be accomplished without changing non-protobuf aspects of Kubernetes API Go types,
222
223
which accomplishes goal 2 of leaving the Go types unchanged from previous releases.
223
224
224
- A possible step 6 is to modify the generated ` String() ` methods (which * happen* to be in protobuf generated code)
225
- from outputting pseudo-Go structures to something simpler and more meaningful like a JSON-encoding of the object.
226
- This is not part of the REST or storage API surface, but could disrupt callers who expect exact string representations in tests.
227
-
228
225
### User Stories
229
226
230
227
#### Story 1
@@ -388,20 +385,6 @@ The subset of the gogo code generation used by `k8s.io/code-generator/cmd/go-to-
388
385
will be forked to a location within the ` kubernetes` or ` kubernetes-sigs` project,
389
386
and pruned / modified to only output the subset of generated code kept by ` go-to-protobuf` .
390
387
391
- **Modify String () implementation**
392
-
393
- There is widespread reliance on Kubernetes API objects implementing ` String()` ,
394
- so preserving the existence of ` String()` implementations is necessary to minimize disruption.
395
-
396
- However, this only *happens* to be done as part of protobuf generation,
397
- and the output is a pseudo-Go structure that requires large amounts of code to construct,
398
- and is not particularly meaningful from an API perspective.
399
-
400
- After the code-generation is forked and modifiable, the ` String()` implementation will be
401
- switched to output a JSON encoding of the object. This will either be done by modifying
402
- the protobuf ` String()` generator, or by creating a separate ` String()` generator
403
- and disabling the protobuf ` String()` generator.
404
-
405
388
### Test Plan
406
389
407
390
[x] I /we understand the owners of the involved components may require updates to
@@ -437,11 +420,6 @@ Second phase:
437
420
* Complete step 5 : Removal of code-generation use of gogo packages
438
421
* Result : No gogo packages are referenced from any staging .go file, or as a direct dependency from any Kubernetes go .mod file
439
422
440
- Third phase:
441
- * Complete step 6 : modify ` String()` implementations to be independent of protobuf generation
442
- * Result : ` String()` implementations for API objects can be generated independent of protobuf,
443
- and return results
444
-
445
423
#### Deprecation
446
424
447
425
n/a
@@ -633,6 +611,30 @@ Two alternatives were considered:
633
611
if it becomes apparent there are benefits that would justify a change of that magnitude,
634
612
and a plan is proposed to make that change safely.
635
613
614
+ ## Possible Future Work
615
+
616
+ The following are *possible* future changes that could be made to the protobuf generator
617
+ once it is in a location that can be modified in ways scoped to Kubernetes API types.
618
+ These changes are not planned as part of this KEP, but are captured here for reference.
619
+
620
+ **Add omitzero support**
621
+
622
+ Current protobuf serialization *always* outputs non-pointer scalar and struct fields.
623
+ This means that feature-gate-disabled fields must be created as pointers so they will not be serialized unless populated.
624
+ Adding support for an `omitzero` tag to protobuf serialization would allow for non-pointer fields which can still be feature-gate-disabled.
625
+
626
+ **Simplify String() implementation**
627
+
628
+ There is widespread reliance on Kubernetes API objects implementing `String()`,
629
+ so preserving the existence of `String()` implementations is necessary to minimize disruption.
630
+
631
+ However, this only *happens* to be done as part of protobuf generation,
632
+ and the output is a pseudo-Go structure that requires large amounts of code to construct,
633
+ and is not particularly meaningful from an API perspective.
634
+
635
+ After the code-generation is forked and modifiable, the `String()` implementation could be
636
+ switched to a simpler implementation, for example returning a JSON encoding of the object.
637
+
636
638
## Infrastructure Needed (Optional)
637
639
638
640
n/a
0 commit comments