Merge pull request #1412 from AustinAbro321/allow-insecure-registry-login
Helm: Allow insecure registry login
This commit is contained in:
commit
014365d0e1
|
@ -1,6 +1,7 @@
|
||||||
name: tests
|
name: tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'CHANGELOG.md'
|
- 'CHANGELOG.md'
|
||||||
|
|
|
@ -171,7 +171,7 @@ func setupRegistryServer(ctx context.Context, workspaceDir string, opts registry
|
||||||
}
|
}
|
||||||
server.dnsServer.PatchNet(net.DefaultResolver)
|
server.dnsServer.PatchNet(net.DefaultResolver)
|
||||||
} else {
|
} else {
|
||||||
server.registryHost = fmt.Sprintf("localhost:%d", port)
|
server.registryHost = fmt.Sprintf("127.0.0.1:%d", port)
|
||||||
}
|
}
|
||||||
|
|
||||||
config.HTTP.Addr = fmt.Sprintf(":%d", port)
|
config.HTTP.Addr = fmt.Sprintf(":%d", port)
|
||||||
|
|
|
@ -162,7 +162,7 @@ func GetClientOpts(ctx context.Context, c client.Client, obj *helmv1.HelmReposit
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
if loginOpt != nil {
|
if loginOpt != nil {
|
||||||
hrOpts.RegLoginOpts = []helmreg.LoginOption{loginOpt}
|
hrOpts.RegLoginOpts = []helmreg.LoginOption{loginOpt, helmreg.LoginOptInsecure(obj.Spec.Insecure)}
|
||||||
tlsLoginOpt := registry.TLSLoginOption(certFile, keyFile, caFile)
|
tlsLoginOpt := registry.TLSLoginOption(certFile, keyFile, caFile)
|
||||||
if tlsLoginOpt != nil {
|
if tlsLoginOpt != nil {
|
||||||
hrOpts.RegLoginOpts = append(hrOpts.RegLoginOpts, tlsLoginOpt)
|
hrOpts.RegLoginOpts = append(hrOpts.RegLoginOpts, tlsLoginOpt)
|
||||||
|
|
|
@ -206,7 +206,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
||||||
"password": []byte("pass"),
|
"password": []byte("pass"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
loginOptsN: 2,
|
loginOptsN: 3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "without caFile",
|
name: "without caFile",
|
||||||
|
@ -225,7 +225,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
||||||
"password": []byte("pass"),
|
"password": []byte("pass"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
loginOptsN: 1,
|
loginOptsN: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "without cert secret",
|
name: "without cert secret",
|
||||||
|
@ -239,7 +239,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
||||||
"password": []byte("pass"),
|
"password": []byte("pass"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
loginOptsN: 1,
|
loginOptsN: 2,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
@ -280,7 +280,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
||||||
}
|
}
|
||||||
if tt.loginOptsN != len(clientOpts.RegLoginOpts) {
|
if tt.loginOptsN != len(clientOpts.RegLoginOpts) {
|
||||||
// we should have a login option but no TLS option
|
// we should have a login option but no TLS option
|
||||||
t.Error("registryTLSLoginOption() != nil")
|
t.Errorf("expected length of %d for clientOpts.RegLoginOpts but got %d", tt.loginOptsN, len(clientOpts.RegLoginOpts))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue