Commit Graph

123 Commits

Author SHA1 Message Date
Dave Protasowski 5671699f23
drop the dynamic type (#2750) 2023-05-31 07:39:36 +00:00
Dave Protasowski 52ff2acf87
drop dynamic client wrappers (#2744) 2023-05-19 20:05:15 +00:00
Chmouel Boudjnah bd3cf5174f
Printf log message with the right type when showing port (#2709)
This will show up like this in the log

13:35:17 Probes server listening on port %!s(int=8080)

with proper type casted it will look a bit better !

Signed-off-by: Chmouel Boudjnah <chmouel@chmouel.com>
2023-03-29 14:15:01 +00:00
Stavros Kontopoulos 4a80605786
Add health checks (#2671)
* add health checks

* updates

* make probes more flexible

* simplify

* minor

* internal only

* fixes
2023-02-15 23:38:50 +00:00
Dave Protasowski 8532ae0645
update OWNERS files to use teams with active members (#2672)
* update OWNERS files to use teams with active members

* add eventing-wg leads as approvers to /apis
2023-02-06 16:58:45 +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
Jonathan Innis 6ce976ce92
Default observability config if nil (#2614) 2022-10-25 20:08:56 +00:00
Kenny Leung b812affa38
Support fetching observability from ctx. (#2610)
* add option to load observability config from ctx

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

* comments and tests

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

* undo

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

* move observability setup logic into function to match logger

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

* fix arg

Signed-off-by: Kenny Leung <kleung@chainguard.dev>

Signed-off-by: Kenny Leung <kleung@chainguard.dev>
2022-10-14 16:45:53 +00:00
Sascha Schwarze 5f66ecf267
Allow configuration of threads-per-controller (#2567) 2022-09-14 15:47:04 +00:00
Matt Moore af54d7330b
Support fetching configs from `ctx`. (#2505)
* Support fetching configs from `ctx`.

This enables callers of `sharedmain` to infuse `ctx` with a `logging.Config` or `leaderelection.Config` instead of relying on the API server for it.

* Move context methods into appropriate packages, drop stutter
2022-05-03 15:25:57 +00:00
Nghia Tran 3a4cc56708
Add configmap informer factory (#2466) 2022-03-15 17:29:59 -07:00
Dave Protasowski 80c511aa34
Wait for reconciler/controllers to return prior to exiting the process (#2437) 2022-02-22 13:12:04 -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
Dave Protasowski 785eb637f6
switch to klog/v2 (#2386) 2022-01-11 13:02:14 -08:00
Pierangelo Di Pilato d82be484e4
Disable controllers using a command-line flag (#2339)
* Disable controllers using a flag

This patch allows disabling controllers when using a new `Main` function
called `MainNamed` which takes a list of `NamedControllerConstructor`.

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

* Apply reviews

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

* Add comments, split filter and conversion

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

* Allocate len(ctors)

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

* to disable -> disabling

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
2021-11-16 13:30:53 -08:00
Matt Moore 819d556cda
Allow configuring bounded staleness for dynamic injection. (#2323)
Unfortunately the lister interfaces didn't plumb through `ctx` so
this is slightly more complex than I'd have liked.  Instead of
threading the `resourceVersion` (bounded-staleness) through `ctx`
it is stored on the lister implementation.

It is seeded with `injection.WithResourceVersion` (ideally this
would have been all we needed, w/o state), and this state can be
updated by calling `SetResourceVersion`.

The stored `resourceVersion` is passed via `FooOptions` to `Get`
and `List` calls.

Fixes: a long-standing `TODO(mattmoor)`
2021-10-25 08:17:38 -07:00
Dave Protasowski fa2f8f1955
drop fake dynamic client workaround (#2310)
the upstream changes have merged
2021-10-13 08:28:48 -07: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
Matt Moore 7b5ecbc0e4
Sketch out an alternate way of injecting clients/informers (#2210)
* This commit contains the actual changes to support dynamic client injection.

* Incorporate n3wscott review nits

* This includes the code-generation for the dynamic client-based injection.

This also includes a number of manually created files of the form `*_expansion.go`, which are needed to satisfy some of the Kubernetes manual type "expansions".  At present, these are all simply `panic("NYI")`, but may become more than that in the future.
2021-08-18 06:52:08 -07:00
Ben Moss 7d1b0f19ef
Add ability to filter objects on injection controller promotion (#2180)
Currently we enqueue every object with no way to filter, which causes
problems for eventing's source controller which reconciles duck CRDs.
2021-07-13 10:55:50 -07:00
Markus Thömmes a1bc850346
Print proper warning logs from API warnings (#2168) 2021-06-24 05:13:45 -07:00
Dave Protasowski eaa823c765
bump k8s to v1.20.7 (#2145)
* bump k8s deps to v1.20.7

* fix migrator test pkg

* dynamicclient now expects List types to be declare either via a scheme or manually

* fix error message comparison

* drop excess vendor licenses

* Using the injection fake dynamic client will preserve pre-1.20 behaviour

This is accomplished by preprocessing the scheme/fixtures and declaring
a custom scheme were we map our types & lists to unstructured.* types

* revert webhook factory changes

* ensure objects to the dynamic client are unstructured

* seed the default dynamic client with k8s scheme

* include duckv1 types in default fake dynamic client scheme

* use default k8s scheme
looks like eventing adds to this scheme but we should import the correct one vs the one from the  fake package

* drop duckv1 from default scheme

* set APIVersion/Kind if empty

* refactor ToUnstructured helper to a new package
2021-06-10 06:56:43 -07:00
Dave Protasowski 47dfdcfaed
consolidate k8s flags to an environment package (#2133)
* consolidate k8s flags to an environment package

* add copyright

* fix comment style

* use go1.16 in workflows so downstream tests work

* Deprecate GetRESTConfig and do not remove

* update copyright date
2021-05-28 13:30:30 -07:00
Markus Thömmes 4a09d5ef1a
Simplify loading of local kubeconfig in sharedmain (#2079) 2021-04-06 09:48:39 -07:00
Markus Thömmes bbe0bb3eb1
Implement getter machinery to generically fetch all injected clients (#2054) 2021-03-10 09:35:25 -08:00
qibobo 1bbf0a6436
add LabelSelector to InformerFactory so that the informers only list and watch resources with the given labels (#1940)
* add  filtered InformerFactory and informers which only list and watch resources with the given labels

* rename to RegisterFilteredInformers

* generated files

* typo

* update per comments

* rename file

* rm old files
2021-01-19 08:21:23 -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 e2d6b4f845
Try splitting configmap package (#1851) 2020-12-22 13:58:04 -08:00
Gallardot 6d905b3f84
expose loggingconfig last error (#1373) 2020-10-29 05:22:34 -07:00
Markus Thömmes 565516e224
Add errorlint and fix all existing issues (#1855) 2020-10-29 01:14:35 -07:00
Markus Thömmes 19995cd8e1
Simplify defaulting and force-default kubeconfig location in tests (#1822) 2020-10-20 07:37:58 -07:00
Scott Nichols fc447086b7
Remove re-definition of kubeconfig from pkg/test (#1820)
* pull flags from injection

* lint

* trim T interface, use flagset
2020-10-19 16:30:58 -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
Scott Nichols 5a5f68637e
use k8s.interface (#1808)
* use k8s.interface

* start to remove test client

* don't use test/KubeClient
2020-10-14 09:51:31 -07:00
Julian Friedman bcdd7509c0
Use default no-op logger for maxprocs (#1801)
Set uses a no-op logger by default, so no need to explicitly pass one.
2020-10-13 01:39:30 -07:00
Victor Agababov a04d64c180
Shush autogomaxproc. (#1800)
* Shush autogomaxproc.

I am not as sure about this change, but those logs are not following the standard formt
and given we need to inject the logger in init() makes this next to impossible.

Corollary, is that we set cpu limits on all our binaries, except QP, so it only mattered there
since otherwise the package logs nothing.

* m
2020-10-12 19:13:30 -07:00
Victor Agababov e3b4e9c229
Step I: move memstats to metrics (#1799)
step II: update deps (serving and eventing)
step: III: remove from shared main

For https://github.com/knative/serving/issues/9787
2020-10-12 15:14:17 -07:00
Pierangelo Di Pilato 1a4c99a865
Allow override QPS and Burst via flag (#1778)
* Allow override QPS and Burst via flag.

Add `--kube-api-qps` and `--kube-api-burst` command-line flags
to control client QPS and Burst respectively.

The default value is set to 0 to keep backward compatibility.

Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>

* Inline validation functions

Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
2020-10-07 10:06:21 -07:00
Scott Nichols 46761ba7c3
Put EnableInjectionOrDie back on the main path (#1772)
* put EnableInjectionOrDie back on the main path

* nil check pointer type

* move enable injeciton out of sharedmain

* lint

* nit picking fmt....

* add documentation

* feedback cleanup

* injection.GetRESTConfig

* redirect code that moved:
2020-10-06 16:58:20 -07:00
Victor Agababov 247841408e
Apply the cleanup to the pkg (#1776)
* Apply the cleanup to the pkg

This is probably the final iteration of my cleanup application.

* codegen

* one more try
2020-10-05 21:41:20 -07:00
Zhongduo Lin (Jimmy) ea7374e811
Delay start of informers in sharedmain (#1767)
The EnableInjectionOrDie starts informers immedidately in a go
routine, which changes the order of informer start and controller
setup. As a result setting resync period to informer handler will
be ignored as the informer is already started. Though this will
likely affect more components, changing the EnableInjectionOrDie
function will break the API, so this is a temporary solution to
fix all the controllers depending on sharedmain.
2020-10-03 10:57:33 -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
Victor Agababov ec3e2dd4bd
Inject the pod name into logger when provided in the envvars (#1714)
Deployments that are H(P)A need to provide the pod name envvar via downward api.
Activator and QP are already doing this.
2020-09-17 14:47: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
Markus Thömmes d21012af55
Deprecate --master flag in favor of --server. (#1693)
* Deprecate --master flag in favor of --server.

* Actually just drop the flag altogether.
2020-09-09 09:57:50 -07:00
chen zhengwei 2fee224e95
Fix some comments in main.go (#1685) 2020-09-03 20:57:31 -07:00
Scott Nichols 2335e4d84a
Adding an easy entry method next to sharedmain to allow for utilities to leverage injection without being a controller. (#1658) 2020-08-28 13:08:07 -07:00
Adam Harwayne 530eac8757
Inject the config into the context. (#1610) 2020-08-11 16:18:05 -07:00
Julian Friedman 095ff27da6
Automatically set GOMAXPROCS using automaxprocs library (#1585) 2020-08-10 02:00:30 -07:00