Repository: knative/pkg
Pull request #1920 (2020-11-20 01:20:06)

[master] Upgrade to latest dependencies
Produced via:
```shell
./hack/update-deps.sh --upgrade
./hack/update-codegen.sh
```
Cron. -knative-prow-robot
/cc knative/serving-writers knative/eventing-writers
/assign knative/serving-writers knative/eventing-writers

knative-prow-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/knative/pkg/pull/1920#" title="Author self-approved">knative-automation</a>*
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **vaikas** after the PR has been reviewed.
You can assign the PR to them by writing `/assign @vaikas` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=knative%2Fpkg).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/knative/pkg/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["vaikas"]} -->
codecov[bot]: # [Codecov](https://codecov.io/gh/knative/pkg/pull/1920?src=pr&el=h1) Report
> Merging [#1920](https://codecov.io/gh/knative/pkg/pull/1920?src=pr&el=desc) (77f8a9b) into [master](https://codecov.io/gh/knative/pkg/commit/e5e30edc364abb9d67cc0e4c5ae142f1e648c8a3?el=desc) (e5e30ed) will **decrease** coverage by `0.02%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/knative/pkg/pull/1920/graphs/tree.svg?width=650&height=150&src=pr&token=rlqpDnfxbO)](https://codecov.io/gh/knative/pkg/pull/1920?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #1920      +/-   ##
==========================================
- Coverage   69.51%   69.49%   -0.03%     
==========================================
  Files         207      207              
  Lines        8748     8748              
==========================================
- Hits         6081     6079       -2     
- Misses       2398     2399       +1     
- Partials      269      270       +1     
```


| [Impacted Files](https://codecov.io/gh/knative/pkg/pull/1920?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [test/gcs/mock/mock.go](https://codecov.io/gh/knative/pkg/pull/1920/diff?src=pr&el=tree#diff-dGVzdC9nY3MvbW9jay9tb2NrLmdv) | `91.39% <0.00%> (-1.08%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/knative/pkg/pull/1920?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/knative/pkg/pull/1920?src=pr&el=footer). Last update [e5e30ed...7767d70](https://codecov.io/gh/knative/pkg/pull/1920?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/go.mod b/go.mod
index 31b375d7b..35e28c26b 100644
--- a/go.mod
+++ b/go.mod
@@ -74,6 +74,6 @@ require (
 	k8s.io/klog v1.0.0
 	k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29 // indirect
 	k8s.io/utils v0.0.0-20200603063816-c1c6865ac451 // indirect
-	knative.dev/hack v0.0.0-20201119025252-d3cb354f49ff
+	knative.dev/hack v0.0.0-20201119155951-11aa26c8eaf6
 	sigs.k8s.io/structured-merge-diff/v3 v3.0.1-0.20200706213357-43c19bbb7fba // indirect
 )
diff --git a/go.sum b/go.sum
index 11a921ae1..356dbb126 100644
--- a/go.sum
+++ b/go.sum
@@ -1120,8 +1120,8 @@ k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29/go.mod h1:F+5wygcW0wmRTnM
 k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
 k8s.io/utils v0.0.0-20200603063816-c1c6865ac451 h1:v8ud2Up6QK1lNOKFgiIVrZdMg7MpmSnvtrOieolJKoE=
 k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
-knative.dev/hack v0.0.0-20201119025252-d3cb354f49ff h1:+bdPPtgog4EAuibiiW1uMdWX2DVij0+elXSh+Yfey78=
-knative.dev/hack v0.0.0-20201119025252-d3cb354f49ff/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
+knative.dev/hack v0.0.0-20201119155951-11aa26c8eaf6 h1:axQj+uBstWcD2KmgTvN0i4Jl4bs2LF2LJTANe1utmFc=
+knative.dev/hack v0.0.0-20201119155951-11aa26c8eaf6/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
 pgregory.net/rapid v0.3.3 h1:jCjBsY4ln4Atz78QoBWxUEvAHaFyNDQg9+WU62aCn1U=
 pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
 rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
diff --git a/vendor/knative.dev/hack/library.sh b/vendor/knative.dev/hack/library.sh
index c2f9081ef..9b90b0025 100644
--- a/vendor/knative.dev/hack/library.sh
+++ b/vendor/knative.dev/hack/library.sh
@@ -410,28 +410,26 @@ function start_latest_knative_serving() {
 }
 
 # Install Knative Eventing in the current cluster.
-# Parameters: $1 - Knative Eventing crds manifest.
-#             $2 - Knative Eventing core manifest.
+# Parameters: $1 - Knative Eventing manifest.
 function start_knative_eventing() {
   header "Starting Knative Eventing"
   subheader "Installing Knative Eventing"
   echo "Installing Eventing CRDs from $1"
+  kubectl apply --selector knative.dev/crd-install=true -f "$1"
+  echo "Installing the rest of eventing components from $1"
   kubectl apply -f "$1"
-  echo "Installing Eventing core components from $2"
-  kubectl apply -f "$2"
   wait_until_pods_running knative-eventing || return 1
 }
 
 # Install the stable release Knative/eventing in the current cluster.
 # Parameters: $1 - Knative Eventing version number, e.g. 0.6.0.
 function start_release_knative_eventing() {
-  start_knative_eventing "https://storage.googleapis.com/knative-releases/eventing/previous/v$1/eventing-crds.yaml" \
-    "https://storage.googleapis.com/knative-releases/eventing/previous/v$1/eventing-core.yaml"
+  start_knative_eventing "https://storage.googleapis.com/knative-releases/eventing/previous/v$1/eventing.yaml"
 }
 
 # Install the latest stable Knative Eventing in the current cluster.
 function start_latest_knative_eventing() {
-  start_knative_eventing "${KNATIVE_EVENTING_RELEASE_CRDS}" "${KNATIVE_EVENTING_RELEASE_CORE}"
+  start_knative_eventing "${KNATIVE_EVENTING_RELEASE}"
 }
 
 # Install Knative Eventing extension in the current cluster.
@@ -764,6 +762,5 @@ readonly REPO_NAME_FORMATTED="Knative $(capitalize "${REPO_NAME//-/ }")"
 readonly KNATIVE_SERVING_RELEASE_CRDS="$(get_latest_knative_yaml_source "serving" "serving-crds")"
 readonly KNATIVE_SERVING_RELEASE_CORE="$(get_latest_knative_yaml_source "serving" "serving-core")"
 readonly KNATIVE_NET_ISTIO_RELEASE="$(get_latest_knative_yaml_source "net-istio" "net-istio")"
-readonly KNATIVE_EVENTING_RELEASE_CRDS="$(get_latest_knative_yaml_source "eventing" "eventing-crds")"
-readonly KNATIVE_EVENTING_RELEASE_CORE="$(get_latest_knative_yaml_source "eventing" "eventing-core")"
+readonly KNATIVE_EVENTING_RELEASE="$(get_latest_knative_yaml_source "eventing" "eventing")"
 readonly KNATIVE_EVENTING_SUGAR_CONTROLLER_RELEASE="$(get_latest_knative_yaml_source "eventing" "eventing-sugar-controller")"
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 1c5975fd8..4e913b513 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -955,7 +955,7 @@ k8s.io/utils/buffer
 k8s.io/utils/integer
 k8s.io/utils/pointer
 k8s.io/utils/trace
-# knative.dev/hack v0.0.0-20201119025252-d3cb354f49ff
+# knative.dev/hack v0.0.0-20201119155951-11aa26c8eaf6
 ## explicit
 knative.dev/hack
 # sigs.k8s.io/structured-merge-diff/v3 v3.0.1-0.20200706213357-43c19bbb7fba
diff --git a/webhook/env.go b/webhook/env.go
index 9e59f7cfd..cd038b40e 100644
--- a/webhook/env.go
+++ b/webhook/env.go
@@ -24,6 +24,9 @@ import (
 
 const portEnvKey = "WEBHOOK_PORT"
 
+// Webhook is the name of the override key used inside of the logging config for Webhook Controller.
+const webhookNameEnv = "WEBHOOK_NAME"
+
 // PortFromEnv returns the webhook port set by portEnvKey, or default port if env var is not set.
 func PortFromEnv(defaultPort int) int {
 	if os.Getenv(portEnvKey) == "" {
@@ -37,3 +40,17 @@ func PortFromEnv(defaultPort int) int {
 	}
 	return port
 }
+
+func NameFromEnv() string {
+	if webhook := os.Getenv(webhookNameEnv); webhook != "" {
+		return webhook
+	}
+
+	panic(fmt.Sprintf(`The environment variable %q is not set.
+This should be unique for the webhooks in a namespace
+If this is a process running on Kubernetes, then initialize this variable via:
+  env:
+  - name: WEBHOOK_NAME
+    value: webhook
+`, webhookNameEnv))
+}


Test patch:
diff --git a/webhook/env_test.go b/webhook/env_test.go
index 4ffc8956c..c08eaba77 100644
--- a/webhook/env_test.go
+++ b/webhook/env_test.go
@@ -33,6 +33,13 @@ type portTest struct {
 	wantPanic bool
 }
 
+type webhookNameTest struct {
+	name      string
+	in        string
+	want      string
+	wantPanic bool
+}
+
 func TestPort(t *testing.T) {
 	tests := []portTest{{
 		name: testMissingInputName,
@@ -81,3 +88,37 @@ func TestPort(t *testing.T) {
 		})
 	}
 }
+
+func TestWebhookName(t *testing.T) {
+	tests := []webhookNameTest{{
+		name:      "EmptyInput",
+		in:        "",
+		wantPanic: true,
+	}, {
+		name: "ValidInput",
+		in:   "mywebhook",
+		want: "mywebhook",
+	}}
+
+	for _, tc := range tests {
+		t.Run(tc.name, func(t *testing.T) {
+			// webhookNameEnv is unset when testing missing input.
+			if tc.name != testMissingInputName {
+				os.Setenv(webhookNameEnv, tc.in)
+			}
+
+			defer func() {
+				if r := recover(); r == nil && tc.wantPanic {
+					t.Error("Did not panic")
+				} else if r != nil && !tc.wantPanic {
+					t.Error("Got unexpected panic")
+				}
+				os.Unsetenv(webhookNameEnv)
+			}()
+
+			if got := NameFromEnv(); got != tc.want {
+				t.Errorf("NameFromEnv = %s, want: %s", got, tc.want)
+			}
+		})
+	}
+}