Skip to content

Commit

Permalink
🔥 Apply carried patches.
Browse files Browse the repository at this point in the history
  • Loading branch information
serverless-qe committed Jul 13, 2022
1 parent 5de713d commit acc3998
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 35 deletions.
2 changes: 1 addition & 1 deletion config/core/deployments/activator-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
# Activator PDB. Currently we permit unavailability of 20% of tasks at the same time.
# Given the subsetting and that the activators are partially stateful systems, we want
# a slow rollout of the new versions and slow migration during node upgrades.
apiVersion: policy/v1
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: activator-pdb
Expand Down
2 changes: 1 addition & 1 deletion config/core/deployments/webhook-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
averageUtilization: 100
---
# Webhook PDB.
apiVersion: policy/v1
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: webhook-pdb
Expand Down
4 changes: 2 additions & 2 deletions openshift/release/knative-serving-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5668,7 +5668,7 @@ spec:
# Activator PDB. Currently we permit unavailability of 20% of tasks at the same time.
# Given the subsetting and that the activators are partially stateful systems, we want
# a slow rollout of the new versions and slow migration during node upgrades.
apiVersion: policy/v1
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: activator-pdb
Expand Down Expand Up @@ -6385,7 +6385,7 @@ spec:
averageUtilization: 100
---
# Webhook PDB.
apiVersion: policy/v1
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: webhook-pdb
Expand Down
4 changes: 2 additions & 2 deletions openshift/release/knative-serving-knative-v1.6.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5668,7 +5668,7 @@ spec:
# Activator PDB. Currently we permit unavailability of 20% of tasks at the same time.
# Given the subsetting and that the activators are partially stateful systems, we want
# a slow rollout of the new versions and slow migration during node upgrades.
apiVersion: policy/v1
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: activator-pdb
Expand Down Expand Up @@ -6385,7 +6385,7 @@ spec:
averageUtilization: 100
---
# Webhook PDB.
apiVersion: policy/v1
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: webhook-pdb
Expand Down
24 changes: 3 additions & 21 deletions test/e2e/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (

"golang.org/x/sync/errgroup"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -68,9 +67,6 @@ func hasPort(u string) bool {

func dial(ctx *TestContext, host, domain string) (*grpc.ClientConn, error) {
defaultPort := "80"
if test.ServingFlags.HTTPS {
defaultPort = "443"
}
if !hasPort(host) {
host = net.JoinHostPort(host, defaultPort)
}
Expand All @@ -83,12 +79,6 @@ func dial(ctx *TestContext, host, domain string) (*grpc.ClientConn, error) {
}

creds := insecure.NewCredentials()
if test.ServingFlags.HTTPS {
tlsConfig := test.TLSClientConfig(context.Background(), ctx.t.Logf, ctx.clients)
// Set ServerName for pseudo hostname with TLS.
tlsConfig.ServerName = domain
creds = credentials.NewTLS(tlsConfig)
}

return grpc.Dial(
host,
Expand Down Expand Up @@ -324,11 +314,6 @@ func streamTest(tc *TestContext, host, domain string) {

func testGRPC(t *testing.T, f grpcTest, fopts ...rtesting.ServiceOption) {
t.Helper()
// TODO: https option with parallel leads to flakes.
// https://github.com/knative/serving/issues/11387
if !test.ServingFlags.HTTPS {
t.Parallel()
}

// Setup
clients := Setup(t)
Expand Down Expand Up @@ -369,16 +354,13 @@ func testGRPC(t *testing.T, f grpcTest, fopts ...rtesting.ServiceOption) {
}

host := url.Host
if !test.ServingFlags.ResolvableDomain {
if true {
addr, mapper, err := ingress.GetIngressEndpoint(context.Background(), clients.KubeClient, pkgTest.Flags.IngressEndpoint)
if err != nil {
t.Fatal("Could not get service endpoint:", err)
}
if test.ServingFlags.HTTPS {
host = net.JoinHostPort(addr, mapper("443"))
} else {
host = net.JoinHostPort(addr, mapper("80"))
}

host = net.JoinHostPort(addr, mapper("80"))
}

f(&TestContext{
Expand Down
4 changes: 2 additions & 2 deletions vendor/knative.dev/pkg/controller/stats_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (r *reporter) ReportReconcile(duration time.Duration, success string, key t
return err
}

metrics.RecordBatch(ctx, reconcileCountStat.M(1),
reconcileLatencyStat.M(duration.Milliseconds()))
// TODO skonto: fix latency histograms
metrics.Record(ctx, reconcileCountStat.M(1))
return nil
}
2 changes: 1 addition & 1 deletion vendor/knative.dev/pkg/test/helpers/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
const (
letterBytes = "abcdefghijklmnopqrstuvwxyz"
randSuffixLen = 8
nameLengthLimit = 50
nameLengthLimit = 40
sep = '-'
sepS = "-"
testNamePrefix = "Test"
Expand Down
40 changes: 40 additions & 0 deletions vendor/knative.dev/pkg/test/spoof/openshift_checks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package spoof

import (
"fmt"
"net/http"
"strings"
)

// isUnknownAuthority checks if the error contains "certificate signed by unknown authority".
// This error happens when OpenShift Route starts/changes to use passthrough mode. It takes a little bit time to be synced.
func isUnknownAuthority(err error) bool {
return err != nil && strings.Contains(err.Error(), "certificate signed by unknown authority")
}

// RetryingRouteInconsistency retries common requests seen when creating a new route
// - 503 to account for Openshift route inconsistency (https://jira.coreos.com/browse/SRVKS-157)
func RouteInconsistencyRetryChecker(resp *Response) (bool, error) {
if resp.StatusCode == http.StatusServiceUnavailable {
return true, fmt.Errorf("retrying route inconsistency request: %s", resp)
}
return false, nil
}

// RouteInconsistencyMultiRetryChecker retries common requests seen when creating a new route
// - 503 to account for Openshift route inconsistency (https://jira.coreos.com/browse/SRVKS-157)
func RouteInconsistencyMultiRetryChecker() ResponseChecker {
const neededSuccesses = 32
var successes int
return func(resp *Response) (bool, error) {
if resp.StatusCode == http.StatusServiceUnavailable {
successes = 0
return true, fmt.Errorf("retrying route inconsistency request: %s", resp)
}
successes++
if successes < neededSuccesses {
return true, fmt.Errorf("successful requests: %d, required: %d", successes, neededSuccesses)
}
return false, nil
}
}
8 changes: 7 additions & 1 deletion vendor/knative.dev/pkg/test/spoof/spoof.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (sc *SpoofingClient) Do(req *http.Request, errorRetryCheckers ...interface{
// If no retry checkers are specified `DefaultErrorRetryChecker` will be used.
func (sc *SpoofingClient) Poll(req *http.Request, inState ResponseChecker, checkers ...interface{}) (*Response, error) {
if len(checkers) == 0 {
checkers = []interface{}{ErrorRetryChecker(DefaultErrorRetryChecker), ResponseRetryChecker(DefaultResponseRetryChecker)}
checkers = []interface{}{ErrorRetryChecker(DefaultErrorRetryChecker), ResponseRetryChecker(DefaultResponseRetryChecker), ResponseRetryChecker(RouteInconsistencyRetryChecker)}
}

var resp *Response
Expand Down Expand Up @@ -252,6 +252,9 @@ func DefaultErrorRetryChecker(err error) (bool, error) {
if isNoRouteToHostError(err) {
return true, fmt.Errorf("retrying for 'no route to host' error: %w", err)
}
if isUnknownAuthority(err) {
return true, fmt.Errorf("retrying for certificate signed by unknown authority: %w", err)
}
return false, err
}

Expand Down Expand Up @@ -328,6 +331,9 @@ func (sc *SpoofingClient) endpointState(
}

func (sc *SpoofingClient) Check(req *http.Request, inState ResponseChecker, checkers ...interface{}) (*Response, error) {
if len(checkers) == 0 {
checkers = []interface{}{ErrorRetryChecker(DefaultErrorRetryChecker), ResponseRetryChecker(DefaultResponseRetryChecker), ResponseRetryChecker(RouteInconsistencyMultiRetryChecker())}
}
resp, err := sc.Do(req, checkers...)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
// NOTE: If you are changing this line, please also update the minimum kubernetes
// version listed here:
// https://github.com/knative/docs/blob/mkdocs/docs/snippets/prerequisites.md
defaultMinimumVersion = "v1.22.0"
defaultMinimumVersion = "v1.19.0"
)

func getMinimumVersion() string {
Expand Down
5 changes: 2 additions & 3 deletions vendor/knative.dev/pkg/webhook/stats_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ func (r *reporter) ReportRequest(req *admissionv1.AdmissionRequest, resp *admiss
return err
}

metrics.RecordBatch(ctx, requestCountM.M(1),
// Convert time.Duration in nanoseconds to milliseconds
responseTimeInMsecM.M(float64(d.Milliseconds())))
// TODO skonto: fix latency histograms
metrics.Record(ctx, requestCountM.M(1))
return nil
}

Expand Down

0 comments on commit acc3998

Please sign in to comment.