Repository: knative/pkg
Pull request #2698 (2023-03-01 01:37:03)

[main] Upgrade to latest dependencies
Cron -knative-prow-robot

/cc knative/serving-writers knative/eventing-writers
/assign knative/serving-writers knative/eventing-writers

Produced by: knative-sandbox/knobots/actions/update-deps

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

This pull-request has been approved by: *<a href="https://github.com/knative/pkg/pull/2698#" title="Author self-approved">knative-automation</a>*
**Once this PR has been reviewed and has the lgtm label**, please assign psschwei for approval. For more information see [the Kubernetes Code Review Process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process).

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/main/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":["psschwei"]} -->
knative-prow[bot]: @knative-automation: The following test **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
unit-tests_pkg_main | 36768ffbdc7f18f154cf932538185bca5b92ddd4 | [link](https://prow.knative.dev/view/gs/knative-prow/pr-logs/pull/knative_pkg/2698/unit-tests_pkg_main/1630743932402929664) | true | `/test unit-tests`

[Your PR dashboard](https://prow.knative.dev/pr).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
codecov[bot]: # [Codecov](https://codecov.io/gh/knative/pkg/pull/2698?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) Report
Patch and project coverage have no change.
> Comparison is base [(`2fdd6bf`)](https://codecov.io/gh/knative/pkg/commit/2fdd6bf8be3190ce23acc7e8a8cb790182f635c1?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) 81.29% compared to head [(`36768ff`)](https://codecov.io/gh/knative/pkg/pull/2698?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) 81.29%.

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main    #2698   +/-   ##
=======================================
  Coverage   81.29%   81.29%           
=======================================
  Files         163      163           
  Lines        9902     9902           
=======================================
  Hits         8050     8050           
  Misses       1610     1610           
  Partials      242      242           
```



Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative)

</details>

[:umbrella: View full report at Codecov](https://codecov.io/gh/knative/pkg/pull/2698?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative).


Patch:
diff --git a/.github/workflows/knative-downstream.yaml b/.github/workflows/knative-downstream.yaml
index 31e1ddc15..e6b144931 100644
--- a/.github/workflows/knative-downstream.yaml
+++ b/.github/workflows/knative-downstream.yaml
@@ -50,10 +50,10 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-    - name: Set up Go 1.18.x
+    - name: Set up Go 1.20.x
       uses: actions/setup-go@v3
       with:
-        go-version: 1.18.x
+        go-version: 1.20.x
 
     - name: Install Dependencies
       run: |
diff --git a/go.mod b/go.mod
index 0723f87f4..09120da4e 100644
--- a/go.mod
+++ b/go.mod
@@ -50,7 +50,7 @@ require (
 	k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9
 	k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54
 	k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2
-	knative.dev/hack v0.0.0-20230217131352-f2f3107be156
+	knative.dev/hack v0.0.0-20230228173453-3de51aff69a3
 	sigs.k8s.io/yaml v1.3.0
 )
 
diff --git a/go.sum b/go.sum
index cd3072a15..834dc8911 100644
--- a/go.sum
+++ b/go.sum
@@ -962,8 +962,8 @@ 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/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJOIfnislxYlqTj8=
 k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
-knative.dev/hack v0.0.0-20230217131352-f2f3107be156 h1:l4/KJeKC7Nrm9WUF3AhAnvoj00OogWfPJKrBP8tbN8c=
-knative.dev/hack v0.0.0-20230217131352-f2f3107be156/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
+knative.dev/hack v0.0.0-20230228173453-3de51aff69a3 h1:Jt3n+AZsZHZaFhk/A1NnboAvgjV+hvvyeyyuIX/hUx0=
+knative.dev/hack v0.0.0-20230228173453-3de51aff69a3/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
 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/release.sh b/vendor/knative.dev/hack/release.sh
index 41d76d6ea..135fa8b7c 100644
--- a/vendor/knative.dev/hack/release.sh
+++ b/vendor/knative.dev/hack/release.sh
@@ -730,7 +730,7 @@ function main() {
 # Parameters: $1..$n - files to add to the release.
 function publish_to_github() {
   (( PUBLISH_TO_GITHUB )) || return 0
-  local title="${REPO_NAME_FORMATTED} release ${TAG}"
+  local title="${TAG}"
   local attachments=()
   local description="$(mktemp)"
   local attachments_dir="$(mktemp -d)"
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 82116c732..9edd17334 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1118,7 +1118,7 @@ k8s.io/utils/net
 k8s.io/utils/pointer
 k8s.io/utils/strings/slices
 k8s.io/utils/trace
-# knative.dev/hack v0.0.0-20230217131352-f2f3107be156
+# knative.dev/hack v0.0.0-20230228173453-3de51aff69a3
 ## explicit; go 1.18
 knative.dev/hack
 # sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2
diff --git a/webhook/env.go b/webhook/env.go
index cd038b40e..01d52c8b0 100644
--- a/webhook/env.go
+++ b/webhook/env.go
@@ -22,10 +22,14 @@ import (
 	"strconv"
 )
 
-const portEnvKey = "WEBHOOK_PORT"
+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"
+	// Webhook is the name of the override key used inside of the logging config for Webhook Controller.
+	webhookNameEnvKey = "WEBHOOK_NAME"
+
+	secretNameEnvKey = "WEBHOOK_SECRET_NAME"
+)
 
 // PortFromEnv returns the webhook port set by portEnvKey, or default port if env var is not set.
 func PortFromEnv(defaultPort int) int {
@@ -42,7 +46,7 @@ func PortFromEnv(defaultPort int) int {
 }
 
 func NameFromEnv() string {
-	if webhook := os.Getenv(webhookNameEnv); webhook != "" {
+	if webhook := os.Getenv(webhookNameEnvKey); webhook != "" {
 		return webhook
 	}
 
@@ -52,5 +56,13 @@ If this is a process running on Kubernetes, then initialize this variable via:
   env:
   - name: WEBHOOK_NAME
     value: webhook
-`, webhookNameEnv))
+`, webhookNameEnvKey))
+}
+
+func SecretNameFromEnv(defaultSecretName string) string {
+	secret := os.Getenv(secretNameEnvKey)
+	if secret == "" {
+		return defaultSecretName
+	}
+	return secret
 }


Test patch:
diff --git a/webhook/env_test.go b/webhook/env_test.go
index 3f3c705ba..df5a0db9e 100644
--- a/webhook/env_test.go
+++ b/webhook/env_test.go
@@ -21,8 +21,10 @@ import (
 )
 
 const (
-	testDefaultPort      = 8888
-	testMissingInputName = "MissingInput" // portEnvKey is not found.
+	testMissingInputName = "MissingInput"
+
+	testDefaultPort       = 8888
+	testDefaultSecretName = "webhook-certs"
 )
 
 type portTest struct {
@@ -39,6 +41,13 @@ type webhookNameTest struct {
 	wantPanic bool
 }
 
+type secretNameTest struct {
+	name      string
+	in        string
+	want      string
+	wantPanic bool
+}
+
 func TestPort(t *testing.T) {
 	tests := []portTest{{
 		name: testMissingInputName,
@@ -102,7 +111,7 @@ func TestWebhookName(t *testing.T) {
 		t.Run(tc.name, func(t *testing.T) {
 			// webhookNameEnv is unset when testing missing input.
 			if tc.name != testMissingInputName {
-				t.Setenv(webhookNameEnv, tc.in)
+				t.Setenv(webhookNameEnvKey, tc.in)
 			}
 
 			defer func() {
@@ -119,3 +128,39 @@ func TestWebhookName(t *testing.T) {
 		})
 	}
 }
+
+func TestSecretName(t *testing.T) {
+	tests := []secretNameTest{{
+		name: testMissingInputName,
+		want: testDefaultSecretName,
+	}, {
+		name: "EmptyInput",
+		in:   "",
+		want: testDefaultSecretName,
+	}, {
+		name: "ValidInput",
+		in:   "my-webhook-certs",
+		want: "my-webhook-certs",
+	}}
+
+	for _, tc := range tests {
+		t.Run(tc.name, func(t *testing.T) {
+			// secretNameEnvKey is unset when testing missing input.
+			if tc.name != testMissingInputName {
+				t.Setenv(secretNameEnvKey, 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")
+				}
+			}()
+
+			if got := SecretNameFromEnv(testDefaultSecretName); got != tc.want {
+				t.Errorf("SecretNameFromEnv = %s, want: %s", got, tc.want)
+			}
+		})
+	}
+}