upgrade to latest dependencies (#704)

bumping k8s.io/gengo 397b4ae...fad74ee:
  > fad74ee Merge pull request # 234 from aojea/use_github_actions
  > e83a76d Merge pull request # 233 from rainest/fix/filter-abort
  > f99002e remove travis
  > 3913671 Merge pull request # 199 from rainest/log/lower-severity-uncopyable
  > 535f8cc Restore uncopyable type case in Filter
  > 3bcdbc7 Merge pull request # 232 from alexzielenski/defaulter-const-symbol-reference
  > 914c10e Update examples/deepcopy-gen/generators/deepcopy.go
  > c0856e2 Merge pull request # 231 from weilaaa/add_method_symmetric_difference_in_set
  > 945b13c fix typo
  > ad375a7 Fail if any requested type cannot be copied
  > 66c86ac add method symmetric difference in set
  > 49f7e1e fix typo
  > 20f90a4 Update examples/defaulter-gen/generators/defaulter.go
  > e1d2c67 remove incorrect quotes from ref regex comment
  > 91632a7 address comments
  > bab4b7f allow +default to refer to symbols in code
bumping k8s.io/api 4b838ea...88912e3:
  > 88912e3 Update dependencies to v0.25.4 tag
  > e7b469b Merge pull request # 112808 from cheftako/automated-cherry-pick-of-# 112689-upstream-release-1.25
  > 1102e6f Updated vendor to the new preferred versions.
bumping k8s.io/code-generator 7e9837e...6523e22:
  > 6523e22 Merge pull request # 112808 from cheftako/automated-cherry-pick-of-# 112689-upstream-release-1.25
  > 59f8301 Updated vendor to the new preferred versions.
bumping knative.dev/hack b035462...de2ff40:
  > de2ff40 Allow tests to skip dumping resources on failure (# 255)
  > 646aac0 e2e script tweaks (# 252)
  > d470f52 Format go code (# 253)
bumping k8s.io/utils ee6ede2...8e77b1f:
  > 8e77b1f Merge pull request # 265 from danwinship/fix-dumb-api-mistake
  > 1a15be2 Merge pull request # 270 from dashpole/trace_panic
  > ba5a213 Fix an API accident with net.IPFamily
  > 61b03e2 Merge pull request # 268 from petr-muller/deprecation-convention
  > 71bfc7b make traces safe for concurrent use
  > cfd413d Merge pull request # 263 from saltbo/fix-invalid-gha-goverion
  > d90ac11 pointer: make deprecation comments follow convention
  > 460b63a demonstrate trace panic
  > 4270251 Merge pull request # 259 from LJTian/master
  > 4a5ee0b fix: update the go-versions format for the gha
  > 665eaae Merge pull request # 261 from liggitt/clean-deps
  > 1be0ed5 Update Go standard libs address to reduce jump time
  > 7796b5f Merge pull request # 260 from dims/bump-dependencies-and-go-language-version
  > 25648b1 Drop testify dependency
  > e9cbc92 Merge pull request # 242 from MushuEE/patch-3
  > c9660c8 Bump dependencies and go language version
  > 49b64f9 Drop afero dependency
  > ad59060 Merge pull request # 253 from kschoche/add_uint_to_pointer_pkg
  > d7bf925 Ineffective break statements triggering SA4011
  > 2e139fc Merge pull request # 254 from dims/bump-version-of-golang-to-1.19
  > d45ae35 add uint64 and uint to pointer pkg
  > e3a7968 Bump version of golang to 1.19
bumping k8s.io/klog/v2 0990e81...9ae4992:
  > 9ae4992 Merge pull request # 355 from pohly/call-overhead-benchmarks
  > cb9292a Merge pull request # 349 from pohly/init-flags-concurrency
  > f08fd26 klog: benchmark the overhead when logging is off
  > 02fe323 Merge pull request # 345 from dims/bump-version-of-golang-to-1.19-and-drop-older-versions
  > 28f7906 make InitFlags read-only
  > d64acbd Merge pull request # 344 from harshanarayana/bug/GIT-343/logr-handle-marshalling-non-string-values
  > 8c0f205 reformat to golang 1.19 standards
  > a952486 add test for the command line usage
  > dcddc5f kvlistformat: fix the issue with display marshalled value for non string type
  > 6f5eeb9 Bump version of golang to 1.19 and prune older versions
bumping knative.dev/pkg 0243d64...dca788a:
  > dca788a Min K8s version is now 1.24 (# 2639)
  > 6255ebd upgrade to latest dependencies (# 2638)
bumping k8s.io/apimachinery 478dd6e...4fbe8e4:
  > 4fbe8e4 Merge pull request # 112218 from haoruan/automated-cherry-pick-of-# 111936-upstream-release-1.25
  > cf171ba Merge pull request # 112808 from cheftako/automated-cherry-pick-of-# 112689-upstream-release-1.25
  > b4db414 Marshal MicroTime to json and proto at the same precision
  > cb0507f Updated vendor to the new preferred versions.
bumping k8s.io/client-go 593f096...7226b15:
  > 7226b15 Update dependencies to v0.25.4 tag
  > 166ab05 Merge pull request # 112808 from cheftako/automated-cherry-pick-of-# 112689-upstream-release-1.25
  > 4b5a638 Updated vendor to the new preferred versions.

Signed-off-by: Knative Automation <automation@knative.team>

Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
knative-automation 2022-11-16 13:35:39 +00:00 committed by GitHub
parent 9712d6eadf
commit 006045e4a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 359 additions and 198 deletions

18
go.mod
View File

@ -6,13 +6,13 @@ require (
github.com/google/go-cmp v0.5.8 github.com/google/go-cmp v0.5.8
github.com/hashicorp/golang-lru v0.5.4 github.com/hashicorp/golang-lru v0.5.4
go.uber.org/zap v1.19.1 go.uber.org/zap v1.19.1
k8s.io/api v0.25.2 k8s.io/api v0.25.4
k8s.io/apimachinery v0.25.2 k8s.io/apimachinery v0.25.4
k8s.io/client-go v0.25.2 k8s.io/client-go v0.25.4
k8s.io/code-generator v0.25.2 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-20221114224536-b0354624aa29 knative.dev/hack v0.0.0-20221115211737-de2ff401a852
knative.dev/pkg v0.0.0-20221107171117-0243d641354d knative.dev/pkg v0.0.0-20221115192737-dca788a951f3
) )
require ( require (
@ -78,9 +78,9 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/gengo v0.0.0-20220613173612-397b4ae3bce7 // indirect k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9 // indirect
k8s.io/klog/v2 v2.70.2-0.20220707122935-0990e81f1a8f // indirect k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect sigs.k8s.io/yaml v1.3.0 // indirect

43
go.sum
View File

@ -120,7 +120,6 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
@ -317,7 +316,6 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
@ -328,8 +326,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@ -348,8 +346,8 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.11-0.20210813005559-691160354723 h1:sHOAIxRGBp443oHZIPB+HsUGaksVCXVQENPxwTfQdH4=
go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
@ -783,28 +781,27 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.25.2 h1:v6G8RyFcwf0HR5jQGIAYlvtRNrxMJQG1xJzaSeVnIS8= k8s.io/api v0.25.4 h1:3YO8J4RtmG7elEgaWMb4HgmpS2CfY1QlaOz9nwB+ZSs=
k8s.io/api v0.25.2/go.mod h1:qP1Rn4sCVFwx/xIhe+we2cwBLTXNcheRyYXwajonhy0= k8s.io/api v0.25.4/go.mod h1:IG2+RzyPQLllQxnhzD8KQNEu4c4YvyDTpSMztf4A0OQ=
k8s.io/apimachinery v0.25.2 h1:WbxfAjCx+AeN8Ilp9joWnyJ6xu9OMeS/fsfjK/5zaQs= k8s.io/apimachinery v0.25.4 h1:CtXsuaitMESSu339tfhVXhQrPET+EiWnIY1rcurKnAc=
k8s.io/apimachinery v0.25.2/go.mod h1:hqqA1X0bsgsxI6dXsJ4HnNTBOmJNxyPp8dw3u2fSHwA= k8s.io/apimachinery v0.25.4/go.mod h1:jaF9C/iPNM1FuLl7Zuy5b9v+n35HGSh6AQ4HYRkCqwo=
k8s.io/client-go v0.25.2 h1:SUPp9p5CwM0yXGQrwYurw9LWz+YtMwhWd0GqOsSiefo= k8s.io/client-go v0.25.4 h1:3RNRDffAkNU56M/a7gUfXaEzdhZlYhoW8dgViGy5fn8=
k8s.io/client-go v0.25.2/go.mod h1:i7cNU7N+yGQmJkewcRD2+Vuj4iz7b30kI8OcL3horQ4= k8s.io/client-go v0.25.4/go.mod h1:8trHCAC83XKY0wsBIpbirZU4NTUpbuhc2JnI7OruGZw=
k8s.io/code-generator v0.25.2 h1:qEHux0+E1c+j1MhsWn9+4Z6av8zrZBixOTPW064rSiY= k8s.io/code-generator v0.25.4 h1:tjQ7/+9eN7UOiU2DP+0v4ntTI4JZLi2c1N0WllpFhTc=
k8s.io/code-generator v0.25.2/go.mod h1:f61OcU2VqVQcjt/6TrU0sta1TA5hHkOO6ZZPwkL9Eys= k8s.io/code-generator v0.25.4/go.mod h1:9F5fuVZOMWRme7MYj2YT3L9ropPWPokd9VRhVyD3+0w=
k8s.io/gengo v0.0.0-20220613173612-397b4ae3bce7 h1:RGb68G3yotdQggcyenx9y0+lnVJCXXcLa6geXOMlf5o= k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9 h1:iu3o/SxaHVI7tKPtkGzD3M9IzrE21j+CUKH98NQJ8Ms=
k8s.io/gengo v0.0.0-20220613173612-397b4ae3bce7/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/klog/v2 v2.70.2-0.20220707122935-0990e81f1a8f h1:dltw7bAn8bCrQ2CmzzhgoieUZEbWqrvIGVdHGioP5nY= k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54 h1:hWRbsoRWt44OEBnYUd4ceLy4ofBoh+p9vauWp/I5Gdg=
k8s.io/klog/v2 v2.70.2-0.20220707122935-0990e81f1a8f/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 h1:MQ8BAZPZlWk3S9K4a9NCkIFQtZShWqoha7snGixVgEA= k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 h1:MQ8BAZPZlWk3S9K4a9NCkIFQtZShWqoha7snGixVgEA=
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-20220728103510-ee6ede2d64ed h1:jAne/RjBTyawwAy0utX5eqigAwz/lQhTmy+Hr/Cpue4= k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJOIfnislxYlqTj8=
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/hack v0.0.0-20221114224536-b0354624aa29 h1:FUHfJXlY5e9wFuSf5JlMONy/fQbofS7hEBfOMXLHXso= knative.dev/hack v0.0.0-20221115211737-de2ff401a852 h1:/uB4umKUahDlWbIC96rSETG2BYA0zwQ02SGuM9ZYdOo=
knative.dev/hack v0.0.0-20221114224536-b0354624aa29/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= knative.dev/hack v0.0.0-20221115211737-de2ff401a852/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/pkg v0.0.0-20221107171117-0243d641354d h1:ACj/4O74QvoB8zE/mlg1ji680gFW7RaUIjAL1x5IN58= knative.dev/pkg v0.0.0-20221115192737-dca788a951f3 h1:6saLhpYxTxGqXZTVSdw8JySNapiqt6QQnWNnyRfDjmw=
knative.dev/pkg v0.0.0-20221107171117-0243d641354d/go.mod h1:JwNkOLWAeuMYlH9WQA83k+afGCanWcvWvdXZsI3xKo4= knative.dev/pkg v0.0.0-20221115192737-dca788a951f3/go.mod h1:QVePbTmHjPK+FRzlqqCzTU17EYsHHr15vPIUedJ+JWw=
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=

View File

@ -27,9 +27,12 @@ func (m *MicroTime) ProtoMicroTime() *Timestamp {
if m == nil { if m == nil {
return &Timestamp{} return &Timestamp{}
} }
// truncate precision to microseconds to match JSON marshaling/unmarshaling
truncatedNanoseconds := time.Duration(m.Time.Nanosecond()).Truncate(time.Microsecond)
return &Timestamp{ return &Timestamp{
Seconds: m.Time.Unix(), Seconds: m.Time.Unix(),
Nanos: int32(m.Time.Nanosecond()), Nanos: int32(truncatedNanoseconds),
} }
} }
@ -51,7 +54,10 @@ func (m *MicroTime) Unmarshal(data []byte) error {
if err := p.Unmarshal(data); err != nil { if err := p.Unmarshal(data); err != nil {
return err return err
} }
m.Time = time.Unix(p.Seconds, int64(p.Nanos)).Local()
// truncate precision to microseconds to match JSON marshaling/unmarshaling
truncatedNanoseconds := time.Duration(p.Nanos).Truncate(time.Microsecond)
m.Time = time.Unix(p.Seconds, int64(truncatedNanoseconds)).Local()
return nil return nil
} }

View File

@ -173,20 +173,26 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
pkgNeedsGeneration := (ptagValue == tagValuePackage) pkgNeedsGeneration := (ptagValue == tagValuePackage)
if !pkgNeedsGeneration { if !pkgNeedsGeneration {
// If the pkg-scoped tag did not exist, scan all types for one that // If the pkg-scoped tag did not exist, scan all types for one that
// explicitly wants generation. // explicitly wants generation. Ensure all types that want generation
// can be copied.
var uncopyable []string
for _, t := range pkg.Types { for _, t := range pkg.Types {
klog.V(5).Infof(" considering type %q", t.Name.String()) klog.V(5).Infof(" considering type %q", t.Name.String())
ttag := extractEnabledTypeTag(t) ttag := extractEnabledTypeTag(t)
if ttag != nil && ttag.value == "true" { if ttag != nil && ttag.value == "true" {
klog.V(5).Infof(" tag=true") klog.V(5).Infof(" tag=true")
if !copyableType(t) { if !copyableType(t) {
klog.Fatalf("Type %v requests deepcopy generation but is not copyable", t) uncopyable = append(uncopyable, fmt.Sprintf("%v", t))
} } else {
pkgNeedsGeneration = true pkgNeedsGeneration = true
break
} }
} }
} }
if len(uncopyable) > 0 {
klog.Fatalf("Types requested deepcopy generation but are not copyable: %s",
strings.Join(uncopyable, ", "))
}
}
if pkgNeedsGeneration { if pkgNeedsGeneration {
klog.V(3).Infof("Package %q needs generation", i) klog.V(3).Infof("Package %q needs generation", i)

View File

@ -23,6 +23,7 @@ import (
"io" "io"
"path/filepath" "path/filepath"
"reflect" "reflect"
"regexp"
"strconv" "strconv"
"strings" "strings"
@ -497,6 +498,23 @@ func mustEnforceDefault(t *types.Type, depth int, omitEmpty bool) (interface{},
} }
} }
var refRE = regexp.MustCompile(`^ref\((?P<reference>[^"]+)\)$`)
var refREIdentIndex = refRE.SubexpIndex("reference")
// parseAsRef looks for strings that match one of the following:
// - ref(Ident)
// - ref(pkgpath.Ident)
// If the input string matches either of these, it will return the (optional)
// pkgpath, the Ident, and true. Otherwise it will return empty strings and
// false.
func parseAsRef(s string) (string, bool) {
matches := refRE.FindStringSubmatch(s)
if len(matches) < refREIdentIndex || matches[refREIdentIndex] == "" {
return "", false
}
return matches[refREIdentIndex], true
}
func populateDefaultValue(node *callNode, t *types.Type, tags string, commentLines []string) *callNode { func populateDefaultValue(node *callNode, t *types.Type, tags string, commentLines []string) *callNode {
defaultMap := extractDefaultTag(commentLines) defaultMap := extractDefaultTag(commentLines)
var defaultString string var defaultString string
@ -513,8 +531,12 @@ func populateDefaultValue(node *callNode, t *types.Type, tags string, commentLin
} else if len(defaultMap) == 0 { } else if len(defaultMap) == 0 {
return node return node
} }
var symbolReference string
var defaultValue interface{} var defaultValue interface{}
if err := json.Unmarshal([]byte(defaultString), &defaultValue); err != nil { if id, ok := parseAsRef(defaultString); ok {
symbolReference = id
defaultString = ""
} else if err := json.Unmarshal([]byte(defaultString), &defaultValue); err != nil {
klog.Fatalf("Failed to unmarshal default: %v", err) klog.Fatalf("Failed to unmarshal default: %v", err)
} }
@ -542,7 +564,8 @@ func populateDefaultValue(node *callNode, t *types.Type, tags string, commentLin
node.defaultIsPrimitive = t.IsPrimitive() node.defaultIsPrimitive = t.IsPrimitive()
node.defaultType = t.String() node.defaultType = t.String()
node.defaultValue = defaultString node.defaultValue.InlineConstant = defaultString
node.defaultValue.SymbolReference = symbolReference
node.defaultDepth = depth node.defaultDepth = depth
return node return node
} }
@ -668,6 +691,11 @@ const (
conversionPackagePath = "k8s.io/apimachinery/pkg/conversion" conversionPackagePath = "k8s.io/apimachinery/pkg/conversion"
) )
type symbolTracker interface {
namer.ImportTracker
AddSymbol(types.Name)
}
// genDefaulter produces a file with a autogenerated conversions. // genDefaulter produces a file with a autogenerated conversions.
type genDefaulter struct { type genDefaulter struct {
generator.DefaultGen generator.DefaultGen
@ -676,7 +704,7 @@ type genDefaulter struct {
peerPackages []string peerPackages []string
newDefaulters defaulterFuncMap newDefaulters defaulterFuncMap
existingDefaulters defaulterFuncMap existingDefaulters defaulterFuncMap
imports namer.ImportTracker imports symbolTracker
typesForInit []*types.Type typesForInit []*types.Type
} }
@ -766,6 +794,24 @@ func (g *genDefaulter) GenerateType(c *generator.Context, t *types.Type, w io.Wr
} }
i := 0 i := 0
callTree.VisitInOrder(func(ancestors []*callNode, current *callNode) { callTree.VisitInOrder(func(ancestors []*callNode, current *callNode) {
if len(current.defaultValue.SymbolReference) > 0 {
// If the defaultValue was a reference to a symbol instead of a constant,
// make sure to add it to imports and resolve the name of the symbol
// before generating the defaults.
parsedName := types.ParseFullyQualifiedName(current.defaultValue.SymbolReference)
g.imports.AddSymbol(parsedName)
// Rewrite the fully qualified name using the local package name
// from the imports
localPackage := g.imports.LocalNameOf(parsedName.Package)
if len(localPackage) > 0 {
current.defaultValue.SymbolReference = localPackage + "." + parsedName.Name
} else {
current.defaultValue.SymbolReference = parsedName.Name
}
}
if len(current.call) == 0 { if len(current.call) == 0 {
return return
} }
@ -836,7 +882,7 @@ type callNode struct {
// defaultValue is the defaultValue of a callNode struct // defaultValue is the defaultValue of a callNode struct
// Only primitive types and pointer types are eligible to have a default value // Only primitive types and pointer types are eligible to have a default value
defaultValue string defaultValue defaultValue
// defaultIsPrimitive is used to determine how to assign the default value. // defaultIsPrimitive is used to determine how to assign the default value.
// Primitive types will be directly assigned while complex types will use JSON unmarshalling // Primitive types will be directly assigned while complex types will use JSON unmarshalling
@ -862,6 +908,28 @@ type callNode struct {
defaultType string defaultType string
} }
type defaultValue struct {
// The value was written directly in the marker comment and
// has been parsed as JSON
InlineConstant string
// The name of the symbol relative to the parsed package path
// i.e. k8s.io/pkg.apis.v1.Foo if from another package or simply `Foo`
// if within the same package.
SymbolReference string
}
func (d defaultValue) IsEmpty() bool {
resolved := d.Resolved()
return resolved == ""
}
func (d defaultValue) Resolved() string {
if len(d.InlineConstant) > 0 {
return d.InlineConstant
}
return d.SymbolReference
}
// CallNodeVisitorFunc is a function for visiting a call tree. ancestors is the list of all parents // CallNodeVisitorFunc is a function for visiting a call tree. ancestors is the list of all parents
// of this node to the root of the tree - will be empty at the root. // of this node to the root of the tree - will be empty at the root.
type CallNodeVisitorFunc func(ancestors []*callNode, node *callNode) type CallNodeVisitorFunc func(ancestors []*callNode, node *callNode)
@ -929,11 +997,11 @@ func getTypeZeroValue(t string) (interface{}, error) {
} }
func (n *callNode) writeDefaulter(varName string, index string, isVarPointer bool, sw *generator.SnippetWriter) { func (n *callNode) writeDefaulter(varName string, index string, isVarPointer bool, sw *generator.SnippetWriter) {
if n.defaultValue == "" { if n.defaultValue.IsEmpty() {
return return
} }
args := generator.Args{ args := generator.Args{
"defaultValue": n.defaultValue, "defaultValue": n.defaultValue.Resolved(),
"varName": varName, "varName": varName,
"index": index, "index": index,
"varDepth": n.defaultDepth, "varDepth": n.defaultDepth,
@ -1046,7 +1114,7 @@ func (n *callNode) WriteMethod(varName string, depth int, ancestors []*callNode,
} }
sw.Do("}\n", nil) sw.Do("}\n", nil)
case n.key: case n.key:
if n.defaultValue != "" { if !n.defaultValue.IsEmpty() {
// Map keys are typed and cannot share the same index variable as arrays and other maps // Map keys are typed and cannot share the same index variable as arrays and other maps
index = index + "_" + ancestors[len(ancestors)-1].field index = index + "_" + ancestors[len(ancestors)-1].field
vars["index"] = index vars["index"] = index

View File

@ -255,15 +255,15 @@ func (s $.type|public$) Clone() $.type|public$ {
return result return result
} }
// Difference returns a set of objects that are not in s2 // Difference returns a set of objects that are not in s2.
// For example: // For example:
// s1 = {a1, a2, a3} // s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5} // s2 = {a1, a2, a4, a5}
// s1.Difference(s2) = {a3} // s1.Difference(s2) = {a3}
// s2.Difference(s1) = {a4, a5} // s2.Difference(s1) = {a4, a5}
func (s $.type|public$) Difference(s2 $.type|public$) $.type|public$ { func (s1 $.type|public$) Difference(s2 $.type|public$) $.type|public$ {
result := New$.type|public$() result := New$.type|public$()
for key := range s { for key := range s1 {
if !s2.Has(key) { if !s2.Has(key) {
result.Insert(key) result.Insert(key)
} }
@ -271,6 +271,16 @@ func (s $.type|public$) Difference(s2 $.type|public$) $.type|public$ {
return result return result
} }
// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection.
// For example:
// s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5}
// s1.SymmetricDifference(s2) = {a3, a4, a5}
// s2.SymmetricDifference(s1) = {a3, a4, a5}
func (s1 $.type|public$) SymmetricDifference(s2 $.type|public$) $.type|public$ {
return s1.Difference(s2).Union(s2.Difference(s1))
}
// Union returns a new set which includes items in either s1 or s2. // Union returns a new set which includes items in either s1 or s2.
// For example: // For example:
// s1 = {a1, a2} // s1 = {a1, a2}

View File

@ -96,15 +96,15 @@ func (s Byte) Clone() Byte {
return result return result
} }
// Difference returns a set of objects that are not in s2 // Difference returns a set of objects that are not in s2.
// For example: // For example:
// s1 = {a1, a2, a3} // s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5} // s2 = {a1, a2, a4, a5}
// s1.Difference(s2) = {a3} // s1.Difference(s2) = {a3}
// s2.Difference(s1) = {a4, a5} // s2.Difference(s1) = {a4, a5}
func (s Byte) Difference(s2 Byte) Byte { func (s1 Byte) Difference(s2 Byte) Byte {
result := NewByte() result := NewByte()
for key := range s { for key := range s1 {
if !s2.Has(key) { if !s2.Has(key) {
result.Insert(key) result.Insert(key)
} }
@ -112,6 +112,16 @@ func (s Byte) Difference(s2 Byte) Byte {
return result return result
} }
// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection.
// For example:
// s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5}
// s1.SymmetricDifference(s2) = {a3, a4, a5}
// s2.SymmetricDifference(s1) = {a3, a4, a5}
func (s1 Byte) SymmetricDifference(s2 Byte) Byte {
return s1.Difference(s2).Union(s2.Difference(s1))
}
// Union returns a new set which includes items in either s1 or s2. // Union returns a new set which includes items in either s1 or s2.
// For example: // For example:
// s1 = {a1, a2} // s1 = {a1, a2}

View File

@ -96,15 +96,15 @@ func (s Int) Clone() Int {
return result return result
} }
// Difference returns a set of objects that are not in s2 // Difference returns a set of objects that are not in s2.
// For example: // For example:
// s1 = {a1, a2, a3} // s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5} // s2 = {a1, a2, a4, a5}
// s1.Difference(s2) = {a3} // s1.Difference(s2) = {a3}
// s2.Difference(s1) = {a4, a5} // s2.Difference(s1) = {a4, a5}
func (s Int) Difference(s2 Int) Int { func (s1 Int) Difference(s2 Int) Int {
result := NewInt() result := NewInt()
for key := range s { for key := range s1 {
if !s2.Has(key) { if !s2.Has(key) {
result.Insert(key) result.Insert(key)
} }
@ -112,6 +112,16 @@ func (s Int) Difference(s2 Int) Int {
return result return result
} }
// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection.
// For example:
// s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5}
// s1.SymmetricDifference(s2) = {a3, a4, a5}
// s2.SymmetricDifference(s1) = {a3, a4, a5}
func (s1 Int) SymmetricDifference(s2 Int) Int {
return s1.Difference(s2).Union(s2.Difference(s1))
}
// Union returns a new set which includes items in either s1 or s2. // Union returns a new set which includes items in either s1 or s2.
// For example: // For example:
// s1 = {a1, a2} // s1 = {a1, a2}

View File

@ -96,15 +96,15 @@ func (s Int64) Clone() Int64 {
return result return result
} }
// Difference returns a set of objects that are not in s2 // Difference returns a set of objects that are not in s2.
// For example: // For example:
// s1 = {a1, a2, a3} // s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5} // s2 = {a1, a2, a4, a5}
// s1.Difference(s2) = {a3} // s1.Difference(s2) = {a3}
// s2.Difference(s1) = {a4, a5} // s2.Difference(s1) = {a4, a5}
func (s Int64) Difference(s2 Int64) Int64 { func (s1 Int64) Difference(s2 Int64) Int64 {
result := NewInt64() result := NewInt64()
for key := range s { for key := range s1 {
if !s2.Has(key) { if !s2.Has(key) {
result.Insert(key) result.Insert(key)
} }
@ -112,6 +112,16 @@ func (s Int64) Difference(s2 Int64) Int64 {
return result return result
} }
// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection.
// For example:
// s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5}
// s1.SymmetricDifference(s2) = {a3, a4, a5}
// s2.SymmetricDifference(s1) = {a3, a4, a5}
func (s1 Int64) SymmetricDifference(s2 Int64) Int64 {
return s1.Difference(s2).Union(s2.Difference(s1))
}
// Union returns a new set which includes items in either s1 or s2. // Union returns a new set which includes items in either s1 or s2.
// For example: // For example:
// s1 = {a1, a2} // s1 = {a1, a2}

View File

@ -96,15 +96,15 @@ func (s String) Clone() String {
return result return result
} }
// Difference returns a set of objects that are not in s2 // Difference returns a set of objects that are not in s2.
// For example: // For example:
// s1 = {a1, a2, a3} // s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5} // s2 = {a1, a2, a4, a5}
// s1.Difference(s2) = {a3} // s1.Difference(s2) = {a3}
// s2.Difference(s1) = {a4, a5} // s2.Difference(s1) = {a4, a5}
func (s String) Difference(s2 String) String { func (s1 String) Difference(s2 String) String {
result := NewString() result := NewString()
for key := range s { for key := range s1 {
if !s2.Has(key) { if !s2.Has(key) {
result.Insert(key) result.Insert(key)
} }
@ -112,6 +112,16 @@ func (s String) Difference(s2 String) String {
return result return result
} }
// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection.
// For example:
// s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5}
// s1.SymmetricDifference(s2) = {a3, a4, a5}
// s2.SymmetricDifference(s1) = {a3, a4, a5}
func (s1 String) SymmetricDifference(s2 String) String {
return s1.Difference(s2).Union(s2.Difference(s1))
}
// Union returns a new set which includes items in either s1 or s2. // Union returns a new set which includes items in either s1 or s2.
// For example: // For example:
// s1 = {a1, a2} // s1 = {a1, a2}

View File

@ -26,7 +26,7 @@ import (
"k8s.io/gengo/types" "k8s.io/gengo/types"
) )
func NewImportTracker(typesToAdd ...*types.Type) namer.ImportTracker { func NewImportTracker(typesToAdd ...*types.Type) *namer.DefaultImportTracker {
tracker := namer.NewDefaultImportTracker(types.Name{}) tracker := namer.NewDefaultImportTracker(types.Name{})
tracker.IsInvalidType = func(*types.Type) bool { return false } tracker.IsInvalidType = func(*types.Type) bool { return false }
tracker.LocalName = func(name types.Name) string { return golangTrackerLocalName(&tracker, name) } tracker.LocalName = func(name types.Name) string { return golangTrackerLocalName(&tracker, name) }

View File

@ -55,6 +55,27 @@ func (tracker *DefaultImportTracker) AddTypes(types ...*types.Type) {
tracker.AddType(t) tracker.AddType(t)
} }
} }
func (tracker *DefaultImportTracker) AddSymbol(symbol types.Name) {
if tracker.local.Package == symbol.Package {
return
}
if len(symbol.Package) == 0 {
return
}
path := symbol.Path
if len(path) == 0 {
path = symbol.Package
}
if _, ok := tracker.pathToName[path]; ok {
return
}
name := tracker.LocalName(symbol)
tracker.nameToPath[name] = path
tracker.pathToName[path] = name
}
func (tracker *DefaultImportTracker) AddType(t *types.Type) { func (tracker *DefaultImportTracker) AddType(t *types.Type) {
if tracker.local.Package == t.Name.Package { if tracker.local.Package == t.Name.Package {
return return
@ -70,19 +91,7 @@ func (tracker *DefaultImportTracker) AddType(t *types.Type) {
return return
} }
if len(t.Name.Package) == 0 { tracker.AddSymbol(t.Name)
return
}
path := t.Name.Path
if len(path) == 0 {
path = t.Name.Package
}
if _, ok := tracker.pathToName[path]; ok {
return
}
name := tracker.LocalName(t.Name)
tracker.nameToPath[name] = path
tracker.pathToName[path] = name
} }
func (tracker *DefaultImportTracker) ImportLines() []string { func (tracker *DefaultImportTracker) ImportLines() []string {

View File

@ -47,6 +47,7 @@ var (
// If set, all log lines will be suppressed from the regular output, and // If set, all log lines will be suppressed from the regular output, and
// redirected to the logr implementation. // redirected to the logr implementation.
// Use as: // Use as:
//
// ... // ...
// klog.SetLogger(zapr.NewLogger(zapLog)) // klog.SetLogger(zapr.NewLogger(zapLog))
// //

View File

@ -145,7 +145,7 @@ func KVListFormat(b *bytes.Buffer, keysAndValues ...interface{}) {
case string: case string:
writeStringValue(b, true, value) writeStringValue(b, true, value)
default: default:
writeStringValue(b, false, fmt.Sprintf("%+v", v)) writeStringValue(b, false, fmt.Sprintf("%+v", value))
} }
case []byte: case []byte:
// In https://github.com/kubernetes/klog/pull/237 it was decided // In https://github.com/kubernetes/klog/pull/237 it was decided

69
vendor/k8s.io/klog/v2/klog.go generated vendored
View File

@ -71,7 +71,6 @@
// "glob" pattern and N is a V level. For instance, // "glob" pattern and N is a V level. For instance,
// -vmodule=gopher*=3 // -vmodule=gopher*=3
// sets the V level to 3 in all Go files whose names begin "gopher". // sets the V level to 3 in all Go files whose names begin "gopher".
//
package klog package klog
import ( import (
@ -397,45 +396,48 @@ type flushSyncWriter interface {
io.Writer io.Writer
} }
// init sets up the defaults. var logging loggingT
var commandLine flag.FlagSet
// init sets up the defaults and creates command line flags.
func init() { func init() {
commandLine.StringVar(&logging.logDir, "log_dir", "", "If non-empty, write log files in this directory (no effect when -logtostderr=true)")
commandLine.StringVar(&logging.logFile, "log_file", "", "If non-empty, use this log file (no effect when -logtostderr=true)")
commandLine.Uint64Var(&logging.logFileMaxSizeMB, "log_file_max_size", 1800,
"Defines the maximum size a log file can grow to (no effect when -logtostderr=true). Unit is megabytes. "+
"If the value is 0, the maximum file size is unlimited.")
commandLine.BoolVar(&logging.toStderr, "logtostderr", true, "log to standard error instead of files")
commandLine.BoolVar(&logging.alsoToStderr, "alsologtostderr", false, "log to standard error as well as files (no effect when -logtostderr=true)")
logging.setVState(0, nil, false)
commandLine.Var(&logging.verbosity, "v", "number for the log level verbosity")
commandLine.BoolVar(&logging.addDirHeader, "add_dir_header", false, "If true, adds the file directory to the header of the log messages")
commandLine.BoolVar(&logging.skipHeaders, "skip_headers", false, "If true, avoid header prefixes in the log messages")
commandLine.BoolVar(&logging.oneOutput, "one_output", false, "If true, only write logs to their native severity level (vs also writing to each lower severity level; no effect when -logtostderr=true)")
commandLine.BoolVar(&logging.skipLogHeaders, "skip_log_headers", false, "If true, avoid headers when opening log files (no effect when -logtostderr=true)")
logging.stderrThreshold = severityValue{ logging.stderrThreshold = severityValue{
Severity: severity.ErrorLog, // Default stderrThreshold is ERROR. Severity: severity.ErrorLog, // Default stderrThreshold is ERROR.
} }
logging.setVState(0, nil, false) commandLine.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr when writing to files and stderr (no effect when -logtostderr=true or -alsologtostderr=false)")
logging.logDir = "" commandLine.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging")
logging.logFile = "" commandLine.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace")
logging.logFileMaxSizeMB = 1800
logging.toStderr = true logging.settings.contextualLoggingEnabled = true
logging.alsoToStderr = false
logging.skipHeaders = false
logging.addDirHeader = false
logging.skipLogHeaders = false
logging.oneOutput = false
logging.flushD = newFlushDaemon(logging.lockAndFlushAll, nil) logging.flushD = newFlushDaemon(logging.lockAndFlushAll, nil)
} }
// InitFlags is for explicitly initializing the flags. // InitFlags is for explicitly initializing the flags.
// It may get called repeatedly for different flagsets, but not
// twice for the same one. May get called concurrently
// to other goroutines using klog. However, only some flags
// may get set concurrently (see implementation).
func InitFlags(flagset *flag.FlagSet) { func InitFlags(flagset *flag.FlagSet) {
if flagset == nil { if flagset == nil {
flagset = flag.CommandLine flagset = flag.CommandLine
} }
flagset.StringVar(&logging.logDir, "log_dir", logging.logDir, "If non-empty, write log files in this directory (no effect when -logtostderr=true)") commandLine.VisitAll(func(f *flag.Flag) {
flagset.StringVar(&logging.logFile, "log_file", logging.logFile, "If non-empty, use this log file (no effect when -logtostderr=true)") flagset.Var(f.Value, f.Name, f.Usage)
flagset.Uint64Var(&logging.logFileMaxSizeMB, "log_file_max_size", logging.logFileMaxSizeMB, })
"Defines the maximum size a log file can grow to (no effect when -logtostderr=true). Unit is megabytes. "+
"If the value is 0, the maximum file size is unlimited.")
flagset.BoolVar(&logging.toStderr, "logtostderr", logging.toStderr, "log to standard error instead of files")
flagset.BoolVar(&logging.alsoToStderr, "alsologtostderr", logging.alsoToStderr, "log to standard error as well as files (no effect when -logtostderr=true)")
flagset.Var(&logging.verbosity, "v", "number for the log level verbosity")
flagset.BoolVar(&logging.addDirHeader, "add_dir_header", logging.addDirHeader, "If true, adds the file directory to the header of the log messages")
flagset.BoolVar(&logging.skipHeaders, "skip_headers", logging.skipHeaders, "If true, avoid header prefixes in the log messages")
flagset.BoolVar(&logging.oneOutput, "one_output", logging.oneOutput, "If true, only write logs to their native severity level (vs also writing to each lower severity level; no effect when -logtostderr=true)")
flagset.BoolVar(&logging.skipLogHeaders, "skip_log_headers", logging.skipLogHeaders, "If true, avoid headers when opening log files (no effect when -logtostderr=true)")
flagset.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr when writing to files and stderr (no effect when -logtostderr=true or -alsologtostderr=false)")
flagset.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging")
flagset.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace")
} }
// Flush flushes all pending log I/O. // Flush flushes all pending log I/O.
@ -550,12 +552,6 @@ type loggingT struct {
vmap map[uintptr]Level vmap map[uintptr]Level
} }
var logging = loggingT{
settings: settings{
contextualLoggingEnabled: true,
},
}
// setVState sets a consistent state for V logging. // setVState sets a consistent state for V logging.
// l.mu is held. // l.mu is held.
func (l *loggingT) setVState(verbosity Level, filter []modulePat, setFilter bool) { func (l *loggingT) setVState(verbosity Level, filter []modulePat, setFilter bool) {
@ -633,8 +629,11 @@ It returns a buffer containing the formatted header and the user's file and line
The depth specifies how many stack frames above lives the source line to be identified in the log message. The depth specifies how many stack frames above lives the source line to be identified in the log message.
Log lines have this form: Log lines have this form:
Lmmdd hh:mm:ss.uuuuuu threadid file:line] msg... Lmmdd hh:mm:ss.uuuuuu threadid file:line] msg...
where the fields are defined as follows: where the fields are defined as follows:
L A single character, representing the log level (eg 'I' for INFO) L A single character, representing the log level (eg 'I' for INFO)
mm The month (zero padded; ie May is '05') mm The month (zero padded; ie May is '05')
dd The day (zero padded) dd The day (zero padded)
@ -1298,9 +1297,13 @@ func newVerbose(level Level, b bool) Verbose {
// The returned value is a struct of type Verbose, which implements Info, Infoln // The returned value is a struct of type Verbose, which implements Info, Infoln
// and Infof. These methods will write to the Info log if called. // and Infof. These methods will write to the Info log if called.
// Thus, one may write either // Thus, one may write either
//
// if klog.V(2).Enabled() { klog.Info("log this") } // if klog.V(2).Enabled() { klog.Info("log this") }
//
// or // or
//
// klog.V(2).Info("log this") // klog.V(2).Info("log this")
//
// The second form is shorter but the first is cheaper if logging is off because it does // The second form is shorter but the first is cheaper if logging is off because it does
// not evaluate its arguments. // not evaluate its arguments.
// //

2
vendor/k8s.io/utils/net/port.go generated vendored
View File

@ -29,7 +29,7 @@ type IPFamily string
// Constants for valid IPFamilys: // Constants for valid IPFamilys:
const ( const (
IPv4 IPFamily = "4" IPv4 IPFamily = "4"
IPv6 = "6" IPv6 IPFamily = "6"
) )
// Protocol is a network protocol support by LocalPort. // Protocol is a network protocol support by LocalPort.

24
vendor/k8s.io/utils/trace/trace.go generated vendored
View File

@ -21,6 +21,7 @@ import (
"context" "context"
"fmt" "fmt"
"math/rand" "math/rand"
"sync"
"time" "time"
"k8s.io/klog/v2" "k8s.io/klog/v2"
@ -93,13 +94,16 @@ func (s traceStep) writeItem(b *bytes.Buffer, formatter string, startTime time.T
// Trace keeps track of a set of "steps" and allows us to log a specific // Trace keeps track of a set of "steps" and allows us to log a specific
// step if it took longer than its share of the total allowed time // step if it took longer than its share of the total allowed time
type Trace struct { type Trace struct {
// constant fields
name string name string
fields []Field fields []Field
threshold *time.Duration
startTime time.Time startTime time.Time
parentTrace *Trace
// fields guarded by a lock
lock sync.RWMutex
threshold *time.Duration
endTime *time.Time endTime *time.Time
traceItems []traceItem traceItems []traceItem
parentTrace *Trace
} }
func (t *Trace) time() time.Time { func (t *Trace) time() time.Time {
@ -138,6 +142,8 @@ func New(name string, fields ...Field) *Trace {
// how long it took. The Fields add key value pairs to provide additional details about the trace // how long it took. The Fields add key value pairs to provide additional details about the trace
// step. // step.
func (t *Trace) Step(msg string, fields ...Field) { func (t *Trace) Step(msg string, fields ...Field) {
t.lock.Lock()
defer t.lock.Unlock()
if t.traceItems == nil { if t.traceItems == nil {
// traces almost always have less than 6 steps, do this to avoid more than a single allocation // traces almost always have less than 6 steps, do this to avoid more than a single allocation
t.traceItems = make([]traceItem, 0, 6) t.traceItems = make([]traceItem, 0, 6)
@ -153,7 +159,9 @@ func (t *Trace) Nest(msg string, fields ...Field) *Trace {
newTrace := New(msg, fields...) newTrace := New(msg, fields...)
if t != nil { if t != nil {
newTrace.parentTrace = t newTrace.parentTrace = t
t.lock.Lock()
t.traceItems = append(t.traceItems, newTrace) t.traceItems = append(t.traceItems, newTrace)
t.lock.Unlock()
} }
return newTrace return newTrace
} }
@ -163,7 +171,9 @@ func (t *Trace) Nest(msg string, fields ...Field) *Trace {
// is logged. // is logged.
func (t *Trace) Log() { func (t *Trace) Log() {
endTime := time.Now() endTime := time.Now()
t.lock.Lock()
t.endTime = &endTime t.endTime = &endTime
t.lock.Unlock()
// an explicit logging request should dump all the steps out at the higher level // an explicit logging request should dump all the steps out at the higher level
if t.parentTrace == nil { // We don't start logging until Log or LogIfLong is called on the root trace if t.parentTrace == nil { // We don't start logging until Log or LogIfLong is called on the root trace
t.logTrace() t.logTrace()
@ -178,13 +188,17 @@ func (t *Trace) Log() {
// If the Trace is nested it is not immediately logged. Instead, it is logged when the trace it // If the Trace is nested it is not immediately logged. Instead, it is logged when the trace it
// is nested within is logged. // is nested within is logged.
func (t *Trace) LogIfLong(threshold time.Duration) { func (t *Trace) LogIfLong(threshold time.Duration) {
t.lock.Lock()
t.threshold = &threshold t.threshold = &threshold
t.lock.Unlock()
t.Log() t.Log()
} }
// logTopLevelTraces finds all traces in a hierarchy of nested traces that should be logged but do not have any // logTopLevelTraces finds all traces in a hierarchy of nested traces that should be logged but do not have any
// parents that will be logged, due to threshold limits, and logs them as top level traces. // parents that will be logged, due to threshold limits, and logs them as top level traces.
func (t *Trace) logTrace() { func (t *Trace) logTrace() {
t.lock.RLock()
defer t.lock.RUnlock()
if t.durationIsWithinThreshold() { if t.durationIsWithinThreshold() {
var buffer bytes.Buffer var buffer bytes.Buffer
traceNum := rand.Int31() traceNum := rand.Int31()
@ -244,10 +258,14 @@ func (t *Trace) calculateStepThreshold() *time.Duration {
traceThreshold := *t.threshold traceThreshold := *t.threshold
for _, s := range t.traceItems { for _, s := range t.traceItems {
nestedTrace, ok := s.(*Trace) nestedTrace, ok := s.(*Trace)
if ok && nestedTrace.threshold != nil { if ok {
nestedTrace.lock.RLock()
if nestedTrace.threshold != nil {
traceThreshold = traceThreshold - *nestedTrace.threshold traceThreshold = traceThreshold - *nestedTrace.threshold
lenTrace-- lenTrace--
} }
nestedTrace.lock.RUnlock()
}
} }
// the limit threshold is used when the threshold( // the limit threshold is used when the threshold(

View File

@ -123,6 +123,10 @@ This is a helper script for Knative E2E test scripts. To use it:
when a test fails, and can dump extra information about the current state of when a test fails, and can dump extra information about the current state of
the cluster (typically using `kubectl`). the cluster (typically using `kubectl`).
1. [optional] Write the `on_success` function. It will be called when a test succeeds
1. [optional] Write the `on_failure` function. It will be called when a test fails
1. [optional] Write the `parse_flags()` function. It will be called whenever an 1. [optional] Write the `parse_flags()` function. It will be called whenever an
unrecognized flag is passed to the script, allowing you to define your own unrecognized flag is passed to the script, allowing you to define your own
flags. The function must return 0 if the flag is unrecognized, or the number flags. The function must return 0 if the flag is unrecognized, or the number

View File

@ -21,13 +21,8 @@ source "$(dirname "${BASH_SOURCE[0]:-$0}")/infra-library.sh"
readonly TEST_RESULT_FILE=/tmp/${REPO_NAME}-e2e-result readonly TEST_RESULT_FILE=/tmp/${REPO_NAME}-e2e-result
# Flag whether test is using a boskos GCP project
IS_BOSKOS=0
# Tear down the test resources. # Tear down the test resources.
function teardown_test_resources() { function teardown_test_resources() {
# On boskos, save time and don't teardown as the cluster will be destroyed anyway.
(( IS_BOSKOS )) && return
header "Tearing down test environment" header "Tearing down test environment"
if function_exists test_teardown; then if function_exists test_teardown; then
test_teardown test_teardown
@ -89,10 +84,9 @@ function setup_test_cluster() {
kubectl config set-context "${k8s_cluster}" --namespace=default kubectl config set-context "${k8s_cluster}" --namespace=default
echo "- Cluster is ${k8s_cluster}" echo "- Cluster is ${k8s_cluster}"
echo "- Docker is ${KO_DOCKER_REPO}" echo "- KO_DOCKER_REPO is ${KO_DOCKER_REPO}"
# Do not run teardowns if we explicitly want to skip them. (( TEARDOWN )) && add_trap teardown_test_resources EXIT
(( ! SKIP_TEARDOWNS )) && add_trap teardown_test_resources EXIT
# Handle failures ourselves, so we can dump useful info. # Handle failures ourselves, so we can dump useful info.
set +o errexit set +o errexit
@ -111,7 +105,7 @@ function success() {
echo "**************************************" echo "**************************************"
echo "*** E2E TESTS PASSED ***" echo "*** E2E TESTS PASSED ***"
echo "**************************************" echo "**************************************"
dump_metrics function_exists on_success && on_success
exit 0 exit 0
} }
@ -122,13 +116,18 @@ function fail_test() {
if [[ "X${message:-}X" == "XX" ]]; then if [[ "X${message:-}X" == "XX" ]]; then
message='test failed' message='test failed'
fi fi
add_trap "dump_cluster_state;dump_metrics" EXIT function_exists on_failure && on_failure
(( ! SKIP_DUMP_ON_FAILURE )) && dump_cluster_state
abort "${message}" abort "${message}"
} }
SKIP_TEARDOWNS=0 # Since create_test_cluster invokes the test script
# recursively we don't want to override these on the second
# invocation
TEARDOWN=${TEARDOWN:-0}
CLOUD_PROVIDER=${CLOUD_PROVIDER:-"gke"}
SKIP_DUMP_ON_FAILURE=${SKIP_DUMP_ON_FAILURE:-0}
E2E_SCRIPT="" E2E_SCRIPT=""
CLOUD_PROVIDER="gke"
# Parse flags and initialize the test cluster. # Parse flags and initialize the test cluster.
function initialize() { function initialize() {
@ -165,9 +164,10 @@ function initialize() {
# Try parsing flag as a standard one. # Try parsing flag as a standard one.
case ${parameter} in case ${parameter} in
--run-tests) run_tests=1 ;; --run-tests) run_tests=1 ;;
--skip-teardowns) SKIP_TEARDOWNS=1 ;; --teardown) TEARDOWN=1 ;;
--skip-istio-addon) echo "--skip-istio-addon is no longer supported" --skip-teardowns) echo "--skip-teardowns is no longer supported - opt in with --teardown" ;;
;; # This flag is a noop --skip-dump-on-failure) SKIP_DUMP_ON_FAILURE=1 ;;
--skip-istio-addon) echo "--skip-istio-addon is no longer supported" ;;
*) *)
case ${parameter} in case ${parameter} in
--cloud-provider) shift; CLOUD_PROVIDER="$1" ;; --cloud-provider) shift; CLOUD_PROVIDER="$1" ;;
@ -177,14 +177,13 @@ function initialize() {
shift shift
done done
(( IS_PROW )) && [[ -z "${GCP_PROJECT_ID:-}" ]] && IS_BOSKOS=1
if [[ "${CLOUD_PROVIDER}" == "gke" ]]; then if [[ "${CLOUD_PROVIDER}" == "gke" ]]; then
custom_flags+=("--addons=NodeLocalDNS") custom_flags+=("--addons=NodeLocalDNS")
fi fi
readonly IS_BOSKOS readonly SKIP_DUMP_ON_FAILURE
readonly SKIP_TEARDOWNS readonly TEARDOWN
readonly CLOUD_PROVIDER
if (( ! run_tests )); then if (( ! run_tests )); then
create_test_cluster "${CLOUD_PROVIDER}" custom_flags e2e_script_command create_test_cluster "${CLOUD_PROVIDER}" custom_flags e2e_script_command

20
vendor/modules.txt vendored
View File

@ -381,7 +381,7 @@ gopkg.in/yaml.v2
# gopkg.in/yaml.v3 v3.0.1 # gopkg.in/yaml.v3 v3.0.1
## explicit ## explicit
gopkg.in/yaml.v3 gopkg.in/yaml.v3
# k8s.io/api v0.25.2 # k8s.io/api v0.25.4
## explicit; go 1.19 ## explicit; go 1.19
k8s.io/api/admissionregistration/v1 k8s.io/api/admissionregistration/v1
k8s.io/api/admissionregistration/v1beta1 k8s.io/api/admissionregistration/v1beta1
@ -429,7 +429,7 @@ k8s.io/api/scheduling/v1beta1
k8s.io/api/storage/v1 k8s.io/api/storage/v1
k8s.io/api/storage/v1alpha1 k8s.io/api/storage/v1alpha1
k8s.io/api/storage/v1beta1 k8s.io/api/storage/v1beta1
# k8s.io/apimachinery v0.25.2 # k8s.io/apimachinery v0.25.4
## explicit; go 1.19 ## explicit; go 1.19
k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/equality
k8s.io/apimachinery/pkg/api/errors k8s.io/apimachinery/pkg/api/errors
@ -477,7 +477,7 @@ k8s.io/apimachinery/pkg/version
k8s.io/apimachinery/pkg/watch k8s.io/apimachinery/pkg/watch
k8s.io/apimachinery/third_party/forked/golang/json k8s.io/apimachinery/third_party/forked/golang/json
k8s.io/apimachinery/third_party/forked/golang/reflect k8s.io/apimachinery/third_party/forked/golang/reflect
# k8s.io/client-go v0.25.2 # k8s.io/client-go v0.25.4
## explicit; go 1.19 ## explicit; go 1.19
k8s.io/client-go/applyconfigurations/admissionregistration/v1 k8s.io/client-go/applyconfigurations/admissionregistration/v1
k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1 k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1
@ -605,7 +605,7 @@ k8s.io/client-go/util/homedir
k8s.io/client-go/util/keyutil k8s.io/client-go/util/keyutil
k8s.io/client-go/util/retry k8s.io/client-go/util/retry
k8s.io/client-go/util/workqueue k8s.io/client-go/util/workqueue
# k8s.io/code-generator v0.25.2 # k8s.io/code-generator v0.25.4
## explicit; go 1.19 ## explicit; go 1.19
k8s.io/code-generator k8s.io/code-generator
k8s.io/code-generator/cmd/client-gen k8s.io/code-generator/cmd/client-gen
@ -640,7 +640,7 @@ k8s.io/code-generator/cmd/set-gen
k8s.io/code-generator/pkg/namer k8s.io/code-generator/pkg/namer
k8s.io/code-generator/pkg/util k8s.io/code-generator/pkg/util
k8s.io/code-generator/third_party/forked/golang/reflect k8s.io/code-generator/third_party/forked/golang/reflect
# k8s.io/gengo v0.0.0-20220613173612-397b4ae3bce7 # k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9
## explicit; go 1.13 ## explicit; go 1.13
k8s.io/gengo/args k8s.io/gengo/args
k8s.io/gengo/examples/deepcopy-gen/generators k8s.io/gengo/examples/deepcopy-gen/generators
@ -652,7 +652,7 @@ k8s.io/gengo/generator
k8s.io/gengo/namer k8s.io/gengo/namer
k8s.io/gengo/parser k8s.io/gengo/parser
k8s.io/gengo/types k8s.io/gengo/types
# k8s.io/klog/v2 v2.70.2-0.20220707122935-0990e81f1a8f # k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54
## explicit; go 1.13 ## explicit; go 1.13
k8s.io/klog/v2 k8s.io/klog/v2
k8s.io/klog/v2/internal/buffer k8s.io/klog/v2/internal/buffer
@ -677,8 +677,8 @@ k8s.io/kube-openapi/pkg/spec3
k8s.io/kube-openapi/pkg/util/proto k8s.io/kube-openapi/pkg/util/proto
k8s.io/kube-openapi/pkg/util/sets k8s.io/kube-openapi/pkg/util/sets
k8s.io/kube-openapi/pkg/validation/spec k8s.io/kube-openapi/pkg/validation/spec
# k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed # k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2
## explicit; go 1.12 ## explicit; go 1.18
k8s.io/utils/buffer k8s.io/utils/buffer
k8s.io/utils/clock k8s.io/utils/clock
k8s.io/utils/clock/testing k8s.io/utils/clock/testing
@ -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-20221114224536-b0354624aa29 # knative.dev/hack v0.0.0-20221115211737-de2ff401a852
## explicit; go 1.18 ## explicit; go 1.18
knative.dev/hack knative.dev/hack
# knative.dev/pkg v0.0.0-20221107171117-0243d641354d # knative.dev/pkg v0.0.0-20221115192737-dca788a951f3
## 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