Repository: knative/serving
Pull request #8906 (2020-08-04 14:02:38)

[master] Format markdown
<!--[master] Format markdown-->
<!---->
Produced via:
  `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)`
/assign dprotaso vagababov
/cc dprotaso vagababov


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

This pull-request has been approved by: *<a href="https://github.com/knative/serving/pull/8906#" title="Author self-approved">mattmoor</a>*

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

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

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

- ~~[OWNERS](https://github.com/knative/serving/blob/master/OWNERS)~~ [mattmoor]

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":[]} -->

Patch:
diff --git a/pkg/reconciler/gc/v2/gc.go b/pkg/reconciler/gc/v2/gc.go
index 220ef3bc3..f75e7e870 100644
--- a/pkg/reconciler/gc/v2/gc.go
+++ b/pkg/reconciler/gc/v2/gc.go
@@ -44,21 +44,27 @@ func Collect(
 	cfg := configns.FromContext(ctx).RevisionGC
 	logger := logging.FromContext(ctx)
 
+	min, max := int(cfg.MinNonActiveRevisions), int(cfg.MaxNonActiveRevisions)
+	if max == gc.Disabled && cfg.RetainSinceCreateTime == gc.Disabled && cfg.RetainSinceLastActiveTime == gc.Disabled {
+		return nil // all deletion settings are disabled
+	}
+
 	selector := labels.SelectorFromSet(labels.Set{serving.ConfigurationLabelKey: config.Name})
 	revs, err := revisionLister.Revisions(config.Namespace).List(selector)
 	if err != nil {
 		return err
 	}
-
-	min, max := int(cfg.MinNonActiveRevisions), int(cfg.MaxNonActiveRevisions)
-	if len(revs) <= min ||
-		max == gc.Disabled && cfg.RetainSinceCreateTime == gc.Disabled && cfg.RetainSinceLastActiveTime == gc.Disabled {
-		return nil
+	if len(revs) <= min {
+		return nil // not enough total revs
 	}
 
 	// Filter out active revs
 	revs = nonactiveRevisions(revs, config)
 
+	if len(revs) <= min {
+		return nil // not enough non-active revs
+	}
+
 	// Sort by last active ascending (oldest first)
 	sort.Slice(revs, func(i, j int) bool {
 		a, b := revisionLastActiveTime(revs[i]), revisionLastActiveTime(revs[j])
diff --git a/support/COMMUNITY_CONTACTS.md b/support/COMMUNITY_CONTACTS.md
index c9fa04083..f98d83930 100644
--- a/support/COMMUNITY_CONTACTS.md
+++ b/support/COMMUNITY_CONTACTS.md
@@ -6,22 +6,23 @@ community contact's duty (subject to change) is as followed:
 
 ## Daily check list
 
-* Check the knative-users@ mailing list and #serving-questions Slack channel for
+- Check the knative-users@ mailing list and #serving-questions Slack channel for
   new unanswered questions.
-* Check [unassigned issues / untriaged
-  issues](https://github.com/knative/serving/issues?q=is%3Aopen+is%3Aissue+no%3Aassignee+no%3Amilestone)
+- Check
+  [unassigned issues / untriaged issues](https://github.com/knative/serving/issues?q=is%3Aopen+is%3Aissue+no%3Aassignee+no%3Amilestone)
   for unanswered questions.
-* You should already be added to @serving-help usergroup by the previous contact
+- You should already be added to @serving-help usergroup by the previous contact
   person, and will be tagged into user questions in other channels.
 
 ## Weekly check list
 
 ### Monday
-* Check the [Serving test grid](https://testgrid.knative.dev/serving) for
+
+- Check the [Serving test grid](https://testgrid.knative.dev/serving) for
   flakiness to pick a test and focus on fixing it during your week. Once you
   pick the test flake, assign the corresponding bug filed by flakiness test
   reporter to yourself so that others won't pick the same test to fix.
-* Join the @serving-help user group if you haven't been invited by the previous
+- Join the @serving-help user group if you haven't been invited by the previous
   contact person using this
   [link](https://app.slack.com/client/T93ELUK42/browse-user-groups/user_groups/S0186KPJYG4)
 
@@ -31,15 +32,14 @@ Continue on fixing test flakes and answer
 
 ### Friday
 
-* Remove yourself from @serving-help usergroup and add the next contact using
-  this [link](
-  https://app.slack.com/client/T93ELUK42/browse-user-groups/user_groups/S0186KPJYG4).
+- Remove yourself from @serving-help usergroup and add the next contact using
+  this
+  [link](https://app.slack.com/client/T93ELUK42/browse-user-groups/user_groups/S0186KPJYG4).
   If you don't have permission, ask in the Slack channel
   #steering-toc-questions.
-* Email the next contacts, cc'ing knative-dev@ with a short summaries of the
+- Email the next contacts, cc'ing knative-dev@ with a short summaries of the
   user questions encountered and links to them.
-* File issue or document suggested improvements to this process.
-
+- File issue or document suggested improvements to this process.
 
 ## SLO
 
@@ -67,7 +67,7 @@ rotation, feel free to send a PR to remove yourself.
 # Schedule
 
 | week       | contact        |
-|------------|----------------|
+| ---------- | -------------- |
 | 2020-08-10 | vagababov      |
 | 2020-08-17 | mattmoor       |
 | 2020-08-24 | ZhiminXiang    |
diff --git a/third_party/cert-manager-0.12.0/net-certmanager.yaml b/third_party/cert-manager-0.12.0/net-certmanager.yaml
index 6a8d811fa..7249700c4 100644
--- a/third_party/cert-manager-0.12.0/net-certmanager.yaml
+++ b/third_party/cert-manager-0.12.0/net-certmanager.yaml
@@ -18,7 +18,7 @@ metadata:
   # These are the permissions needed by the `cert-manager` `Certificate` implementation.
   name: knative-serving-certmanager
   labels:
-    serving.knative.dev/release: "v20200727-2db31aa"
+    serving.knative.dev/release: "v20200804-9aa1fe7"
     serving.knative.dev/controller: "true"
     networking.knative.dev/certificate-provider: cert-manager
 rules:
@@ -49,7 +49,7 @@ kind: ValidatingWebhookConfiguration
 metadata:
   name: config.webhook.net-certmanager.networking.internal.knative.dev
   labels:
-    serving.knative.dev/release: "v20200727-2db31aa"
+    serving.knative.dev/release: "v20200804-9aa1fe7"
 webhooks:
 - admissionReviewVersions:
   - v1beta1
@@ -86,7 +86,7 @@ metadata:
   name: net-certmanager-webhook-certs
   namespace: knative-serving
   labels:
-    serving.knative.dev/release: "v20200727-2db31aa"
+    serving.knative.dev/release: "v20200804-9aa1fe7"
 
 ---
 # Copyright 2020 The Knative Authors
@@ -109,7 +109,7 @@ metadata:
   name: config-certmanager
   namespace: knative-serving
   labels:
-    serving.knative.dev/release: "v20200727-2db31aa"
+    serving.knative.dev/release: "v20200804-9aa1fe7"
     networking.knative.dev/certificate-provider: cert-manager
 data:
   _example: |
@@ -156,7 +156,7 @@ metadata:
   name: networking-certmanager
   namespace: knative-serving
   labels:
-    serving.knative.dev/release: "v20200727-2db31aa"
+    serving.knative.dev/release: "v20200804-9aa1fe7"
     networking.knative.dev/certificate-provider: cert-manager
 spec:
   selector:
@@ -168,14 +168,14 @@ spec:
         cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
       labels:
         app: networking-certmanager
-        serving.knative.dev/release: "v20200727-2db31aa"
+        serving.knative.dev/release: "v20200804-9aa1fe7"
     spec:
       serviceAccountName: controller
       containers:
       - name: networking-certmanager
         # This is the Go import path for the binary that is containerized
         # and substituted here.
-        image: gcr.io/knative-nightly/knative.dev/net-certmanager/cmd/controller@sha256:af969f13741e49b5805941685c87bacf558028a30ad1426e54b408cf2e641730
+        image: gcr.io/knative-nightly/knative.dev/net-certmanager/cmd/controller@sha256:45ac4b3137007a040f7b41f88e91fd0b7ac650f3a1c8c0e6e1c498858285863f
         resources:
           requests:
             cpu: 30m
@@ -208,7 +208,7 @@ kind: Service
 metadata:
   labels:
     app: networking-certmanager
-    serving.knative.dev/release: "v20200727-2db31aa"
+    serving.knative.dev/release: "v20200804-9aa1fe7"
     networking.knative.dev/certificate-provider: cert-manager
   name: networking-certmanager
   namespace: knative-serving
@@ -245,7 +245,7 @@ metadata:
   name: net-certmanager-webhook
   namespace: knative-serving
   labels:
-    serving.knative.dev/release: "v20200727-2db31aa"
+    serving.knative.dev/release: "v20200804-9aa1fe7"
 spec:
   selector:
     matchLabels:
@@ -258,14 +258,14 @@ spec:
       labels:
         app: net-certmanager-webhook
         role: net-certmanager-webhook
-        serving.knative.dev/release: "v20200727-2db31aa"
+        serving.knative.dev/release: "v20200804-9aa1fe7"
     spec:
       serviceAccountName: controller
       containers:
       - name: webhook
         # This is the Go import path for the binary that is containerized
         # and substituted here.
-        image: gcr.io/knative-nightly/knative.dev/net-certmanager/cmd/webhook@sha256:4f2999810ce81b12da4c8ec358a7832e59377a5b00009f9b96152c138f5206d7
+        image: gcr.io/knative-nightly/knative.dev/net-certmanager/cmd/webhook@sha256:5161e5d064390c6418d83118721be491044e29024f297912edb96c2bf19b0c39
         resources:
           requests:
             cpu: 20m
@@ -319,7 +319,7 @@ metadata:
   namespace: knative-serving
   labels:
     role: net-certmanager-webhook
-    serving.knative.dev/release: "v20200727-2db31aa"
+    serving.knative.dev/release: "v20200804-9aa1fe7"
 spec:
   ports:
   - # Define metrics and profiling for them to be accessible within service meshes.


Test patch:
diff --git a/cmd/queue/execprobe_test.go b/cmd/queue/execprobe_test.go
index 9f28d8891..27406521c 100644
--- a/cmd/queue/execprobe_test.go
+++ b/cmd/queue/execprobe_test.go
@@ -22,6 +22,7 @@ import (
 	"net/url"
 	"os"
 	"strconv"
+	"sync/atomic"
 	"testing"
 	"time"
 
@@ -46,9 +47,9 @@ func TestProbeQueueConnectionFailure(t *testing.T) {
 }
 
 func TestProbeQueueNotReady(t *testing.T) {
-	queueProbed := 0
+	var probed int64
 	port := newProbeTestServer(t, func(w http.ResponseWriter) {
-		queueProbed++
+		atomic.AddInt64(&probed, 1)
 		w.WriteHeader(http.StatusBadRequest)
 	})
 
@@ -58,15 +59,15 @@ func TestProbeQueueNotReady(t *testing.T) {
 		t.Error("Unexpected not ready error:", err)
 	}
 
-	if queueProbed == 0 {
+	if atomic.LoadInt64(&probed) == 0 {
 		t.Error("Expected the queue proxy server to be probed")
 	}
 }
 
 func TestProbeShuttingDown(t *testing.T) {
-	queueProbed := 0
+	var probed int64
 	port := newProbeTestServer(t, func(w http.ResponseWriter) {
-		queueProbed++
+		atomic.AddInt64(&probed, 1)
 		w.WriteHeader(http.StatusGone)
 	})
 
@@ -76,7 +77,7 @@ func TestProbeShuttingDown(t *testing.T) {
 		t.Error("Unexpected error:", err)
 	}
 
-	if queueProbed == 0 {
+	if atomic.LoadInt64(&probed) == 0 {
 		t.Error("Expected the queue proxy server to be probed")
 	}
 }
@@ -98,9 +99,9 @@ func TestProbeQueueShuttingDownFailsFast(t *testing.T) {
 }
 
 func TestProbeQueueReady(t *testing.T) {
-	queueProbed := 0
+	var probed int64
 	port := newProbeTestServer(t, func(w http.ResponseWriter) {
-		queueProbed++
+		atomic.AddInt64(&probed, 1)
 		w.WriteHeader(http.StatusOK)
 	})
 
@@ -111,15 +112,15 @@ func TestProbeQueueReady(t *testing.T) {
 		t.Error("Unexpected return value from standaloneProbeMain:", rv)
 	}
 
-	if queueProbed == 0 {
+	if atomic.LoadInt64(&probed) == 0 {
 		t.Error("Expected the queue proxy server to be probed")
 	}
 }
 
 func TestProbeQueueTimeout(t *testing.T) {
-	probed := make(chan struct{})
+	var probed int64
 	port := newProbeTestServer(t, func(w http.ResponseWriter) {
-		close(probed)
+		atomic.AddInt64(&probed, 1)
 		time.Sleep(2 * time.Second)
 		w.WriteHeader(http.StatusOK)
 	})
@@ -132,17 +133,15 @@ func TestProbeQueueTimeout(t *testing.T) {
 		t.Error("Unexpected return value from standaloneProbeMain:", rv)
 	}
 
-	select {
-	case <-probed:
-	default:
+	if atomic.LoadInt64(&probed) == 0 {
 		t.Error("Expected the queue proxy server to be probed")
 	}
 }
 
 func TestProbeQueueDelayedReady(t *testing.T) {
-	count := 0
+	var count int64
 	port := newProbeTestServer(t, func(w http.ResponseWriter) {
-		count++
+		count := atomic.AddInt64(&count, 1)
 		if count < 9 {
 			w.WriteHeader(http.StatusBadRequest)
 			return
diff --git a/pkg/reconciler/gc/v2/gc_test.go b/pkg/reconciler/gc/v2/gc_test.go
index c02a5bf69..8ef0fb583 100644
--- a/pkg/reconciler/gc/v2/gc_test.go
+++ b/pkg/reconciler/gc/v2/gc_test.go
@@ -74,6 +74,18 @@ func TestCollectMin(t *testing.T) {
 		revs        []*v1.Revision
 		wantDeletes []clientgotesting.DeleteActionImpl
 	}{{
+		name: "too few revisions",
+		cfg: cfg("none-reserved", "foo", 5556,
+			WithLatestCreated("5556"),
+			WithLatestReady("5556"),
+			WithConfigObservedGen),
+		revs: []*v1.Revision{
+			rev("none-reserved", "foo", 5556, MarkRevisionReady,
+				WithRevName("5556"),
+				WithRoutingState(v1.RoutingStateActive),
+				WithCreationTimestamp(old)),
+		},
+	}, {
 		name: "delete oldest, keep one recent, one active",
 		cfg: cfg("keep-two", "foo", 5556,
 			WithLatestCreated("5556"),
diff --git a/third_party/contour-latest/net-contour.yaml b/third_party/contour-latest/net-contour.yaml
index c161d93ca..47daf8d68 100644
--- a/third_party/contour-latest/net-contour.yaml
+++ b/third_party/contour-latest/net-contour.yaml
@@ -35,7 +35,7 @@ metadata:
   namespace: knative-serving
   labels:
     networking.knative.dev/ingress-provider: contour
-    serving.knative.dev/release: "v20200803-3e3e1970"
+    serving.knative.dev/release: "v20200804-3e3e1970"
 data:
   _example: |
     ################################