[main] Upgrade to latest dependencies (#1763)

* upgrade to latest dependencies

bumping knative.dev/networking c037e29...e9d3a55:
  > e9d3a55 adjust domain validation in kcert (# 755)
  > dd05ffd upgrade to latest dependencies (# 753)
  > 3ad2fdc Update actions (# 752)
  > fe0ac7d Update community files (# 751)
  > 68f0fa7 add new field 'Domain' to kcert spec (# 747)
  > a51817e upgrade to latest dependencies (# 750)
  > bc7a7e5 Update community files (# 749)
  > eee5118 upgrade to latest dependencies (# 748)
  > f1db313 upgrade to latest dependencies (# 746)
  > 383bb2f Update community files (# 745)
  > 891aac2 upgrade to latest dependencies (# 740)
  > 5be75f2 upgrade to latest dependencies (# 739)
bumping knative.dev/serving cd1cd1a...6b7e09a:
  > 6b7e09a upgrade to latest dependencies (# 13616)
  > 2338826 Don't default Revision values when BYO name is unchanged. (# 13565)
  > f2147ef Stream logs from system and test namespace in upgrade tests (# 13587)
  > b989439 Ensure the autoscaler only has a single elector (# 13585)
  > 873eb5c Advance pvc e2e test to beta (# 13535)
  > 5cb43ab Update net-gateway-api nightly (# 13615)
  > 8064f6b Update net-gateway-api nightly (# 13614)
  > 52e79f7 show an error when curling the istio release (# 13612)
  > a5d0384 Update net-contour nightly (# 13613)
  > 2c117e8 Update net-gateway-api nightly (# 13607)
  > 06f59e3 Update net-kourier nightly (# 13608)
  > aa744ae Update net-certmanager nightly (# 13606)
  > cd2ad0c Update actions (# 13604)
  > 162b8fb consistent label selector for Service - include app label (# 13265)
  > 76005a0 upgrade to latest dependencies (# 13594)
  > ff959e4 Update net-kourier nightly (# 13599)
  > fc1cf65 Update net-contour nightly (# 13597)
  > 3db1864 Update net-istio nightly (# 13596)
  > bab961f Update net-certmanager nightly (# 13595)
  > e6db06e Update net-gateway-api nightly (# 13598)
  > 10a8e38 Update community files (# 13593)
  > b421efb Update net-kourier nightly (# 13590)
  > 288e59a Update net-contour nightly (# 13578)
  > 6d70f59 Update net-gateway-api nightly (# 13577)
  > b9d0952 Update net-certmanager nightly (# 13588)
  > 7b5c641 upgrade to latest dependencies (# 13573)
  > 4ad830a add fetch depth so we can fetch the tags (# 13586)
  > fb0c4bd Add setup script for internal-encryption e2e test (# 13559)
  > 11d88db Update community files (# 13584)
  > aaa992e upgrade to latest dependencies (# 13564)
  > 3b8f17c Update net-kourier nightly (# 13561)
  > 35abde0 Update net-istio nightly (# 13556)
  > 88ccb50 Update net-certmanager nightly (# 13557)
  > 3812acf Update net-contour nightly (# 13555)
  > cd50d85 Update net-gateway-api nightly (# 13554)
  > 01676d5 Update net-kourier nightly (# 13547)
  > f1b45e6 Update net-istio nightly (# 13549)
  > f0379ef Update net-certmanager nightly (# 13548)
  > 114bebe Update net-contour nightly (# 13550)
  > 38fa7c0 Update community files (# 13545)
  > 017bb66 Update net-istio nightly (# 13538)
  > a4f6edc Update net-contour nightly (# 13534)
  > 442877d Update net-certmanager nightly (# 13533)
  > b4198e7 Update net-kourier nightly (# 13532)
  > ceb505d Update net-gateway-api nightly (# 13530)
  > 99c3d5a Update net-gateway-api nightly (# 13527)
  > 95a6492 upgrade to latest dependencies (# 13526)
  > 7f217bb Use ubuntu 20.04 for kind e2e tests (# 13528)
  > 327bf91 Update net-istio nightly (# 13524)
  > 1beadbd Update net-gateway-api nightly (# 13523)
  > 0ea12f4 Update net-contour nightly (# 13520)
  > bcef4be Update net-contour nightly (# 13514)
  > b7492cc Update net-certmanager nightly (# 13509)
  > 5b217ef Update net-istio nightly (# 13510)
  > 2ba4499 Don't set seccomp profile in the queue proxy (# 13507)
  > e17e4d1 Update net-contour nightly (# 13502)
  > 05a28e0 Ensure probes from the autoscaler are not passed to the user-container (# 13501)
bumping knative.dev/hack c12c1bf...c7cfcb0:
  > c7cfcb0 Update community files (# 263)
  > af8745e Update community files (# 262)
  > cf3796d Upload attestations and print cosign version (# 261)
  > b9801b4 Update community files (# 260)
  > 7233e77 No more sugar controller in upstream eventing (# 259)

Signed-off-by: Knative Automation <automation@knative.team>

* Fix broker test

Signed-off-by: Knative Automation <automation@knative.team>
Co-authored-by: David Simansky <dsimansk@redhat.com>
This commit is contained in:
knative-automation 2023-01-19 11:42:02 -05:00 committed by GitHub
parent b72e964fe4
commit 982711e2e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 297 additions and 121 deletions

14
go.mod
View File

@ -20,11 +20,11 @@ require (
k8s.io/cli-runtime v0.25.2
k8s.io/client-go v0.25.4
k8s.io/code-generator v0.25.4
knative.dev/eventing v0.35.1-0.20221118131140-41653ce64478
knative.dev/hack v0.0.0-20221122182941-c12c1bfbd6d2
knative.dev/networking v0.0.0-20221123133043-c037e29a5cf4
knative.dev/pkg v0.0.0-20221123154742-05b694ec4d3a
knative.dev/serving v0.35.1-0.20221123150142-cd1cd1a61257
knative.dev/eventing v0.35.1-0.20230118083600-9417125b1468
knative.dev/hack v0.0.0-20230113013652-c7cfcb062de9
knative.dev/networking v0.0.0-20230118220600-e9d3a55facee
knative.dev/pkg v0.0.0-20230117181655-247510c00e9d
knative.dev/serving v0.35.1-0.20230119001800-6b7e09ac25e8
sigs.k8s.io/yaml v1.3.0
)
@ -43,8 +43,8 @@ require (
github.com/blendle/zapdriver v1.3.1 // indirect
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cloudevents/sdk-go/sql/v2 v2.0.0-20220930150014-52b12276cc4a // indirect
github.com/cloudevents/sdk-go/v2 v2.12.0 // indirect
github.com/cloudevents/sdk-go/sql/v2 v2.13.0 // indirect
github.com/cloudevents/sdk-go/v2 v2.13.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.8.0 // indirect

28
go.sum
View File

@ -112,10 +112,10 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudevents/sdk-go/sql/v2 v2.0.0-20220930150014-52b12276cc4a h1:jwFoLdIzNYc92s2ZwhU4yOdoPP8zoALcKOzenIALHJM=
github.com/cloudevents/sdk-go/sql/v2 v2.0.0-20220930150014-52b12276cc4a/go.mod h1:SPV4fdKh1YqSNn2TTUVqUcw1El9Er0HI/yzay5wqsFk=
github.com/cloudevents/sdk-go/v2 v2.12.0 h1:p1k+ysVOZtNiXfijnwB3WqZNA3y2cGOiKQygWkUHCEI=
github.com/cloudevents/sdk-go/v2 v2.12.0/go.mod h1:xDmKfzNjM8gBvjaF8ijFjM1VYOVUEeUfapHMUX1T5To=
github.com/cloudevents/sdk-go/sql/v2 v2.13.0 h1:gMJvQ3XFkygY9JmrusgK80d9yRAb8+J3X8IA1OC+oc0=
github.com/cloudevents/sdk-go/sql/v2 v2.13.0/go.mod h1:XZRQBCgRreddIpQrdjBJQUrRg3BCs3aikplJQkHrK44=
github.com/cloudevents/sdk-go/v2 v2.13.0 h1:2zxDS8RyY1/wVPULGGbdgniGXSzLaRJVl136fLXGsYw=
github.com/cloudevents/sdk-go/v2 v2.13.0/go.mod h1:xDmKfzNjM8gBvjaF8ijFjM1VYOVUEeUfapHMUX1T5To=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
@ -1086,16 +1086,16 @@ 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/eventing v0.35.1-0.20221118131140-41653ce64478 h1:V9dz+2u28klK87h5fUxQT077beNofUEYByQ/QcMelv8=
knative.dev/eventing v0.35.1-0.20221118131140-41653ce64478/go.mod h1:E56YAT2bNLH6h6XBf7DpjRHxKpnl3NGnEMdz66L3YIc=
knative.dev/hack v0.0.0-20221122182941-c12c1bfbd6d2 h1:/1qij7gQhnVLVH6hI8HqMBYUhMGurGcbqnHXwOKbWgs=
knative.dev/hack v0.0.0-20221122182941-c12c1bfbd6d2/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20221123133043-c037e29a5cf4 h1:U5sh7aUCCev1tHcWPHlniBQVYbCBRXya75DfwJvd/3c=
knative.dev/networking v0.0.0-20221123133043-c037e29a5cf4/go.mod h1:DCcDFXdCCa1md7kTbmW7FDqyCRdCThMqBv3CQ+JO7kY=
knative.dev/pkg v0.0.0-20221123154742-05b694ec4d3a h1:mTDxXL+zRBMz7BcdM3WOgw9FVbmkIN/3cvEj4MeS8zI=
knative.dev/pkg v0.0.0-20221123154742-05b694ec4d3a/go.mod h1:fckNBPf9bu5/p1RbnOhEauX7r+kfN1zSQupEVtkaYBs=
knative.dev/serving v0.35.1-0.20221123150142-cd1cd1a61257 h1:aYk6Q035hrIq/Kw8eb9KHezixjWo8Bi/0ayZYorEStk=
knative.dev/serving v0.35.1-0.20221123150142-cd1cd1a61257/go.mod h1:CrLD+Rg65djuCzkf+phhXRdqRde6siZJ6roZUTuiKRY=
knative.dev/eventing v0.35.1-0.20230118083600-9417125b1468 h1:N6Nh3b46f+iAOuu/14P488TMBieF6/tC9NA+83LAxqM=
knative.dev/eventing v0.35.1-0.20230118083600-9417125b1468/go.mod h1:PqYrXKXhZU7rQaS5TQuZDSOd9jPX7AegF8uNNUY4kcU=
knative.dev/hack v0.0.0-20230113013652-c7cfcb062de9 h1:CDa7s9KspEZqPhk7cN68ZypRLuAvSgr+knoOaXSsrHk=
knative.dev/hack v0.0.0-20230113013652-c7cfcb062de9/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20230118220600-e9d3a55facee h1:8KYvxZFaP/LgOE+zVvcG5SpdEK1b03eETvaCauoeCUs=
knative.dev/networking v0.0.0-20230118220600-e9d3a55facee/go.mod h1:rn1yRurhkxmSFkpqs/YdG7b9DiYj0VlmLFzBdOQjpOo=
knative.dev/pkg v0.0.0-20230117181655-247510c00e9d h1:pjKDcvHoMib8nRp56eISRmMj/pFMzJljnzvMvGCIReI=
knative.dev/pkg v0.0.0-20230117181655-247510c00e9d/go.mod h1:VO/fcEsq43seuONRQxZyftWHjpMabYzRHDtpSEQ/eoQ=
knative.dev/serving v0.35.1-0.20230119001800-6b7e09ac25e8 h1:9id7E3O0KkMFvtO4TbjYXXIJT7kr1JNiN/t14iMofLc=
knative.dev/serving v0.35.1-0.20230119001800-6b7e09ac25e8/go.mod h1:JSbgFN3qNLqEZhNtn6uZLIj7Aaut+hhYEcsyrkfEXTE=
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=

View File

@ -114,5 +114,8 @@ func describeBroker(out io.Writer, broker *v1beta1.Broker, printDetails bool) er
}
func extractURL(broker *v1beta1.Broker) string {
return broker.Status.Address.URL.String()
if broker.Status.AddressStatus.Address != nil {
return broker.Status.AddressStatus.Address.URL.String()
}
return ""
}

View File

@ -127,9 +127,11 @@ func getBroker() *eventingv1.Broker {
Namespace: "default",
},
Status: eventingv1.BrokerStatus{
Address: duckv1.Addressable{
AddressStatus: duckv1.AddressStatus{
Address: &duckv1.Addressable{
URL: &apis.URL{Scheme: "http", Host: "foo-broker.test"},
},
},
Status: duckv1.Status{
Conditions: duckv1.Conditions{
apis.Condition{

View File

@ -19,6 +19,8 @@ package broker
import (
"fmt"
"knative.dev/pkg/apis"
"github.com/spf13/cobra"
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
@ -116,7 +118,10 @@ func printBrokerList(kServiceList *eventingv1.BrokerList, options hprinters.Prin
// printBroker populates the broker table rows
func printBroker(broker *eventingv1.Broker, options hprinters.PrintOptions) ([]metav1beta1.TableRow, error) {
name := broker.Name
url := broker.Status.Address.URL
url := &apis.URL{}
if broker.Status.AddressStatus.Address != nil {
url = broker.Status.AddressStatus.Address.URL
}
age := commands.TranslateTimestampSince(broker.CreationTimestamp)
conditions := commands.ConditionsValue(broker.Status.Conditions)
ready := commands.ReadyCondition(broker.Status.Conditions)

View File

@ -277,7 +277,7 @@ func (v *expressionVisitor) VisitStringLiteral(ctx *gen.StringLiteralContext) in
}
func (v *expressionVisitor) VisitIntegerLiteral(ctx *gen.IntegerLiteralContext) interface{} {
val, err := strconv.Atoi(ctx.GetText())
val, err := strconv.ParseInt(ctx.GetText(), 10, 32)
if err != nil {
v.parsingErrors = append(v.parsingErrors, err)
}

View File

@ -34,7 +34,7 @@ func Cast(val interface{}, target cesql.Type) (interface{}, error) {
case cesql.IntegerType:
switch val.(type) {
case string:
v, err := strconv.Atoi(val.(string))
v, err := strconv.ParseInt(val.(string), 10, 32)
if err != nil {
err = fmt.Errorf("cannot cast from String to Integer: %w", err)
}

View File

@ -21,7 +21,7 @@ import (
// Client
type ClientOption client.Option
type ClientOption = client.Option
type Client = client.Client
// Event
@ -42,7 +42,7 @@ type URIRef = types.URIRef
// HTTP Protocol
type HTTPOption http.Option
type HTTPOption = http.Option
type HTTPProtocol = http.Protocol

View File

@ -12,6 +12,7 @@ import (
"net/http"
"strconv"
"strings"
"time"
)
type WebhookConfig struct {
@ -23,6 +24,7 @@ type WebhookConfig struct {
const (
DefaultAllowedRate = 1000
DefaultTimeout = time.Second * 600
)
// TODO: implement rate limiting.

View File

@ -40,6 +40,8 @@ func (p *Protocol) OpenInbound(ctx context.Context) error {
p.server = &http.Server{
Addr: listener.Addr().String(),
Handler: attachMiddleware(p.Handler, p.middleware),
ReadTimeout: DefaultTimeout,
WriteTimeout: DefaultTimeout,
}
// Shutdown

View File

@ -20,6 +20,7 @@ import (
"sync"
"knative.dev/pkg/apis"
v1 "knative.dev/pkg/apis/duck/v1"
)
const (
@ -72,7 +73,12 @@ func (bs *BrokerStatus) GetTopLevelCondition() *apis.Condition {
// SetAddress makes this Broker addressable by setting the URI. It also
// sets the BrokerConditionAddressable to true.
func (bs *BrokerStatus) SetAddress(url *apis.URL) {
bs.Address.URL = url
bs.AddressStatus = v1.AddressStatus{
Address: &v1.Addressable{
URL: url,
},
}
if url != nil {
bs.GetConditionSet().Manage(bs).MarkTrue(BrokerConditionAddressable)
} else {

View File

@ -88,10 +88,10 @@ type BrokerStatus struct {
// * Conditions - the latest available observations of a resource's current state.
duckv1.Status `json:",inline"`
// Broker is Addressable. It exposes the endpoint as an URI to get events
// delivered into the Broker mesh.
// AddressStatus is the part where the Broker fulfills the Addressable contract.
// It exposes the endpoint as an URI to get events delivered into the Broker mesh.
// +optional
Address duckv1.Addressable `json:"address,omitempty"`
duckv1.AddressStatus `json:",inline"`
// DeliveryStatus contains a resolved URL to the dead letter sink address, and any other
// resolved delivery options.

View File

@ -119,7 +119,7 @@ func (in *BrokerSpec) DeepCopy() *BrokerSpec {
func (in *BrokerStatus) DeepCopyInto(out *BrokerStatus) {
*out = *in
in.Status.DeepCopyInto(&out.Status)
in.Address.DeepCopyInto(&out.Address)
in.AddressStatus.DeepCopyInto(&out.AddressStatus)
in.DeliveryStatus.DeepCopyInto(&out.DeliveryStatus)
return
}

View File

@ -17,7 +17,10 @@ limitations under the License.
package v1
import (
"time"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1"
messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1"
@ -93,13 +96,20 @@ func (ss *SequenceStatus) PropagateSubscriptionStatuses(subscriptions []*messagi
Namespace: s.Namespace,
},
}
readyCondition := s.Status.GetCondition(messagingv1.SubscriptionConditionReady)
if readyCondition != nil {
if readyCondition := s.Status.GetCondition(messagingv1.SubscriptionConditionReady); readyCondition != nil {
ss.SubscriptionStatuses[i].ReadyCondition = *readyCondition
if readyCondition.Status != corev1.ConditionTrue {
if !readyCondition.IsTrue() {
allReady = false
}
} else {
ss.SubscriptionStatuses[i].ReadyCondition = apis.Condition{
Type: apis.ConditionReady,
Status: corev1.ConditionUnknown,
Reason: "NoReady",
Message: "Subscription does not have Ready condition",
LastTransitionTime: apis.VolatileTime{Inner: metav1.NewTime(time.Now())},
}
allReady = false
}
@ -142,7 +152,13 @@ func (ss *SequenceStatus) PropagateChannelStatuses(channels []*eventingduckv1.Ch
allReady = false
}
} else {
ss.ChannelStatuses[i].ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionUnknown, Reason: "NoReady", Message: "Channel does not have Ready condition"}
ss.ChannelStatuses[i].ReadyCondition = apis.Condition{
Type: apis.ConditionReady,
Status: corev1.ConditionUnknown,
Reason: "NoReady",
Message: "Channel does not have Ready condition",
LastTransitionTime: apis.VolatileTime{Inner: metav1.NewTime(time.Now())},
}
allReady = false
}
}

View File

@ -586,17 +586,6 @@ function start_knative_eventing_extension() {
wait_until_pods_running "$2" || return 1
}
# Install the stable release of eventing extension sugar controller in the current cluster.
# Parameters: $1 - Knative Eventing release version, e.g. 0.16.0
function start_release_eventing_sugar_controller() {
start_knative_eventing_extension "https://storage.googleapis.com/knative-releases/eventing/previous/v$1/eventing-sugar-controller.yaml" "knative-eventing"
}
# Install the sugar cotroller eventing extension
function start_latest_eventing_sugar_controller() {
start_knative_eventing_extension "${KNATIVE_EVENTING_SUGAR_CONTROLLER_RELEASE}" "knative-eventing"
}
# Run a go utility without installing it.
# Parameters: $1 - tool package for go run.
# $2..$n - parameters passed to the tool.
@ -1018,4 +1007,3 @@ readonly KNATIVE_SERVING_RELEASE_CRDS="$(get_latest_knative_yaml_source "serving
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="$(get_latest_knative_yaml_source "eventing" "eventing")"
readonly KNATIVE_EVENTING_SUGAR_CONTROLLER_RELEASE="$(get_latest_knative_yaml_source "eventing" "eventing-sugar-controller")"

View File

@ -289,6 +289,10 @@ function main() {
echo ">> maven version"
mvn --version
fi
if command -v cosign > /dev/null; then
echo ">> cosign version"
cosign version
fi
echo ">> prow-tests image version"
[[ -f /commit_hash ]] && echo "Prow test image was built from $(cat /commit_hash) commit which is viewable at https://github.com/knative/test-infra/tree/$(cat /commit_hash) " || echo "unknown"
fi

View File

@ -359,6 +359,7 @@ function sign_release() {
if [ -n "${ATTEST_IMAGES:-}" ]; then # Temporary Feature Gate
provenance-generator --clone-log=/logs/clone.json \
--image-refs=imagerefs.txt --output=attestation.json
mkdir -p "${ARTIFACTS}"/attestation && cp attestation.json "${ARTIFACTS}"/attestation
COSIGN_EXPERIMENTAL=1 cosign attest $(cat imagerefs.txt) --recursive --identity-token="${ID_TOKEN}" \
--predicate=attestation.json --type=slsaprovenance
fi

View File

@ -82,6 +82,10 @@ type CertificateSpec struct {
// The wildcard format of DNSNames (e.g. *.default.example.com) is supported.
DNSNames []string `json:"dnsNames"`
// Domain is the top level domain of the values for DNSNames.
// +optional
Domain string `json:"domain,omitempty"`
// SecretName is the name of the secret resource to store the SSL certificate in.
SecretName string `json:"secretName"`
}

View File

@ -18,6 +18,7 @@ package v1alpha1
import (
"context"
"strings"
"knative.dev/pkg/apis"
)
@ -44,5 +45,21 @@ func (spec *CertificateSpec) Validate(ctx context.Context) (all *apis.FieldError
if spec.SecretName == "" {
all = all.Also(apis.ErrMissingField("secretName"))
}
if spec.Domain != "" && len(spec.DNSNames) != 0 {
suffix := "." + spec.Domain
valid := false
for _, dnsName := range spec.DNSNames {
if strings.HasSuffix(dnsName, suffix) || dnsName == spec.Domain {
valid = true
break
}
}
if !valid {
all = all.Also(apis.ErrInvalidValue("domain", "domain must be a suffix of, or match exactly, at least one entry in dnsNames"))
}
}
return all
}

View File

@ -19,7 +19,7 @@ package kmeta
import (
"crypto/md5" //nolint:gosec // No strong cryptography needed.
"fmt"
"strings"
"regexp"
)
// The longest name supported by the K8s is 63.
@ -30,6 +30,8 @@ const (
head = longest - md5Len // How much to truncate to fit the hash.
)
var isAlphanumeric = regexp.MustCompile(`^[a-zA-Z0-9]*$`)
// ChildName generates a name for the resource based upon the parent resource and suffix.
// If the concatenated name is longer than K8s permits the name is hashed and truncated to permit
// construction of the resource, but still keeps it unique.
@ -55,12 +57,19 @@ func ChildName(parent, suffix string) string {
if d := longest - len(ret); d > 0 {
ret += suffix[:d]
}
// If due to trimming above we're terminating the string with a `-`,
// remove it.
return strings.TrimRight(ret, "-")
return makeValidName(ret)
}
//nolint:gosec // No strong cryptography needed.
n = fmt.Sprintf("%s%x", parent[:head-len(suffix)], md5.Sum([]byte(parent)))
}
return n + suffix
}
// If due to trimming above we're terminating the string with a non-alphanumeric
// character, remove it.
func makeValidName(n string) string {
for i := len(n) - 1; !isAlphanumeric.MatchString(string(n[i])); i-- {
n = n[:len(n)-1]
}
return n
}

View File

@ -18,6 +18,7 @@ package logstream
import (
"context"
"fmt"
"os"
"strings"
"sync"
@ -29,9 +30,11 @@ import (
logstreamv2 "knative.dev/pkg/test/logstream/v2"
)
// Canceler is the type of a function returned when a logstream is started to be
// deferred so that the logstream can be stopped when the test is complete.
type Canceler = logstreamv2.Canceler
type (
// Canceler is the type of function returned when a logstream is started to be
// deferred so that the logstream can be stopped when the test is complete.
Canceler = logstreamv2.Canceler
)
type ti interface {
Name() string
@ -47,29 +50,33 @@ func Start(t ti) Canceler {
// Do this lazily to make import ordering less important.
once.Do(func() {
if ns := os.Getenv(system.NamespaceEnvKey); ns != "" {
var err error
// handle case when ns contains a csv list
namespaces := strings.Split(ns, ",")
if sysStream, err = initStream(namespaces); err != nil {
t.Error("Error initializing logstream", "error", err)
}
} else {
// Otherwise, set up a null stream.
sysStream = &null{}
}
})
return sysStream.Start(t)
}
func initStream(namespaces []string) (streamer, error) {
config, err := test.Flags.GetRESTConfig()
if err != nil {
t.Error("Error loading client config", "error", err)
return
return &null{}, fmt.Errorf("error loading client config: %w", err)
}
kc, err := kubernetes.NewForConfig(config)
if err != nil {
t.Error("Error creating kubernetes client", "error", err)
return
return &null{}, fmt.Errorf("error creating kubernetes client: %w", err)
}
// handle case when ns contains a csv list
namespaces := strings.Split(ns, ",")
stream = &shim{logstreamv2.FromNamespaces(context.Background(), kc, namespaces)}
} else {
// Otherwise set up a null stream.
stream = &null{}
}
})
return stream.Start(t)
return &shim{logstreamv2.FromNamespaces(context.Background(), kc, namespaces)}, nil
}
type streamer interface {
@ -77,7 +84,7 @@ type streamer interface {
}
var (
stream streamer
sysStream streamer
once sync.Once
)

View File

@ -20,6 +20,7 @@ import (
"bufio"
"context"
"encoding/json"
"errors"
"fmt"
"reflect"
"strings"
@ -34,25 +35,57 @@ import (
"knative.dev/pkg/ptr"
)
func FromNamespaces(ctx context.Context, c kubernetes.Interface, namespaces []string) Source {
return &namespaceSource{
// New creates a new log source. The source namespaces must be configured through
// log source options.
func New(ctx context.Context, c kubernetes.Interface, opts ...func(*logSource)) Source {
s := &logSource{
ctx: ctx,
kc: c,
namespaces: namespaces,
keys: make(map[string]Callback, 1),
filterLines: true, // Filtering log lines by the watched resource name is enabled by default.
}
for _, opt := range opts {
opt(s)
}
return s
}
// WithNamespaces configures namespaces for log stream.
func WithNamespaces(namespaces ...string) func(*logSource) {
return func(s *logSource) {
s.namespaces = namespaces
}
}
func FromNamespace(ctx context.Context, c kubernetes.Interface, namespace string) Source {
return &namespaceSource{
ctx: ctx,
kc: c,
namespaces: []string{namespace},
keys: make(map[string]Callback, 1),
// WithLineFiltering configures whether log lines will be filtered by
// the resource name.
func WithLineFiltering(enabled bool) func(*logSource) {
return func(s *logSource) {
s.filterLines = enabled
}
}
type namespaceSource struct {
// WithPodPrefixes specifies which Pods will be included in the
// log stream through the provided prefixes. If no prefixes are
// configured then logs from all Pods in the configured namespaces will
// be streamed.
func WithPodPrefixes(podPrefixes ...string) func(*logSource) {
return func(s *logSource) {
s.podPrefixes = podPrefixes
}
}
func FromNamespaces(ctx context.Context, c kubernetes.Interface, namespaces []string, opts ...func(*logSource)) Source {
sOpts := []func(*logSource){WithNamespaces(namespaces...)}
sOpts = append(sOpts, opts...)
return New(ctx, c, sOpts...)
}
func FromNamespace(ctx context.Context, c kubernetes.Interface, namespace string, opts ...func(*logSource)) Source {
return FromNamespaces(ctx, c, []string{namespace}, opts...)
}
type logSource struct {
namespaces []string
kc kubernetes.Interface
ctx context.Context
@ -60,10 +93,12 @@ type namespaceSource struct {
m sync.RWMutex
once sync.Once
keys map[string]Callback
filterLines bool
podPrefixes []string
watchErr error
}
func (s *namespaceSource) StartStream(name string, l Callback) (Canceler, error) {
func (s *logSource) StartStream(name string, l Callback) (Canceler, error) {
s.once.Do(func() { s.watchErr = s.watchPods() })
if s.watchErr != nil {
return nil, fmt.Errorf("failed to watch pods in one of the namespace(s) %q: %w", s.namespaces, s.watchErr)
@ -82,7 +117,10 @@ func (s *namespaceSource) StartStream(name string, l Callback) (Canceler, error)
}, nil
}
func (s *namespaceSource) watchPods() error {
func (s *logSource) watchPods() error {
if len(s.namespaces) == 0 {
return errors.New("namespaces for logstream not configured")
}
for _, ns := range s.namespaces {
wi, err := s.kc.CoreV1().Pods(ns).Watch(s.ctx, metav1.ListOptions{})
if err != nil {
@ -113,7 +151,7 @@ func (s *namespaceSource) watchPods() error {
case watch.Deleted:
watchedPods.Delete(p.Name)
case watch.Added, watch.Modified:
if !watchedPods.Has(p.Name) && isPodReady(p) {
if !watchedPods.Has(p.Name) && isPodReady(p) && s.matchesPodPrefix(p.Name) {
watchedPods.Insert(p.Name)
s.startForPod(p)
}
@ -127,7 +165,20 @@ func (s *namespaceSource) watchPods() error {
return nil
}
func (s *namespaceSource) startForPod(pod *corev1.Pod) {
func (s *logSource) matchesPodPrefix(name string) bool {
if len(s.podPrefixes) == 0 {
// Pod prefixes are not configured => always match.
return true
}
for _, p := range s.podPrefixes {
if strings.Contains(name, p) {
return true
}
}
return false
}
func (s *logSource) startForPod(pod *corev1.Pod) {
// Grab data from all containers in the pods. We need this in case
// an envoy sidecar is injected for mesh installs. This should be
// equivalent to --all-containers.
@ -136,7 +187,7 @@ func (s *namespaceSource) startForPod(pod *corev1.Pod) {
psn, pn, cn := pod.Namespace, pod.Name, container.Name
handleLine := s.handleLine
if wellKnownContainers.Has(cn) {
if wellKnownContainers.Has(cn) || !s.filterLines {
// Specialcase logs from chaosduck, queueproxy etc.
// - ChaosDuck logs enable easy
// monitoring of killed pods throughout all tests.
@ -196,7 +247,7 @@ const (
// are captured without filtering.
var wellKnownContainers = sets.NewString(ChaosDuck, QueueProxy)
func (s *namespaceSource) handleLine(l []byte, pod string, _ string) {
func (s *logSource) handleLine(l []byte, pod string, _ string) {
// This holds the standard structure of our logs.
var line struct {
Level string `json:"severity"`
@ -258,7 +309,7 @@ func (s *namespaceSource) handleLine(l []byte, pod string, _ string) {
// handleGenericLine prints the given logline to all active tests as it cannot be parsed
// and/or doesn't contain any correlation data (like the chaosduck for example).
func (s *namespaceSource) handleGenericLine(l []byte, pod string, cn string) {
func (s *logSource) handleGenericLine(l []byte, pod string, cn string) {
s.m.RLock()
defer s.m.RUnlock()

View File

@ -23,20 +23,49 @@ import (
"knative.dev/serving/pkg/apis/serving"
)
type configSpecKey struct{}
// WithPreviousConfigurationSpec stores the pre-update ConfigurationSpec in the
// context, to allow ConfigurationSpec.SetDefaults to determine whether the
// update would create a new Revision.
func WithPreviousConfigurationSpec(ctx context.Context, spec *ConfigurationSpec) context.Context {
return context.WithValue(ctx, configSpecKey{}, spec)
}
func previousConfigSpec(ctx context.Context) *ConfigurationSpec {
if spec, ok := ctx.Value(configSpecKey{}).(*ConfigurationSpec); ok {
return spec
}
return nil
}
// SetDefaults implements apis.Defaultable
func (c *Configuration) SetDefaults(ctx context.Context) {
ctx = apis.WithinParent(ctx, c.ObjectMeta)
c.Spec.SetDefaults(apis.WithinSpec(ctx))
if c.GetOwnerReferences() == nil {
if apis.IsInUpdate(ctx) {
serving.SetUserInfo(ctx, apis.GetBaseline(ctx).(*Configuration).Spec, c.Spec, c)
} else {
serving.SetUserInfo(ctx, nil, c.Spec, c)
var prevSpec *ConfigurationSpec
if prev, ok := apis.GetBaseline(ctx).(*Configuration); ok && prev != nil {
prevSpec = &prev.Spec
ctx = WithPreviousConfigurationSpec(ctx, prevSpec)
}
c.Spec.SetDefaults(apis.WithinSpec(ctx))
if c.GetOwnerReferences() == nil {
serving.SetUserInfo(ctx, prevSpec, &c.Spec, c)
}
}
// SetDefaults implements apis.Defaultable
func (cs *ConfigurationSpec) SetDefaults(ctx context.Context) {
if prev := previousConfigSpec(ctx); prev != nil {
newName := cs.Template.ObjectMeta.Name
oldName := prev.Template.ObjectMeta.Name
if newName != "" && newName == oldName {
// Skip defaulting, to avoid suggesting changes that would conflict with
// "BYO RevisionName".
return
}
}
cs.Template.SetDefaults(ctx)
}

View File

@ -26,13 +26,16 @@ import (
// SetDefaults implements apis.Defaultable
func (s *Service) SetDefaults(ctx context.Context) {
ctx = apis.WithinParent(ctx, s.ObjectMeta)
s.Spec.SetDefaults(apis.WithinSpec(ctx))
if apis.IsInUpdate(ctx) {
serving.SetUserInfo(ctx, apis.GetBaseline(ctx).(*Service).Spec, s.Spec, s)
} else {
serving.SetUserInfo(ctx, nil, s.Spec, s)
var prevSpec *ServiceSpec
if prev, ok := apis.GetBaseline(ctx).(*Service); ok && prev != nil {
prevSpec = &prev.Spec
ctx = WithPreviousConfigurationSpec(ctx, &prev.Spec.ConfigurationSpec)
}
s.Spec.SetDefaults(apis.WithinSpec(ctx))
serving.SetUserInfo(ctx, prevSpec, &s.Spec, s)
}
// SetDefaults implements apis.Defaultable

View File

@ -161,6 +161,13 @@ func WithServiceImage(img string) ServiceOption {
}
}
// WithServiceName sets the service name.
func WithServiceName(name string) ServiceOption {
return func(svc *v1.Service) {
svc.ObjectMeta.Name = name
}
}
// WithTrafficTarget sets the traffic to be the provided traffic target.
func WithTrafficTarget(tt []v1.TrafficTarget) ServiceOption {
return func(svc *v1.Service) {

View File

@ -66,7 +66,7 @@ function latest_net_istio_version() {
local major_minor
major_minor=$(echo "$serving_version" | cut -d '.' -f 1,2)
curl -L --silent "https://api.github.com/repos/knative/net-istio/releases" | jq --arg major_minor "$major_minor" -r '[.[].tag_name] | map(select(. | startswith($major_minor))) | sort_by( sub("knative-";"") | sub("v";"") | split(".") | map(tonumber) ) | reverse[0]'
curl -L --show-error --silent "https://api.github.com/repos/knative/net-istio/releases" | jq --arg major_minor "$major_minor" -r '[.[].tag_name] | map(select(. | startswith($major_minor))) | sort_by( sub("knative-";"") | sub("v";"") | split(".") | map(tonumber) ) | reverse[0]'
}
# Latest serving release. If user does not supply this as a flag, the latest

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Copyright 2022 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
echo "TODO(KauzClay): Implement Me!"
exit 0

View File

@ -52,6 +52,7 @@ header "Running upgrade tests"
go_test_e2e -tags=upgrade -timeout=${TIMEOUT} \
./test/upgrade \
--disable-logstream \
--resolvabledomain=$(use_resolvable_domain) || fail_test
# Remove the kail log file if the test flow passes.

14
vendor/modules.txt vendored
View File

@ -46,7 +46,7 @@ github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1
# github.com/cespare/xxhash/v2 v2.1.2
## explicit; go 1.11
github.com/cespare/xxhash/v2
# github.com/cloudevents/sdk-go/sql/v2 v2.0.0-20220930150014-52b12276cc4a
# github.com/cloudevents/sdk-go/sql/v2 v2.13.0
## explicit; go 1.17
github.com/cloudevents/sdk-go/sql/v2
github.com/cloudevents/sdk-go/sql/v2/expression
@ -55,7 +55,7 @@ github.com/cloudevents/sdk-go/sql/v2/gen
github.com/cloudevents/sdk-go/sql/v2/parser
github.com/cloudevents/sdk-go/sql/v2/runtime
github.com/cloudevents/sdk-go/sql/v2/utils
# github.com/cloudevents/sdk-go/v2 v2.12.0
# github.com/cloudevents/sdk-go/v2 v2.13.0
## explicit; go 1.17
github.com/cloudevents/sdk-go/v2
github.com/cloudevents/sdk-go/v2/binding
@ -917,7 +917,7 @@ k8s.io/utils/net
k8s.io/utils/pointer
k8s.io/utils/strings/slices
k8s.io/utils/trace
# knative.dev/eventing v0.35.1-0.20221118131140-41653ce64478
# knative.dev/eventing v0.35.1-0.20230118083600-9417125b1468
## explicit; go 1.18
knative.dev/eventing/pkg/apis/config
knative.dev/eventing/pkg/apis/duck
@ -945,10 +945,10 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1
knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1/fake
knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2
knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2/fake
# knative.dev/hack v0.0.0-20221122182941-c12c1bfbd6d2
# knative.dev/hack v0.0.0-20230113013652-c7cfcb062de9
## explicit; go 1.18
knative.dev/hack
# knative.dev/networking v0.0.0-20221123133043-c037e29a5cf4
# knative.dev/networking v0.0.0-20230118220600-e9d3a55facee
## explicit; go 1.18
knative.dev/networking/pkg
knative.dev/networking/pkg/apis/networking
@ -963,7 +963,7 @@ knative.dev/networking/pkg/http/probe
knative.dev/networking/pkg/http/proxy
knative.dev/networking/pkg/http/stats
knative.dev/networking/pkg/k8s
# knative.dev/pkg v0.0.0-20221123154742-05b694ec4d3a
# knative.dev/pkg v0.0.0-20230117181655-247510c00e9d
## explicit; go 1.18
knative.dev/pkg/apis
knative.dev/pkg/apis/duck
@ -1013,7 +1013,7 @@ knative.dev/pkg/tracing/config
knative.dev/pkg/tracing/propagation
knative.dev/pkg/tracing/propagation/tracecontextb3
knative.dev/pkg/tracker
# knative.dev/serving v0.35.1-0.20221123150142-cd1cd1a61257
# knative.dev/serving v0.35.1-0.20230119001800-6b7e09ac25e8
## explicit; go 1.18
knative.dev/serving/pkg/apis/autoscaling
knative.dev/serving/pkg/apis/autoscaling/v1alpha1