Skip to content

Commit

Permalink
Update UID generation for GenericResource (#1420)
Browse files Browse the repository at this point in the history
/cherry-pick

Signed-off-by: 1gtm <[email protected]>
  • Loading branch information
1gtm authored Feb 10, 2022
1 parent 2162c12 commit 0c84840
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ require (
k8s.io/component-base v0.21.1 // indirect
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e // indirect
k8s.io/utils v0.0.0-20210802155522-efc7438f0176 // indirect
kmodules.xyz/resource-metadata v0.9.4 // indirect
kmodules.xyz/resource-metadata v0.9.7 // indirect
kmodules.xyz/resource-metrics v0.0.8 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15 // indirect
sigs.k8s.io/cli-utils v0.26.1 // indirect
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1256,8 +1256,9 @@ kmodules.xyz/openshift v0.0.0-20210618001443-f2507caa512f h1:V1lapZtGG7GntoUsOuE
kmodules.xyz/openshift v0.0.0-20210618001443-f2507caa512f/go.mod h1:8E5ckbd1KMNmR4hc7ScvmQnGfx1ULUUp+UTmoDdxRkc=
kmodules.xyz/prober v0.0.0-20210618020259-5836fb959027 h1:rtSPsruEkoBOLcbJkxMQjnPafpv8/vJnfWlTIj9yRBg=
kmodules.xyz/prober v0.0.0-20210618020259-5836fb959027/go.mod h1:H4NcvS1RQxeXtQONALbU6r9OT3Xa7cMhfamX/k9t9wo=
kmodules.xyz/resource-metadata v0.9.4 h1:aVVh3j8Z/Z98NRHI5kYXTEchm1oYCaH7q/e2U/XYEyE=
kmodules.xyz/resource-metadata v0.9.4/go.mod h1:GsaythrHLBLKhEy8/l+ioJC0mFmJmZR0FRXpkyxztt8=
kmodules.xyz/resource-metadata v0.9.7 h1:r5YTmkUFTAv9Lj9K1JDethIpspxwB0kWoJdGKIaxRME=
kmodules.xyz/resource-metadata v0.9.7/go.mod h1:aqGkyKpDVvbRArR6ueVL0CdJzPxToKj8BF7Q3eOMctc=
kmodules.xyz/resource-metrics v0.0.6/go.mod h1:M7rWuo2qh3BpHhogiEVPnvGY9Xx4Pfygqn1Rex8YbgM=
kmodules.xyz/resource-metrics v0.0.8 h1:4WHV7vKGfoxpZquu/Jowq4pgoMEithyMjFfJIg68Nq8=
kmodules.xyz/resource-metrics v0.0.8/go.mod h1:M7rWuo2qh3BpHhogiEVPnvGY9Xx4Pfygqn1Rex8YbgM=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ import (
resourcemetrics "kmodules.xyz/resource-metrics"
"kmodules.xyz/resource-metrics/api"

"github.com/google/uuid"
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/cli-utils/pkg/kstatus/status"
"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down Expand Up @@ -83,7 +81,7 @@ func ToGenericResource(item client.Object, apiType *kmapi.ResourceID, cmeta *kma
GenerateName: item.GetGenerateName(),
Namespace: item.GetNamespace(),
SelfLink: "",
UID: types.UID(uuid.Must(uuid.NewUUID()).String()),
UID: "gres-" + item.GetUID(),
ResourceVersion: item.GetResourceVersion(),
Generation: item.GetGeneration(),
CreationTimestamp: item.GetCreationTimestamp(),
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ kmodules.xyz/prober/probe
kmodules.xyz/prober/probe/exec
kmodules.xyz/prober/probe/http
kmodules.xyz/prober/probe/tcp
# kmodules.xyz/resource-metadata v0.9.4
# kmodules.xyz/resource-metadata v0.9.7
## explicit; go 1.17
kmodules.xyz/resource-metadata/apis/core/v1alpha1
# kmodules.xyz/resource-metrics v0.0.8
Expand Down

0 comments on commit 0c84840

Please sign in to comment.