Skip to content

Commit

Permalink
upgrade to latest dependencies (#471)
Browse files Browse the repository at this point in the history
bumping knative.dev/pkg 4a03844...93b66e6:
  > 93b66e6 Update: report stats for request (# 2584)
  > a650186 Make request body available in admission context (# 2583)
  > a6afcab Fix # 2115, allow selective verbs / subresources for webhooks. (# 2547)
  > da71919 split warnings. Fix issue: 2581 (# 2582)
  > 0a3c1d6 upgrade to latest dependencies (# 2580)
  > 5fbe0c3 upgrade to latest dependencies (# 2579)
  > 2f06d64 Update community files (# 2578)
  > 2e08ca6 WaitForServiceEndpoints doesn't take into account not found endpoint (# 2576)
  > 766f70d fix double close of channel (# 2574)
bumping knative.dev/eventing a9151b5...7f1f49f:
  > 7f1f49f Knative port prefer header check test to rekt (# 6499)
  > f63a073 Knative containersource test to rekt (# 6507)
  > e1866d7 Knative trigger dependency annotations test to rekt (# 6506)
  > ceaae24 We always have v1 ConfigMaps... (# 6502)
  > db235e7 upgrade to latest dependencies (# 6494)
bumping knative.dev/hack 8d1e4cc...f9dc722:
  > f9dc722 Format go code (# 218)
  > 664eac5 Fixing go.mod foreach (# 217)
  > 97fd663 🎁 Support multiple Golang modules in a single project (# 205)
  > f472a96 fix go run invocation of github hub cli (# 212)
  > 7d3bed1 go run... (# 210)
  > e81d63a Update community files (# 209)
bumping knative.dev/serving d79b8bb...62685b3:
  > 62685b3 upgrade to latest dependencies (# 13272)
  > ab56cfe Update net-kourier nightly (# 13273)
  > 6d3d676 Tests for encryption with Kourier local gateway (# 13263)
  > 3e07846 Update net-contour nightly (# 13268)
  > f43692b Update net-kourier nightly (# 13269)
  > 85d2eee Update net-gateway-api nightly (# 13267)
  > 89469ad Update net-certmanager nightly (# 13266)
  > 84be423 add e2e test for timeout with websocket (# 13232)
  > 4fc7743 Add timeout handler to activator to respect the revision timeouts (# 13261)
  > e9df8d9 Update net-kourier nightly (# 13264)
  > f517a90 Update net-istio nightly (# 13253)
  > 39f30aa Update net-gateway-api nightly (# 13251)
  > 79232f4 Update net-certmanager nightly (# 13249)
  > 17a970f Update net-kourier nightly (# 13250)
  > b7075ab Update net-contour nightly (# 13252)
  > b36de60 revision request start timeout should default to revision timeout second (# 13255)
bumping knative.dev/client 6d86bf7...59948bb:
  > 59948bb upgrade to latest dependencies (# 1730)
  > 6376f9a Add --scale-activation flag to match new Serving option (# 1729)
  > 794cdef upgrade to latest dependencies (# 1728)
bumping knative.dev/networking e51df7c...215bac9:
  > 215bac9 httpproxy test image can setup TLS client with CA certs (# 708)
  > 7c9b49e upgrade to latest dependencies (# 707)
  > dba99c4 upgrade to latest dependencies (# 706)
  > 9d28d41 Update community files (# 705)
  > 99830de upgrade to latest dependencies (# 704)

Signed-off-by: Knative Automation <[email protected]>

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation authored Sep 6, 2022
1 parent 015646f commit 1843b3f
Show file tree
Hide file tree
Showing 16 changed files with 264 additions and 84 deletions.
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ require (
k8s.io/client-go v0.23.9
k8s.io/code-generator v0.23.9
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf
knative.dev/eventing v0.34.1
knative.dev/hack v0.0.0-20220823140917-8d1e4ccf9dc3
knative.dev/pkg v0.0.0-20220818004048-4a03844c0b15
knative.dev/eventing v0.34.1-0.20220906111743-7f1f49f5b4e0
knative.dev/hack v0.0.0-20220906140443-f9dc7220d362
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700
)

require (
Expand All @@ -41,7 +41,7 @@ require (
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
gotest.tools/v3 v3.1.0
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
knative.dev/client v0.34.0
knative.dev/client v0.34.1-0.20220906114442-59948bb3723d
)

require (
Expand Down Expand Up @@ -148,8 +148,8 @@ require (
k8s.io/cli-runtime v0.23.4 // indirect
k8s.io/gengo v0.0.0-20220613173612-397b4ae3bce7 // indirect
k8s.io/klog/v2 v2.70.2-0.20220707122935-0990e81f1a8f // indirect
knative.dev/networking v0.0.0-20220818010248-e51df7cdf571 // indirect
knative.dev/serving v0.34.0 // indirect
knative.dev/networking v0.0.0-20220831065816-215bac90b28b // indirect
knative.dev/serving v0.34.1-0.20220905171742-62685b3b4a5a // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/kustomize/api v0.10.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.0 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1378,18 +1378,18 @@ k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc=
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/client v0.34.0 h1:CY62Bd/sodq8aeL6dYGYnDCvpe39qiPGXJHtR4Rktbk=
knative.dev/client v0.34.0/go.mod h1:mquhJiwkZytOKzLjRu3K+5HWRM6YAplWfvGUbCFZI4M=
knative.dev/eventing v0.34.1 h1:r6QuQmDCmmSANdTRLdbKb6YcYaJoeNpEuFfS8Bq0ZgQ=
knative.dev/eventing v0.34.1/go.mod h1:6UnNnPrEUNAM9PfCpf7L8N7G/1vq+HQlpOjzndY6ryw=
knative.dev/hack v0.0.0-20220823140917-8d1e4ccf9dc3 h1:umaeMRecA0g5g48L9tnEAkTBIitr9eKWMyJYo9YttAA=
knative.dev/hack v0.0.0-20220823140917-8d1e4ccf9dc3/go.mod h1:t/azP8I/Cygaw+87O7rkAPrNRjCelmtfSzWzu/9TM7I=
knative.dev/networking v0.0.0-20220818010248-e51df7cdf571 h1:Lu/TsJjxg1p+2CMr2LNHEdEFBNHYjDoZv2f1QZoM8jg=
knative.dev/networking v0.0.0-20220818010248-e51df7cdf571/go.mod h1:m3ataWRwmbHjOY9sCFvcDWRNLVITxVl0fH0RxdCa4jE=
knative.dev/pkg v0.0.0-20220818004048-4a03844c0b15 h1:GNmzHVaUo3zoi/wtIN71LPQaWy6DdoYzmb+GIq2s4fw=
knative.dev/pkg v0.0.0-20220818004048-4a03844c0b15/go.mod h1:YLjXbkQLlGHok+u0FLfMbBHFzY9WGu3GHhnrptoAy8I=
knative.dev/serving v0.34.0 h1:x3fS4e0AcNBBlQv5Dd5y30W2gtrxndUEwIEPknZfeVg=
knative.dev/serving v0.34.0/go.mod h1:IyfedOBq3KzcD5dZONjbix2BfS0jOwDq5td8UE9CjCk=
knative.dev/client v0.34.1-0.20220906114442-59948bb3723d h1:2VReV5z4UELaRYJDo/+QU7gYd4LVcOKMeZDC9hfi4sI=
knative.dev/client v0.34.1-0.20220906114442-59948bb3723d/go.mod h1:2Z3qxDjIiniQCGrpvTRbbn9nxB8D5pzVH36E3xql+ko=
knative.dev/eventing v0.34.1-0.20220906111743-7f1f49f5b4e0 h1:IVLZkOQlBL8MMwSYw28WVMru36UdXTZW+FkKuZACMhs=
knative.dev/eventing v0.34.1-0.20220906111743-7f1f49f5b4e0/go.mod h1:6UnNnPrEUNAM9PfCpf7L8N7G/1vq+HQlpOjzndY6ryw=
knative.dev/hack v0.0.0-20220906140443-f9dc7220d362 h1:z3MkroifHD8RBAJv3zD6PDYhE/XRRJdrMpuIYHd3cFI=
knative.dev/hack v0.0.0-20220906140443-f9dc7220d362/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20220831065816-215bac90b28b h1:NhaGPmanHDyWMsl/LudsCmTMcdEEjZFk3qkSIUOW9Jw=
knative.dev/networking v0.0.0-20220831065816-215bac90b28b/go.mod h1:vMMT540KNAh6TWmpGEFnExTxJ/j9cee5qNV7Bs0kzUk=
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700 h1:6xjS69vf5Pbwu+dWckqPALmm5pc3p0/XScPpRBhugRc=
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700/go.mod h1:WIQZyPTLzT+z0V3/gB91aWugIi3E1mkU9rjCrLfjOwY=
knative.dev/serving v0.34.1-0.20220905171742-62685b3b4a5a h1:GT7gPwH4JkKScyZBKwNpE2w4hPDbbVFG66iZWbTxI4M=
knative.dev/serving v0.34.1-0.20220905171742-62685b3b4a5a/go.mod h1:F1+qPPtn78vmrDdOoOsapHEOCzVqRcmDcFFJolWVuE0=
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/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
Expand Down
5 changes: 5 additions & 0 deletions vendor/knative.dev/client/pkg/serving/config_changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ func UpdateScaleTarget(template *servingv1.RevisionTemplateSpec, target int) err
return UpdateRevisionTemplateAnnotation(template, autoscaling.TargetAnnotationKey, strconv.Itoa(target))
}

//UpdateScaleActivation updates the scale activation annotation
func UpdateScaleActivation(template *servingv1.RevisionTemplateSpec, activation int) error {
return UpdateRevisionTemplateAnnotation(template, autoscaling.ActivationScaleKey, strconv.Itoa(activation))
}

// UpdateScaleUtilization updates container target utilization percentage annotation
func UpdateScaleUtilization(template *servingv1.RevisionTemplateSpec, target int) error {
return UpdateRevisionTemplateAnnotation(template, autoscaling.TargetUtilizationPercentageKey, strconv.Itoa(target))
Expand Down
7 changes: 7 additions & 0 deletions vendor/knative.dev/hack/go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
go 1.18

use (
.
schema
test/e2e
)
52 changes: 40 additions & 12 deletions vendor/knative.dev/hack/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function patch_version() {
# Print error message and exit 1
# Parameters: $1..$n - error message to be displayed
function abort() {
echo "error: $*"
echo "error: $*" >&2
exit 1
}

Expand Down Expand Up @@ -126,7 +126,7 @@ function subheader() {

# Simple warning banner for logging purposes.
function warning() {
make_banner "!" "$1"
make_banner '!' "$*" >&2
}

# Checks whether the given function exists.
Expand Down Expand Up @@ -567,7 +567,6 @@ function go_run() {
export GORUN_PATH
GOPATH="${GORUN_PATH}" \
GOFLAGS='' \
GO111MODULE='' \
go run "$package" "$@"
}

Expand All @@ -577,6 +576,7 @@ function go_run() {
# $3..$n - parameters passed to the tool.
# Deprecated: use go_run instead
function run_go_tool() {
warning 'The "run_go_tool" function is deprecated. Use "go_run" instead.'
local package=$1
# If no `@version` is provided, default to adding `@latest`
if [[ "$package" != *@* ]]; then
Expand All @@ -601,6 +601,26 @@ function add_trap {
done
}

# Run a command, described by $1, for every go module in the project.
# Parameters: $1 - Description of the command being run,
# $2 - $n - Arguments to pass to the command.
function foreach_go_module() {
local failed=0
local -r cmd="$1"
shift
local gomod_filepath gomod_dir
while read -r gomod_filepath; do
gomod_dir="$(dirname "$gomod_filepath")"
pushd "$gomod_dir" > /dev/null
"$cmd" "$@" || failed=$?
popd > /dev/null
if (( failed )); then
echo "Command '${cmd}' failed in module $gomod_dir: $failed" >&2
return $failed
fi
done < <(find . -name go.mod -type f ! -path "*/vendor/*" ! -path "*/third_party/*")
}

# Update go deps.
# Parameters (parsed as flags):
# "--upgrade", bool, do upgrade.
Expand All @@ -613,14 +633,18 @@ function add_trap {
# global env var: FLOATING_DEPS
# --upgrade will set GOPROXY to direct unless it is already set.
function go_update_deps() {
cd "${REPO_ROOT_DIR}" || return 1
foreach_go_module __go_update_deps_for_module "$@"
}

function __go_update_deps_for_module() {
( # do not modify the environment
set -Eeuo pipefail

export GO111MODULE=on
export GOFLAGS=""
export GONOSUMDB="${GONOSUMDB:-},knative.dev/*"
export GONOPROXY="${GONOPROXY:-},knative.dev/*"

echo "=== Update Deps for Golang"
echo "=== Update Deps for Golang module: $(go_mod_module_name)"

local UPGRADE=0
local RELEASE="v9000.1" # release v9000 is so far in the future, it will always pick the default branch.
Expand All @@ -646,7 +670,7 @@ function go_update_deps() {
else
group "Upgrading to release ${RELEASE}"
fi
FLOATING_DEPS+=( $(go_run knative.dev/test-infra/buoy@latest float ${REPO_ROOT_DIR}/go.mod "${buoyArgs[@]}") )
FLOATING_DEPS+=( $(go_run knative.dev/test-infra/buoy@latest float ./go.mod "${buoyArgs[@]}") )
if [[ ${#FLOATING_DEPS[@]} > 0 ]]; then
echo "Floating deps to ${FLOATING_DEPS[@]}"
go get -d ${FLOATING_DEPS[@]}
Expand All @@ -664,6 +688,9 @@ function go_update_deps() {
go mod vendor 2>&1 | grep -v "ignoring symlink" || true
eval "$orig_pipefail_opt"

if ! [ -d vendor ]; then
return 0
fi
group "Removing unwanted vendor files"

# Remove unwanted vendor files
Expand All @@ -680,13 +707,15 @@ function go_update_deps() {

group "Removing broken symlinks"
remove_broken_symlinks ./vendor
)
}


# Return the go module name of the current module.
# Intended to be used like:
# export MODULE_NAME=$(go_mod_module_name)
function go_mod_module_name() {
go mod graph | cut -d' ' -f 1 | grep -v '@' | head -1
grep -E '^module ' go.mod | cut -d' ' -f2
}

# Return a GOPATH to a temp directory. Works around the out-of-GOPATH issues
Expand Down Expand Up @@ -717,19 +746,18 @@ function run_kntest() {
# Parameters: $1 - output file, relative to repo root dir.
# $2 - directory to inspect.
function update_licenses() {
cd "${REPO_ROOT_DIR}" || return 1
local dst=$1
local dir=$2
shift
go_run github.com/google/[email protected].0 \
go_run github.com/google/[email protected].1 \
save "${dir}" --save_path="${dst}" --force || \
{ echo "--- FAIL: go-licenses failed to update licenses"; return 1; }
}

# Run go-licenses to check for forbidden licenses.
function check_licenses() {
# Check that we don't have any forbidden licenses.
go_run github.com/google/[email protected].0 \
go_run github.com/google/[email protected].1 \
check "${REPO_ROOT_DIR}/..." || \
{ echo "--- FAIL: go-licenses failed the license check"; return 1; }
}
Expand Down Expand Up @@ -762,7 +790,7 @@ function is_protected_project() {
# Remove symlinks in a path that are broken or lead outside the repo.
# Parameters: $1 - path name, e.g. vendor
function remove_broken_symlinks() {
for link in $(find $1 -type l); do
for link in $(find "$1" -type l); do
# Remove broken symlinks
if [[ ! -e ${link} ]]; then
unlink ${link}
Expand Down
36 changes: 27 additions & 9 deletions vendor/knative.dev/hack/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ function report_build_test() {
# * `go build` on the entire repo
# * check licenses in all go packages
function default_build_test_runner() {
foreach_go_module __build_test_runner_for_module
}

function __build_test_runner_for_module() {
local failed=0
subheader "Build tests for $(go_mod_module_name)"
# Run verify-codegen check
if [[ -f ./hack/verify-codegen.sh ]]; then
subheader "Checking autogenerated code is up-to-date"
Expand All @@ -132,18 +137,26 @@ function default_build_test_runner() {
# verify-codegen (as md files can be auto-generated in some repos).
(( IS_DOCUMENTATION_PR )) && return ${failed}
# Don't merge these two lines, or return code will always be 0.
# Get all build tags in go code (ignore /vendor, /hack and /third_party)
local tags
tags="$(grep -I -r '// +build' . | \
grep -v '/vendor/' | \
grep -v '/hack/' | \
grep -v '/third_party' | \
cut -f3 -d' ' | \
tr ',' '\n' | \
sort | uniq | \
grep -v '^!' | \
tr '\n' ' ')"
local go_pkg_dirs
go_pkg_dirs="$(go list ./...)" || return 1
# Skip build test if there is no go code
[[ -z "${go_pkg_dirs}" ]] && return ${failed}
go_pkg_dirs="$(go list -tags "${tags}" ./...)" || return $?
if [[ -z "${go_pkg_dirs}" ]]; then
subheader "No golang code found, skipping build tests"
return 0
fi
# Ensure all the code builds
subheader "Checking that go code builds"
# Get all build tags in go code (ignore /vendor, /hack and /third_party)
local tags
tags="$(find . \
-path './vendor' -prune -o -path './hack' -prune -o -path './third_party' -prune \
-o -type f -name '*.go' -exec grep '// +build' {} + \
| cut -f3 -d' ' | tr ',' '\n' | uniq | sort | tr '\n' ' ')"

report_build_test Build_Go \
go test -vet=off -tags "${tags}" -exec echo ./... || failed=2

Expand Down Expand Up @@ -185,6 +198,11 @@ function run_unit_tests() {

# Default unit test runner that runs all go tests in the repo.
function default_unit_test_runner() {
foreach_go_module __unit_test_runner_for_module
}

function __unit_test_runner_for_module() {
subheader "Unit tests for $(go_mod_module_name)"
report_go_test -short -race -count 1 ./...
}

Expand Down
4 changes: 4 additions & 0 deletions vendor/knative.dev/pkg/test/kube_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
k8styped "k8s.io/client-go/kubernetes/typed/core/v1"

"knative.dev/pkg/test/logging"
)

Expand Down Expand Up @@ -141,6 +142,9 @@ func WaitForServiceEndpoints(ctx context.Context, client kubernetes.Interface, s
waitErr := wait.PollImmediate(interval, podTimeout, func() (bool, error) {
var err error
endpoints, err = endpointsService.Get(ctx, svcName, metav1.GetOptions{})
if apierrs.IsNotFound(err) {
return false, nil
}
if err != nil {
return false, err
}
Expand Down
21 changes: 19 additions & 2 deletions vendor/knative.dev/pkg/webhook/admission.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ limitations under the License.
package webhook

import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
"time"

"go.uber.org/zap"
Expand Down Expand Up @@ -90,10 +93,12 @@ func admissionHandler(rootLogger *zap.SugaredLogger, stats StatsReporter, c Admi
logger.Infof("Webhook ServeHTTP request=%#v", r)

var review admissionv1.AdmissionReview
if err := json.NewDecoder(r.Body).Decode(&review); err != nil {
bodyBuffer := bytes.Buffer{}
if err := json.NewDecoder(io.TeeReader(r.Body, &bodyBuffer)).Decode(&review); err != nil {
http.Error(w, fmt.Sprint("could not decode body:", err), http.StatusBadRequest)
return
}
r.Body = io.NopCloser(&bodyBuffer)

logger = logger.With(
logkey.Kind, review.Request.Kind.String(),
Expand Down Expand Up @@ -124,6 +129,18 @@ func admissionHandler(rootLogger *zap.SugaredLogger, stats StatsReporter, c Admi
if !reviewResponse.Allowed || reviewResponse.PatchType != nil || response.Response == nil {
response.Response = reviewResponse
}

// If warnings contain newlines, which they will do by default if
// using Knative apis.FieldError, split them based on newlines
// and create a new warning. This is because any control characters
// in the warnings will cause the warning to be dropped silently.
if reviewResponse.Warnings != nil {
cleanedWarnings := make([]string, 0, len(reviewResponse.Warnings))
for _, w := range reviewResponse.Warnings {
cleanedWarnings = append(cleanedWarnings, strings.Split(w, "\n")...)
}
reviewResponse.Warnings = cleanedWarnings
}
response.Response.UID = review.Request.UID

logger = logger.With(
Expand All @@ -141,7 +158,7 @@ func admissionHandler(rootLogger *zap.SugaredLogger, stats StatsReporter, c Admi

if stats != nil {
// Only report valid requests
stats.ReportRequest(review.Request, response.Response, time.Since(ttStart))
stats.ReportAdmissionRequest(review.Request, response.Response, time.Since(ttStart))
}
}
}
Expand Down
Loading

0 comments on commit 1843b3f

Please sign in to comment.