mirror of https://github.com/knative/caching.git
upgrade to latest dependencies (#710)
bumping knative.dev/hack 7233e77...b9801b4: > b9801b4 Update community files (# 260) bumping knative.dev/pkg 05b694e...4fd6eb8: > 4fd6eb8 make ChildName produce valid names (# 2660) > 911b435 Update community files (# 2661) > f4eb778 upgrade to latest dependencies (# 2658) > 9e943fa Removal of Tekton downstream tests (# 2654) Signed-off-by: Knative Automation <automation@knative.team> Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
0ea6b3f92f
commit
db0a0f9f64
4
go.mod
4
go.mod
|
@ -11,8 +11,8 @@ require (
|
||||||
k8s.io/client-go v0.25.4
|
k8s.io/client-go v0.25.4
|
||||||
k8s.io/code-generator v0.25.4
|
k8s.io/code-generator v0.25.4
|
||||||
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1
|
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1
|
||||||
knative.dev/hack v0.0.0-20221201154717-7233e77996f1
|
knative.dev/hack v0.0.0-20221209013717-b9801b4f5a4d
|
||||||
knative.dev/pkg v0.0.0-20221123154742-05b694ec4d3a
|
knative.dev/pkg v0.0.0-20221221230956-4fd6eb8652b7
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|
8
go.sum
8
go.sum
|
@ -798,10 +798,10 @@ k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 h1:MQ8BAZPZlWk3S9K4a9NCkI
|
||||||
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU=
|
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU=
|
||||||
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJOIfnislxYlqTj8=
|
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJOIfnislxYlqTj8=
|
||||||
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||||
knative.dev/hack v0.0.0-20221201154717-7233e77996f1 h1:bPrqF9fmlZm972UUHN03lCCWBHgZ44F+orLK0Z+apDk=
|
knative.dev/hack v0.0.0-20221209013717-b9801b4f5a4d h1:nMp1GE3iwrJzABi4xP0xSVOwaaZMJ8loT9S42d54wFM=
|
||||||
knative.dev/hack v0.0.0-20221201154717-7233e77996f1/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
knative.dev/hack v0.0.0-20221209013717-b9801b4f5a4d/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
||||||
knative.dev/pkg v0.0.0-20221123154742-05b694ec4d3a h1:mTDxXL+zRBMz7BcdM3WOgw9FVbmkIN/3cvEj4MeS8zI=
|
knative.dev/pkg v0.0.0-20221221230956-4fd6eb8652b7 h1:YaO4KgF1Kp8BTi1hxMXDRnvsxCFq/wpotOD3jzrHmzw=
|
||||||
knative.dev/pkg v0.0.0-20221123154742-05b694ec4d3a/go.mod h1:fckNBPf9bu5/p1RbnOhEauX7r+kfN1zSQupEVtkaYBs=
|
knative.dev/pkg v0.0.0-20221221230956-4fd6eb8652b7/go.mod h1:IeUSNPPUpQnM35SjpnfCx0w5/V2RpEc+nmke6oPwpD0=
|
||||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||||
|
|
|
@ -19,7 +19,7 @@ package kmeta
|
||||||
import (
|
import (
|
||||||
"crypto/md5" //nolint:gosec // No strong cryptography needed.
|
"crypto/md5" //nolint:gosec // No strong cryptography needed.
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"regexp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The longest name supported by the K8s is 63.
|
// The longest name supported by the K8s is 63.
|
||||||
|
@ -30,6 +30,8 @@ const (
|
||||||
head = longest - md5Len // How much to truncate to fit the hash.
|
head = longest - md5Len // How much to truncate to fit the hash.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var isAlphanumeric = regexp.MustCompile(`^[a-zA-Z0-9]*$`)
|
||||||
|
|
||||||
// ChildName generates a name for the resource based upon the parent resource and suffix.
|
// ChildName generates a name for the resource based upon the parent resource and suffix.
|
||||||
// If the concatenated name is longer than K8s permits the name is hashed and truncated to permit
|
// If the concatenated name is longer than K8s permits the name is hashed and truncated to permit
|
||||||
// construction of the resource, but still keeps it unique.
|
// construction of the resource, but still keeps it unique.
|
||||||
|
@ -55,12 +57,19 @@ func ChildName(parent, suffix string) string {
|
||||||
if d := longest - len(ret); d > 0 {
|
if d := longest - len(ret); d > 0 {
|
||||||
ret += suffix[:d]
|
ret += suffix[:d]
|
||||||
}
|
}
|
||||||
// If due to trimming above we're terminating the string with a `-`,
|
return makeValidName(ret)
|
||||||
// remove it.
|
|
||||||
return strings.TrimRight(ret, "-")
|
|
||||||
}
|
}
|
||||||
//nolint:gosec // No strong cryptography needed.
|
//nolint:gosec // No strong cryptography needed.
|
||||||
n = fmt.Sprintf("%s%x", parent[:head-len(suffix)], md5.Sum([]byte(parent)))
|
n = fmt.Sprintf("%s%x", parent[:head-len(suffix)], md5.Sum([]byte(parent)))
|
||||||
}
|
}
|
||||||
return n + suffix
|
return n + suffix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If due to trimming above we're terminating the string with a non-alphanumeric
|
||||||
|
// character, remove it.
|
||||||
|
func makeValidName(n string) string {
|
||||||
|
for i := len(n) - 1; !isAlphanumeric.MatchString(string(n[i])); i-- {
|
||||||
|
n = n[:len(n)-1]
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
|
@ -687,10 +687,10 @@ k8s.io/utils/internal/third_party/forked/golang/net
|
||||||
k8s.io/utils/net
|
k8s.io/utils/net
|
||||||
k8s.io/utils/strings/slices
|
k8s.io/utils/strings/slices
|
||||||
k8s.io/utils/trace
|
k8s.io/utils/trace
|
||||||
# knative.dev/hack v0.0.0-20221201154717-7233e77996f1
|
# knative.dev/hack v0.0.0-20221209013717-b9801b4f5a4d
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
knative.dev/hack
|
knative.dev/hack
|
||||||
# knative.dev/pkg v0.0.0-20221123154742-05b694ec4d3a
|
# knative.dev/pkg v0.0.0-20221221230956-4fd6eb8652b7
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
knative.dev/pkg/apis
|
knative.dev/pkg/apis
|
||||||
knative.dev/pkg/apis/duck
|
knative.dev/pkg/apis/duck
|
||||||
|
|
Loading…
Reference in New Issue