Skip to content

Commit

Permalink
Update deps
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Jun 14, 2024
1 parent c921cc9 commit f2665b6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ require (
k8s.io/kube-state-metrics/v2 v2.12.0
kmodules.xyz/apiversion v0.2.0
kmodules.xyz/authorizer v0.29.1
kmodules.xyz/client-go v0.30.4
kmodules.xyz/client-go v0.30.5
kmodules.xyz/custom-resources v0.30.0
kmodules.xyz/go-containerregistry v0.0.12
kmodules.xyz/monitoring-agent-api v0.29.0
kmodules.xyz/resource-metadata v0.18.8-0.20240612015959-9832ca0a2adb
kmodules.xyz/resource-metadata v0.18.8-0.20240614001230-063fb3a89196
kmodules.xyz/resource-metrics v0.30.1
kmodules.xyz/resource-metrics/utils v0.30.1
kmodules.xyz/sets v0.29.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,8 @@ kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk=
kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80=
kmodules.xyz/authorizer v0.29.1 h1:uByGGoryKbZcfiEAhjcK/Y345I9mygNQP7DVpkMbNQQ=
kmodules.xyz/authorizer v0.29.1/go.mod h1:kZRhclL8twzyt2bQuJQJbpYww2sc+qFr8I5PPoq/sWY=
kmodules.xyz/client-go v0.30.4 h1:lfCNkSUvd4HkQnW94nm65AgwMt1UppqPffqXH0NPh2w=
kmodules.xyz/client-go v0.30.4/go.mod h1:ekDSUC0UFLI0Jq3A62myW7VG8TYLBqCwMjqWJM1SrqU=
kmodules.xyz/client-go v0.30.5 h1:Zgi25FXK52Y4Pe2Ei43oZ6QLgk+x0XXukmw1gtOx9Bs=
kmodules.xyz/client-go v0.30.5/go.mod h1:XL3PDQIXG4s3xNRL2SSxIvi8b2WyMGpn26dFnOBz0j4=
kmodules.xyz/crd-schema-fuzz v0.29.1 h1:zJTlWYOrT5dsVVHW8HGcnR/vaWfxQfNh11QwTtkYpcs=
kmodules.xyz/crd-schema-fuzz v0.29.1/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE=
kmodules.xyz/custom-resources v0.30.0 h1:vR3CbseHMLwR4GvtcJJuRuwIV8voKqFqNii27rMcm1o=
Expand All @@ -916,8 +916,8 @@ kmodules.xyz/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9
kmodules.xyz/monitoring-agent-api v0.29.0/go.mod h1:iNbvaMTgVFOI5q2LJtGK91j4Dmjv4ZRiRdasGmWLKQI=
kmodules.xyz/offshoot-api v0.29.4 h1:WQV2BIUIoVKKiqZNmZ4gAy367jEdwBhEl3dFCLZM1qA=
kmodules.xyz/offshoot-api v0.29.4/go.mod h1:e+NQ0s4gW/YTPWBWEfdISZcmk+tlTq8IjvP5SLdqvko=
kmodules.xyz/resource-metadata v0.18.8-0.20240612015959-9832ca0a2adb h1:4iHgeGV4lO/d60fd0V13DqPqnJ3XgepsCDOIaYmxytg=
kmodules.xyz/resource-metadata v0.18.8-0.20240612015959-9832ca0a2adb/go.mod h1:iWMQ1teVvqqHygN79A+UlhuY2QDamIqzO94yXBHdYrY=
kmodules.xyz/resource-metadata v0.18.8-0.20240614001230-063fb3a89196 h1:eoZfQGKevjUl0A1Xvry3STD1uufj1Na9IquZVJ44rvo=
kmodules.xyz/resource-metadata v0.18.8-0.20240614001230-063fb3a89196/go.mod h1:sfb7uQ6H/XvL/AWqRZCBhRf+gO+NB3vmyPOoD6LVEys=
kmodules.xyz/resource-metrics v0.30.1 h1:o7mVY8ZwSe5iEILy1eMG4EPZCli7mXZCkgQONjoY9uU=
kmodules.xyz/resource-metrics v0.30.1/go.mod h1:UYcQQLN+3o8rNPQJwJa2D9bt5ihJCeo5bCDuQ4O3MPY=
kmodules.xyz/resource-metrics/utils v0.30.1 h1:iRnAKNMMdAi7QYjMQrK9W3vNMhSC21RWNx9yS3qlpTA=
Expand Down
23 changes: 12 additions & 11 deletions vendor/kmodules.xyz/client-go/cluster/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,27 @@ func ClusterUID(c client.Reader) (string, error) {
}

func ClusterMetadata(c client.Reader) (*kmapi.ClusterMetadata, error) {
var ns core.Namespace
err := c.Get(context.TODO(), client.ObjectKey{Name: metav1.NamespaceSystem}, &ns)
if err != nil {
return nil, err
}

var cm core.ConfigMap
err := c.Get(context.TODO(), client.ObjectKey{Name: kmapi.AceInfoConfigMapName, Namespace: metav1.NamespacePublic}, &cm)
err = c.Get(context.TODO(), client.ObjectKey{Name: kmapi.AceInfoConfigMapName, Namespace: metav1.NamespacePublic}, &cm)
if err == nil {
result, err := ClusterMetadataForConfigMap(&cm)
result, err := ClusterMetadataFromConfigMap(&cm, string(ns.UID))
if err == nil {
return result, nil
}
} else if !kerr.IsNotFound(err) {
return nil, err
}

var ns core.Namespace
err = c.Get(context.TODO(), client.ObjectKey{Name: metav1.NamespaceSystem}, &ns)
if err != nil {
return nil, err
}
return LegacyClusterMetadataForNamespace(&ns)
return LegacyClusterMetadataFromNamespace(&ns)
}

func LegacyClusterMetadataForNamespace(ns *core.Namespace) (*kmapi.ClusterMetadata, error) {
func LegacyClusterMetadataFromNamespace(ns *core.Namespace) (*kmapi.ClusterMetadata, error) {
if ns.Name != metav1.NamespaceSystem {
return nil, fmt.Errorf("expected namespace %s, found namespace %s", metav1.NamespaceSystem, ns.Name)
}
Expand All @@ -83,7 +84,7 @@ func LegacyClusterMetadataForNamespace(ns *core.Namespace) (*kmapi.ClusterMetada
return md, nil
}

func ClusterMetadataForConfigMap(cm *core.ConfigMap) (*kmapi.ClusterMetadata, error) {
func ClusterMetadataFromConfigMap(cm *core.ConfigMap, clusterUIDVerifier string) (*kmapi.ClusterMetadata, error) {
if cm.Name != kmapi.AceInfoConfigMapName || cm.Namespace != metav1.NamespacePublic {
return nil, fmt.Errorf("expected configmap %s/%s, found %s/%s", metav1.NamespacePublic, kmapi.AceInfoConfigMapName, cm.Namespace, cm.Name)
}
Expand All @@ -103,7 +104,7 @@ func ClusterMetadataForConfigMap(cm *core.ConfigMap) (*kmapi.ClusterMetadata, er
if err != nil {
return nil, err
}
hasher := hmac.New(sha256.New, []byte(md.UID))
hasher := hmac.New(sha256.New, []byte(clusterUIDVerifier))
hasher.Write(data)
messageMAC := hasher.Sum(nil)
expectedMAC := cm.BinaryData["mac"]
Expand Down
13 changes: 7 additions & 6 deletions vendor/kmodules.xyz/client-go/tools/clusterid/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,20 @@ func ClusterUID(client corev1.NamespaceInterface) (string, error) {
}

func ClusterMetadata(client kubernetes.Interface) (*kmapi.ClusterMetadata, error) {
ns, err := client.CoreV1().Namespaces().Get(context.TODO(), metav1.NamespaceSystem, metav1.GetOptions{})
if err != nil {
return nil, err
}

cm, err := client.CoreV1().ConfigMaps(metav1.NamespacePublic).Get(context.TODO(), kmapi.AceInfoConfigMapName, metav1.GetOptions{})
if err == nil {
result, err := clustermeta.ClusterMetadataForConfigMap(cm)
result, err := clustermeta.ClusterMetadataFromConfigMap(cm, string(ns.UID))
if err == nil {
return result, nil
}
} else if !kerr.IsNotFound(err) {
return nil, err
}

ns, err := client.CoreV1().Namespaces().Get(context.TODO(), metav1.NamespaceSystem, metav1.GetOptions{})
if err != nil {
return nil, err
}
return clustermeta.LegacyClusterMetadataForNamespace(ns)
return clustermeta.LegacyClusterMetadataFromNamespace(ns)
}
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ kmodules.xyz/authorizer/apiserver
kmodules.xyz/authorizer/rbac
kmodules.xyz/authorizer/rbac/helpers
kmodules.xyz/authorizer/rbac/validation
# kmodules.xyz/client-go v0.30.4
# kmodules.xyz/client-go v0.30.5
## explicit; go 1.22.0
kmodules.xyz/client-go
kmodules.xyz/client-go/api/v1
Expand Down Expand Up @@ -1959,7 +1959,7 @@ kmodules.xyz/monitoring-agent-api/client
## explicit; go 1.22.0
kmodules.xyz/offshoot-api/api/v1
kmodules.xyz/offshoot-api/api/v2
# kmodules.xyz/resource-metadata v0.18.8-0.20240612015959-9832ca0a2adb
# kmodules.xyz/resource-metadata v0.18.8-0.20240614001230-063fb3a89196
## explicit; go 1.22.1
kmodules.xyz/resource-metadata/apis/core/install
kmodules.xyz/resource-metadata/apis/core/v1alpha1
Expand Down

0 comments on commit f2665b6

Please sign in to comment.