Skip to content

Commit 63228a0

Browse files
authored
[cherry-pick] Update Kubernetes v1.18.9 dependencies (#471) (#479)
/cherry-pick Signed-off-by: 1gtm <1gtm@appscode.com>
1 parent 69573d3 commit 63228a0

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
k8s.io/apimachinery v0.18.9
1919
k8s.io/client-go v12.0.0+incompatible
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
@@ -1305,6 +1305,8 @@ kmodules.xyz/client-go v0.0.0-20200903033732-dab39b86c81b/go.mod h1:sY/eoe4ktxZE
13051305
kmodules.xyz/client-go v0.0.0-20200922200830-63d86b6e5b63/go.mod h1:JZN34jqk6ZlR+QOnBPpnUVBab4rmfamqxfSvLaulBMY=
13061306
kmodules.xyz/client-go v0.0.0-20201011221802-3180ab67d845 h1:7ytqOvrfdq5Ul5SicCyy0s1YnnBSGu33hSZaBEcTbXs=
13071307
kmodules.xyz/client-go v0.0.0-20201011221802-3180ab67d845/go.mod h1:pnRh7gtJ6ErPJQBkQeRlpD95KRtxhD4eGrYagZEU8RM=
1308+
kmodules.xyz/client-go v0.0.0-20201013083546-b17c1e15f1a3 h1:vP8h3s+JdqXQHhhmvoTgKZOtpraF4X1NxA/y4OFTn+I=
1309+
kmodules.xyz/client-go v0.0.0-20201013083546-b17c1e15f1a3/go.mod h1:pnRh7gtJ6ErPJQBkQeRlpD95KRtxhD4eGrYagZEU8RM=
13081310
kmodules.xyz/constants v0.0.0-20200506032633-a21e58ceec72/go.mod h1:DbiFk1bJ1KEO94t1SlAn7tzc+Zz95rSXgyUKa2nzPmY=
13091311
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95 h1:v0S/+ftzL6Xrs9XevgchAOJyPKlRQXPiZf87xotj3X4=
13101312
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95/go.mod h1:jpu8xFsDKd6kAWUAKk8oTu/GQGBWqhrcaDeOJdaCJnk=

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)