Commit Graph

32 Commits

Author SHA1 Message Date
HirazawaUi
3b18e80fb4 delete unused functions in pkg directory 2023-01-16 21:43:36 +08:00
Davanum Srinivas
a9593d634c
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

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
qulifeng
054271445e fix Log attempts to output resp.Body 2021-09-06 23:01:03 +08:00
Kermit Alexander
0dcafb1f37 Add RegistryConfig/RegistryConfigEntry. 2021-03-02 00:08:54 +00:00
Kermit Alexander
42fb89eb89 Move config and provider code out of pkg/credentialprovider and into staging. 2021-03-02 00:07:02 +00:00
Nikolaos Moraitis
b907f9e118 avoid potential secret leaking while reading .dockercfg
There are a lot of scenarios where an invalid .dockercfg file
will still contain secrets. This commit removes logging of the
contents to avoid any potential leaking and manages the actual error
by printing to the user the actual location of the invalid file.

Signed-off-by: Nikolaos Moraitis <nmoraiti@redhat.com>
2020-09-14 15:39:05 +02:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
martin-schibsted
9ba2bd57fb
Improve error message (#82829)
* Improve error message

* Update pkg/credentialprovider/config.go

Co-Authored-By: Jordan Liggitt <jordan@liggitt.net>

Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
2020-03-20 00:02:36 -07:00
zzde
a95d04993a
Fix golint failures in pkg/credentialprovider (#88860)
* Fix golint failures in pkg/credentialprovider

* improve Comment

* test
2020-03-18 20:10:43 -07:00
Oleg Bulatov
5bec54ed5b
fix: padded base64 encoded docker auth field
base64 allows usage of new line characters and some tools use them.
As a result, the length of the encoded string cannot be used to
determine whether it's padded or not.

This patch fixes the regression after #82148.
2019-11-28 17:12:03 +01:00
Benoît Bourbié
a3e434cee4 fix: handling unpadded base64 encoded docker auth field
docker-credential-desk does not pad anymore the auth field.
it is then possible to have unpadded auth field.

field might be encoded either with RawStdEncoding or StdEncoding

we now determine if it is correctly padded in order to handle
both cases.
2019-09-09 21:30:03 -07:00
Claudiu Belu
16da70c249 credentialprovider: Sets homeDirPath to os.UserHomeDir()
Currently, the credential provider will look in the path set in
the $HOME env variable, but that environment does not exist on
Windows, but $HOMEPATH does. Because of this, if credentials are
set in ~/.docker on Windows, they will not be used by kubelet
when pulling images.

The function os.UserHomeDir can solve this problem [1].

[1] https://golang.org/pkg/os/#UserHomeDir
2019-05-25 12:52:32 -07:00
Haiyan Meng
529ac8a2d8
Limit the read length of ioutil.ReadAll in pkg/credentialprovider
Signed-off-by: Haiyan Meng <haiyanmeng@google.com>
2019-04-16 13:59:44 -07:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
guangxuli
032e450ec4 make invocation ReadDockerConfigFile can handle .dockerconfigjson file
only extract ReadSpecificDockerConfigJsonFile from function ReadDockerConfigJSONFile

put error checking and logging in the loop above

godoc gofmt and return dockecfg directly
2016-11-17 09:32:32 +08:00
mbohlool
25afcc5522 Add +optional tag to all fields with omitempty json tag 2016-10-17 08:52:13 -07:00
guangxuli
8a9cfdf86a make function ReadDockerConfigFile more flexible
rename the variable

make parameter more flexible

handle docker config file path

use a single set of paths

delete debug print

gofmt

delete the empty line

comment is not correct

move the comment to the correct place

keep original signature

godoc
2016-10-14 23:23:46 +08:00
David McMahon
ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Rudi Chiarito
ca6bdba014 Allow lazy binding in credential providers; don't use it in AWS yet
This is step one for cross-region ECR support and has no visible effects yet.
I'm not crazy about the name LazyProvide. Perhaps the interface method could
remain like that and the package method of the same name could become
LateBind(). I still don't understand why the credential provider has a
DockerConfigEntry that has the same fields but is distinct from
docker.AuthConfiguration. I had to write a converter now that we do that in
more than one place.

In step two, I'll add another intermediate, lazy provider for each AWS region,
whose empty LazyAuthConfiguration will have a refresh time of months or years.
Behind the scenes, it'll use an actual ecrProvider with the usual ~12 hour
credentials, that will get created (and later refreshed) only when kubelet is
attempting to pull an image. If we simply turned ecrProvider directly into a
lazy provider, we would bypass all the caching and get new credentials for
each image pulled.
2016-03-29 15:39:30 -04:00
Yu-Ju Hong
fd7e323cc6 Revert "Set timeout for accessing credential provider's URL"
This reverts commit 9d3806bceb.
2016-03-04 12:37:30 -08:00
Yu-Ju Hong
9d3806bceb Set timeout for accessing credential provider's URL
This changes sets the timeout and also adds the retry mechanism.
2016-03-01 15:41:16 -08:00
tamnd
906b279080 Support new docker config format for private registries 2015-08-22 15:37:25 +07:00
deads2k
ac2c43fc87 serialize dockercfg with matching auth field 2015-06-05 11:14:10 -04:00
deads2k
72c0709f18 reduce scope of DockerConfigEntryWithAuth 2015-05-19 12:41:03 -04:00
deads2k
be0f2d2930 add dockercfg secret types 2015-05-18 08:25:27 -04:00
Eric Paris
6b3a6e6b98 Make copyright ownership statement generic
Instead of saying "Google Inc." (which is not always correct) say "The
Kubernetes Authors", which is generic.
2015-05-01 17:49:56 -04:00
Mike Danese
33f158073b Check other dirs for .dockercfg 2015-01-27 15:54:20 -08:00
Dawn Chen
0962b86ce3 Remove useless and duplicate call. 2015-01-22 15:00:21 -08:00
Matt Moore
65c246d45a Make credentialprovider less verbose about benign errors.
In particular, a few of the utilities used within the credentialprovider had the pattern:
   glog.Errorf("while blah %s: %v", s, err)
   return nil, err

This change propagates those error message and puts the burden of logging on the caller.

In particular, this allows us to squelch all output during kubelet startup when we are detecting whether certain credentialprovider plugins should even be enabled.

Fixes: https://github.com/GoogleCloudPlatform/kubernetes/issues/2673
2014-12-01 11:54:50 -08:00
Tim Hockin
95a9098311 fix 'go vet' warnings 2014-11-21 09:45:28 +08:00
Clayton Coleman
2afa12073c Do not log an error when file does not exist 2014-11-19 22:04:36 -05:00
Matt Moore
0c5d9ed0d2 Implements a credentialprovider library for use by DockerPuller.
This change refactors the way Kubelet's DockerPuller handles the docker config credentials to utilize a new credentialprovider library.

The credentialprovider library is based on several of the files from the Kubelet's dockertools directory, but supports a new pluggable model for retrieving a .dockercfg-compatible JSON blob with credentials.

With this change, the Kubelet will lazily ask for the docker config from a set of DockerConfigProvider extensions each time it needs a credential.

This change provides common implementations of DockerConfigProvider for:
 - "Default": load .dockercfg from disk
 - "Caching": wraps another provider in a cache that expires after a pre-specified lifetime.

GCP-only:
 - "google-dockercfg": reads a .dockercfg from a GCE instance's metadata
 - "google-dockercfg-url": reads a .dockercfg from a URL specified in a GCE instance's metadata.
 - "google-container-registry": reads an access token from GCE metadata into a password field.
2014-11-17 21:46:54 -08:00