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
1c72f2b9
Commit
1c72f2b9
authored
Jan 19, 2017
by
Cole Mickens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
azure: acr fix login server
parent
0144fae6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
azure_credentials.go
pkg/credentialprovider/azure/azure_credentials.go
+7
-3
azure_credentials_test.go
pkg/credentialprovider/azure/azure_credentials_test.go
+10
-1
No files found.
pkg/credentialprovider/azure/azure_credentials.go
View file @
1c72f2b9
...
@@ -17,7 +17,6 @@ limitations under the License.
...
@@ -17,7 +17,6 @@ limitations under the License.
package
azure
package
azure
import
(
import
(
"fmt"
"io/ioutil"
"io/ioutil"
"time"
"time"
...
@@ -133,12 +132,17 @@ func (a *acrProvider) Provide() credentialprovider.DockerConfig {
...
@@ -133,12 +132,17 @@ func (a *acrProvider) Provide() credentialprovider.DockerConfig {
return
cfg
return
cfg
}
}
for
ix
:=
range
*
res
.
Value
{
for
ix
:=
range
*
res
.
Value
{
// TODO: I don't think this will work for national clouds
loginServer
:=
getLoginServer
((
*
res
.
Value
)[
ix
])
cfg
[
fmt
.
Sprintf
(
"%s.azurecr.io"
,
*
(
*
res
.
Value
)[
ix
]
.
Name
)]
=
entry
glog
.
V
(
4
)
.
Infof
(
"Adding Azure Container Registry docker credential for %s"
,
loginServer
)
cfg
[
loginServer
]
=
entry
}
}
return
cfg
return
cfg
}
}
func
getLoginServer
(
registry
containerregistry
.
Registry
)
string
{
return
*
(
*
registry
.
RegistryProperties
)
.
LoginServer
}
func
(
a
*
acrProvider
)
LazyProvide
()
*
credentialprovider
.
DockerConfigEntry
{
func
(
a
*
acrProvider
)
LazyProvide
()
*
credentialprovider
.
DockerConfigEntry
{
return
nil
return
nil
}
}
pkg/credentialprovider/azure/azure_credentials_test.go
View file @
1c72f2b9
...
@@ -41,12 +41,21 @@ func Test(t *testing.T) {
...
@@ -41,12 +41,21 @@ func Test(t *testing.T) {
Value
:
&
[]
containerregistry
.
Registry
{
Value
:
&
[]
containerregistry
.
Registry
{
{
{
Name
:
to
.
StringPtr
(
"foo"
),
Name
:
to
.
StringPtr
(
"foo"
),
RegistryProperties
:
&
containerregistry
.
RegistryProperties
{
LoginServer
:
to
.
StringPtr
(
"foo-microsoft.azurecr.io"
),
},
},
},
{
{
Name
:
to
.
StringPtr
(
"bar"
),
Name
:
to
.
StringPtr
(
"bar"
),
RegistryProperties
:
&
containerregistry
.
RegistryProperties
{
LoginServer
:
to
.
StringPtr
(
"bar-microsoft.azurecr.io"
),
},
},
},
{
{
Name
:
to
.
StringPtr
(
"baz"
),
Name
:
to
.
StringPtr
(
"baz"
),
RegistryProperties
:
&
containerregistry
.
RegistryProperties
{
LoginServer
:
to
.
StringPtr
(
"baz-microsoft.azurecr.io"
),
},
},
},
},
},
}
}
...
@@ -73,7 +82,7 @@ func Test(t *testing.T) {
...
@@ -73,7 +82,7 @@ func Test(t *testing.T) {
}
}
}
}
for
_
,
val
:=
range
*
result
.
Value
{
for
_
,
val
:=
range
*
result
.
Value
{
registryName
:=
*
val
.
Name
+
".azurecr.io"
registryName
:=
getLoginServer
(
val
)
if
_
,
found
:=
creds
[
registryName
];
!
found
{
if
_
,
found
:=
creds
[
registryName
];
!
found
{
t
.
Errorf
(
"Missing expected registry: %s"
,
registryName
)
t
.
Errorf
(
"Missing expected registry: %s"
,
registryName
)
}
}
...
...
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