diff --git a/go.mod b/go.mod index 9a0593adf..5cbe5cc3b 100644 --- a/go.mod +++ b/go.mod @@ -3,16 +3,16 @@ module knative.dev/kn-plugin-source-kafka go 1.15 require ( - github.com/maximilien/kn-source-pkg v0.6.2-0.20210219230238-c655d7ca141e + github.com/maximilien/kn-source-pkg v0.6.3 github.com/spf13/cobra v1.1.3 github.com/spf13/pflag v1.0.5 gotest.tools/v3 v3.0.3 k8s.io/apimachinery v0.19.7 k8s.io/client-go v0.19.7 - knative.dev/client v0.20.1-0.20210219184703-18ff59604195 - knative.dev/eventing-kafka v0.19.1-0.20210219230103-ae8020f1c58b + knative.dev/client v0.21.0 + knative.dev/eventing-kafka v0.21.0 knative.dev/hack v0.0.0-20210203173706-8368e1f6eacf - knative.dev/pkg v0.0.0-20210219164703-8a9bf766d36d + knative.dev/pkg v0.0.0-20210216013737-584933f8280b ) replace github.com/go-openapi/spec => github.com/go-openapi/spec v0.19.3 diff --git a/go.sum b/go.sum index 2693ab40c..beaefc11a 100644 --- a/go.sum +++ b/go.sum @@ -585,8 +585,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182aff github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0/go.mod h1:fcEyUyXZXoV4Abw8DX0t7wyL8mCDxXyU4iAFZfT3IHw= -github.com/maximilien/kn-source-pkg v0.6.2-0.20210219230238-c655d7ca141e h1:I6C6PGN+ozRgK9+A57cYK8eyWYEBkjRw3KLqOoO0hUE= -github.com/maximilien/kn-source-pkg v0.6.2-0.20210219230238-c655d7ca141e/go.mod h1:IgDTyFJ2oxU0VRzpNe/oszbJGsGf0H81awjkdcShsQ0= +github.com/maximilien/kn-source-pkg v0.6.3 h1:5S9jgof8KSvde/hrM0VaOMZ6LmBPTIMO05fdDpbVbvI= +github.com/maximilien/kn-source-pkg v0.6.3/go.mod h1:3Nym+ahhV18lkHutauJdw1r3PmlDfu/DoTUuF8ySMt4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.17/go.mod h1:WgzbA6oji13JREwiNsRDNfl7jYdPnmz+VEuLrA+/48M= github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= @@ -1429,12 +1429,12 @@ k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 h1:0T5IaWHO3sJTEmCP6mUlBvMukxPKUQWqiI/YuiBNMiQ= k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= knative.dev/caching v0.0.0-20210215030244-1212288570f0/go.mod h1:rAPalJe9Lx3jHffJpackk5WjZYl3j2QvXUgw0GPllxQ= -knative.dev/client v0.20.1-0.20210219184703-18ff59604195 h1:jwR5Z5wljpa0LbQt9t/P68X+7yyTlXUm85lXFDa8AMc= -knative.dev/client v0.20.1-0.20210219184703-18ff59604195/go.mod h1:is1fmAT7Osn/Yfw65B3AqI8gCBpxXadDudgAOfMzvKE= -knative.dev/eventing v0.20.1-0.20210219125302-4e5bdf97930a h1:3cqlUxlZ6M+EZA80OTroRXz7XNNImc4Qix01jqOA1Bo= -knative.dev/eventing v0.20.1-0.20210219125302-4e5bdf97930a/go.mod h1:JjbVEOTJJHqo9CTxbTfrMn018hG8fOr3UfBoCJ7KWaA= -knative.dev/eventing-kafka v0.19.1-0.20210219230103-ae8020f1c58b h1:6pdsLZrbHg3wd8Ou2eXtvjPkHdf21rOs3Iyhw5Zvk74= -knative.dev/eventing-kafka v0.19.1-0.20210219230103-ae8020f1c58b/go.mod h1:mRGIPGpaOvtpFgTlc+XR5O6aH8Yo8jkfjQ5o8WsGegw= +knative.dev/client v0.21.0 h1:VWgxFKClPe26PsSigiPoTx6zYBcMmLWv3I7cQsIfGw8= +knative.dev/client v0.21.0/go.mod h1:1En9uxMhk62EReWR1d66/d3tnpkot/D3vBRfmuidFNc= +knative.dev/eventing v0.21.0 h1:oZoL0lXXslUClNvoi5mLO2YI6zn2C8qg80mz8Y6Vmkg= +knative.dev/eventing v0.21.0/go.mod h1:JjbVEOTJJHqo9CTxbTfrMn018hG8fOr3UfBoCJ7KWaA= +knative.dev/eventing-kafka v0.21.0 h1:DJ9HGLjQBA0zJC4FTjAGH+FWEroNfj+Jti/EQ7pahxQ= +knative.dev/eventing-kafka v0.21.0/go.mod h1:4dmXMBHTToZJSYKnFv3guSPMYdMHPs5xRcXS7BiJvyQ= knative.dev/hack v0.0.0-20210203173706-8368e1f6eacf h1:u4cY4jr2LYvhoz/1HBWEPsMiLkm0HMdDTfmmw1RE8zE= knative.dev/hack v0.0.0-20210203173706-8368e1f6eacf/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= knative.dev/networking v0.0.0-20210215030235-088986a1c2a3/go.mod h1:pmAMQjMqQUxpK0UyjE71KljMs6rwDMVIAlvrZsU3I6Y= @@ -1444,11 +1444,9 @@ knative.dev/pkg v0.0.0-20210212203835-448ae657fb5f/go.mod h1:TJSdebQOWX5N2bszohO knative.dev/pkg v0.0.0-20210215165523-84c98f3c3e7a/go.mod h1:TJSdebQOWX5N2bszohOYVi0H1QtXbtlYLuMghAFBMhY= knative.dev/pkg v0.0.0-20210216013737-584933f8280b h1:2v+GBBenjPXhtk3KX/YqxCQVBU6o/AaRkkqE58lgFRQ= knative.dev/pkg v0.0.0-20210216013737-584933f8280b/go.mod h1:TJSdebQOWX5N2bszohOYVi0H1QtXbtlYLuMghAFBMhY= -knative.dev/pkg v0.0.0-20210219164703-8a9bf766d36d h1:qiLJrG5YYX0foHLzedhXjx5IPPSzZN9PffN8iEeWBKg= -knative.dev/pkg v0.0.0-20210219164703-8a9bf766d36d/go.mod h1:TJSdebQOWX5N2bszohOYVi0H1QtXbtlYLuMghAFBMhY= knative.dev/reconciler-test v0.0.0-20210216030508-77f50054d024/go.mod h1:RP/K5xJylB72Go6eAsXYEsQHp4zCCNMNjmsqhvq7wko= -knative.dev/serving v0.20.1-0.20210219075403-2516dae3d46e h1:nPwnrjTsPdf4eVlhHDPckURcKIZwe4lXoiIeMHcQ6TU= -knative.dev/serving v0.20.1-0.20210219075403-2516dae3d46e/go.mod h1:PU9k1Y6YMG27XQldEu5agNkcebvSafUXKXPircQYCsE= +knative.dev/serving v0.21.0 h1:bdg0JqNovzlMQB2IxXU/iJKF2zPZH6/yXiwiUtr7vtY= +knative.dev/serving v0.21.0/go.mod h1:PU9k1Y6YMG27XQldEu5agNkcebvSafUXKXPircQYCsE= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index 131eb5132..81edb6d47 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -23,8 +23,8 @@ export PATH=$PATH:${REPO_ROOT_DIR} # Will create and delete this namespace (used for all tests, modify if you want a different one used) export KN_E2E_NAMESPACE=kne2etests -export KNATIVE_EVENTING_VERSION="0.20.0" -export KNATIVE_SERVING_VERSION="0.20.0" +export KNATIVE_EVENTING_VERSION="0.21.0" +export KNATIVE_SERVING_VERSION="0.21.0" # Strimzi installation config template used for starting up Kafka clusters. readonly STRIMZI_INSTALLATION_CONFIG_TEMPLATE="${REPO_ROOT_DIR}/test/config/100-strimzi-cluster-operator-0.20.0.yaml" @@ -42,7 +42,7 @@ readonly KAFKA_CRD_CONFIG_TEMPLATE="400-kafka-config.yaml" # Real Kafka channel CRD config , generated from the template directory and modified template file. readonly KAFKA_CRD_CONFIG_DIR="$(mktemp -d)" # Kafka channel CRD config template directory. -readonly KAFKA_SOURCE_CRD_YAML="https://github.com/knative-sandbox/eventing-kafka/releases/download/v0.20.0/source.yaml" +readonly KAFKA_SOURCE_CRD_YAML="https://github.com/knative-sandbox/eventing-kafka/releases/download/v0.21.0/source.yaml" run() { # Create cluster diff --git a/vendor/knative.dev/client/pkg/kn/commands/types.go b/vendor/knative.dev/client/pkg/kn/commands/types.go index 7578a2584..524c521ef 100644 --- a/vendor/knative.dev/client/pkg/kn/commands/types.go +++ b/vendor/knative.dev/client/pkg/kn/commands/types.go @@ -42,6 +42,8 @@ import ( type KnParams struct { Output io.Writer KubeCfgPath string + KubeContext string + KubeCluster string ClientConfig clientcmd.ClientConfig NewServingClient func(namespace string) (clientservingv1.KnServingClient, error) NewGitopsServingClient func(namespace string, dir string) (clientservingv1.KnServingClient, error) @@ -167,14 +169,21 @@ func (params *KnParams) RestConfig() (*rest.Config, error) { // GetClientConfig gets ClientConfig from KubeCfgPath func (params *KnParams) GetClientConfig() (clientcmd.ClientConfig, error) { loadingRules := clientcmd.NewDefaultClientConfigLoadingRules() + configOverrides := &clientcmd.ConfigOverrides{} + if params.KubeContext != "" { + configOverrides.CurrentContext = params.KubeContext + } + if params.KubeCluster != "" { + configOverrides.Context.Cluster = params.KubeCluster + } if len(params.KubeCfgPath) == 0 { - return clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, &clientcmd.ConfigOverrides{}), nil + return clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides), nil } _, err := os.Stat(params.KubeCfgPath) if err == nil { loadingRules.ExplicitPath = params.KubeCfgPath - return clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, &clientcmd.ConfigOverrides{}), nil + return clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides), nil } if !os.IsNotExist(err) { @@ -183,8 +192,8 @@ func (params *KnParams) GetClientConfig() (clientcmd.ClientConfig, error) { paths := filepath.SplitList(params.KubeCfgPath) if len(paths) > 1 { - return nil, fmt.Errorf("Can not find config file. '%s' looks like a path. "+ + return nil, fmt.Errorf("can not find config file. '%s' looks like a path. "+ "Please use the env var KUBECONFIG if you want to check for multiple configuration files", params.KubeCfgPath) } - return nil, fmt.Errorf("Config file '%s' can not be found", params.KubeCfgPath) + return nil, fmt.Errorf("config file '%s' can not be found", params.KubeCfgPath) } diff --git a/vendor/knative.dev/client/pkg/serving/v1/client.go b/vendor/knative.dev/client/pkg/serving/v1/client.go index c5aa30d27..68c5d53c9 100644 --- a/vendor/knative.dev/client/pkg/serving/v1/client.go +++ b/vendor/knative.dev/client/pkg/serving/v1/client.go @@ -62,12 +62,12 @@ type KnServingClient interface { // UpdateService updates the given service. For a more robust variant with automatic // conflict resolution see UpdateServiceWithRetry - UpdateService(service *servingv1.Service) error + UpdateService(service *servingv1.Service) (bool, error) // UpdateServiceWithRetry updates service and retries if there is a version conflict. // The updateFunc receives a deep copy of the existing service and can add update it in - // place. - UpdateServiceWithRetry(name string, updateFunc ServiceUpdateFunc, nrRetries int) error + // place. Return if the service creates a new generation or not + UpdateServiceWithRetry(name string, updateFunc ServiceUpdateFunc, nrRetries int) (bool, error) // Apply a service's definition to the cluster. The full service declaration needs to be provided, // which is different to UpdateService which can also do a partial update. If the given @@ -241,36 +241,37 @@ func (cl *knServingClient) CreateService(service *servingv1.Service) error { } // Update the given service -func (cl *knServingClient) UpdateService(service *servingv1.Service) error { - _, err := cl.client.Services(cl.namespace).Update(context.TODO(), service, v1.UpdateOptions{}) +func (cl *knServingClient) UpdateService(service *servingv1.Service) (bool, error) { + updated, err := cl.client.Services(cl.namespace).Update(context.TODO(), service, v1.UpdateOptions{}) if err != nil { - return err + return false, err } - return updateServingGvk(service) + changed := service.ObjectMeta.Generation != updated.ObjectMeta.Generation + return changed, updateServingGvk(service) } // Update the given service with a retry in case of a conflict -func (cl *knServingClient) UpdateServiceWithRetry(name string, updateFunc ServiceUpdateFunc, nrRetries int) error { +func (cl *knServingClient) UpdateServiceWithRetry(name string, updateFunc ServiceUpdateFunc, nrRetries int) (bool, error) { return updateServiceWithRetry(cl, name, updateFunc, nrRetries) } // Extracted to be usable with the Mocking client -func updateServiceWithRetry(cl KnServingClient, name string, updateFunc ServiceUpdateFunc, nrRetries int) error { +func updateServiceWithRetry(cl KnServingClient, name string, updateFunc ServiceUpdateFunc, nrRetries int) (bool, error) { var retries = 0 for { service, err := cl.GetService(name) if err != nil { - return err + return false, err } if service.GetDeletionTimestamp() != nil { - return fmt.Errorf("can't update service %s because it has been marked for deletion", name) + return false, fmt.Errorf("can't update service %s because it has been marked for deletion", name) } updatedService, err := updateFunc(service.DeepCopy()) if err != nil { - return err + return false, err } - err = cl.UpdateService(updatedService) + changed, err := cl.UpdateService(updatedService) if err != nil { // Retry to update when a resource version conflict exists if apierrors.IsConflict(err) && retries < nrRetries { @@ -279,9 +280,9 @@ func updateServiceWithRetry(cl KnServingClient, name string, updateFunc ServiceU time.Sleep(time.Second) continue } - return fmt.Errorf("giving up after %d retries: %w", nrRetries, err) + return false, fmt.Errorf("giving up after %d retries: %w", nrRetries, err) } - return nil + return changed, nil } } diff --git a/vendor/knative.dev/client/pkg/serving/v1/client_mock.go b/vendor/knative.dev/client/pkg/serving/v1/client_mock.go index 4d1f89512..c2256743e 100644 --- a/vendor/knative.dev/client/pkg/serving/v1/client_mock.go +++ b/vendor/knative.dev/client/pkg/serving/v1/client_mock.go @@ -90,17 +90,17 @@ func (c *MockKnServingClient) CreateService(service *servingv1.Service) error { } // Update the given service -func (sr *ServingRecorder) UpdateService(service interface{}, err error) { - sr.r.Add("UpdateService", []interface{}{service}, []interface{}{err}) +func (sr *ServingRecorder) UpdateService(service interface{}, hasChanged bool, err error) { + sr.r.Add("UpdateService", []interface{}{service}, []interface{}{hasChanged, err}) } -func (c *MockKnServingClient) UpdateService(service *servingv1.Service) error { +func (c *MockKnServingClient) UpdateService(service *servingv1.Service) (bool, error) { call := c.recorder.r.VerifyCall("UpdateService", service) - return mock.ErrorOrNil(call.Result[0]) + return call.Result[0].(bool), mock.ErrorOrNil(call.Result[1]) } // Delegate to shared retry method -func (c *MockKnServingClient) UpdateServiceWithRetry(name string, updateFunc ServiceUpdateFunc, maxRetry int) error { +func (c *MockKnServingClient) UpdateServiceWithRetry(name string, updateFunc ServiceUpdateFunc, maxRetry int) (bool, error) { return updateServiceWithRetry(c, name, updateFunc, maxRetry) } diff --git a/vendor/knative.dev/client/pkg/serving/v1/gitops.go b/vendor/knative.dev/client/pkg/serving/v1/gitops.go index 5e342045d..d27ad8d4a 100644 --- a/vendor/knative.dev/client/pkg/serving/v1/gitops.go +++ b/vendor/knative.dev/client/pkg/serving/v1/gitops.go @@ -178,17 +178,17 @@ func writeFile(obj runtime.Object, fp, format string) error { // UpdateService updates the service in // the local directory -func (cl *knServingGitOpsClient) UpdateService(service *servingv1.Service) error { +func (cl *knServingGitOpsClient) UpdateService(service *servingv1.Service) (bool, error) { // check if file exist if _, err := cl.GetService(service.ObjectMeta.Name); err != nil { - return err + return false, err } // replace file - return cl.CreateService(service) + return true, cl.CreateService(service) } // UpdateServiceWithRetry updates the service in the local directory -func (cl *knServingGitOpsClient) UpdateServiceWithRetry(name string, updateFunc ServiceUpdateFunc, nrRetries int) error { +func (cl *knServingGitOpsClient) UpdateServiceWithRetry(name string, updateFunc ServiceUpdateFunc, nrRetries int) (bool, error) { return updateServiceWithRetry(cl, name, updateFunc, nrRetries) } diff --git a/vendor/knative.dev/client/pkg/wait/wait_for_ready.go b/vendor/knative.dev/client/pkg/wait/wait_for_ready.go index 0d0ddb534..00b1b3d3e 100644 --- a/vendor/knative.dev/client/pkg/wait/wait_for_ready.go +++ b/vendor/knative.dev/client/pkg/wait/wait_for_ready.go @@ -166,6 +166,18 @@ func (w *waitForReadyConfig) waitForReadyCondition(watcher watch.Interface, star return true, false, nil } + // Check whether resource is in sync already (meta.generation == status.observedGeneration) + inSync, err := generationCheck(event.Object) + if err != nil { + return false, false, err + } + + // Skip events if generations has not yet been consolidated, regardless of type. + // Wait for the next event to come in until the generations align + if !inSync { + continue + } + // Skip event if its not a MODIFIED event, as only MODIFIED events update the condition // we are looking for. // This will filter out all synthetic ADDED events that created bt the API server for @@ -180,15 +192,6 @@ func (w *waitForReadyConfig) waitForReadyCondition(watcher watch.Interface, star continue } - // Skip event if generations has not yet been consolidated - inSync, err := generationCheck(event.Object) - if err != nil { - return false, false, err - } - if !inSync { - continue - } - conditions, err := w.conditionsExtractor(event.Object) if err != nil { return false, false, err diff --git a/vendor/knative.dev/pkg/controller/controller.go b/vendor/knative.dev/pkg/controller/controller.go index 2a28497fa..27fe75e40 100644 --- a/vendor/knative.dev/pkg/controller/controller.go +++ b/vendor/knative.dev/pkg/controller/controller.go @@ -152,13 +152,6 @@ func FilterControllerGK(gk schema.GroupKind) func(obj interface{}) bool { } } -// FilterController makes it simple to create FilterFunc's for use with -// cache.FilteringResourceEventHandler that filter based on the -// controlling resource. -func FilterController(r kmeta.OwnerRefable) func(obj interface{}) bool { - return FilterControllerGK(r.GetGroupVersionKind().GroupKind()) -} - // FilterWithName makes it simple to create FilterFunc's for use with // cache.FilteringResourceEventHandler that filter based on a name. func FilterWithName(name string) func(obj interface{}) bool { diff --git a/vendor/knative.dev/pkg/metrics/resource_view.go b/vendor/knative.dev/pkg/metrics/resource_view.go index 236fd588b..7135af70a 100644 --- a/vendor/knative.dev/pkg/metrics/resource_view.go +++ b/vendor/knative.dev/pkg/metrics/resource_view.go @@ -82,16 +82,10 @@ func cleanup() { expiryCutoff := allMeters.clock.Now().Add(-1 * maxMeterExporterAge) allMeters.lock.Lock() defer allMeters.lock.Unlock() - resourceViews.lock.Lock() - defer resourceViews.lock.Unlock() for key, meter := range allMeters.meters { if key != "" && meter.t.Before(expiryCutoff) { flushGivenExporter(meter.e) - // Make a copy of views to avoid data races - viewsCopy := copyViews(resourceViews.views) - meter.m.Unregister(viewsCopy...) delete(allMeters.meters, key) - meter.m.Stop() } } } @@ -145,7 +139,7 @@ func RegisterResourceView(views ...*view.View) error { return nil } -// UnregisterResourceView is similar to view.Unregister(), except that it will +// UnregisterResourceView is similar to view.Unregiste(), except that it will // unregister the view across all Resources tracked byt he system, rather than // simply the default view. func UnregisterResourceView(views ...*view.View) { diff --git a/vendor/knative.dev/pkg/network/network.go b/vendor/knative.dev/pkg/network/network.go index ee5ce7c48..b2ac63ce7 100644 --- a/vendor/knative.dev/pkg/network/network.go +++ b/vendor/knative.dev/pkg/network/network.go @@ -52,20 +52,18 @@ const ( // uses to find out which version of the networking config is deployed. HashHeaderName = "K-Network-Hash" - // KubeProbeUAPrefix is the prefix for the User-Agent header. // Since K8s 1.8, prober requests have // User-Agent = "kube-probe/{major-version}.{minor-version}". KubeProbeUAPrefix = "kube-probe/" - // KubeletProbeHeaderName is the header name to augment the probes, because // Istio with mTLS rewrites probes, but their probes pass a different - // user-agent. + // user-agent. So we augment the probes with this header. KubeletProbeHeaderName = "K-Kubelet-Probe" ) // IsKubeletProbe returns true if the request is a Kubernetes probe. func IsKubeletProbe(r *http.Request) bool { - return strings.HasPrefix(r.Header.Get(UserAgentKey), KubeProbeUAPrefix) || + return strings.HasPrefix(r.Header.Get("User-Agent"), KubeProbeUAPrefix) || r.Header.Get(KubeletProbeHeaderName) != "" } diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/configuration_validation.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/configuration_validation.go index 01c0cefad..6b719ae6b 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/configuration_validation.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/configuration_validation.go @@ -18,7 +18,6 @@ package v1 import ( "context" - "strings" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" @@ -63,19 +62,8 @@ func (cs *ConfigurationSpec) Validate(ctx context.Context) *apis.FieldError { // validateLabels function validates configuration labels func (c *Configuration) validateLabels() (errs *apis.FieldError) { - for key, val := range c.GetLabels() { - switch key { - case serving.RouteLabelKey, - serving.ConfigurationUIDLabelKey, - serving.ServiceUIDLabelKey: - // Known valid labels - so just skip them - case serving.ServiceLabelKey: - errs = errs.Also(verifyLabelOwnerRef(val, serving.ServiceLabelKey, "Service", c.GetOwnerReferences())) - default: - if strings.HasPrefix(key, serving.GroupNamePrefix) { - errs = errs.Also(apis.ErrInvalidKeyName(key, apis.CurrentField)) - } - } + if val, ok := c.Labels[serving.ServiceLabelKey]; ok { + errs = errs.Also(verifyLabelOwnerRef(val, serving.ServiceLabelKey, "Service", c.GetOwnerReferences())) } return errs } diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go index 32ac6180a..63ea4f6c3 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go @@ -82,9 +82,9 @@ type RevisionSpec struct { // +optional ContainerConcurrency *int64 `json:"containerConcurrency,omitempty"` - // TimeoutSeconds holds the max duration the instance is allowed for - // responding to a request. If unspecified, a system default will - // be provided. + // TimeoutSeconds is the maximum duration in seconds that the request routing + // layer will wait for a request delivered to a container to begin replying + // (send network traffic). If unspecified, a system default will be provided. // +optional TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"` } diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_validation.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_validation.go index 02f50a196..e5c961bde 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_validation.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_validation.go @@ -123,22 +123,8 @@ func (rs *RevisionStatus) Validate(_ context.Context) *apis.FieldError { // ValidateLabels function validates service labels func (r *Revision) ValidateLabels() (errs *apis.FieldError) { - for key, val := range r.GetLabels() { - switch key { - case serving.RoutingStateLabelKey, - serving.RouteLabelKey, - serving.ServiceLabelKey, - serving.ConfigurationUIDLabelKey, - serving.ServiceUIDLabelKey, - serving.ConfigurationGenerationLabelKey: - // Known valid labels. - case serving.ConfigurationLabelKey: - errs = errs.Also(verifyLabelOwnerRef(val, serving.ConfigurationLabelKey, "Configuration", r.GetOwnerReferences())) - default: - if strings.HasPrefix(key, serving.GroupNamePrefix) { - errs = errs.Also(apis.ErrInvalidKeyName(key, "")) - } - } + if val, ok := r.Labels[serving.ConfigurationLabelKey]; ok { + errs = errs.Also(verifyLabelOwnerRef(val, serving.ConfigurationLabelKey, "Configuration", r.GetOwnerReferences())) } return errs } diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/route_validation.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/route_validation.go index cbe667f7f..0a9a4c9d6 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/route_validation.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/route_validation.go @@ -19,7 +19,6 @@ package v1 import ( "context" "fmt" - "strings" "k8s.io/apimachinery/pkg/util/validation" network "knative.dev/networking/pkg" @@ -204,17 +203,13 @@ func validateClusterVisibilityLabel(label string) *apis.FieldError { // validateLabels function validates route labels. func (r *Route) validateLabels() (errs *apis.FieldError) { - for key, val := range r.GetLabels() { - switch key { - case network.VisibilityLabelKey: - errs = errs.Also(validateClusterVisibilityLabel(val)) - case serving.ServiceLabelKey: - errs = errs.Also(verifyLabelOwnerRef(val, serving.ServiceLabelKey, "Service", r.GetOwnerReferences())) - default: - if strings.HasPrefix(key, serving.GroupNamePrefix) { - errs = errs.Also(apis.ErrInvalidKeyName(key, apis.CurrentField)) - } - } + if val, ok := r.Labels[network.VisibilityLabelKey]; ok { + errs = errs.Also(validateClusterVisibilityLabel(val)) + } + + if val, ok := r.Labels[serving.ServiceLabelKey]; ok { + errs = errs.Also(verifyLabelOwnerRef(val, serving.ServiceLabelKey, "Service", r.GetOwnerReferences())) } + return errs } diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/service_validation.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/service_validation.go index 7178bd7fe..eb1ecbf63 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/service_validation.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/service_validation.go @@ -18,7 +18,6 @@ package v1 import ( "context" - "strings" network "knative.dev/networking/pkg" "knative.dev/pkg/apis" @@ -67,13 +66,8 @@ func (ss *ServiceSpec) Validate(ctx context.Context) *apis.FieldError { // validateLabels function validates service labels func (s *Service) validateLabels() (errs *apis.FieldError) { - for key, val := range s.GetLabels() { - switch { - case key == network.VisibilityLabelKey: - errs = errs.Also(validateClusterVisibilityLabel(val)) - case strings.HasPrefix(key, serving.GroupNamePrefix): - errs = errs.Also(apis.ErrInvalidKeyName(key, apis.CurrentField)) - } + if val, ok := s.Labels[network.VisibilityLabelKey]; ok { + errs = errs.Also(validateClusterVisibilityLabel(val)) } return errs } diff --git a/vendor/modules.txt b/vendor/modules.txt index 9aa37f227..c43ed66f1 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -197,7 +197,7 @@ github.com/mailru/easyjson/jlexer github.com/mailru/easyjson/jwriter # github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 github.com/matttproud/golang_protobuf_extensions/pbutil -# github.com/maximilien/kn-source-pkg v0.6.2-0.20210219230238-c655d7ca141e +# github.com/maximilien/kn-source-pkg v0.6.3 ## explicit github.com/maximilien/kn-source-pkg/pkg/client github.com/maximilien/kn-source-pkg/pkg/commands/source @@ -704,7 +704,7 @@ k8s.io/kube-openapi/pkg/util/proto k8s.io/utils/buffer k8s.io/utils/integer k8s.io/utils/trace -# knative.dev/client v0.20.1-0.20210219184703-18ff59604195 +# knative.dev/client v0.21.0 ## explicit knative.dev/client/lib/test knative.dev/client/pkg/apis/client @@ -725,7 +725,7 @@ knative.dev/client/pkg/sources/v1alpha2 knative.dev/client/pkg/util knative.dev/client/pkg/util/mock knative.dev/client/pkg/wait -# knative.dev/eventing v0.20.1-0.20210219125302-4e5bdf97930a +# knative.dev/eventing v0.21.0 knative.dev/eventing/pkg/apis/config knative.dev/eventing/pkg/apis/configs knative.dev/eventing/pkg/apis/configs/v1alpha1 @@ -755,7 +755,7 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1beta1 knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1beta1 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha2 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha2/fake -# knative.dev/eventing-kafka v0.19.1-0.20210219230103-ae8020f1c58b +# knative.dev/eventing-kafka v0.21.0 ## explicit knative.dev/eventing-kafka/pkg/apis/bindings knative.dev/eventing-kafka/pkg/apis/bindings/v1alpha1 @@ -777,7 +777,7 @@ knative.dev/hack knative.dev/networking/pkg knative.dev/networking/pkg/apis/networking knative.dev/networking/pkg/apis/networking/v1alpha1 -# knative.dev/pkg v0.0.0-20210219164703-8a9bf766d36d +# knative.dev/pkg v0.0.0-20210216013737-584933f8280b ## explicit knative.dev/pkg/apis knative.dev/pkg/apis/duck @@ -819,7 +819,7 @@ knative.dev/pkg/tracing/propagation knative.dev/pkg/tracing/propagation/tracecontextb3 knative.dev/pkg/tracker knative.dev/pkg/webhook/resourcesemantics -# knative.dev/serving v0.20.1-0.20210219075403-2516dae3d46e +# knative.dev/serving v0.21.0 knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1 knative.dev/serving/pkg/apis/config