Commit Graph

41 Commits

Author SHA1 Message Date
Dave Protasowski ee1db869c7
Update linter config and address lint warnings/failures (#3068)
* fix whitespace linter

* fix usestdlibvars

* fix staticheck

* ignore spancheck warning

* fix linter perfsprint

* fix nolintlint feedback

* fix nilerr lint checks

* fix misspell

* fix mirror lint

* fix intrange linter

* fix gofumpt linter

* fix gosec linter - ignore warning since default min tls version is 1.3

* fix gocritic linter

* fix whitespace

* fix fatcontext linter

* fix errorlint

* fix errname linter

* fix copyloopvar (go1.22) linter

* fix bodyclose linter

* update linter config

* add script to format code

* fix unit test
2024-06-25 14:49:36 +00:00
Dave Protasowski 8535fcc248
gofumpt the repo (#3067)
* gofumpt the repo

* don't prefix numbers with 0 - otherwise they're octal
2024-06-25 07:27:07 +00:00
Prashant Rewar fef5da99bd
Replace all usages of deprecated wait.PollImmediate with wait.PollUntilContextTimeout (#3004)
Signed-off-by: Prashant Rewar <108176843+prashantrewar@users.noreply.github.com>
2024-04-02 14:44:03 +00:00
navin de3e9cc204
Fixing all deprecated use of sets.String (#2915)
* Fixing all deprecated use of sets.String

* review comments

* Fixing deprecated use of sets.String
2024-01-08 15:21:18 +00:00
Dave Protasowski 44d1d7d978
Go1.19 changes (#2631)
* run goimports

* ignore linter errors for now

* fix boilerplate
2022-11-03 22:34:05 +00:00
Paul Schweigert aad4309963
sets mutating webhook ReinvocationPolicy to ifNeeded (#2472)
Signed-off-by: Paul S. Schweigert <paulschw@us.ibm.com>
2022-06-07 15:53:37 +00:00
Matt Moore 9c7fd8e14f
Introduce `NewContext`, deprecate `NewImplFull`. (#2222)
* Introduce `NewContext`, deprecate `NewImplFull`.

Our generated `NewImpl` methods have long taken `context.Context`, but despite many iterations the forms we expose from our `controller` package never have.  This change contains several elements:
1. Expose a new `NewContext` method that takes `context.Context` in addition to the current `NewImplFull` signature.
2. Call `NewContext` instead of the deprecated `NewImpl` from our generated controller code.
3. Call `NewContext` from all our webhook reconcilers.

* Add a Tracker to controller.Impl to cut down on downstream boilerplate.
2021-08-21 14:00:34 -07:00
Markus Thömmes 35bcd16656
Drop redundant pointers and decoders (#2211) 2021-08-17 02:04:16 -07:00
Markus Thömmes 980a33719a
Fix revive related linting issues (#2131) 2021-05-26 01:10:28 -07:00
Markus Thömmes 40488532be
Drop master references to knative repos (#2050) 2021-03-11 09:48:26 -08:00
Markus Thömmes 4b2ae073fa
Replace deprecated github.com/markbates/inflect with github.com/gobuffalo/flect (#2014) 2021-02-08 05:12:26 -08:00
Dave Protasowski 75d66b5894
preserve the stable webhook logger names we had before (#1994)
* preserve the stable webhook logger names we had before

* pr feedback
2021-01-18 11:25:21 -08:00
Matt Moore f0ea5e6b9c
Use special error type to designate skips. (#1988)
This change introduces a new `controller.NewSkipKey` method to designate certain reconciliations as "skipped".

The primary motivation for this is to squelch useless logging on non-leader replicas, which currently report success with trivial latency.

I have plumbed this through existing reconcilers and the code-gen so most things downstream should get this for free.  In places where a key is observed, I do not mark the reconcile as skipped as the reconciler did some processing for which the awareness of side-effects and reported latency may be interesting.
2021-01-14 14:30:20 -08:00
Markus Thömmes 5f11dd0634
Add smart handling of selectors in webhooks (#1949)
* Add smart handling of selectors in webhooks

This is an alternative fix for #1590. Instead of arbitrarily adding a label from a different project to avoid the reconcilers racing, this adds "smart" handling of the selectors in that labels not inside the knative.dev domain are plainly ignored and our own selectors are added additively.

* Fix formatting

* Fix missing variable usage
2020-12-08 23:38:41 -08:00
Glyn Normington 0d896b5c87
Apply multiple bindings to the same subject (#1925)
* Factor index out of Reconciler

Applying multiple Bindings to the same subject makes the reconciler more
complex, so split out the index handling.

* unexport contents of index.go

* Apply multiple bindings to the same subject

The affected files are actually copyright 2019-2020,
but boilerplate-check fails if this is used. See:
https://github.com/mattmoor/boilerplate-check/issues/22

Fixes https://github.com/knative/pkg/issues/1786
2020-11-26 17:33:35 -08:00
Markus Thömmes d9c4e5c439
Fix a few more occurrences of divisive language (#1902) 2020-11-12 06:41:59 -08:00
Victor Agababov 5807b6f9ee
Fix the error/warn log usage (#1839)
* Fix the error/warn log usage

zap doesn't do this well, when errors are not presented without zap.Error

* nits
2020-10-23 13:06:37 -07:00
Josh Soref b39d5da935
Spelling (#1797)
* spelling: adopted

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: aliased

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: apierrs

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: assignment

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: coexistence

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: commit

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conversions

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: creates

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: custom

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: determine

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: different

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: distribution

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: duplicate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: editing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: endpoint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: environment

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: generate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implementation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: identified

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: ignore

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: indicates

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interface

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interleaved

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: labels

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: label

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: mimic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: namespaced

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: necessary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: organization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: populatable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: prometheus

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: refer

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: reference

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: repetitive

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: response

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: something

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: specable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: spoofing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: synchronized

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: this

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: trailing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unsupported

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: validation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* chore: reviewdog go header boilerplate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-10-18 14:22:57 -07:00
Victor Agababov 1e373a9e5d
take 2 (#1755) 2020-09-29 14:10:29 -07:00
Victor Agababov a371418524
v2 (#1754) 2020-09-29 13:18:29 -07:00
Riccardo Piccoli 27275cae24
add subresource reconciler for bindings BaseReconciler (#1712) 2020-09-18 15:26:45 -07:00
Zbynek Roubalik 2d4efecc6b
bump to k8s 1.18 (#1428)
* bump to k8s 1.18.8

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* plumbing ctx through

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* add more ctx plumbing

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* ctx WithCancel()

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-09-11 07:54:00 -07:00
Scott Nichols b4c9a6da30
do not fight with azure's webhook for webhooks (#1696) 2020-09-09 16:37:51 -07:00
Victor Agababov 08156c67f6
Use slow lane to do global resync (#1528)
* Use slow lane to do global resync

* cmt

* yolo

* yolo v2

* fix log str

* fixes

* publicize things

* renamemove
2020-07-21 13:11:54 -07:00
Victor Agababov acd3f31714
nits (#1529) 2020-07-20 18:44:35 -07:00
Victor Agababov ac02cac99b
Preallocate sets in pkg (#1485) 2020-07-14 00:09:18 -07:00
Matt Moore bfc0cee945
Implement the second wave of per-reconciler leaderelection (#1302)
* Implement the second wave of per-reconciler leaderelection.

Detailed design: https://docs.google.com/document/d/1i_QHjQO2T3SNv49xjZLWlivcc0UvZN1Tbw2NKxThkyM/edit#
Issue: https://github.com/knative/pkg/issues/1181

* incorporate vagababov feedback

* Improve controller.go coverage
2020-06-19 09:47:25 -07:00
Dave Protasowski caa444033b
use crd & webhook v1 APIs (#1391) 2020-06-19 08:43:25 -07:00
Markus Thömmes d29cf98a77
Assorted linting fixes. (#1249)
* Remove unused code.

* Use raw strings to avoid escaping.

* Remove unneeded type conversions.

* Preallocate slices where possible.

* Use semantic equality in psbinding reconciler.
2020-04-28 08:20:51 -07:00
Victor Agababov 5ba6c1d101
Change %v to %w in errors and other nits (#1252)
* Change %v to %w in errors and other nits
Other are things I noticed when fixing the main %v->%w conversion

* fold
2020-04-27 15:04:51 -07:00
Lukas Berk 0e31d66795
Sinkbinding Webhook should label namespace for inclusion (#1208)
* First hack at getting the namespaces of interest to the ps

* Have the webhook label the namespace for inclusion

* Fix unit tests

* Update with feedback

* Add namespace lister, use constants

* Add one more err logging statement
2020-04-21 09:29:36 -07:00
Markus Thömmes c09083a601
Fix a few simple linter warnings: unused code, govet warnings etc. (#1191) 2020-04-06 08:21:20 -07:00
Matt Moore 1893541a0f
Scope the webhook secret informers to the system namespace. (#1158) 2020-03-12 18:29:29 -07:00
Cong Liu 55831d9ef7
Add an option to specify the selector for psbinding webhook. (#1123) 2020-02-24 13:24:08 -08:00
cshou 1cc3c3e852
Update jsonpatch lib that correctly handle object removal (#1078)
* update jsonpatch lib

* add more patch tests for removal
2020-02-12 08:27:22 -08:00
Timur Zununbekov a805892837
Handle wrong apiVersion/kind in SinkBinding subject (#1067)
* Handle case with unavailable subject in psbinding

* Added test for finalizing forbidden subject
2020-02-11 06:09:08 -08:00
Matt Moore 16a2361203 Only intercept types that appear in Bindings. (#1004)
This removes the built-in types from being hard-coded, and we will now only intercept them if they are used in a Binding.
2020-01-22 12:04:24 -08:00
Ville Aikas 7c7512aecf add ability to opt-out of bindings (#970)
* add ability to opt-out of bindings

* I guess a year changed...

* had opt-in / opt-out backwards

* add unit test for contexts, fix comment

* clarify comments

* remove Binding from method/const names since already in bindings package
2020-01-07 08:56:51 -08:00
Markus Thömmes e08acb9512 Remove all occurrences of github.com/pkg/errors. (#888) 2019-12-17 10:41:03 -08:00
Matt Moore 3444316bde Format markdown (#919)
Produced via:
  `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
/assign n3wscott
2019-12-03 09:47:35 -08:00
Matt Moore 891c2876dd Implement a base library for implementing "Pod Spec"-able bindings. (#915)
This PR adds facilities to make it easier to create both components of a Binding
over "Pod Spec"-able resources.  Rather than rehashing it all here, please look
at `./pkg/webhook/psbinding/README.md` for more details.
2019-12-02 08:58:34 -08:00