Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
2285a7dd
Unverified
Commit
2285a7dd
authored
Sep 25, 2018
by
k8s-ci-robot
Committed by
GitHub
Sep 25, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #68423 from smarterclayton/break_docker_types_on_credential_providre
Remove dependency on docker daemon for core credential types
parents
54dd6e4f
7e398dc3
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
16 deletions
+30
-16
BUILD
pkg/credentialprovider/BUILD
+0
-2
keyring.go
pkg/credentialprovider/keyring.go
+24
-3
keyring_test.go
pkg/credentialprovider/keyring_test.go
+3
-5
provider.go
pkg/credentialprovider/provider.go
+2
-5
helpers.go
pkg/kubelet/dockershim/helpers.go
+1
-1
No files found.
pkg/credentialprovider/BUILD
View file @
2285a7dd
...
@@ -18,7 +18,6 @@ go_library(
...
@@ -18,7 +18,6 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/credentialprovider",
importpath = "k8s.io/kubernetes/pkg/credentialprovider",
deps = [
deps = [
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/github.com/docker/docker/api/types:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
],
],
)
)
...
@@ -31,7 +30,6 @@ go_test(
...
@@ -31,7 +30,6 @@ go_test(
"provider_test.go",
"provider_test.go",
],
],
embed = [":go_default_library"],
embed = [":go_default_library"],
deps = ["//vendor/github.com/docker/docker/api/types:go_default_library"],
)
)
filegroup(
filegroup(
...
...
pkg/credentialprovider/keyring.go
View file @
2285a7dd
...
@@ -25,7 +25,6 @@ import (
...
@@ -25,7 +25,6 @@ import (
"github.com/golang/glog"
"github.com/golang/glog"
dockertypes
"github.com/docker/docker/api/types"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/sets"
)
)
...
@@ -52,17 +51,39 @@ type lazyDockerKeyring struct {
...
@@ -52,17 +51,39 @@ type lazyDockerKeyring struct {
Providers
[]
DockerConfigProvider
Providers
[]
DockerConfigProvider
}
}
// AuthConfig contains authorization information for connecting to a Registry
// This type mirrors "github.com/docker/docker/api/types.AuthConfig"
type
AuthConfig
struct
{
Username
string
`json:"username,omitempty"`
Password
string
`json:"password,omitempty"`
Auth
string
`json:"auth,omitempty"`
// Email is an optional value associated with the username.
// This field is deprecated and will be removed in a later
// version of docker.
Email
string
`json:"email,omitempty"`
ServerAddress
string
`json:"serveraddress,omitempty"`
// IdentityToken is used to authenticate the user and get
// an access token for the registry.
IdentityToken
string
`json:"identitytoken,omitempty"`
// RegistryToken is a bearer token to be sent to a registry
RegistryToken
string
`json:"registrytoken,omitempty"`
}
// LazyAuthConfiguration wraps dockertypes.AuthConfig, potentially deferring its
// LazyAuthConfiguration wraps dockertypes.AuthConfig, potentially deferring its
// binding. If Provider is non-nil, it will be used to obtain new credentials
// binding. If Provider is non-nil, it will be used to obtain new credentials
// by calling LazyProvide() on it.
// by calling LazyProvide() on it.
type
LazyAuthConfiguration
struct
{
type
LazyAuthConfiguration
struct
{
dockertypes
.
AuthConfig
AuthConfig
Provider
DockerConfigProvider
Provider
DockerConfigProvider
}
}
func
DockerConfigEntryToLazyAuthConfiguration
(
ident
DockerConfigEntry
)
LazyAuthConfiguration
{
func
DockerConfigEntryToLazyAuthConfiguration
(
ident
DockerConfigEntry
)
LazyAuthConfiguration
{
return
LazyAuthConfiguration
{
return
LazyAuthConfiguration
{
AuthConfig
:
dockertypes
.
AuthConfig
{
AuthConfig
:
AuthConfig
{
Username
:
ident
.
Username
,
Username
:
ident
.
Username
,
Password
:
ident
.
Password
,
Password
:
ident
.
Password
,
Email
:
ident
.
Email
,
Email
:
ident
.
Email
,
...
...
pkg/credentialprovider/keyring_test.go
View file @
2285a7dd
...
@@ -21,8 +21,6 @@ import (
...
@@ -21,8 +21,6 @@ import (
"fmt"
"fmt"
"reflect"
"reflect"
"testing"
"testing"
dockertypes
"github.com/docker/docker/api/types"
)
)
func
TestUrlsMatch
(
t
*
testing
.
T
)
{
func
TestUrlsMatch
(
t
*
testing
.
T
)
{
...
@@ -505,7 +503,7 @@ func TestLazyKeyring(t *testing.T) {
...
@@ -505,7 +503,7 @@ func TestLazyKeyring(t *testing.T) {
func
TestDockerKeyringLookup
(
t
*
testing
.
T
)
{
func
TestDockerKeyringLookup
(
t
*
testing
.
T
)
{
ada
:=
LazyAuthConfiguration
{
ada
:=
LazyAuthConfiguration
{
AuthConfig
:
dockertypes
.
AuthConfig
{
AuthConfig
:
AuthConfig
{
Username
:
"ada"
,
Username
:
"ada"
,
Password
:
"smash"
,
Password
:
"smash"
,
Email
:
"ada@example.com"
,
Email
:
"ada@example.com"
,
...
@@ -513,7 +511,7 @@ func TestDockerKeyringLookup(t *testing.T) {
...
@@ -513,7 +511,7 @@ func TestDockerKeyringLookup(t *testing.T) {
}
}
grace
:=
LazyAuthConfiguration
{
grace
:=
LazyAuthConfiguration
{
AuthConfig
:
dockertypes
.
AuthConfig
{
AuthConfig
:
AuthConfig
{
Username
:
"grace"
,
Username
:
"grace"
,
Password
:
"squash"
,
Password
:
"squash"
,
Email
:
"grace@example.com"
,
Email
:
"grace@example.com"
,
...
@@ -576,7 +574,7 @@ func TestDockerKeyringLookup(t *testing.T) {
...
@@ -576,7 +574,7 @@ func TestDockerKeyringLookup(t *testing.T) {
// NOTE: the above covers the case of a more specific match trumping just hostname.
// NOTE: the above covers the case of a more specific match trumping just hostname.
func
TestIssue3797
(
t
*
testing
.
T
)
{
func
TestIssue3797
(
t
*
testing
.
T
)
{
rex
:=
LazyAuthConfiguration
{
rex
:=
LazyAuthConfiguration
{
AuthConfig
:
dockertypes
.
AuthConfig
{
AuthConfig
:
AuthConfig
{
Username
:
"rex"
,
Username
:
"rex"
,
Password
:
"tiny arms"
,
Password
:
"tiny arms"
,
Email
:
"rex@example.com"
,
Email
:
"rex@example.com"
,
...
...
pkg/credentialprovider/provider.go
View file @
2285a7dd
...
@@ -22,7 +22,6 @@ import (
...
@@ -22,7 +22,6 @@ import (
"sync"
"sync"
"time"
"time"
dockertypes
"github.com/docker/docker/api/types"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
@@ -40,14 +39,12 @@ type DockerConfigProvider interface {
...
@@ -40,14 +39,12 @@ type DockerConfigProvider interface {
LazyProvide
()
*
DockerConfigEntry
LazyProvide
()
*
DockerConfigEntry
}
}
func
LazyProvide
(
creds
LazyAuthConfiguration
)
dockertypes
.
AuthConfig
{
func
LazyProvide
(
creds
LazyAuthConfiguration
)
AuthConfig
{
if
creds
.
Provider
!=
nil
{
if
creds
.
Provider
!=
nil
{
entry
:=
*
creds
.
Provider
.
LazyProvide
()
entry
:=
*
creds
.
Provider
.
LazyProvide
()
return
DockerConfigEntryToLazyAuthConfiguration
(
entry
)
.
AuthConfig
return
DockerConfigEntryToLazyAuthConfiguration
(
entry
)
.
AuthConfig
}
else
{
return
creds
.
AuthConfig
}
}
return
creds
.
AuthConfig
}
}
// A DockerConfigProvider that simply reads the .dockercfg file
// A DockerConfigProvider that simply reads the .dockercfg file
...
...
pkg/kubelet/dockershim/helpers.go
View file @
2285a7dd
...
@@ -344,7 +344,7 @@ func ensureSandboxImageExists(client libdocker.Interface, image string) error {
...
@@ -344,7 +344,7 @@ func ensureSandboxImageExists(client libdocker.Interface, image string) error {
var
pullErrs
[]
error
var
pullErrs
[]
error
for
_
,
currentCreds
:=
range
creds
{
for
_
,
currentCreds
:=
range
creds
{
authConfig
:=
credentialprovider
.
LazyProvide
(
currentCreds
)
authConfig
:=
dockertypes
.
AuthConfig
(
credentialprovider
.
LazyProvide
(
currentCreds
)
)
err
:=
client
.
PullImage
(
image
,
authConfig
,
dockertypes
.
ImagePullOptions
{})
err
:=
client
.
PullImage
(
image
,
authConfig
,
dockertypes
.
ImagePullOptions
{})
// If there was no error, return success
// If there was no error, return success
if
err
==
nil
{
if
err
==
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment