Skip to content

Commit 0c21b28

Browse files
committed
Convert k8s.io/kms/apis from gogo to protoc
Use standard protoc for the kms APIs instead of gogo. Part of #96564 Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
1 parent 9e204ba commit 0c21b28

File tree

18 files changed

+1438
-927
lines changed

18 files changed

+1438
-927
lines changed

hack/unwanted-dependencies.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@
152152
"k8s.io/apiserver",
153153
"k8s.io/client-go",
154154
"k8s.io/code-generator",
155-
"k8s.io/kms",
156155
"k8s.io/kube-aggregator",
157156
"k8s.io/kubelet",
158157
"k8s.io/kubernetes",

hack/update-codegen.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,8 +1025,6 @@ function codegen::protobindings() {
10251025

10261026
"staging/src/k8s.io/kubelet/pkg/apis/deviceplugin"
10271027

1028-
"staging/src/k8s.io/kms/apis"
1029-
"staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2"
10301028

10311029
"staging/src/k8s.io/kubelet/pkg/apis/dra"
10321030

@@ -1035,6 +1033,8 @@ function codegen::protobindings() {
10351033

10361034
)
10371035
local apis_using_protoc=(
1036+
"staging/src/k8s.io/kms/apis"
1037+
"staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2"
10381038
"staging/src/k8s.io/cri-api/pkg/apis/runtime"
10391039
"staging/src/k8s.io/externaljwt/apis"
10401040
)

staging/src/k8s.io/apiserver/pkg/server/options/encryptionconfig/config_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"time"
3131

3232
"github.com/google/go-cmp/cmp"
33+
"github.com/google/go-cmp/cmp/cmpopts"
3334

3435
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3536
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -2100,16 +2101,17 @@ func Test_kmsv2PluginProbe_rotateDEKOnKeyIDChange(t *testing.T) {
21002101
}
21012102

21022103
ignoredFields := sets.NewString("Transformer", "EncryptedObject.EncryptedDEKSource", "UID", "CacheKey")
2104+
ignoreUnexported := cmpopts.IgnoreUnexported(kmstypes.EncryptedObject{})
21032105

21042106
gotState := *h.state.Load()
21052107

21062108
if diff := cmp.Diff(tt.wantState, gotState,
2107-
cmp.FilterPath(func(path cmp.Path) bool { return ignoredFields.Has(path.String()) }, cmp.Ignore()),
2109+
cmp.FilterPath(func(path cmp.Path) bool { return ignoredFields.Has(path.String()) }, cmp.Ignore()), ignoreUnexported,
21082110
); len(diff) > 0 {
21092111
t.Errorf("state mismatch (-want +got):\n%s", diff)
21102112
}
21112113

2112-
if len(cmp.Diff(tt.wantState, gotState)) > 0 { // we only need to run this check when the state changes
2114+
if len(cmp.Diff(tt.wantState, gotState, ignoreUnexported)) > 0 { // we only need to run this check when the state changes
21132115
validCiphertext := len(gotState.EncryptedObject.EncryptedDEKSource) > 0
21142116
if tt.useSeed {
21152117
validCiphertext = validCiphertext && gotState.EncryptedObject.EncryptedDEKSourceType == kmstypes.EncryptedDEKSourceType_HKDF_SHA256_XNONCE_AES_GCM_SEED

staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/envelope.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ import (
2727
"time"
2828
"unsafe"
2929

30-
"github.com/gogo/protobuf/proto"
3130
"go.opentelemetry.io/otel/attribute"
3231
"golang.org/x/crypto/cryptobyte"
32+
"google.golang.org/protobuf/proto"
3333

3434
utilerrors "k8s.io/apimachinery/pkg/util/errors"
3535
"k8s.io/apimachinery/pkg/util/uuid"

staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/envelope_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ import (
3535
"testing"
3636
"time"
3737

38-
"github.com/gogo/protobuf/proto"
3938
"go.opentelemetry.io/otel/sdk/trace"
4039
"go.opentelemetry.io/otel/sdk/trace/tracetest"
40+
"google.golang.org/protobuf/proto"
4141

4242
utilrand "k8s.io/apimachinery/pkg/util/rand"
4343
"k8s.io/apimachinery/pkg/util/uuid"
@@ -552,9 +552,7 @@ func TestEncodeDecode(t *testing.T) {
552552
if err != nil {
553553
t.Fatalf("envelopeTransformer: error while decoding data: %s", err)
554554
}
555-
// reset internal field modified by marshaling obj
556-
obj.XXX_sizecache = 0
557-
if !reflect.DeepEqual(got, obj) {
555+
if !proto.Equal(got, obj) {
558556
t.Fatalf("envelopeTransformer: decoded data does not match original data. Got: %v, want %v", got, obj)
559557
}
560558
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy