diff --git a/go.mod b/go.mod index f120209c8..9d314e980 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( k8s.io/apimachinery v0.18.9 k8s.io/client-go v12.0.0+incompatible k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 - kmodules.xyz/client-go v0.0.0-20201011221802-3180ab67d845 + kmodules.xyz/client-go v0.0.0-20201013083546-b17c1e15f1a3 kmodules.xyz/crd-schema-fuzz v0.0.0-20200922204806-c1426cd7fcf4 kmodules.xyz/custom-resources v0.0.0-20201008012351-6d8090f759d4 kmodules.xyz/offshoot-api v0.0.0-20200922211229-36acc531abab diff --git a/go.sum b/go.sum index 2b22137ba..e27887eb7 100644 --- a/go.sum +++ b/go.sum @@ -1305,6 +1305,8 @@ kmodules.xyz/client-go v0.0.0-20200903033732-dab39b86c81b/go.mod h1:sY/eoe4ktxZE kmodules.xyz/client-go v0.0.0-20200922200830-63d86b6e5b63/go.mod h1:JZN34jqk6ZlR+QOnBPpnUVBab4rmfamqxfSvLaulBMY= kmodules.xyz/client-go v0.0.0-20201011221802-3180ab67d845 h1:7ytqOvrfdq5Ul5SicCyy0s1YnnBSGu33hSZaBEcTbXs= kmodules.xyz/client-go v0.0.0-20201011221802-3180ab67d845/go.mod h1:pnRh7gtJ6ErPJQBkQeRlpD95KRtxhD4eGrYagZEU8RM= +kmodules.xyz/client-go v0.0.0-20201013083546-b17c1e15f1a3 h1:vP8h3s+JdqXQHhhmvoTgKZOtpraF4X1NxA/y4OFTn+I= +kmodules.xyz/client-go v0.0.0-20201013083546-b17c1e15f1a3/go.mod h1:pnRh7gtJ6ErPJQBkQeRlpD95KRtxhD4eGrYagZEU8RM= kmodules.xyz/constants v0.0.0-20200506032633-a21e58ceec72/go.mod h1:DbiFk1bJ1KEO94t1SlAn7tzc+Zz95rSXgyUKa2nzPmY= kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95 h1:v0S/+ftzL6Xrs9XevgchAOJyPKlRQXPiZf87xotj3X4= kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95/go.mod h1:jpu8xFsDKd6kAWUAKk8oTu/GQGBWqhrcaDeOJdaCJnk= diff --git a/vendor/kmodules.xyz/client-go/meta/hash.go b/vendor/kmodules.xyz/client-go/meta/hash.go index cb119fe89..4981fee35 100644 --- a/vendor/kmodules.xyz/client-go/meta/hash.go +++ b/vendor/kmodules.xyz/client-go/meta/hash.go @@ -23,7 +23,6 @@ import ( "reflect" "strconv" - "github.com/appscode/go/encoding/json/types" "github.com/davecgh/go-spew/spew" "github.com/fatih/structs" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -106,7 +105,7 @@ func MustAlreadyReconciled(o interface{}) bool { } func AlreadyReconciled(o interface{}) (bool, error) { - var generation, observedGeneration *types.IntHash + var generation, observedGeneration int64 var err error switch obj := o.(type) { @@ -120,36 +119,36 @@ func AlreadyReconciled(o interface{}) (bool, error) { if err != nil { return false, err } - return observedGeneration.MatchGeneration(generation), nil + return observedGeneration == generation, nil } -func extractGenerationFromUnstructured(obj *unstructured.Unstructured) (*types.IntHash, *types.IntHash, error) { - generation := types.IntHashForGeneration(obj.GetGeneration()) - +func extractGenerationFromUnstructured(obj *unstructured.Unstructured) (int64, int64, error) { val, found, err := unstructured.NestedFieldNoCopy(obj.Object, "status", "observedGeneration") if err != nil { - return nil, nil, err + return -1, -1, err } else if !found { - return nil, nil, fmt.Errorf("status.observedGeneration is missing") + return obj.GetGeneration(), -1, nil } - observedGeneration, err := types.ParseIntHash(val) - - return generation, observedGeneration, err + observedGeneration, ok := val.(int64) + if !ok { + return -1, -1, fmt.Errorf("%s %s/%s status.observedGeneration %+v is not int64", obj.GroupVersionKind(), obj.GetNamespace(), obj.GetName(), val) + } + return obj.GetGeneration(), observedGeneration, nil } -func extractGenerationFromObject(obj metav1.Object) (*types.IntHash, *types.IntHash, error) { - generation := types.IntHashForGeneration(obj.GetGeneration()) - +func extractGenerationFromObject(obj metav1.Object) (int64, int64, error) { st := structs.New(obj) fieldStatus, found := st.FieldOk("Status") if !found { - return nil, nil, fmt.Errorf("status is missing") + return obj.GetGeneration(), -1, nil } fieldObsGen, found := fieldStatus.FieldOk("ObservedGeneration") if !found { - return nil, nil, fmt.Errorf("status.observedGeneration is missing") + return obj.GetGeneration(), -1, nil } - observedGeneration, err := types.ParseIntHash(fieldObsGen.Value()) - - return generation, observedGeneration, err + observedGeneration, ok := fieldObsGen.Value().(int64) + if !ok { + return -1, -1, fmt.Errorf("%s %s/%s status.observedGeneration %+v is not int64", reflect.TypeOf(obj).String(), obj.GetNamespace(), obj.GetName(), fieldObsGen.Value()) + } + return obj.GetGeneration(), observedGeneration, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 0a18f7f63..6891a1e80 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -843,7 +843,7 @@ k8s.io/utils/net k8s.io/utils/path k8s.io/utils/pointer k8s.io/utils/trace -# kmodules.xyz/client-go v0.0.0-20201011221802-3180ab67d845 +# kmodules.xyz/client-go v0.0.0-20201013083546-b17c1e15f1a3 kmodules.xyz/client-go kmodules.xyz/client-go/api/v1 kmodules.xyz/client-go/apiextensions