Commit Graph

100 Commits

Author SHA1 Message Date
Jordan Liggitt
cde3140590 Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Replay of a9593d634c6a053848413e600dadbf974627515f

Kubernetes-commit: 15d9d196476d64482189f00f1cf1a2061aea5b35
2022-11-16 11:39:18 -05:00
Monis Khan
8d6ca3cde1 exec auth: support TLS config caching
This change updates the transport.Config .Dial and .TLS.GetCert fields
to use a struct wrapper.  This indirection via a pointer allows the
functions to be compared and thus makes them valid to use as map keys.
This change is then leveraged by the existing global exec auth and TLS
config caches to return the same authenticator and TLS config even when
distinct but identical rest configs were used to create distinct
clientsets.

Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: e3bffcd28922b24e54cc89c4356c2dc16e778e67
2022-08-24 16:04:19 +00:00
Mike Danese
f624f8e770 add better link for gcp auth plugin doc
Kubernetes-commit: 6a8579d1cd3ddeea6c012a4c0fdb7e32687a83f1
2022-03-21 09:48:27 -07:00
Margo Crawford
28b9e26d5f Remove v1alpha1 of the execcredential
Signed-off-by: Margo Crawford <margaretc@vmware.com>

Kubernetes-commit: 5b690b44d08807c6434a421b0041ef685482d337
2022-03-18 10:16:11 -07:00
Margo Crawford
2b59dabd4c Check whether static cert is already configured in UpdateTransportConfig
- Also update test-cmd.sh to pass a signing ca to the kube controller
  manager, so CSRs work properly in integration tests.

Signed-off-by: Margo Crawford <margaretc@vmware.com>

Kubernetes-commit: f015fd66ce95d02cd66efc263eb9e5441b42a17d
2021-12-07 15:58:46 -08:00
sabbey37
f4bf7599b4 Update azure auth plugin deprecation to warning
Kubernetes-commit: c94b4bb2acd11bc0677eb867e6eff5b36bd205b4
2022-02-01 15:31:10 -05:00
Davanum Srinivas
73f2731e23 Cleanup OWNERS files (No Activity in the last year)
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 497e9c1971c9e7d0193bc6d11503ec4ad527f1d5
2021-12-10 15:18:50 -05:00
Davanum Srinivas
70f09c4943 Check in OWNERS modified by update-yamlfmt.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 9405e9b55ebcd461f161859a698b949ea3bde31d
2021-12-09 21:31:26 -05:00
Monis Khan
d92ef13286 client-go exec: make sure round tripper can be unwrapped
Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: 249aefebe340ce4de4a67446c8b6b43c2121044e
2021-10-29 17:59:52 -04:00
wojtekt
608b5216df Migrate to k8s.io/utils/clock in client-go - part 1
Kubernetes-commit: 950f655bdd19c5af275846cf1940d767a5ec0115
2021-09-15 10:58:56 +02:00
Stephen Augustus
624e6827e6 generated: Run hack/update-gofmt.sh
Signed-off-by: Stephen Augustus <foo@auggie.dev>

Kubernetes-commit: 481cf6fbe753b9eb2a47ced179211206b0a99540
2021-08-12 17:13:11 -04:00
Monis Khan
ef1d5d2691 client-go exec: fix metrics related to plugin not found
These were missed because our tests did not pass in the correct test
data input (the command to execute).

Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: a6ac42082b4d7c0057b52900736bd7fbc2c44241
2021-07-14 12:34:56 -04:00
Monis Khan
e2b531141a Deprecate azure and gcp in-tree auth plugins
With the client-go credential plugin functionality going GA in 1.22,
it is now time to deprecate these legacy integrations.

Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: 6bfaeaf91658835aeea267500299de1c4a35a248
2021-05-20 11:54:16 -04:00
Andrew Keesler
f00874ad93 exec credential provider: update tests+metadata for v1
Signed-off-by: Andrew Keesler <akeesler@vmware.com>

Kubernetes-commit: 20e1c4d7548de0b39a2d70a748ca0b9aab28f631
2021-06-28 10:58:02 -04:00
Andrew Keesler
37ed584bed exec credential provider: InteractiveMode support
The value here is that the exec plugin author can use the kubeconfig to assert
how standard input is treated with respect to the exec plugin, e.g.,
- an exec plugin author can ensure that kubectl fails if it cannot provide
  standard input to an exec plugin that needs it (Always)
- an exec plugin author can ensure that an client-go process will still call an
  exec plugin that prefers standard input even if standard input is not
  available (IfAvailable)

Signed-off-by: Andrew Keesler <akeesler@vmware.com>

Kubernetes-commit: cd83d89ac94c5b61fdd38840098e7223e5af0d34
2021-06-14 17:15:36 -04:00
Ping He
88929e8a2b Azure auth forwarding adal refresh error to tokenSource, fixes error when token refresh fails.
Signed-off-by: Ping He <tdihp@hotmail.com>

Kubernetes-commit: e105611d3a732a5b7bf34cf48f60b5a785181e6f
2021-05-17 22:02:52 +08:00
Andrew Keesler
9edbd9bed3 exec credential provider: don't run exec plugin with basic auth
If a user specifies basic auth, then apply the same short circuit logic
that we do for bearer tokens (see comment).

Signed-off-by: Andrew Keesler <akeesler@vmware.com>

Kubernetes-commit: 9dee2b95c27a9d61c2bade8fe67f120b5853c4d6
2021-05-20 09:17:17 -04:00
c00522440
ca138c86e8 Change time.Now().Sub(x) to time.Since(x) for cleanup
Kubernetes-commit: 878548ceac9c109881c379911b8b0d8fce5ea68e
2021-04-12 10:27:54 +08:00
Monis Khan
4f026b62ab Update auth OWNERS files to only use aliases
Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: bca4993004953041c91ad56e37ef195b32066c27
2021-04-07 10:42:00 -04:00
Davanum Srinivas
3da4c9cb25 Common auth plugins should always be available
Whether `providerless` is present or not, the OIDC plugin
should be available.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: b1e9fc4935e60092b4823bd67e82c4d2bfb1a7fc
2021-03-30 06:09:56 -04:00
Davanum Srinivas
6c816ada5f providerless tag for client-go auth plugins
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 1ac2d6f7fa45616ec968c39e66fbc526809edab7
2021-03-28 20:05:32 -04:00
Andrew Keesler
8aa3e0f684 exec credential provider: add rest_client_exec_plugin_call_total metric
Signed-off-by: Andrew Keesler <akeesler@vmware.com>

Kubernetes-commit: 31eec29b098f790cd96fd6d2441e68938f15363b
2021-02-08 15:20:15 -05:00
Andrew Keesler
149c501b92 exec credential provider: use stdin to detect user interaction
We are not sure why this was stdout, since stdin is what the user uses to pass
information to the exec plugin.

There is a question of backwards compatibility here. Our take is that this is a
bug, and so we are ameliorating behavior instead of breaking behavior. There are
2 main cases to consider with respect to backwards compatibility:

1. an existing exec plugin depended on stdin being hooked up to them if stdout
   was a terminal (e.g., echo foo | client-go-command-line-tool); we believe
   this is an anti-pattern, since the client-go-command-line-tool could be using
   stdin elsewhere (e.g., echo foo | kubectl apply -f -)

2. an existing exec plugin depended on stdin not being hooked up to them if
   stdout was not a terminal (e.g., client-go-command-line-tool >/dev/null);
   hopefully there are very few plugins that have tried to base logic off of
   whether stdin returned EOF immediately, since this could also happen when
   something else is wrong with stdin

We hope to apply a stronger fix to this exec plugin user interaction stuff in a
future release.

Signed-off-by: Andrew Keesler <akeesler@vmware.com>

Kubernetes-commit: aea995c45ff057406b586144e28bd9575162b8df
2021-03-02 14:30:42 -05:00
Stephen Augustus
b13f594878 Fixup golang.org/x/term staticcheck warnings
Errors from staticcheck:
cmd/preferredimports/preferredimports.go:38:2:
  package golang.org/x/crypto/ssh/terminal is deprecated:
  this package moved to golang.org/x/term.  (SA1019)
vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go:36:2:
  package golang.org/x/crypto/ssh/terminal is deprecated:
  this package moved to golang.org/x/term.  (SA1019)
vendor/k8s.io/client-go/tools/clientcmd/auth_loaders.go:26:2:
  package golang.org/x/crypto/ssh/terminal is deprecated:
  this package moved to golang.org/x/term.  (SA1019)

Please review the above warnings. You can test via:
  hack/verify-staticcheck.sh <failing package>
If the above warnings do not make sense, you can exempt the line or
file. See:
  https://staticcheck.io/docs/#ignoring-problems

generated:
- hack/update-internal-modules.sh
- hack/lint-dependencies.sh
- hack/update-vendor.sh

Signed-off-by: Stephen Augustus <foo@auggie.dev>

Kubernetes-commit: d9435800b65d6787beaf061546599d757b8e87c9
2021-03-02 00:14:47 -05:00
Jordan Liggitt
0c5bab64fe Track opened connections with a single tracker per authenticator
Kubernetes-commit: ecbff22ca134bd802127aab2be165d2770a9262a
2021-01-08 12:13:19 -05:00
Marek Siarkowicz
e93788d387 Add datapolicy tags to staging/src/k8s.io/client-go/
Kubernetes-commit: e29c568c4a9cd45d15665345aa015e21bcff52dd
2020-10-29 18:15:52 +01:00
Andrew Keesler
a7ba87c612 exec credential provider: ProvideClusterInfo and kubeconfig shadow
- The main idea here is that we want to 1) prevent potentially large CA
  bundles from being set in an exec plugin's environment and 2) ensure
  that the exec plugin is getting everything it needs in order to talk to
  a cluster.
- Avoid breaking existing manual declarations of rest.Config instances by
  moving exec Cluster to kubeconfig internal type.
- Use client.authentication.k8s.io/exec to qualify exec cluster extension.
- Deep copy the exec Cluster.Config when we copy a rest.Config.

Signed-off-by: Andrew Keesler <akeesler@vmware.com>

Kubernetes-commit: c4299d15d5289768808034676858e76a177eeae5
2020-10-29 13:38:42 -04:00
Monis Khan
9e147f192f exec credential provider: wire in cluster info
Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: f97422c8bd57692f5a1a3aa6dc6abc31051ebc82
2020-05-06 01:01:09 -04:00
Jordan Liggitt
e6a0f4acba Fix int->string casts
Kubernetes-commit: 124a5ddf725c4862520d8619017cac9db7a03522
2020-07-24 11:13:07 -04:00
Anders Eknert
2321e60ec1 Presence of bearer token should cancel exec action
If a bearer token is present in a request, the exec credential plugin should accept that as the chosen method of authentication. Judging by an [earlier comment in exec.go](c18bc7e9f7/staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go (L217)), this was already intended. This would however not work since UpdateTransportConfig would set the GetCert callback which would then get called by the transport, triggering the exec plugin action even with a token present in the request. See linked issue for further details.

See #87369 for further details.

Signed-off-by: Anders Eknert <anders.eknert@bisnode.com>

Kubernetes-commit: b423216a3b781009fb4ec4d5974eeb3f882f9d2d
2020-06-04 00:12:05 +02:00
Andrew Keesler
6b620f1777 exec credential provider: add install hint
This commit adds the ability for users to specify an install hint for
their exec credential provider binary.

In the exec credential provider workflow, if the exec credential binary
does not exist, then the user will see some sort of ugly

  exec: exec: "does-not-exist": executable file not found in $PATH

error message.  If some user downloads a kubeconfig from somewhere, they
may not know that kubectl is trying to use a binary to obtain
credentials to auth to the API, and scratch their head when they see
this error message.  Furthermore, even if a user does know that their
kubeconfig is trying to run a binary, they might not know how to obtain
the binary.  This install hint seeks to ease the above 2 user pains.

Signed-off-by: Andrew Keesler <akeesler@vmware.com>

Kubernetes-commit: 94e2065df2eef3b198942efb156ef6e27abcc6f9
2020-05-20 15:20:20 -04:00
Davanum Srinivas
75fea27a27 switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 442a69c3bdf6fe8e525b05887e57d89db1e2f3a5
2020-04-17 15:25:06 -04:00
ga
b3b874faea [AZURE] t.Fatalf() for nil pointer (#90154)
* [AZURE] t.FatalF() for nil pointer

* [AZURE] t.FatalF() for nil pointer

Kubernetes-commit: cf1b72e4571b69995ce65a659a9b67c867b1d1b0
2020-04-16 14:16:18 +00:00
tianhongw
b13839ec75 fix golint errors in staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc
Kubernetes-commit: 50de627302097bd978191625583302ff420417f3
2020-03-07 22:35:10 +08:00
Weinong Wang
de57c8c011 fix a bug where spn: prefix is unexpectedly added to kubeconfig apiserver-id setting
Kubernetes-commit: 77bd7c8a8b29dced5a06c232485ab6de1306c087
2020-03-31 15:59:37 -07:00
Ping He
a6c937f0cd Azure auth fallback to real auth if refresh token fails, refactor and add more tests.
Signed-off-by: Ping He <tdihp@hotmail.com>

Kubernetes-commit: 26c97fa1b40a7939ca26084c819af4794df34406
2020-03-22 17:04:20 +08:00
Monis Khan
fe48733009 client-go: remove openstack auth plugin
The openstack auth plugin was deprecated in v1.11 in favor of the
"client-keystone-auth" credential plugin.  This change removes the
plugin in v1.19 (eight releases seems more than sufficient notice).

Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: 0beb8ea0fef3556474b3a713a2203d4edbbb4fc2
2020-03-10 15:22:47 -04:00
Weinong Wang
6ece45329e add a flag in azure auth module to omit spn: prefix in audience claim
Kubernetes-commit: c08db5feacc78aeaf104f2c0eb0c4b038fba1df5
2020-01-28 14:29:11 -08:00
Weinong Wang
5494d16ef1 Revert "It fixes a bug where AAD token obtained by kubectl is incompatible with on-behalf-of flow and oidc."
This reverts commit d1480ab49d603d0a95e509b627252ee7af8559ae.

Revert this commit due to incomplete migration path

Kubernetes-commit: 71b2a4cdcc18694387961d119c6ab71772579918
2020-01-23 14:21:33 -08:00
Weinong Wang
b6e5d4b890 It fixes a bug where AAD token obtained by kubectl is incompatible with on-behalf-of flow and oidc.
Kubernetes-commit: d1480ab49d603d0a95e509b627252ee7af8559ae
2019-12-18 20:21:21 -08:00
Monis Khan
98b61416aa kubectl oidc auth-provider: include cluster address in cache key
This change includes the cluster address in the cache key so that
using the same issuer and client ID with different tokens across
multiple clusters does not result in the wrong token being used for
authentication.

Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: 96fe76a9ed4fde16f449995cc698dca3719ed546
2019-12-06 20:26:25 -05:00
Samuel Davidson
41735bf478 Changed Kubelet client and serving cert TTL/Expiry certs to use gaugefunc for calculating time remaining.
Kubernetes-commit: aba0b315269dab469694af7fca879438a7f87e41
2019-12-03 16:01:56 -08:00
Samuel Davidson
775f4ddf38 Added rest client metrics for client TTL and rot. (#84382)
* Added rest client metrics for client TTL and rot.

* Fixed foo bar comment, added nil checks

* Moved rotation observation inside of old cert nil check block

* Fixed rotation age logic.

* fixed BUILD for exec plugin package

* fixed null pointer dereference in exec.go

* Updated metric name, bucket, used oldest cert.

Kubernetes-commit: 9dcb3bfcff2024e4690d70262cad14668b1f2507
2019-11-22 17:29:30 -08:00
danielqsj
0dd469e42b Fix data race in client-go UpdateTransportConfig
Kubernetes-commit: 7518a44b18d8b225a9572f1e0c902776eb4a6eb0
2019-07-18 12:46:03 +08:00
clarklee92
d3a5e5f798 Modify the status code number to HTTP status semantics
Signed-off-by: clarklee92 <clarklee1992@hotmail.com>

Kubernetes-commit: f86f5ee14ef3c8adf9855ce16dcc57beca949719
2019-11-06 00:45:35 +08:00
Xiang Dai
879ff4004d delete all duplicate empty blanks
Signed-off-by: Xiang Dai <764524258@qq.com>

Kubernetes-commit: 36065c6dd717c14e0a90131041e20345a7e5e324
2019-02-22 09:43:51 +08:00
Roy Lenferink
94093d2527 Updated OWNERS files to include link to docs
Kubernetes-commit: b43c04452f3b563473b5c2a765d4ac18cc0ff58f
2019-01-30 20:05:00 +01:00
Andrew Lytvynov
420f3f77fb Implement fmt.Stringer on rest.Config to sanitize sensitive fields
It's very easy to add glog.Info(config) calls for debugging (or actual
logging). In some scenarios those configs will carry sensitive tokens
and those tokens will end up in logs or response bodies.
Leaking of those stringified configs compromises the cluster.

Also implement fmt.GoStringer.

Kubernetes-commit: c9ad1d7339b164dfba0846ec49fa4a52474d3e23
2018-11-02 11:39:14 -07:00
Clayton Coleman
615e8e2492 Make wrapping a client transport more pleasant
Properly wrapping a transport can be tricky. Make the normal case
(adding a non-nil transport wrapper to a config) easier with a helper.
Also enforce a rough ordering, which in the future we can use to
simplify the WrapTransport mechanism down into an array of functions
we execute in order and avoid wrapping altogether.

Kubernetes-commit: 1f590e697ef64812620c787720b4b5942027e4a1
2018-12-27 11:47:50 -05:00
Dong Liu
ba28f5cc8e Fix aad support in kubectl for sovereign cloud
Kubernetes-commit: 092f3988255801ce7a97de5448384c50c400a3a4
2018-12-18 13:50:56 +08:00