Commit Graph

989 Commits

Author SHA1 Message Date
Chi Zhang 3afddc40ce
Do not hardcode knative in test/prow library (#1344)
* do not hardcode knative in test/prow library

* fix unit test
2020-05-19 07:23:57 -07:00
Markus Thömmes 60f4ae1dbe
Use config map parsing lib and enhance it further. (#1335)
* Use config map parsing lib and enhance it further.

* Unexport test struct values.

* Migrate tracing config too.

* Use sample-rate.
2020-05-18 10:42:06 -07:00
Jihui Nie 3c29a1ce89
Add helper function to read webhook port number from env var (#1162)
* Add helper function to read port number from env var

* Add check for port == 0

* Add the unit test

* Update error message

Co-Authored-By: savitaashture <sashture@redhat.com>

* Panic when env var is set but invalid

* Rename the func to be PortFromEnv.

* Apply suggestions from code review on error message

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Join defers

Co-authored-by: savitaashture <sashture@redhat.com>
Co-authored-by: Victor Agababov <vagababov@gmail.com>
2020-05-16 18:43:02 -07:00
Victor Agababov 148827986b
reconcile owners (#1342) 2020-05-16 13:26:02 -07:00
Nghia Tran 89c9ab7268
Move knative.dev/serving/pkg/pool to knative.dev/pkg/pool. (#1341) 2020-05-16 13:13:01 -07:00
Victor Agababov 1ceb875570
Fix \" escaping and other nits in the pkg (#1339) 2020-05-16 09:36:02 -07:00
Yanwei Guo f1c51d6830
Delete nit check log (#1340)
* do not record for empty metric config

* Revert "do not record for empty metric config"

This reverts commit 539a5e4dbb.

* delete
2020-05-16 09:00:02 -07:00
Victor Agababov f6cfa4c47c
Clean context.TODO in pkg and other minor nits (#1337)
- TODO is for migration, we know we want background there
- other nits
2020-05-15 10:58:02 -07:00
Victor Agababov 4419e613c1
Add a constant with default shutdown wait time (#1338)
We have in situ constants, which are not always consistent.
2020-05-15 10:47:01 -07:00
Matt Moore 58d464a29e
[master] Auto-update dependencies (#1336)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-05-15 09:24:02 -07:00
Yanwei Guo 16d7b96341
Print nil check log only once (#1334)
* do not record for empty metric config

* Revert "do not record for empty metric config"

This reverts commit 539a5e4dbb.

* delete

* log once

* remove space
2020-05-14 17:25:00 -07:00
coryrc 5e72dd0f3f
Library for writing interactive "shell script" in Go (#1332)
* Library for writing interactive "shell script" in Go

Advance knative/test-infra#2063

Already used elsewhere

* address most comments

* Address more comments
2020-05-14 14:58:00 -07:00
Martin Gencur e80bcb7e66
Functions common to HA tests (#1259)
* Functions common to HA tests

* Fix format errors

* More robust GetEndpoints function

* Do not use listOptions in getting endpoints

* re-use more existing code

* Fix format

* Rename GetLeader to WaitForNewLeader

* Fix fmt

* Simplify WaitForPodDeleted

* Remove span from WaitForChangedEndpoints
2020-05-14 11:11:00 -07:00
Weston Haught db40bcad49
Simplify the krshaped interface, just use k8s interfaces for TypeMeta and ObjectMeta (#1322)
* simplify the krshaped interface

* switch to the runtime.ObjectKind interface

* update example types
2020-05-14 09:47:00 -07:00
Markus Thömmes a43a1b10f2
Add a library to parse config map values. (#1329)
* Add a library to parse config map values.

* Add AsString and comments.

* Add ParseFunc type.
2020-05-14 09:17:00 -07:00
Markus Thömmes c75d324f8b
Code hygiene: Remove unused, use common constructs. (#1320) 2020-05-13 22:20:58 -07:00
Lionel Villard 40ed633032
add source metrics to report general errors and timeout (#1283)
* add source metrics to report general errors and timeout

* some renaming...

* reintroduce constant
2020-05-13 10:29:58 -07:00
Matt Moore ba44ff8d57
[master] Auto-update dependencies (#1330)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-05-13 08:55:58 -07:00
Victor Agababov b10849aacf
Some nits in the genreconciler (#1328)
* Some nits in the genreconciler

- make sure we allocate proper amount of slice space
-  `t:=t` is needed only if you're doing goroutines in the loop
- extract constants outside of the loops.
- reformat

* meh, I was wrong
2020-05-12 12:11:30 -07:00
Weston Haught 2a7c3fd8e2
use our tag parser (#1327) 2020-05-12 10:45:58 -07:00
Weston Haught 00ce2bb1b4
krshaped should be part of genereconciler (#1326) 2020-05-12 08:28:03 -07:00
Yanwei Guo de5c590700
Don't record data points when metric config is not initialized yet (#1323)
* do not record for empty metric config

* Revert "do not record for empty metric config"

This reverts commit 539a5e4dbb.

* dont record

* add comment
2020-05-11 15:34:46 -07:00
Matt Moore a468cb8569
[master] Auto-update dependencies (#1321)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-05-11 09:08:47 -07:00
Matt Moore b52862b1b3
Implement the K8s lifecycle in webhook. (#1318)
* Implement the K8s lifecycle in webhook.

The webhook never properly implemented the Kubernetes SIGTERM/SIGKILL
lifecycle, and doesn't even really support readiness probes today.  This
change enables folks to use a block like this on their webhook container:

```yaml
        readinessProbe: &probe
          periodSeconds: 1
          httpGet:
            scheme: HTTPS
            port: 8443
            httpHeaders:
            - name: k-kubelet-probe
              value: "webhook"
        livenessProbe: *probe
```

With this, the webhook won't report as `Ready` until a probe has succeeded,
and when the SIGTERM is received, we will start failing probes for a grace
period (so our Endpoint drops) before shutting down the webhook's HTTP Server.

This was uncovered by running the webhook across 10 replicas in Serving with
the "Goose" (https://github.com/knative/pkg/pull/1316) enabled for the e2e
tests.  The failure mode I saw was conversion webhook requests failing across
random tests.

This also moves the Serving probe-detection function into PKG.

* Increase the log level when we start to fail probes

* Wait for go routines to terminate on all paths.
2020-05-09 16:44:45 -07:00
Victor Agababov 3a7a787c42
Fix the comment for volatile time (#1315)
And provide a UT and an example how to do this with go-cmp
2020-05-08 10:20:45 -07:00
Antoine Cotten 8930ffb535
Fail reconciliation when event is wrapped (#1289) 2020-05-08 10:09:45 -07:00
Weston Haught b559da3646
Generate common logic for krshaped resources (#1311)
* generate krshaped logic

* add logic to the tag

* Update injection/README.md

Co-authored-by: Matt Moore <mattmoor@vmware.com>

* move var to reconciler

Co-authored-by: Matt Moore <mattmoor@vmware.com>
2020-05-08 10:00:45 -07:00
Jason Hall ae0b7dda87
Document VolatileTime (#1313) 2020-05-08 09:39:45 -07:00
Matt Moore b820699d66
[master] Auto-update dependencies (#1312)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-05-08 08:22:45 -07:00
Yanwei Guo 19b1d7b64d
Add a helper func to set a default metric config for unit tests (#1263)
* do not record for empty metric config

* Revert "do not record for empty metric config"

This reverts commit 539a5e4dbb.

* add a comment

* fix typo

* fix tests

* revert

* revert tests

* revert

* fix conflicts

* one more test file
2020-05-07 21:11:45 -07:00
Victor Agababov 66f1d63f10
Fix logging around pkg (#1310)
- use more performant functions (mostly remove formatters were possible)
- move zap.Error() to the call site, rather than creating a new sugared logger with a key attached (not cheap)
- fix *w usages where the key was not provided.
2020-05-07 15:00:45 -07:00
Yanwei Guo 66c1551b08
Use helper func from metricstest package for the unit test (#1268)
* do not record for empty metric config

* Revert "do not record for empty metric config"

This reverts commit 539a5e4dbb.

* use metricstest package for test
2020-05-07 12:04:45 -07:00
Ian Milligan c0dd593d3f
Ensure that all needed imports are tracked in reconciler generator (#1308) 2020-05-07 07:07:45 -07:00
Victor Agababov 2581370e4a
Add custom object encoders for the set of string and namespaced name (#1309)
* Add custom object encoders for the set of string and namespaced name

In future we might add more (endpoints is a really good candidate)

* switch NN logging

* usage

* nn without ns

* nit
2020-05-06 18:13:44 -07:00
Weston Haught c88f43eed9
Create a common method for processing reconciliation on generic KRShaped (#1284)
* Split KResource into a file. Include an interface.

* Update apis/duck/v1/kresource_type.go

Co-authored-by: Matt Moore <mattmoor@vmware.com>

* type

* rename to KRShaped

* Create common logic for bumping obsgen

* fix typo

* remove interface cast

* missed a spot

* Update to use ObjectMetaAccessor

* switch alias to duckv1

* fix var names

* include a reason

* Switch to preprocess

* rename variable from new to resource

* Create a table style test

* missed a spot

* update deps

* fix nits

* fix gomod deps

* update with new KRshaped

* Update reconciler/reconcile_common_test.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update reconciler/reconcile_common_test.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update reconciler/reconcile_common_test.go

Co-authored-by: Matt Moore <mattmoor@vmware.com>

Co-authored-by: Matt Moore <mattmoor@vmware.com>
Co-authored-by: Victor Agababov <vagababov@gmail.com>
2020-05-06 17:10:44 -07:00
Weston Haught 3769cd27e5
Switch KRShaped interface to retrieve entire condition set (#1307)
* Switch interface to retrieve entire condition set

* fix method under test

* type
2020-05-06 14:53:44 -07:00
Matt Moore 5b98a55816
[master] Auto-update dependencies (#1306)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-05-06 07:28:44 -07:00
Victor Agababov 478962f05e
Properly fix the tests for the client (#1300)
There was a comment on the PR I merged earlier.
To add cmp.diff to the tests,
but when I actually looked, the tests look pretty bleak,
so I beefed them up and used t rather log
2020-05-05 17:17:44 -07:00
Ian Milligan e8bf7b7f98
Do not cd inside update-codegen (#1305)
It should be safe to assume that these scripts are run from within the target repo.
2020-05-05 17:03:45 -07:00
Ian Milligan 99f815e03d
Use go run to run codegen (#1293)
* Update codegen

* Use go run to run codegen
2020-05-05 14:50:44 -07:00
Matt Moore b4e3d02cee
[master] Auto-update dependencies (#1299)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-05-05 14:38:44 -07:00
Weston Haught 1099bd14ba
Include GetTopLevelConditionType for KRShaped (#1298)
* Include GetHappyConditionType for KRShaped

* Rename to GetTopLevelCondition
2020-05-05 14:22:44 -07:00
Matt Moore 3da93ebb24
Properly set hasClass (#1296)
This was changed in #1277
2020-05-05 12:10:44 -07:00
Weston Haught 0605de9264
Make example types KRShaped (#1288)
* make pkg example types KRShaped

* Fix comments

* Switch to the ObjectMeta standard accessor

* Keep pointers around
2020-05-05 10:50:44 -07:00
Victor Agababov 1b41d4f041
Hide metadata as a private (#1292)
* Hide metadata as a private
I am pretty sure it is unused outside of the package.

* also fix test
2020-05-05 09:36:45 -07:00
Matt Moore 4fc2d8ab75
[master] Auto-update dependencies (#1290)
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
2020-05-05 08:42:44 -07:00
Weston Haught 4a2ba059b0
Create an interface for retrieving duck-type fields (#1275)
* Split KResource into a file. Include an interface.

* Update apis/duck/v1/kresource_type.go

Co-authored-by: Matt Moore <mattmoor@vmware.com>

* type

* rename to KRShaped

Co-authored-by: Matt Moore <mattmoor@vmware.com>
2020-05-04 11:09:43 -07:00
Weston Haught 10ba977860
Create our own comment parser for codegen (#1277)
* Adapt our own comment parser

* Use our new comment parser to extract tags

* Update codegen/cmd/injection-gen/generators/comment_parser.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update codegen/cmd/injection-gen/generators/comment_parser_test.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update codegen/cmd/injection-gen/generators/comment_parser.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update codegen/cmd/injection-gen/generators/comment_parser.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update codegen/cmd/injection-gen/generators/comment_parser_test.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update codegen/cmd/injection-gen/generators/packages.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* suggestion didn't compile

* Update codegen/cmd/injection-gen/generators/comment_parser.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* trimspace

* include test for ,,, case

* add empty check

* fix comment

Co-authored-by: Victor Agababov <vagababov@gmail.com>
2020-05-04 09:42:43 -07:00
Chi Zhang f591fc672a
export Client (#1278) 2020-05-04 00:22:43 -07:00
Markus Thömmes 0e0f650dfa
Fix deprecation comment. (#1279) 2020-05-04 00:13:43 -07:00