Skip to content

Commit 01e10af

Browse files
authored
[cherry-pick] Update Kubernetes v1.18.9 dependencies (#175) (#176)
/cherry-pick Signed-off-by: 1gtm <1gtm@appscode.com>
1 parent f781cd8 commit 01e10af

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ require (
1616
k8s.io/api v0.18.9
1717
k8s.io/apiextensions-apiserver v0.18.9
1818
k8s.io/apimachinery v0.18.9
19-
k8s.io/client-go v12.0.0+incompatible
19+
k8s.io/client-go v0.18.9
2020
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6
21-
kmodules.xyz/client-go v0.0.0-20201011221802-3180ab67d845
21+
kmodules.xyz/client-go v0.0.0-20201013083546-b17c1e15f1a3
2222
kmodules.xyz/crd-schema-fuzz v0.0.0-20200922204806-c1426cd7fcf4
2323
kmodules.xyz/custom-resources v0.0.0-20201008012351-6d8090f759d4
2424
kmodules.xyz/offshoot-api v0.0.0-20200922211229-36acc531abab

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,8 @@ kmodules.xyz/client-go v0.0.0-20200818143024-600fef263e03/go.mod h1:sY/eoe4ktxZE
954954
kmodules.xyz/client-go v0.0.0-20200922200830-63d86b6e5b63/go.mod h1:JZN34jqk6ZlR+QOnBPpnUVBab4rmfamqxfSvLaulBMY=
955955
kmodules.xyz/client-go v0.0.0-20201011221802-3180ab67d845 h1:7ytqOvrfdq5Ul5SicCyy0s1YnnBSGu33hSZaBEcTbXs=
956956
kmodules.xyz/client-go v0.0.0-20201011221802-3180ab67d845/go.mod h1:pnRh7gtJ6ErPJQBkQeRlpD95KRtxhD4eGrYagZEU8RM=
957+
kmodules.xyz/client-go v0.0.0-20201013083546-b17c1e15f1a3 h1:vP8h3s+JdqXQHhhmvoTgKZOtpraF4X1NxA/y4OFTn+I=
958+
kmodules.xyz/client-go v0.0.0-20201013083546-b17c1e15f1a3/go.mod h1:pnRh7gtJ6ErPJQBkQeRlpD95KRtxhD4eGrYagZEU8RM=
957959
kmodules.xyz/constants v0.0.0-20200506032633-a21e58ceec72/go.mod h1:DbiFk1bJ1KEO94t1SlAn7tzc+Zz95rSXgyUKa2nzPmY=
958960
kmodules.xyz/crd-schema-fuzz v0.0.0-20200922204806-c1426cd7fcf4 h1:NWWv+Qju8xzHZT9hIk1+BbgQtIytNOoCU4g4vqUmh3M=
959961
kmodules.xyz/crd-schema-fuzz v0.0.0-20200922204806-c1426cd7fcf4/go.mod h1:WrO3fryNyFCgqqyWnwI89lnzWA7kN072Ehya7ELGfzE=

vendor/kmodules.xyz/client-go/meta/hash.go

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"reflect"
2424
"strconv"
2525

26-
"github.com/appscode/go/encoding/json/types"
2726
"github.com/davecgh/go-spew/spew"
2827
"github.com/fatih/structs"
2928
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -106,7 +105,7 @@ func MustAlreadyReconciled(o interface{}) bool {
106105
}
107106

108107
func AlreadyReconciled(o interface{}) (bool, error) {
109-
var generation, observedGeneration *types.IntHash
108+
var generation, observedGeneration int64
110109
var err error
111110

112111
switch obj := o.(type) {
@@ -120,36 +119,36 @@ func AlreadyReconciled(o interface{}) (bool, error) {
120119
if err != nil {
121120
return false, err
122121
}
123-
return observedGeneration.MatchGeneration(generation), nil
122+
return observedGeneration == generation, nil
124123
}
125124

126-
func extractGenerationFromUnstructured(obj *unstructured.Unstructured) (*types.IntHash, *types.IntHash, error) {
127-
generation := types.IntHashForGeneration(obj.GetGeneration())
128-
125+
func extractGenerationFromUnstructured(obj *unstructured.Unstructured) (int64, int64, error) {
129126
val, found, err := unstructured.NestedFieldNoCopy(obj.Object, "status", "observedGeneration")
130127
if err != nil {
131-
return nil, nil, err
128+
return -1, -1, err
132129
} else if !found {
133-
return nil, nil, fmt.Errorf("status.observedGeneration is missing")
130+
return obj.GetGeneration(), -1, nil
134131
}
135-
observedGeneration, err := types.ParseIntHash(val)
136-
137-
return generation, observedGeneration, err
132+
observedGeneration, ok := val.(int64)
133+
if !ok {
134+
return -1, -1, fmt.Errorf("%s %s/%s status.observedGeneration %+v is not int64", obj.GroupVersionKind(), obj.GetNamespace(), obj.GetName(), val)
135+
}
136+
return obj.GetGeneration(), observedGeneration, nil
138137
}
139138

140-
func extractGenerationFromObject(obj metav1.Object) (*types.IntHash, *types.IntHash, error) {
141-
generation := types.IntHashForGeneration(obj.GetGeneration())
142-
139+
func extractGenerationFromObject(obj metav1.Object) (int64, int64, error) {
143140
st := structs.New(obj)
144141
fieldStatus, found := st.FieldOk("Status")
145142
if !found {
146-
return nil, nil, fmt.Errorf("status is missing")
143+
return obj.GetGeneration(), -1, nil
147144
}
148145
fieldObsGen, found := fieldStatus.FieldOk("ObservedGeneration")
149146
if !found {
150-
return nil, nil, fmt.Errorf("status.observedGeneration is missing")
147+
return obj.GetGeneration(), -1, nil
151148
}
152-
observedGeneration, err := types.ParseIntHash(fieldObsGen.Value())
153-
154-
return generation, observedGeneration, err
149+
observedGeneration, ok := fieldObsGen.Value().(int64)
150+
if !ok {
151+
return -1, -1, fmt.Errorf("%s %s/%s status.observedGeneration %+v is not int64", reflect.TypeOf(obj).String(), obj.GetNamespace(), obj.GetName(), fieldObsGen.Value())
152+
}
153+
return obj.GetGeneration(), observedGeneration, nil
155154
}

vendor/modules.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ k8s.io/apiserver/plugin/pkg/audit/truncate
594594
k8s.io/apiserver/plugin/pkg/audit/webhook
595595
k8s.io/apiserver/plugin/pkg/authenticator/token/webhook
596596
k8s.io/apiserver/plugin/pkg/authorizer/webhook
597-
# k8s.io/client-go v12.0.0+incompatible => github.com/kmodules/k8s-client-go v0.18.10-0.20200922201634-73fedf3d677e
597+
# k8s.io/client-go v0.18.9 => github.com/kmodules/k8s-client-go v0.18.10-0.20200922201634-73fedf3d677e
598598
k8s.io/client-go/discovery
599599
k8s.io/client-go/discovery/fake
600600
k8s.io/client-go/dynamic
@@ -843,7 +843,7 @@ k8s.io/utils/net
843843
k8s.io/utils/path
844844
k8s.io/utils/pointer
845845
k8s.io/utils/trace
846-
# kmodules.xyz/client-go v0.0.0-20201011221802-3180ab67d845
846+
# kmodules.xyz/client-go v0.0.0-20201013083546-b17c1e15f1a3
847847
kmodules.xyz/client-go
848848
kmodules.xyz/client-go/api/v1
849849
kmodules.xyz/client-go/apiextensions

0 commit comments

Comments
 (0)