Skip to content

Commit 7e5ddba

Browse files
committed
Describe build-tagged isolation of ProtoMessage for a single release
1 parent 6a09eaf commit 7e5ddba

File tree

1 file changed

+12
-4
lines changed
  • keps/sig-api-machinery/5589-gogo-dependency

1 file changed

+12
-4
lines changed

keps/sig-api-machinery/5589-gogo-dependency/README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ This accomplishes goal 4 (no runtime use of gogo packages for the Kubernetes API
202202

203203
Step 4: Update the post-gogo-generation Go-rewriting step already present in
204204
[k8s.io/code-generator/cmd/go-to-protobuf](https://github.com/kubernetes/code-generator/tree/v0.34.0/cmd/go-to-protobuf)
205-
to remove generated protobuf code that is unused, removing all runtime references to gogo packages,
205+
to remove or isolate via build tags generated protobuf code that is unused, removing all runtime references to gogo packages,
206206
while still satisfying the interfaces required for apimachinery protobuf handling.
207207
This accomplishes goal 3 by removing generated aspects of Kubernetes API types like proto descriptors
208208
which *appeared* to allow standard proto libraries to interact with those objects,
@@ -301,7 +301,7 @@ Removed methods and their replacement are:
301301
* `XXX_Size` --> `Size`
302302
* `XXX_DiscardUnknown` --> Remove, was a no-op
303303
* `Descriptor` --> No replacement
304-
* `ProtoMessage` --> Remove, was a no-op
304+
* `ProtoMessage` --> Remove, was a no-op (or re-enable via a `kubernetes_protomessage_one_more_release` build tag for one release while eliminating use)
305305

306306
Mitigation: there is no use of these methods across all
307307
[kubernetes](https://github.com/search?q=language%3AGo+-org%3Agogo+-repo%3Acosmos%2Fgogoproto+-path%3A%2Fvendor%7Ctest%7Cexample%7Cgogo%2F+%2F%5C.%28XXX_Unmarshal%7CXXX_Marshal%7CXXX_Merge%7CXXX_Size%7CXXX_DiscardUnknown%7CDescriptor%7CProtoMessage%29%5C%28%2F+org%3Akubernetes&type=code)
@@ -336,7 +336,7 @@ Mitigations:
336336

337337
**Truncate exported methods**
338338

339-
Only the exported methods used by `k8s.io/apimachinery` protobuf handling or with other widespread use will be kept:
339+
Only the exported methods used by `k8s.io/apimachinery` protobuf handling or with other widespread use will be kept in default builds:
340340

341341
* Unmarshaling:
342342
```go
@@ -358,6 +358,11 @@ Only the exported methods used by `k8s.io/apimachinery` protobuf handling or wit
358358

359359
We will truncate the exported methods from protobuf generation to just those methods.
360360

361+
The `ProtoMessage()` marker method will be relocated to build-tagged files,
362+
which library consumers can enable with a `kubernetes_protomessage_one_more_release`
363+
build tag for a single release as a build mitigation if they rely on this method.
364+
After one minor release, this will be removed as well.
365+
361366
**Truncate imports**
362367

363368
The only gogo packages used in generated code for anything other than a type assertion are:
@@ -486,7 +491,10 @@ Several unused generated protobuf-related methods will be removed:
486491
* `XXX_Size`
487492
* `XXX_DiscardUnknown`
488493
* `Descriptor`
489-
* `ProtoMessage`
494+
495+
The `ProtoMessage` marker method for use with standard protobuf libraries
496+
will be isolated in build-tagged files, which can be temporarily reenabled with a
497+
`kubernetes_protomessage_one_more_release` build tag for one minor release.
490498

491499
### Monitoring Requirements
492500

0 commit comments

Comments
 (0)