Commit Graph

867 Commits

Author SHA1 Message Date
Matt Moore e2ee5bed78
Start the webhook before informers sync. (#1180)
* Start the webhook before informers sync.

Some webhooks (e.g. conversion) are required to list resources, so by delaying those until after informers have synced, we create a deadlock when they run in the same process.  This change has two key parts:
1. Start the webhook immediately when our process starts, and issue a callback from sharedmain when the informers have synced.
2. Block `Admit` calls until informers have synced (all conversions are exempt), unless they have been designated by implementing `webhook.StatelessAdmissionController`.

Our built-in admission controllers (defaulting, validation, configmap validation) have all been marked as stateless, the main case where we want to block `Admit` calls is when we require the informer to have synchronized to populate indices for Bindings.

* Add missing err declaration
2020-03-30 18:14:50 -07:00
Victor Agababov f40c61abc6
update the yaml library to new version (#1178)
* update go-cmpt to work with 1.14.

Mostly to fix https://github.com/google/go-cmp/issues/167, but we also pinned at some
random commit, rather than at a release version.

* add new pkg

* Make sure we use same versions in pkg and serving
2020-03-30 16:02:50 -07:00
Scott Nichols 8a6d25b309
Generate reconcilers for resources out of tree. (#1175)
* genreconciler:nonNamespaced

* Adding a force-kinds flag to the reconciler generator to allow us to generate reconcilers for non-owned types.

* force-kinds --> force-genreconciler-kinds

* some minor nits with the generators for non-knative types needed to be removed.

* remove whitespace

Co-authored-by: Nacho Cano <nachoacano@gmail.com>
2020-03-25 11:34:51 -07:00
Matt Moore 079ae277d3
[master] Auto-update dependencies (#1174)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-03-25 07:33:52 -07:00
Ville Aikas 9f9f7bea94
Introduce key/value store interface + cm backed version of it. (#1173)
* simple configstore for saving state in configmaps

* introduce interface, tests

* address pr feedback

* return interface -> add Init to interface
2020-03-24 16:06:09 -07:00
Chi Zhang 0840da9555
add options for cmd (#1170) 2020-03-23 16:16:09 -07:00
Joyce Liu 777b215a64
use boskos to fetch a project if only a project is not specified (#1169) 2020-03-23 12:45:09 -07:00
Victor Agababov aa5b1f2211
update go-cmpt to work with 1.14. (#1167)
* update go-cmpt to work with 1.14.

Mostly to fix https://github.com/google/go-cmp/issues/167, but we also pinned at some
random commit, rather than at a release version.

* add new pkg
2020-03-22 14:03:08 -07:00
Ignacio (Nacho) Cano 381424b197
add CloudEventAttributes to duckv1.SourceStatus (#1165) 2020-03-20 09:08:22 -07:00
Kenjiro Nakayama c13e86e2d4
Add MarkTrueWithReason function to ConditionManager (#1148)
* Add MarkTrueWithReason function to ConditionManager

When using `MarkTrue()` function, it does not allow us to add the reason and message.
Also, if we use `SetCondition()` instead, it does not update the happy condtion.

So, this PR adds new `MarkTrueWithReason(reason, message)` function.

* Make test better

* Add unit test for MarkTrueWithReason

* Rename markHappy with recomputeHappiness
2020-03-19 09:36:06 -07:00
Matt Moore 4507ec91a4
Auto-update dependencies (#1166)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-03-19 09:05:06 -07:00
Matt Moore 42d1b005c8
Auto-update dependencies (#1164)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-03-17 09:22:06 -07:00
Matt Moore be54585f8f
Drop the logic to create missing secrets. (#1154)
This is a carry-over from when this was originally written and we had webhooks and secrets being GC'd due to a bad owner reference.
2020-03-16 11:36:31 -07:00
ian-mi 7cbd0bcc1a
Add JSONTracePred to the zipkin testing package (#1157)
Allows the use of an arbitrary predicate when polling a zipkin trace
ID. Enables the creation of tests in which the number of trace spans
may vary.
2020-03-13 17:04:29 -07:00
Chi Zhang a4c6b47c82
Add a function to parse all env config set by Prow (#1147)
* add a function to parse all env config set by Prow

* fix unit tests

* address comments

* address comments again

* address comments2

* address comments
2020-03-13 14:41:30 -07:00
Matt Moore 2907962d4c
Auto-update dependencies (#1160)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-03-13 08:59:30 -07:00
Matt Moore 1893541a0f
Scope the webhook secret informers to the system namespace. (#1158) 2020-03-12 18:29:29 -07:00
Matt Moore 00f0de3a18
Auto-update dependencies (#1153)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-03-11 12:38:29 -07:00
Victor Agababov a572b9922a
Remove named returns, since they look icky :) (#1151)
In general, imo, it's prettier to return things as is, rather than the pattern that was
there.
Also handle one more error case, which was kind of ignored before (probably in practice
impossible, but idk)
2020-03-10 14:39:29 -07:00
Victor Agababov 507b519649
Fix some nits in the webhook code (#1150) 2020-03-10 10:36:29 -07:00
Martin Gencur 1327ff3179
Configurable SpoofRequestInterval and SpoofRequestTimeout (#942) 2020-03-09 09:59:28 -07:00
Paul Morie d166581448
Mutate `-` to `_` in component names for metrics (#1145) 2020-03-06 14:56:27 -08:00
Knative Prow Robot fc857aa77f
Auto-update dependencies (#1144)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-03-05 16:52:26 -08:00
Knative Prow Robot acb0b0386b
Fix crash looping when leader election config doesn't exist (#1142) 2020-03-05 12:50:25 -08:00
Knative Prow Robot 4e71646b1e
Auto-update dependencies (#1141)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-03-05 10:26:26 -08:00
Knative Prow Robot 312b1be35c
Format markdown (#1139)
Produced via:
  `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-03-04 10:55:54 -08:00
Markus Thömmes 5605ade524
Add filtering to class based controller stubs. (#1133) 2020-03-03 12:57:53 -08:00
Andrew Su 340837e654
Fix typos (#1138)
- implementor -> implementer
- implemnted -> implemented
- "Codify" the kind tag.
2020-03-03 09:59:53 -08:00
Markus Thömmes 52cba6da6d
Generalize SetupFakeContext to be able to serve tests and benchmarks. (#1134) 2020-03-03 08:33:53 -08:00
Matt Moore 73701f1aa5
Add an `--upgrade` flag to `./hack/update-dev.sh` (#1136)
This flag upgrades the list of dependencies that we choose to track at HEAD.
2020-03-02 12:31:52 -08:00
Victor Agababov 2fe8db3000
Add standard pod and container name keys (#1135)
Those are used in many places and thus deserve to be named constants.
First class citizenship for pod name!
2020-02-27 11:38:51 -08:00
Paul Morie ca35cb8791
add leader election support to sharedmain (#1019)
* Add leader election config and to sharedmain

* Add new dependencies

* Extract method for RunLeaderElected

* Make leader election config constructor validate

* Rename leader election files

* Always start profiling server whether component has LE lock or not

* Fix entering unreachable section when leader election is disabled

* Address PR feedback
2020-02-26 14:40:50 -08:00
Matt Moore 3925d38991
Format markdown (#1128)
Produced via:
  `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
/assign n3wscott
/cc n3wscott
2020-02-26 06:55:50 -08:00
Evan Anderson 7af3fab62c
Roll forward #1045 (#1109)
* Revert "Add support for client TLS to pkg/metrics (#1045)"

This reverts commit 945b556708.

* Roll forward "Add support for client TLS to pkg/metrics (#1045)"

Adds support for client TLS certs for opencensus export

* Switch sharedmain to only pass a getter rather than an all-namespace lister.

* Add a TODO about using a cached copy if this generates undue load

* Update deps per build failure.

* Refactor per @anniefu suggestion
2020-02-25 11:42:51 -08:00
Matt Moore d704a0d92b
Auto-update dependencies (#1127)
Produced via:
  `dep ensure -update knative.dev/test-infra`
/assign n3wscott
/cc n3wscott
2020-02-25 09:10:58 -08:00
Matt Moore bb008a5b53
Move map functions to PKG (#1126) 2020-02-24 20:57:50 -08:00
Victor Agababov 14a424af04
Fix the nits leftover from #1118 review (#1124)
Fix the stuff that was not fixed.
2020-02-24 16:43:08 -08:00
coryrc 60e39237f6
Pass verbosity level on to klog (#1118)
* Pass verbosity level on to klog

This was left out of #1022

* Missed capitalization
2020-02-24 13:37:08 -08:00
Cong Liu 55831d9ef7
Add an option to specify the selector for psbinding webhook. (#1123) 2020-02-24 13:24:08 -08:00
Dave Protasowski d771641c91
Fixed #1057 - Rename ConvertUp/Down to ConvertTo/From (#1122) 2020-02-24 09:44:08 -08:00
Dave Protasowski 5bc49f27e6
use interfaces when testing conditions so we don't need versioned methods (#1120) 2020-02-24 09:23:08 -08:00
Scott Nichols 8dc3f910f5
Delete ./test/testgenclient after presubmit is finished. (#1121)
* An oversight left the gen test client around and it is causing issues with other automation that did not gen the test client because of deps changes.

* new better way to test codegen
2020-02-24 09:13:08 -08:00
Mike Petersen a2e3b66654
Renews a webhook cert before it expires (#1101)
* Renews a webhook cert before it expires

* Moved checks out of webhook and into certificate

* Updated error messages and others from review

* Updated error messages and changed time comparison

* Added two tests cases for checking expiration

* Fixed issue with missing "." in webhook.go
2020-02-22 12:33:08 -08:00
Scott Nichols 3a272190c3
Found missing forced packages in injection gen. (#1116)
* ctx

* runtime.object

* update codegen
2020-02-21 13:42:07 -08:00
Matt Moore 3bada55aab
Drops the Serving-specific stats reporter logic from knative/pkg (#1114) 2020-02-21 10:02:07 -08:00
Paul Morie 1d60dd6107
Introduce sharedmain.WebhookMain* (#1084) 2020-02-21 07:25:07 -08:00
Scott Nichols d9a38f13e8
Nil check conditions (#1112)
* Realized a corner case on ordering and False > Unknown states.

* add test with unknown fall through.

* I guess some integartions allow nil happy

* add unit tests for GetMessage and GetReason

* all conditons can be nil.

* Search for unhappy dependents.

* update codegen

* Remove KResource from v1alpha1 ducks.
2020-02-20 11:20:06 -08:00
Scott Nichols d38e1f8bde
Realized a corner case on ordering and False > Unknown states. (#1110)
* Realized a corner case on ordering and False > Unknown states.

* add test with unknown fall through.
2020-02-20 06:55:06 -08:00
Scott Nichols 5c9bc970ce
Clear falied propagation status of the top level condition if cleared. (#1108) 2020-02-19 21:16:06 -08:00
coryrc a81f50a34e
Backend for improving test logging (#1022)
* Create TLogger, bringing leveled logging to tests

Inspired heavily by go-logr, brings leveled logging to tests while
using the highly reliable zap logger backend to fulfill writing to
multiple log files.

Now that metrics logger has been removed, SetupLoggingFlags() is redundant. Moved to test/logging

* Cleanup TLogger and document

Add TLogger.Collect() to support collecting outcomes (either positive
strings or error types) which will be processed in a subtest upon
completion of the currently-running (sub-)test.

StructuredError prints its output in a more-readable form now.

Call-site should now work for .Log/.Logf-using functions.

Use cancel from NewTLogger instead of t.CleanUp()

Use a zapcore SpewEncoder when writing to testing.T

Means even non-json-encodable structs will get printed to the test log
output, while preserving encodable structured output for other log files.

Removed timestamp from printing to t.Log

* Fix the automatically-detected issues

Spelling, codegen, some coverage (coverage of memory_encoder.go should
not be necessary but the coverage tool is broken and needs to be fixed).

* Increase unit test coverage slightly and fix tiny comment

* Set attribute the way the coverage program wants

* Cleanup based on notes

* Comment cleanup and privitize var

* Mistake; left purposely-failing tests enabled

* Reduce long lines

* Consolidate cleanup code; make variable expressive

* Cleanup and bugfix

Failing functions now tested by having an internal constructor
option to skip calls to t.Fail()/t.FailNow().

Fixed some bugs with internal method errorWithRuntimeCheck and added
tests for it.

Address minor typos from comments.

* Tiny name/optimization fixes
2020-02-19 13:57:05 -08:00