Commit Graph

392 Commits

Author SHA1 Message Date
Matt Moore 7735348150 Add some helpers to reduce boilerplate in controller binaries. (#335)
* Add some helpers to reduce boilerplate in controller binaries.

* Incorporate feedback from Victor.

* Fix a couple test data races.
2019-03-23 10:57:48 -07:00
Markus Thömmes 6dbff19883 Factor out common logic on obtaining the ingress' endpoint. (#334)
* Factor out common logic on obtaining the ingress' endpoint.

* Resolve import cycle.

* Fix compile error.

* Fix obscure import bug.
2019-03-22 12:35:47 -07:00
Matt Moore 60fdcbcabd This threads a context.Context through the webhook interfaces we expose. (#332)
Related to: https://github.com/knative/pkg/issues/306
2019-03-21 10:48:48 -07:00
srinivashegde86 3b8bc39ced Use latest tag to get test images (#331) 2019-03-19 18:11:46 -07:00
Scott Nichols 5e5f376ef5 Delete pkg/cloudevents, use cloudevents/sdk-go instead. (#330)
* Delete pkg/cloudevents, use cloudevents/sdk-go instead.

* update deps.
2019-03-19 17:55:46 -07:00
Victor Agababov 4840bbe7b4 Retry the connection refused errors. (#329)
* Retry the connection refused errors.

Some of the integration tests fail after Istio reprogramming
with `connection refused` errors.
They are usually transitive and are happening due to the Istio probes
temporarily failing after reprogramming.
With this change we'll retry those errors, hopefully reducing the
flakes.

* fix the error string
2019-03-19 11:31:47 -07:00
Scott Nichols 915415e7be Need to use patch merge for conditions. (#328)
* Need to use patch merge for conditions.

* use correct package.
2019-03-18 14:21:45 -07:00
Scott Nichols 587fb819f4 Add back KResourceStatus so eventing master can build serving 0.4 (#325)
* Add back KResourceStatus so eventing master can build serving 0.4

* update codegen.
2019-03-18 10:59:46 -07:00
srinivashegde86 46bd1f13c2 Add some more common test componets in pkg/test (#321) 2019-03-18 10:41:46 -07:00
Matt Moore 374ae9eb1f Expand the Conditions duck type to also encompass ObservedGeneration. (#324)
With this, the expectation is that folks can embed the following in
the status of their resource:

```go
type FooStatus struct {
	duckv1alpha1.Status `json:",inline"`

	// other fields
}
```

`ObservedGeneration` is important to the usefulness of our standard
conditions because `{Ready,Succeeded}: True` is only meaningful when
`.status.observedGeneration == .metadata.generation`.

When `.status.observedGeneration != .metadata.generation` it indicates
that the controller has not yet attempted to reconcile a change in the
desired state of the world (aka `spec:`).
2019-03-17 16:56:45 -07:00
Matt Moore 35d3a1b0d4 Modify the webhook to allow the use of duck types. (#323)
* Modify the webhook to allow the use of duck types.

This change enables us to define a duck type that applies to a whole class of GroupVersionKinds and leverage it to perform generic validation, defaulting, etc.

Fixes: #322

* Fix typo
2019-03-16 11:10:45 -07:00
jonjohnsonjr cd278f2d33 Bump k8s deps: 1.11.3 -> 1.12.6 (#310)
* Bump k8s deps: 1.11.3 -> 1.12.6

* ./hack/update-deps.sh

* ./hack/update-codegen.sh
2019-03-14 13:48:45 -07:00
srinivashegde86 684620ff81 Make monitoring components take namespace arg instead of defaulting to istio namespace (#316) 2019-03-12 11:23:43 -07:00
Yanwei Guo 060135fc89 Record metrics if config is nil (#315)
* record if nil

* some more comment

* some more comment

* return
2019-03-11 13:28:43 -07:00
Markus Thömmes efe322d2ca Remove 'MatchesAny'. (#312) 2019-03-11 05:37:42 -07:00
Stefan Prodan f8007289b2 Add CORS Policy to Istio HTTP route (#294)
Signed-off-by: stefanprodan <stefan.prodan@gmail.com>
2019-03-08 16:35:41 -08:00
Alex DiCarlo cc337f8142 Fix VirtualService tcp and tls definitions (#268)
* Fix VirtualService tcp and tls definitions

* Regenerate deepcopy for istio/v1alpha3

* Remove out of date comment

* Fix up comments
2019-03-08 16:30:41 -08:00
Markus Thömmes 07cb28db97 Consistently log the full response on errors in tests. (#313)
* Consistently log the full response on errors in tests.

* Remove unnecessary String() call.
2019-03-08 09:50:41 -08:00
Yanwei Guo 2b411285d2 Use a fake exporter in unit tests (#311)
* add fake exporter

* change comment
2019-03-07 16:12:41 -08:00
Yanwei Guo b4a3bde045 Decide whether to record metrics according to current metrics config (#292)
* split and update

* bug fixed

* change the copyright year

* use fake metadata in tests

* exclude test coverage for gcp_metadata

* add record

* add tests

* revert 2019 and add a new var

* change documents

* address comment

* change line
2019-03-07 10:26:42 -08:00
mattmoor-sockpuppet f05e26f201 golang format tools (#307)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-03-07 07:05:40 -08:00
mattmoor-sockpuppet e191fc0811 golang format tools (#304)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-03-07 07:00:43 -08:00
Matt Moore cbb16f0f4a Add support for URLs vs. simple domains to WaitForEndpointState* (#308) 2019-03-06 20:29:40 -08:00
Bob Corsaro 1ed7b993c8 Updates istio HTTPMatchRequest api (#305)
* Updates istio HTTPMatchRequest api

* Updates generated code
2019-03-05 12:19:39 -08:00
srinivashegde86 e5c43dce06 Separate common monitoring methods into monitoring package (#302)
* Separate common monitoring methods into monitoring package

* Add doc.go to monitoring

* Update doc.go to add information about the public methods

* Fix build tests
2019-03-02 18:20:38 -08:00
mattmoor-sockpuppet a3220b881c Format markdown (#301)
Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
2019-03-01 12:45:38 -08:00
Victor Agababov c100323403 Fix the sugared logger usage (#300)
* Fix the sugared logger usage

Without `w` the logged messages are quite useless and annoying.

* some more magic
2019-02-28 18:17:38 -08:00
mattmoor-sockpuppet 23907fa727 golang format tools (#298)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-02-28 10:06:49 -08:00
srinivashegde86 cccc0604d0 Use FormatLogger instead of func parameter (#297) 2019-02-27 15:47:49 -08:00
srinivashegde86 2a8c1b0e5a Remove baselogger and use FormatLogger everywhere (#296)
* Remove baselogger and use FormatLogger everywhere

* Fix blank spaces in README

* Fix linting issues

* Fix comment to FormatLogger
2019-02-27 11:29:49 -08:00
dushyanthsc 41761b2c81 Adding default zipkin tracing support to SpoofClient (#273)
Existing support for Zipkin tracing pushes the
responsibility of logging zipkin traces to
individual tests. This change moves the responsibility
to SpoofClient, so that all tests get it by default.
Traces are logged only for requests that have
encountered Server errors i.e if the
http.Response.StatusCode between 500 to 599.

For SpoofingClient.Poll calls we only log trace of the
final SpoofingClient.Do made.
2019-02-25 10:40:48 -08:00
Markus Thömmes 374dc8c6ce Make it possible to use 'IsStatusOK' without parentheses. (#291) 2019-02-22 10:16:47 -08:00
Victor Agababov 4a1fba4148 Add a variant of wait for status with explicit timeout. (#290)
* Add a variant of wait for status with explicit timeout.

This permits setting higher timeouts in the performance tests,
which it seems take longer to come to life.

* revert the default timeout change
2019-02-21 11:09:47 -08:00
Yanwei Guo 1494b24d7f Update OpenCensus Stackdriver exporter version (#280)
* split and update

* bug fixed

* change the copyright year

* use fake metadata in tests

* exclude test coverage for gcp_metadata

* revert 2019 change on existing files
2019-02-20 14:18:46 -08:00
Adriano Cunha b273d660ad Remove usage of K8S_CLUSTER_OVERRIDE (#289)
It was removed in https://github.com/knative/test-infra/pull/481.
2019-02-20 10:17:47 -08:00
mattmoor-sockpuppet 737c4a42f3 golang format tools (#287)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-02-19 07:12:46 -08:00
mattmoor-sockpuppet d462372eb2 Format markdown (#288)
Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
2019-02-19 06:52:46 -08:00
Matt Moore 729d5ada5f Adapt the spoofing client to take a "FormatLogger" instead of a BaseLogger (#285)
This is a breaking change, that can be fixed up by replacing `logger,` with `logger.Infof,` in the argument lists for these functions.

This is part of a larger cleanup to allow us to use alternate log methods like `t.Logf` in place of `BaseLogger`.
2019-02-18 16:57:45 -08:00
Markus Thömmes eac0dd3596 Add 'MatchesAllOf' to make it possible to combine matchers. (#284) 2019-02-18 14:36:45 -08:00
Victor Agababov 7a5ce38287 Simplify and comment AppenRandomString (#282)
* Simplify and comment AppenRandomString

Port and rewrite the comment from the original.
Remove the sync.Once(). Initializing during package initialization is just as good.
Mutex doesn't have to be a pointer

* remove fancy rnd, remove mutex, add example, which would also check compilation

* actually commit the example

* add licence
2019-02-18 12:26:45 -08:00
Markus Thömmes 93989176e0 Fix range expression in 'IsOneOfStatusCodes' to actually match the codes. (#283) 2019-02-18 08:48:46 -08:00
dushyanthsc ec1c8ea324 Metrics logging fix in pkg/test: Issue-3150 (#279)
* Metrics logging fix in pkg/test: Issue-3150

https://github.com/knative/serving/issues/3150 describes the issue
that currently exists in our test logging framework. This change
fixes the problem by prefixing metrics that needs to be emited by
a constant which the logging.ExpoxtSpan method then uses to identify
the spans that needs to be emitted as logs

Note this only fixes part of the issue:
https://github.com/knative/serving/issues/3150
this change needs to be ported to knative serving before the issue
can be closed.

* Update test/logging/logging.go

Adding required lines.

Co-Authored-By: dushyanthsc <43390008+dushyanthsc@users.noreply.github.com>
2019-02-15 13:36:44 -08:00
Nghia Tran 717a172c91 Helper to call Hijack on a http.ResponseWriter if possible. (#281) 2019-02-15 13:13:44 -08:00
Markus Thömmes f9ede61d88 Add status matchers to help unify test code. (#278)
* Add status matchers to help unify test code.

* Generalize status code matcher to be able to match multiple codes.
2019-02-15 10:38:44 -08:00
Dave Protasowski 0183bf9cdc Drop spec.generation support (#234)
* Drop webhook logic to increment spec.generation

With Kubernetes 1.11+ metadata.generation now increments properly
when the status subresource is enabled on CRDs

For more details see: https://github.com/knative/serving/issues/643

* Drop the generational duck type
2019-02-14 08:29:45 -08:00
Dave Protasowski 829b886f7e Don't close the http.Request body (#277)
As per net.http package for `http.Request.Body`

```
        // The Server will close the request body. The ServeHTTP
        // Handler does not need to.
```
2019-02-14 07:01:44 -08:00
mattmoor-sockpuppet d9eb9772e8 golang format tools (#276)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-02-13 08:29:42 -08:00
Victor Agababov 1982208dd9 Initial commit for the webhook to set the annotations about mutator. (#275)
* Initial commit for the webhook to set the annotations about mutator.

The user that created or updated the resource will be set in the
annotations.

* update comments

* remove debug logging

* logging :/

* logging :/, returns

* logging :/ III

* error wrap

* simplify test

* rename the test

* add pkg/errors to the deps for better errors

* do not require CRD to implement Annotatable

* review issues

* fix interface as required by review
2019-02-12 21:03:43 -08:00
Leonardo Rossetti c089ddfc5d test/helpers module to store AppendRandomString helper fn (#256)
* test/helpers module to store AppendRandomString helper fn

* defer unlock
2019-02-12 12:10:43 -08:00
Victor Agababov dc1adcf1df Cleanup the webhook code. (#272)
* Cleanup the webhook code.

- add more tests
- fix formatting
- fix logging and errors
- use shorthands
- some optimizations in types
- make code more Go'ey from C'ey.

* raise test coverage
2019-02-12 09:12:44 -08:00