Commit Graph

245 Commits

Author SHA1 Message Date
Markus Thömmes fff36e41c6 Add durable websocket client from serving. (#206)
* Add durable websocket client from serving.

* Remove accidental bump.

* Finally used the update-deps.sh script for good.
2018-12-20 13:00:36 -08:00
Evan Anderson c04a8036d6 Check out shell scripts with unix line endings, even on windows. (#204) 2018-12-20 07:15:35 -08:00
Evan Anderson f3e33e3b92 Add support for returning a cloudevents.EventContext from a function. (#205)
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
2018-12-19 14:32:35 -08:00
Markus Thömmes b04c0947ad Enable 'GetServiceEndpoint' to search through all given ingress names. (#202) 2018-12-14 10:44:33 -08:00
mattmoor-sockpuppet 10aa1c060a golang format tools (#199)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2018-12-10 07:25:29 -08:00
Victor Agababov 585076ba67 Fix some comments about code comments left from the previous PR. (#196) 2018-12-09 06:42:27 -08:00
jonjohnsonjr 3043da57e9 Add kmp, a safe wrapper for google/go-cmp (#197)
* Add kcmp, a safe wrapper for google/go-cmp

* Returns an error instead of panicking.
* Holds common options that we use.

* Rename things

kcmp -> kmp
Diff -> SafeDiff
2018-12-08 08:39:27 -08:00
Victor Agababov 1f624b77dd Some clean ups in the FieldError code and its tests. (#194)
* Some clean ups in the FieldError code and its tests.

- rename FieldError.getNormalizedError to be normalized:
  - Go kind of discourages GetA() vs A()
  - it's an error, so normalizing itself is also an error, so
    normalizedError() is a tautology at this point
- flatten was doing a[x]=fmt.Sprintf("%s%s", a[x],y), which is a very
  expensive substitution for a[x]+=y
- some minor test cleanups (fix strings, streamline `got, want:=`
  pattern, etc.

* Also make normalize() and merge() operate on pointers.

As the code currently is structured we are doing lots of duplication
and copies of the objects, since we're doing []FieldError throughout
normalize() and merge() even though normalize already returns a copy of
the initial error tree, rather than a list of pointers to existing
errors.

Hence list returned by normalize() and hence merge() can actually be pointer
lists which would save us some CPU and memory.
2018-12-06 17:06:26 -08:00
Matt Moore 0e41760cea Undo the patch sorting. (#192)
My prior change added sorting to the duck.CreatePatch method to try and stabilize the result of jsonpatch.CreatePatch, which is otherwise non-deterministic (probably walking a map?).

My bad assumption was that the patch operations this generated wouldn't conflict, e.g. it should use `replace` vs. `remove` and `add`.

Clearly this was bad because we start getting really strange errors trying to import this into knative/serving, e.g.
https://gubernator.knative.dev/build/knative-prow/pr-logs/pull/knative_serving/2646/pull-knative-serving-integration-tests/1070435951391543298/
2018-12-05 15:04:26 -08:00
Matt Moore c267dfecb7 This exempts defaulting from the rules governing field immutability. (#191)
Immutable fields with default values may now be changed iff they change is to populate their default value.  This is to support defaulting in the scenario where an object was created long ago and a new field (with a default!) is added.  When controllers attempt to mutate the object status today, this would create a webhook rejection!  With this change, we compare against a freshly defaulted "old" object to exclude newly defaulted fields from the immutability check.

We saw this in knative/serving for the newly added TimeoutSeconds field in Revision (otherwise immutable), which I believe it leading to upgrade testing flakes since post-upgrade Revision status updates will fail.
2018-12-05 13:40:26 -08:00
Aldo Culquicondor c2b6cc54fb Clean up controller code (#187)
- Removed unnecessary machinery
- Fixed misleading comments
2018-12-04 17:00:26 -08:00
Mustafa Demirhan 53b1235c2a Use different reporting periods based on the metrics backend (#182)
* Use different reporting periods based on the metrics backend. Original implementation was setting this value to 1 min to accommodate the minimum allowed value for stackdriver, but that is a sub optimal behavior for Prometheus. The change also allows operator to override the default values.

* Fix the units of reconciler latency from nano seconds to milliseconds.

* Address PR comments.

* Add better logging for reconciliation.

* Remove unnecessary lock in the UT.

* Address PR comments.
2018-12-04 15:16:25 -08:00
mattmoor-sockpuppet 973ea220f9 Format markdown (#189)
Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
2018-12-04 14:14:25 -08:00
Matt Moore 102237ce9b Simplify the core controller logic. (#184)
I was hoping to switch from a simple string key to a struct to include additional metadata into our workqueue item (in particular the time at which it was queued), but the great unit tests here reminded me that this would not properly deduplicate keys (they would have different queue times!), so I'm settling for simplifying the loop in a few ways:
1. Keys can only be strings, so remove some error checking and a test.
1. We were wrapping a block in a `func` because it contained `defer`, but the outer function had nothing in it.

I'd still like to try and find a way to track queue times for keys, so that we can surface two interesting metrics:
1. How long are things spending queued?
1. How long between events being observed and us responding? (above + reconcile latency)
2018-12-03 17:02:25 -08:00
mattmoor-sockpuppet 0f793b2942 Format markdown (#183)
* Format markdown

Produced via: `prettier --write $(find -name '*.md' | grep -v vendor)`

* Fix issue template
2018-12-03 13:53:25 -08:00
chaodaiG e54498d978 Update test-infra: keep only test-infra/scripts (#179)
Previous PR vendored unnecessary files from test-infra, update Gopkg.toml and clean up unneeded files
2018-11-30 17:49:24 -08:00
chaodaiG b899d3fdac Make verify-codegen.sh also check /vendor (#180)
Replicated from: https://github.com/knative/serving/pull/2561

Original link: https://github.com/knative/serving/issues/1711`
2018-11-30 12:37:24 -08:00
chaodaiG bace358626 Remove images deletion step from e2e test / Update test-infra (#175)
Old images cleanup is no longer part of e2e test, this functionality will be moved to a separate job runs periodically.

Proposed Changes
This part is done in knative/test-infra, updating dependencies in this repo to include this update.
Link to the issue in test-infra: knative/test-infra#276
2018-11-29 13:45:24 -08:00
lichuqiang 9a644df00f update gateway (#170)
* update gateway

* temporary work around the upgrade test issue
2018-11-27 23:10:23 -08:00
mattmoor-sockpuppet 862aa6dbe7 Fix spelling errors (#174)
Produced via: `github.com/client9/misspell`
2018-11-26 13:02:22 -08:00
lichuqiang c1d9d9552a quieting controller log (#169) 2018-11-26 08:47:23 -08:00
Galo Navarro 6ac3c8ef24 encoding: expose HeaderExtensionPrefix (#172)
So that the header prefix can be used in downstream dependencies.

Signed-off-by: Galo Navarro <anglorvaroa@gmail.com>
2018-11-26 07:25:23 -08:00
mattmoor-sockpuppet d99eb0732f Run gofmt (#171)
Produced via: `gofmt -s -w $(find -name '*.go' | grep -v vendor)`
2018-11-26 07:18:22 -08:00
akyyy acfd173abd add metrics constants for resource type and labels (#168)
* add constants for resource type and labels

* add set and map for easy access

* address cr comments

* fix typo

* Update comment

* add value unknown

* Update comments

* update comments
2018-11-21 14:17:21 -08:00
lichuqiang a5c260df2a Update EnqueueLabelOf to handle resources in same namespace (#166)
* update EnqueueLabelOf to handle resources in same namespace

* spit the EnqueueLabelOf func for namespaced/cluster-scoped resources
2018-11-19 19:04:20 -08:00
Kenny Leung 3e52d67e3d Add ErrOutOfBoundsValue for value boundary validation (#167) 2018-11-13 17:36:45 -08:00
Matthias Wessendorf 18ee4c298a Removing eventTime for required attrs. (#164) 2018-11-12 11:37:45 -08:00
Matt Moore 4b704fa794 Update the ConditionSet to support non-terminal conditions. (#161)
* Update the ConditionSet to support non-terminal conditions.

This change updates the `ConditionSet` datatype to treat the set of conditions that it is initially supplied with as the set of "terminal" conditions, where as before:
1. If all `True`, results in `Ready=True`
2. If any `False`, results in `Ready=False`
3. Otherwise, `Ready=Unknown`

However, in additional to this initial "terminal" set, other conditions may be set that are "non-terminal" and have no influence over the "happy" condition (e.g. `Ready`).

Related to: https://github.com/knative/serving/issues/2394

* Add severity handling to ConditionSet.

This adds a Severity field to our common Condition type, as outlined [here](https://github.com/knative/serving/issues/2394#issuecomment-436806801).

The only way Severity is populated in this change is:
 * Terminal conditions (passed at initial construction) always result in `severity: Error`,
 * non-Terminal conditions (added outside initial set) always result in `severity: Info`.

We should think about how we want to update the `Condition{Set,Manager}` interfaces to surface more control (e.g. `severity: Warning`).
2018-11-08 15:47:44 -08:00
akyyy 7e60946848 Fix the wrong id (#163) 2018-11-07 09:42:37 -08:00
Yanwei Guo 088e3f7faf Add the commit ID key as constant for log label (#158)
* add the commit id constant

* add changeset lib

* add doc.go with explanation
2018-11-06 14:59:36 -08:00
lichuqiang af2c4bc84e Update OnChanged in tracker to support deletion events (#160)
* define kmeta.Accessor interface

* update tracker and EnsureTypeMeta to support deletion events
2018-11-05 08:21:35 -08:00
Evan Anderson a8160c7d72 Clean up eventing duck types (#153)
* Clean up eventing duck types.

* Introduce Addressable to unify delivery ducks.
* Remove Subscribable and Channelable (moved to knative/eventing).
* Mark Sinkable and Targetable as retired in favor of Addresable &
  annotations for Callable.

See https://docs.google.com/document/d/1xu18lprM8EFknqrsyZeNgYX2sLE13hfT2UKlYfdxv1g/edit#
for interface/naming details.

* Keep targetable as retired until serving stops using it.
2018-11-02 10:59:35 -07:00
Scott Nichols 04b40fd38a Adding cloudevent sdk for working with cloud event producers and consumers. (#154) 2018-11-02 10:43:35 -07:00
Matt Moore 35322088a8 Move the `getObject` method into `kmeta` (#155)
This promotes the private deletion-handling helper wrapping `meta.Accessor` into `kmeta`.  The wordy name is based on the wordier `cache.DeletionHandlingMetaNamespaceKeyFunc`, since it serves a similar purpose.
2018-11-01 18:48:34 -07:00
Matt Moore 6f60c709b7 This moves a relatively pristine copy of EnsureTypeMeta into knative/pkg. (#157) 2018-11-01 17:24:34 -07:00
Evan Anderson 7a435db409 Add additional validation for ObjectReferences (#156) 2018-11-01 15:47:34 -07:00
Matt Moore f83edbe3bc Reject ObjectReferences missing key elements. (#151)
Fixes: https://github.com/knative/pkg/issues/150
2018-11-01 10:48:34 -07:00
Evan Anderson 82424e6283 Fix a typo in Implementable (#152) 2018-11-01 07:24:34 -07:00
lichuqiang fcb0656514 requeue keys on error in controller (#149)
* requeue keys on error in controller

* remove maxRetries limit
2018-10-31 09:59:34 -07:00
dushyanthsc 083969f9a0 Adding Zipkin tracing support for SpoofingClient (#119) 2018-10-31 09:06:37 -07:00
akyyy 02b354e3a4 Relax the requirement for stackdriver project id for metrics exporter. (#147)
* fix flaky test

* relax the requirement for stackdriver project id

* improve log

* add comment for stackdriverProjectIDKey not provided case

* minor format

* simplify the map access
2018-10-30 16:20:34 -07:00
srinivashegde86 e811acc8d2 Export method to get service endpoint (#148) 2018-10-30 15:12:34 -07:00
lichuqiang d247efe41d update EnqueueControllerOf to properly handle Delete (#146)
* update EnqueueControllerOf to properly handle Delete

* update existing test

* add enqueue label tests

* address comments
2018-10-30 07:13:34 -07:00
Scott Nichols 5a67e38d13 Simplify FieldError merging. (#99)
* checkpoint.

* Tried a new way.

* Some more slimplifying based on feedback.

* use bang vs == false.

* not sure why I did not use go style on this forloop, fixed.
2018-10-30 01:20:33 -07:00
Zrss d83605ef7b Add webhook svc name to DNSNames of cert (#140) 2018-10-29 11:16:33 -07:00
Gregory Haynes 594df37bfd Add support for StrategicMergePatch to duck (#145)
K8s fake clients only support StrategicMergePatches so we should be
creating patches in this format.

Fixes #144
2018-10-26 17:06:32 -07:00
Martin Gencur 7528f768d9 Check error condition when setting default kubeconfig (#142)
* avoid segmentation fault when the user is not returned correctly
2018-10-26 09:17:32 -07:00
Adam Harwayne 79a09989e6 Make Channelable match the definition in https://github.com/knative/eventing/pull/482. (#134) 2018-10-26 09:13:32 -07:00
Matt Moore 5c809f170b Add logic to check the licenses of our common package (#135)
* Add logic to check the licenses of our common packages.

* Update test-infra.

* Fix the test-infra vendor
2018-10-25 17:37:31 -07:00
akyyy a935e6aaa6 fix flaky test (#138) 2018-10-25 14:44:32 -07:00