Set proto go_package: kubelet dynamic resource API

This package was specifying the option, but wrongly.

This also creates some diff to the *.pb.go files to note that in the
"options".

You can dump the gzipped blob with the following program (thanks
StackOverflow!):

```go
package main

import (
	"bytes"
	"compress/gzip"
	"encoding/json"
	"fmt"
	"os"

	"io/ioutil"

	proto "github.com/golang/protobuf/proto"
	dpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
)

func main() {
	m := map[string][]byte{
		"before": blobv1,
		"after": blobv2,
	}
	arg := os.Args[1]
	dump(m[arg])
}

func dump(bytes []byte) {
	fd, err := decodeFileDesc(bytes)
	if err != nil {
		panic(err)
	}
	b, err := json.MarshalIndent(fd, "", "  ")
	if err != nil {
		panic(err)
	}
	fmt.Println(string(b))
}

// decompress does gzip decompression.
func decompress(b []byte) ([]byte, error) {
	r, err := gzip.NewReader(bytes.NewReader(b))
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	out, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	return out, nil
}

func decodeFileDesc(enc []byte) (*dpb.FileDescriptorProto, error) {
	raw, err := decompress(enc)
	if err != nil {
		return nil, fmt.Errorf("failed to decompress enc: %v", err)
	}

	fd := new(dpb.FileDescriptorProto)
	if err := proto.Unmarshal(raw, fd); err != nil {
		return nil, fmt.Errorf("bad descriptor: %v", err)
	}
	return fd, nil
}
```

Kubernetes-commit: e4e26a7f0c30c669fa23186cbe5d2e41a6dc5b45
This commit is contained in:
Tim Hockin 2023-01-14 10:30:08 -08:00 committed by Kubernetes Publisher
parent 189da6f245
commit d0ffd0e221
2 changed files with 27 additions and 25 deletions

View File

@ -17,7 +17,7 @@ limitations under the License.
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: api.proto
package dra
package v1alpha1
import (
context "context"
@ -294,29 +294,31 @@ func init() {
func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) }
var fileDescriptor_00212fb1f9d3bf1c = []byte{
// 348 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x52, 0x31, 0x4f, 0x32, 0x41,
0x10, 0x65, 0x3f, 0xc8, 0x17, 0x6e, 0x4c, 0x34, 0x59, 0x63, 0x72, 0x39, 0xe0, 0xc0, 0x8b, 0x0a,
0x8d, 0x47, 0xd0, 0xde, 0xc2, 0x58, 0x58, 0x11, 0x73, 0x09, 0x8d, 0x0d, 0x59, 0x76, 0x47, 0x58,
0xc3, 0xdd, 0xae, 0x77, 0x1c, 0xb5, 0x3f, 0xc1, 0xd6, 0xca, 0xbf, 0x43, 0x69, 0x49, 0x29, 0xe7,
0x1f, 0x31, 0xec, 0x49, 0x8c, 0x0a, 0xa1, 0xb3, 0xdb, 0x79, 0xf3, 0x66, 0xde, 0x9b, 0x99, 0x05,
0x8b, 0x69, 0xe9, 0xeb, 0x58, 0x4d, 0x14, 0x2d, 0x4f, 0x3b, 0x6c, 0xac, 0x47, 0xac, 0xe3, 0x9c,
0x0e, 0xe5, 0x64, 0x94, 0x0e, 0x7c, 0xae, 0xc2, 0xf6, 0x50, 0x0d, 0x55, 0xdb, 0x10, 0x06, 0xe9,
0x9d, 0x89, 0x4c, 0x60, 0x5e, 0x79, 0xa1, 0xf7, 0x42, 0xc0, 0xe9, 0x2a, 0x81, 0x37, 0x31, 0x6a,
0x16, 0x63, 0x80, 0x89, 0x4a, 0x63, 0x8e, 0x01, 0x3e, 0xa4, 0x98, 0x4c, 0x68, 0x15, 0xac, 0x88,
0x85, 0x98, 0x68, 0xc6, 0xd1, 0x26, 0x0d, 0xd2, 0xb2, 0x82, 0x2f, 0x80, 0x56, 0xc0, 0xe2, 0x63,
0x26, 0xc3, 0x7e, 0x2a, 0x85, 0xfd, 0xcf, 0x64, 0xcb, 0x06, 0xe8, 0x49, 0x41, 0x6b, 0x00, 0x79,
0x72, 0xc9, 0xb7, 0x8b, 0x79, 0xad, 0x41, 0xba, 0x2c, 0x44, 0xda, 0x84, 0xbd, 0xf8, 0x53, 0xac,
0x3f, 0x62, 0x91, 0x18, 0xa3, 0x5d, 0x32, 0x9c, 0xdd, 0x15, 0x7c, 0x6d, 0x50, 0xef, 0x02, 0x2a,
0x6b, 0x0d, 0x26, 0x5a, 0x45, 0x09, 0xd2, 0x3a, 0xec, 0x70, 0x21, 0xfb, 0x02, 0xa7, 0x92, 0x63,
0x62, 0x93, 0x46, 0xb1, 0x65, 0x05, 0xc0, 0x85, 0xbc, 0xca, 0x11, 0xef, 0x99, 0x40, 0x75, 0xd9,
0xa0, 0x17, 0xe9, 0xbf, 0x9e, 0xf1, 0x87, 0xb7, 0xd2, 0x2f, 0x6f, 0x75, 0xa8, 0x6d, 0xb0, 0x96,
0x4f, 0x77, 0x36, 0x27, 0x50, 0x5a, 0x32, 0xa8, 0x80, 0xfd, 0x35, 0x5b, 0xa0, 0x47, 0xfe, 0xea,
0xf0, 0xfe, 0xe6, 0x2b, 0x3a, 0xc7, 0x5b, 0x58, 0xb9, 0x98, 0x57, 0xa0, 0xf7, 0x70, 0xb0, 0xd6,
0x0f, 0x3d, 0xf9, 0xde, 0x61, 0xd3, 0x2e, 0x9d, 0xe6, 0x56, 0xde, 0x4a, 0xeb, 0xf2, 0x70, 0xb6,
0x70, 0xc9, 0x7c, 0xe1, 0x16, 0x1e, 0x33, 0x97, 0xcc, 0x32, 0x97, 0xbc, 0x66, 0x2e, 0x79, 0xcb,
0x5c, 0xf2, 0xf4, 0xee, 0x16, 0x6e, 0x8b, 0x22, 0x66, 0x83, 0xff, 0xe6, 0x8f, 0x9e, 0x7f, 0x04,
0x00, 0x00, 0xff, 0xff, 0xab, 0xb6, 0x01, 0xe3, 0xe9, 0x02, 0x00, 0x00,
// 374 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x52, 0x31, 0x6f, 0xda, 0x40,
0x14,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, 0x9a, 0xf3, 0xb1, 0x86, 0xff,
0x6a, 0xd4, 0xf9, 0x8d, 0x3b, 0x07, 0x0d, 0x2a, 0x29, 0x52, 0x05, 0xa4, 0x8f, 0x3f, 0x84, 0x8c,
0x2f, 0x18, 0xac, 0x79, 0x08, 0xca, 0x44, 0x83, 0xe6, 0xd8, 0xf0, 0x71, 0xc8, 0xf8, 0x9f, 0x0a,
0x71, 0xae, 0x11, 0xee, 0xee, 0x1b, 0xcc, 0x53, 0xf9, 0xd6, 0x33, 0xbe, 0xf0, 0xd6, 0x7a, 0xe5,
0xad, 0x8f, 0x7b, 0x47, 0xac, 0x55, 0xd3, 0xfd, 0xd8, 0x22, 0xdc, 0xda, 0x33, 0x08, 0xc3, 0x9f,
0x0f, 0x6c, 0x81, 0x0c, 0xdd, 0xfa, 0xf0, 0xee, 0xf1, 0x2b, 0x5a, 0x5f, 0x4f, 0xb0, 0x2a, 0x31,
0xa7, 0x41, 0xce, 0xf1, 0x97, 0x83, 0x7e, 0xc8, 0xb7, 0xe7, 0x1d, 0x8e, 0xed, 0xd2, 0x1a, 0x9d,
0xe4, 0xd5, 0x5a, 0xd3, 0xe9, 0x66, 0x67, 0xa3, 0xed, 0xce, 0x6e, 0x5c, 0x96, 0x36, 0xda, 0x94,
0x36, 0xba, 0x2d, 0x6d, 0x74, 0x57, 0xda, 0xe8, 0xea, 0xde, 0x6e, 0xfc, 0x1f, 0xae, 0x7e, 0x29,
0x97, 0x0b, 0x6f, 0x55, 0x04, 0x10, 0x43, 0xee, 0xc9, 0x55, 0xe4, 0x51, 0xc9, 0x95, 0xc7, 0x32,
0xea, 0xd5, 0x1a, 0xc1, 0x7b, 0xfd, 0x89, 0x7f, 0x3e, 0x04, 0x00, 0x00, 0xff, 0xff, 0xf6, 0xcb,
0x4e, 0x59, 0x0a, 0x03, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View File

@ -19,10 +19,10 @@ limitations under the License.
syntax = "proto3";
package v1alpha1;
option go_package = "k8s.io/kubelet/pkg/apis/dra/v1alpha1";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option go_package = "dra";
option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.stringer_all) = true;
option (gogoproto.goproto_getters_all) = true;