Commit Graph

1816 Commits

Author SHA1 Message Date
Knative Prow Robot a637a96a1b
[release-1.3] Take pointer to map in AsOptionalMap for consistency (#2462)
* Take pointer to map in AsOptionalMap for consistency

- Other `As*` functions take pointers.
- It avoids having to initialize the map passed to the function

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Remove double pointer

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* AsOptionalMap -> CollectMapEntriesWithPrefix

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

Co-authored-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2022-03-14 09:56:18 -07:00
Knative Prow Robot 38af013b30
Initialize prefix remapping map to avoid panic (#2459)
A `nil` `target` passed to `AsOptionalMap` causes a panic.

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

Co-authored-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2022-03-10 11:54:47 -08:00
knative-automation 2fdd5f232e
Update actions (#2449)
Signed-off-by: Knative Automation <automation@knative.team>
2022-03-01 10:19:42 -08:00
Dave Protasowski 76a28b066d
set git user name/email prior to merging upstream (#2448) 2022-03-01 07:09:41 -08:00
Pierangelo Di Pilato fe26417344
Allow overriding lease name for a reconciler (#2435)
Add a `map-lease-prefix` prefix for config keys for
`config-leader-election` that is a map from a generated lease prefix
to a new prefix:

```yaml
map-lease-prefix.<component>.<package>.<reconciler_type_name>: <new_prefix>
map-lease-prefix.<component-x>.<package-x>.<reconciler_type_name-x>: <new_prefix>
```

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2022-02-28 11:55:09 -08:00
Todd 9b5c41135d
allow overriding the default grace period of 45 seconds (#2423)
This allows users to configure a faster restart of their
webhook if desired while retaining the current behavior.
2022-02-28 11:40:09 -08:00
Pierangelo Di Pilato 4c2331f26a
Bump golang.org/x/crypto (#2444)
Run:
```
go get -u golang.org/x/crypto/...
./hack/update-deps.sh
```

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2022-02-28 11:21:10 -08:00
knative-automation 708dc1cc48
Update community files (#2443)
Signed-off-by: Knative Automation <automation@knative.team>
2022-02-25 08:11:42 -08:00
knative-automation 062ca30c05
upgrade to latest dependencies (#2433)
bumping knative.dev/hack 0456e8b...e178598:
  > e178598 Update community files (# 157)
  > cf8cbc0 Fix the regex used for matching GitHub Actions files (# 156)
  > a8ef7b6 Skip presubmit tests for .github updates (# 154)

Signed-off-by: Knative Automation <automation@knative.team>
2022-02-24 18:16:41 -08:00
knative-automation 4fcbc1bc12
Update actions (#2434)
Signed-off-by: Knative Automation <automation@knative.team>
2022-02-23 10:09:40 -08:00
Dave Protasowski 80c511aa34
Wait for reconciler/controllers to return prior to exiting the process (#2437) 2022-02-22 13:12:04 -08:00
knative-automation d481724519
Update community files (#2428)
Signed-off-by: Knative Automation <automation@knative.team>
2022-02-17 07:51:12 -08:00
knative-automation 9ea81766b5
Update actions (#2430)
Signed-off-by: Knative Automation <automation@knative.team>
2022-02-17 07:39:13 -08:00
knative-automation 0caafcbeb0
upgrade to latest dependencies (#2429)
bumping knative.dev/hack 7331bb1...0456e8b:
  > 0456e8b Update community files (# 152)
  > b9cb198 Update community files (# 151)
  > 0e30607 Update kntest path after https://github.com/knative/test-infra/pull/3087 (# 150)

Signed-off-by: Knative Automation <automation@knative.team>
2022-02-17 07:28:20 -08:00
Billy Lynch 3b550aff99
changeset: Look in packed-refs file if ref file not found. (#2425)
If you have a lot of refs in a repo, git will eventually start
condensing them into a single file instead of letting them sprawl out in
separate directories on the filesystem. This change lets the changeset
package use the packed-refs file as a fall back in the event that the
ref file is not found.

See https://git-scm.com/docs/git-pack-refs for more details on packed
refs.
2022-02-17 07:28:13 -08:00
Chunyi Lyu 5e98acda85
Make URL compatible with controller-gen (#2431)
- add kubebuilder marker so CRDs using URL could be
generated with controller-gen
- same change but on VolatileTime: https://github.com/knative/pkg/pull/2104
2022-02-17 06:50:12 -08:00
knative-automation 3c00bb0157
Update community files (#2426)
Signed-off-by: Knative Automation <automation@knative.team>
2022-02-15 07:34:00 -08:00
knative-automation fc93ac76d0
upgrade to latest dependencies (#2424)
bumping knative.dev/hack 51a42b2...7331bb1:
  > 7331bb1 rename function (# 149)
  > 9b303d6 Update community files (# 148)
  > 82bfca1 Update community files (# 147)

Signed-off-by: Knative Automation <automation@knative.team>
2022-02-10 12:19:07 -08:00
knative-automation 51be315ed1
Update community files (#2419)
Signed-off-by: Knative Automation <automation@knative.team>
2022-02-02 18:09:20 -08:00
knative-automation b619c92456
Update actions (#2417)
Signed-off-by: Knative Automation <automation@knative.team>
2022-02-02 05:26:33 -08:00
knative-automation bab3d0d472
Update actions (#2413)
Signed-off-by: Knative Automation <automation@knative.team>
2022-02-01 08:39:33 -08:00
Matthias Wessendorf 671e46d0cc
💫 we must use `flags` instead of `pflags`, since this is not working. It seems like pflag.* adds the var to its own flag set, not the one package flag uses, and it doesn't expose the internal flag.Var externally - hence this fix. (#2414)
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
2022-02-01 08:28:38 -08:00
knative-automation 7880fb407b
Update community files (#2412)
Signed-off-by: Knative Automation <automation@knative.team>
2022-02-01 08:28:32 -08:00
Martin Gencur 8681fe2035
Continual tests logging within test scope (#2293)
* Continual tests logging within test scope

* Make ThreadSafeBuffer unexported

* logBuffer private on BackgroundContext

* log the buffer in Setup phase on success as well

* Use AddCaller and Development for actual (non-test) logging

* Highlight background logs

* Initial newline for background logs

* Remove space before Background log end

* Style

* Pass LogConfig instead of Log

* Introduce new typ Configuration.LogConfig that is accepted by the Execute function. This
  type holds the zap logger configuration and a custom build function for producing
  the resulting logger.
* The zap Config can be reused to produce the internal logger for background tests. This
  way the background logger can share most configuration with the main framework logger.
* Keep the Configuration.Log variable for backwards compatibility reasons. It's used when
  no Configuration.LogConfig is defined.
* Modify tests to use a background test logger in Continual/Background tests
  so that we can verify those tests are executed correctly.

* Review changes

* Wrapping logs back to testing.T

* Write background logs before AND after Verify phase

* To prevent losing background logs when the Verify phase calls t.Fail
or t.Skip

* Use InMemoryLogger in setup phase as well

* that's where the logger is passed to tests and its background
operations (e.g. prober)

* Verify background logs for skipped test

* Add TestFailAtBackgroundVerification and rename the test file

* the file now includes more tests for the background verification
phase, not just "skip"

* Simplify verifyBackgroundLogs and remove redundant suffix for logs

* Better zap Config default value

* Override output paths if set to default value

* Do not pass zap.Config by reference

* Trigger checks

Co-authored-by: Chris Suszyński <ksuszyns@redhat.com>
2022-02-01 05:20:31 -08:00
Pierangelo Di Pilato f4b57aef00
Fix invalid creator or lastModifier annotations on core resources (#2409)
When the admission request is for a resource with an empty string as
group, which happens on core resources, the `creator` or `lastModifier`
annotations are invalid since they become `/creator` or
`/lastModifier`.

This patch removes the `/` when group = `""`.

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2022-01-31 06:49:30 -08:00
knative-automation 21b467ba3f
upgrade to latest dependencies (#2406)
bumping knative.dev/hack 9b2ed84...51a42b2:
  > 51a42b2 Update community files (# 146)
  > 81ef5cc Update community files (# 145)
  > cfb3eb8 Enable opting out Preemptible/Spot GKE Worker Nodes (# 144)
  > 9dd1ec1 Look at package name when checking whether the shell package can be used (# 142)
  > f1822b1 Disable Logs/Metrics on GKE and Run Preemptible Nodes (# 138)
  > 32375dc remove clusteradmin grant (# 141)
  > 987528e Temporarily fix the unit tests for library.sh (# 143)
  > da09733 print commit hash (# 140)

Signed-off-by: Knative Automation <automation@knative.team>
2022-01-31 06:38:30 -08:00
knative-automation ca64d3b3ea
Update community files (#2404)
Signed-off-by: Knative Automation <automation@knative.team>
2022-01-29 08:01:48 -08:00
Kenjiro Nakayama 2783cd8cfa
Do not block NotFound error during patching resources (#2403)
storage-version-migration-serving crashes if ksvc deleted during
migration.

Please refer to the following error especially
`services.serving.knative.dev \"receiver261\" not found` message.

```
{"severity":"INFO","timestamp":"2022-01-25T14:17:19.840090884Z","caller":"logging/config.go:116","message":"Successfully created the logger."}
{"severity":"INFO","timestamp":"2022-01-25T14:17:19.840350704Z","caller":"logging/config.go:117","message":"Logging level set to: info"}
{"severity":"INFO","timestamp":"2022-01-25T14:17:19.840399959Z","caller":"logging/config.go:79","message":"Fetch GitHub commit ID from kodata failed","error":"\"KO_DATA_PATH\" does not exist or is empty"}
{"severity":"INFO","timestamp":"2022-01-25T14:17:19.854296148Z","logger":"storage-migrator","caller":"migrate/main.go:60","message":"Migrating 4 group resources"}
{"severity":"INFO","timestamp":"2022-01-25T14:17:19.85439718Z","logger":"storage-migrator","caller":"migrate/main.go:63","message":"Migrating group resource services.serving.knative.dev"}
{"severity":"EMERGENCY","timestamp":"2022-01-25T14:17:47.601002153Z","logger":"storage-migrator","caller":"migrate/main.go:65","message":"Failed to migrate: unable to patch resource kc-broker-newsubs-kn-0/receiver261 (gvr: serving.knative.dev/v1, Resource=services) - services.serving.knative.dev \"receiver261\" not found","stacktrace":"main.main\n\t/opt/app-root/src/go/src/knative.dev/serving/vendor/knative.dev/pkg/apiextensions/storageversion/cmd/migrate/main.go:65\nruntime.main\n\t/usr/lib/golang/src/runtime/proc.go:255"}
```

It could be a rare case but it happens when an user delete their
resource during storage-version-migration-serving is running.

This patch fixes the issue by ignoring the NotFound error during
patching resources.
2022-01-28 06:59:47 -08:00
Chris Suszynski d7b329c360
🐛 Update required Go version to 1.17 to fix #2399 (#2400)
* Update required Go version to fix #2399

* Running `hack/update-deps.sh`
2022-01-26 13:42:46 -08:00
Pierangelo Di Pilato 3ba5d72e31
Don't discard addressable resolver original errors (#2395)
Errors from the tracker or the addressable resolver factory
are discarded which isn't helpful for debugging since the
error is generic `kafkachannels "Lister" not found`.

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2022-01-21 01:23:05 -08:00
knative-automation 77555ea48c
upgrade to latest dependencies (#2398)
bumping knative.dev/hack 59b0cf1...9b2ed84:
  > 9b2ed84 Update community files (# 139)

Signed-off-by: Knative Automation <automation@knative.team>
2022-01-18 08:05:32 -08:00
Dave Protasowski 768f44f3fc
bump our min version to 1.21 (#2397) 2022-01-18 07:11:32 -08:00
knative-automation e989c22732
Update community files (#2393)
Signed-off-by: Knative Automation <automation@knative.team>
2022-01-17 18:57:32 -08:00
Pierangelo Di Pilato 0a429cba1c
Allow Unstructured callback from Defaulting Webhook (#2363)
* Add support for callback defaults

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>

* Put unstr object in ctx and set user info

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>

* Move get callback at the top

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>

* Panic when using delete verb

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>

* Split tests and add callback ctx tests

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>

* Set user info annotations

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>

* Register Webhook Rules from callbacks

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>

* Adapt unstructured objects to apis.HasSpec

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Change json tag name to match struct field name

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2022-01-14 06:18:42 -08:00
knative-automation c0e1594c2f
Update actions (#2392)
Signed-off-by: Knative Automation <automation@knative.team>
2022-01-12 20:59:12 -08:00
Evan Anderson 1db74d0a18
Adjust leaderelection defaults, add documentation. (#2391) 2022-01-12 20:43:12 -08:00
Pierangelo Di Pilato 2b23ad111b
Simplify URI creation in source validation tests (#2389)
Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2022-01-12 10:19:51 -08:00
Dave Protasowski c568527ffc
Fixes #2308 TestSpoofingClient_WaitForEndpointState flake (#2387) 2022-01-11 23:42:50 -08:00
knative-automation b90b853c52
upgrade to latest dependencies (#2388)
bumping knative.dev/hack f08cb0d...59b0cf1:
  > 59b0cf1 Proper search for tags in Go files only (# 135)

Signed-off-by: Knative Automation <automation@knative.team>
2022-01-11 19:13:50 -08:00
Dave Protasowski 785eb637f6
switch to klog/v2 (#2386) 2022-01-11 13:02:14 -08:00
Pierangelo Di Pilato bba447088f
Validate Sink in SourceSpec (#2384)
* Validate Sink in SourceSpec

The `Sink` in `SourceSpec` is required.

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Update apis/duck/v1/source_types.go

Co-authored-by: Pablo Mercado <pablo@triggermesh.com>

Co-authored-by: Pablo Mercado <pablo@triggermesh.com>
2022-01-11 08:24:14 -08:00
knative-automation 80b253f230
upgrade to latest dependencies (#2385)
bumping knative.dev/hack e11ac12...f08cb0d:
  > f08cb0d Fixing issue knative/hack# 136 (# 137)
  > abd085f Update community files (# 131)
  > 6fc0304 Update community files (# 130)
  > 92d8a0a Update community files (# 129)
  > 50bb1cb Update community files (# 128)

Signed-off-by: Knative Automation <automation@knative.team>
2022-01-11 05:44:15 -08:00
knative-automation 96f18522d7
Update actions (#2382)
Signed-off-by: Knative Automation <automation@knative.team>
2022-01-05 13:13:33 -08:00
knative-automation 3f86f595a8
Update community files (#2381)
Signed-off-by: Knative Automation <automation@knative.team>
2022-01-05 13:03:33 -08:00
Matt Moore 52e42b760b
Extend Apply verb to extensions, Bump to K8s 1.22. (#2327)
* Extend Apply verb to extensions, Bump to K8s 1.22.

This was motivated by the linked issue, and does the work to upgrade PKG to 1.22 libs.

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

* 0.22.2 -> 0.22.5
2022-01-04 10:58:30 -08:00
knative-automation 79271798f6
Update community files (#2380)
Signed-off-by: Knative Automation <automation@knative.team>
2021-12-16 06:21:17 -08:00
Pierangelo Di Pilato 552319d4f5
Add nil checks for Source types validation to be pointer receiver based (#2378)
It's better to have nil checks inside the Validate method of the
type itself instead of the type that holds a field of that type
because this allows using the types in other contexts without
the types that hold a field.

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
2021-12-14 22:57:29 -08:00
Julian Friedman fe5b178f35
Tidy helper to avoid need for nosec comment (#2377)
* Tidy helper to avoid need for nosec comment

Currently we fmt.Sprintf a command string only to immediately split it
back in to args, which causes gosec to complain about unsanitised inputs
to exec.Command. Refactoring this to directly pass an args array is
clearer, more secure, and avoids needing the nosec comment.

* Drop helper method
2021-12-14 04:44:51 -08:00
Matthias Wessendorf c3a4928da7
Remove discovery as it was removed from release train... (#2376)
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
2021-12-13 09:02:20 -08:00
knative-automation e86584fd3c
upgrade to latest dependencies (#2375)
bumping knative.dev/hack 813559c...e11ac12:
  > e11ac12 Update community files (# 126)
  > 4ec2223 Update community files (# 124)

Signed-off-by: Knative Automation <automation@knative.team>
2021-12-10 05:24:29 -08:00