Commit Graph

682 Commits

Author SHA1 Message Date
Yanwei Guo 94a34e416c Upgrade OpenCensus Stackdriver exporter (#865)
* upgrade

* change unit tests

* upgrade os sd again

* change unit tests

* add comment

* add comment

* address comments
2019-12-03 14:12:37 -08:00
Matt Moore 3444316bde Format markdown (#919)
Produced via:
  `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
/assign n3wscott
2019-12-03 09:47:35 -08:00
Matt Moore 12b4f0010d Auto-update dependencies (#920)
Produced via:
  `dep ensure -update knative.dev/test-infra`
/assign n3wscott
2019-12-03 09:33:35 -08:00
Joyce Liu c259ed6f2e Moved cluster name check to later so --get can use cluster name in kubeconfig (#918) 2019-12-02 15:50:35 -08:00
Matt Moore 891c2876dd Implement a base library for implementing "Pod Spec"-able bindings. (#915)
This PR adds facilities to make it easier to create both components of a Binding
over "Pod Spec"-able resources.  Rather than rehashing it all here, please look
at `./pkg/webhook/psbinding/README.md` for more details.
2019-12-02 08:58:34 -08:00
Ville Aikas 944655d6cc fix comment, followup to 911 (#912)
* fix comment, followup to 911

* Update webhook/testing/listers.go

Co-Authored-By: Victor Agababov <vagababov@gmail.com>
2019-11-28 13:49:22 -08:00
Victor Agababov 8eb13fa842 Some cleanups in the URI tests (#914)
As referenced in the previous PRs

/assign @vaikas mattmoor
2019-11-28 13:42:22 -08:00
Matt Moore 20ef0b737b This has three small table testing changes. (#911)
I'm splitting this off of another change that needed them, the three changes are:

1. Give the PostConditions callbacks in TableRow access to the Reconciler
  resource.  It turns out this is incredibly useful to have the `TableRow`
  program an admission controller and then test that programming by calling
  `Admit()`.

1. Surface the test resources in our webhook "listers", and add the testing
  scheme.

1. Change the `objKey` to only use reflection as a fallback.  The existing logic
  doesn't work properly when a mix of real resources and unstructured.Unstructured
  is used for the same resource.
2019-11-28 11:10:22 -08:00
Matt Moore 1490c68a0c Run ./hack/update-codegen.sh (#910) 2019-11-28 11:03:22 -08:00
Ville Aikas cac31abb7f Change URIFromDestinationV1 to return apis.URL instead of string (#909) 2019-11-27 13:13:22 -08:00
Matt Moore 7fbd5952bb Auto-update dependencies (#908)
Produced via:
  `dep ensure -update knative.dev/test-infra`
/assign n3wscott
2019-11-27 07:54:22 -08:00
Francesco Guardiani 00cee157bd Added test utilities methods (#902)
* Added WaitForPodState to wait a state of a single pod

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Added WaitForServiceEndpoints

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Changes from review

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Change from review

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2019-11-27 07:13:21 -08:00
Victor Agababov 06d6b25dd6 Remove panics from the test and use t.Fatalf instead (#906) 2019-11-26 15:21:21 -08:00
grac3gao 46cfce8d99 Add check in informer to make controllers work when process invalid resources (#880)
* #2047 sources-controller can't recover from faulty sink (in eventing)

* #2047 sources-controller can't recover from faulty sink (in eventing)

* add unit test

* change after review

* change after review-2

Co-Authored-By: Victor Agababov <vagababov@gmail.com>
2019-11-26 14:16:21 -08:00
Ville Aikas 9a81fcece3 Resolvev1destination (#905)
* support v1.Destination

* rebase

* remove leftover crud from rebase

* address pr feedback

* moar feedback from pr
2019-11-26 14:00:21 -08:00
Slavomir Kaslev ddf3968b65 Migrate pkg to istio.io/client-go apis (#882)
* Add istio api packages from istio.io/api and istio.io/client-go

* Codegen istio client for apis from istio.io/client-go

* Remove our istio apis
2019-11-26 11:41:21 -08:00
Matt Moore 7325e901c0 Format markdown (#904)
Produced via:
  `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
/assign n3wscott
2019-11-26 10:28:21 -08:00
Matt Moore 9f41433241 Add a simple ToUnstructured method for converting our types to unstructured. (#900)
This adds a ToUnstructured method to complement the FromUnstructured method
we have had for some time.  The ToUnstructured method is effectively scoped
to Knative-style types since we expect it to implement both kmeta.Accessor
and kmeta.OwnerRefable in order to ensure that the TypeMeta is always
properly populated.
2019-11-26 10:05:21 -08:00
Markus Thömmes 47b250654a Add an -imagetemplate option to allow for more flexible test image locations. (#903) 2019-11-26 06:40:22 -08:00
Matt Moore 6305a6322f Fix the serialized name of the spec field (oops) (#899) 2019-11-25 13:24:21 -08:00
Matt Moore b75a4bf672 This adds a duck type representing the common shape for Bindings. (#898)
For more information, see [here](https://docs.google.com/document/d/1t5WVrj2KQZ2u5s0LvIUtfHnSonBv5Vcv8Gl2k5NXrCQ/edit?ts=5dce0223#heading=h.lnql658xmg9p).
2019-11-25 13:10:21 -08:00
Matt Moore 43ca049cdb Reduce the boilerplate for setting up duck.InformerFactory's. (#896)
This augments the injection codegen with the capability to produce a duck.InformerFactory
attached to context for each type that we process.

Now a `duck.InformerFactory` for "Addressable" can be produced by "Get"ing it from the context.

This is triggered by placing `// +genduck` on the type that implements `duck.Implementable`.
2019-11-25 09:57:10 -08:00
Francesco Guardiani 2ec0f8da50 Mako stub improvements (#868)
* mako-stub now writes columns before the message output
mako-stub now REQUIRES the dev.config in the config-mako ConfigMap
mako-stub waits a configurable time for the stdout flush

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* mako-stub serves results with http AFTER the results are received
Added an handy script to read the results with http

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Trailing new line

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Applied suggested changes + fixed read_results.sh script

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Changes from review

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2019-11-22 11:33:09 -08:00
Matt Moore 8c1fb5fe04 Auto-update dependencies (#893)
Produced via:
  `dep ensure -update knative.dev/test-infra`
/assign n3wscott
2019-11-21 11:11:08 -08:00
Matt Moore cd063fbc21 golang format tools (#892)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
/assign n3wscott
2019-11-21 11:06:08 -08:00
Chi Zhang 0400231005 Add a command package to run command line (#762)
* add Run and RunBatchSequentially

* add RunBatchParallelly

* minor changes

* parallel

* address feedbacks

* add trailing space

* sort import

* address CR feedbacks

* fix unit test

* change to private

* address comments

* nit
2019-11-20 07:35:08 -08:00
JUN JIE NAN 27b3dc39ad Fixed knative activator handshake timeout issue (#836)
The original handshake timeout is too short to dial connection
successfully under some situation. So the activator pod can not be
active. And the log message just say "Failed to send ping message to
ws://autoscaler.knative-serving.svc.cluster.local:8080", not easy to
figure out what's the problem underneeth.

The fix switch to websocket default dial, so the default handle shake
time is 45 seconds, and once dial error found, the error will be
reported as error.
2019-11-18 23:19:07 -08:00
Matt Moore d752898438 Make PodSpeccable a real thing (#884) 2019-11-18 08:02:08 -08:00
coryrc d9e3e244a6 Allow glog to coexist with klog (#881)
* Allow glog to coexist with klog

glog isn't used in our repos with good reason, but performance tests
use it, for now. This commit removes the ability to set klog flags
that aren't shared with glog, in return for the ability of glog to be imported.

* update-codegen
2019-11-15 10:57:02 -08:00
Matt Moore 4836f680bb Split the resource semantic webhooks into separate AdmissionControllers (#848)
By combining our validation logic into our mutating webhook we were previously allowing for mutating webhooks evaluated after our own to modify our resources into invalid shapes.  There are no guarantees around ordering of mutating webhooks (that I could find), so the only way to remedy this properly is to split apart the two into separate webhook configurations:
 - `defaulting`: which runs during the mutating admission webhook phase
 - `validation`: which runs during the validating admission webhook phase.

The diagram in [this post](https://kubernetes.io/blog/2019/03/21/a-guide-to-kubernetes-admission-controllers/) is very helpful in illustrating the flow of webhooks.

Fixes: https://github.com/knative/pkg/issues/847
2019-11-14 16:51:02 -08:00
coryrc 3525756c2a Address serving#5949 by putting flag initialization into pkg. (#870)
Created a unit test for flag setup.
Use Subtests for table-driven tests.

Moved from https://github.com/knative/serving/pull/5984
2019-11-14 16:33:02 -08:00
Matt Moore 80da64a31c golang format tools (#879)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
/assign n3wscott
2019-11-14 11:06:31 -08:00
coryrc d3841ea2c3 Remove ugly constant string being printed in every log. (#878)
In every log we get the ugly string printed:
2019-11-13T08:44:42.421-0800    info    logging/config.go:50
Successfully created the logger.    {"knative.dev/jsonconfig": "{\n\t
\"level\": \"debug\",\n\t  \"encoding\": \"console\",\n\t
\"outputPaths\": [\"stdout\"],\n\t  \"errorOutputPaths\":
[\"stderr\"],\n\t  \"encoderConfig\": {\n\t    \"timeKey\":
\"ts\",\n\t    \"messageKey\": \"message\",\n\t    \"levelKey\":
\"level\",\n\t    \"nameKey\": \"logger\",\n\t    \"callerKey\":
\"caller\",\n\t    \"messageKey\": \"msg\",\n\t    \"stacktraceKey\":
\"stacktrace\",\n\t    \"lineEnding\": \"\",\n\t    \"levelEncoder\":
\"\",\n\t    \"timeEncoder\": \"iso8601\",\n\t    \"durationEncoder\":
\"\",\n\t    \"callerEncoder\": \"\"\n\t  }\n\t}"}

It's all a constant (see test/logging/logging.go:newLogger), except
"level", which is then printed immediately afterward. So just remove
printing this string.
2019-11-13 19:30:28 -08:00
Matt Moore 0b70cd6820 Auto-update dependencies (#877)
Produced via:
  `dep ensure -update knative.dev/test-infra`
/assign n3wscott
2019-11-13 17:22:28 -08:00
Matt Moore e96196e347 golang format tools (#876)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
/assign n3wscott
2019-11-13 15:49:28 -08:00
Vincent 94911510c3 Skip watching the ConfigMaps if they are missing (#872)
* Skip watching the ConfigMaps if they are missing

* Log the error message
2019-11-13 15:17:29 -08:00
Matt Moore 9283d2c32c Format markdown (#875)
Produced via:
  `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
/assign n3wscott
2019-11-13 15:08:28 -08:00
Nima Kaviani 4deb5d83d2 move metrics config to pkg (#786)
the observability config is used in other packages including
the sample controller. This commit pulls observability config
into knative.dev/pkg similar to logging config for better reusability.
2019-11-13 06:52:28 -08:00
Adriano Cunha 6335100d29 Allow passing options to NewSDKClient() (#864) 2019-11-11 15:00:22 -08:00
Matt Moore 6d806b9983 Add support for Selector in tracker.Reference. (#861)
* Add support for Selector in tracker.Reference.

`tracker.Reference` may now optionally replace `Name` with `Selector` to track zero or multiple resources of a particular `apiVersion`, `kind` and `namespace`.

Fixes: https://github.com/knative/pkg/issues/859

* Address code review comments
2019-11-11 07:05:21 -08:00
Matt Moore a805b647f3 Expand the tracker interface to include a variant with its own type. (#860)
`TrackReference` is the same as `Track`, but takes a `tracker.Reference` instead.  This type has been seeded with the subset of `corev1.ObjectReference` that the tracker currently consumes / supports, but the intention is to expand this type to allow inexact references that (optionally) use label selectors in place of name to reference objects.

See also: https://github.com/knative/pkg/issues/859
2019-11-10 09:04:12 -08:00
Victor Agababov e4e8788a2c Fix the race in the webhook test. (#858)
The usual stuff: logger after test terminated.

/assign mattmoor
2019-11-08 10:24:56 -08:00
Markus Thömmes 9bdf8c1c8f Add Namespace index to listers in tests. (#857)
Not having this causes the listers to log an annoying log message like

W1108 02:48:54.848573  211995 listers.go:77] can not retrieve list of objects using index : Index with name namespace does not exist

That message doesn't cause the tests to fail because the cache logic works around by doing a "slow indexing". I was very confused by this log though and sunk a bit of time into debugging it, so here we go.
2019-11-08 04:23:56 -08:00
Francesco Guardiani f0da42d387 Made ReadProfilingKey method public and more generic (#852)
* Made ReadProfilingKey method public and more generic

* Removed old readProfilingFlag
2019-11-07 06:31:55 -08:00
Matt Moore 285df36be4 Move Destination under knative.dev/pkg/apis/duck/v1. (#851)
Destination sits in a strange versioned directory without a group under APIs.  Destination is in fact part of our duck type space, so it belongs under the `duck` group.  This moves the definition (previously v1alpha1) to `v1` because it is referenced from source types that have been designated `v1`.
2019-11-06 15:59:02 -08:00
Ignacio (Nacho) Cano 93838817ef Eventing StackDriver internal metrics (#846)
* marking the metrics as internal as we need to pre-process them to include
pod_name and container_name...

* removing eventSource

* updates

* rollbacking changes to source

* updating changes to source

* minimizing change

* minimizing change
2019-11-06 10:38:03 -08:00
Yanwei Guo 7d0779c71d Add fake functions for GCP metadata and Stackdriver back (#850)
* add fack back

* rename
2019-11-05 15:51:02 -08:00
Antoine Cotten 1cc9641c28 Remove openapi-gen annotations (#775) 2019-11-05 13:03:27 -08:00
Ville Aikas 6fbbb282a0 remove vaikas-google since was replaced with vaikas (#849) 2019-11-05 10:31:27 -08:00
Scott Nichols cdc2959956 adding note about undoing release staging. (#845) 2019-11-04 18:32:22 -08:00