@@ -29,7 +29,6 @@ import (
29
29
"k8s.io/apimachinery/pkg/runtime/schema"
30
30
"k8s.io/apimachinery/third_party/forked/golang/netutil"
31
31
restclient "k8s.io/client-go/rest"
32
- kclientcmd "k8s.io/client-go/tools/clientcmd"
33
32
"k8s.io/kubernetes/pkg/api/legacyscheme"
34
33
kapi "k8s.io/kubernetes/pkg/apis/core"
35
34
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
@@ -158,7 +157,7 @@ type StartBuildOptions struct {
158
157
159
158
Mapper meta.RESTMapper
160
159
BuildClient buildclient.BuildInterface
161
- ClientConfig kclientcmd. ClientConfig
160
+ ClientConfig * restclient. Config
162
161
163
162
AsBinary bool
164
163
ShortOutput bool
@@ -169,11 +168,15 @@ type StartBuildOptions struct {
169
168
}
170
169
171
170
func (o * StartBuildOptions ) Complete (f * clientcmd.Factory , in io.Reader , out , errout io.Writer , cmd * cobra.Command , cmdFullName string , args []string ) error {
171
+ var err error
172
172
o .In = in
173
173
o .Out = out
174
174
o .ErrOut = errout
175
175
o .Git = git .NewRepository ()
176
- o .ClientConfig = f .OpenShiftClientConfig ()
176
+ o .ClientConfig , err = f .ClientConfig ()
177
+ if err != nil {
178
+ return err
179
+ }
177
180
o .Mapper , _ = f .Object ()
178
181
179
182
o .IncrementalOverride = cmd .Flags ().Lookup ("incremental" ).Changed
@@ -716,13 +719,10 @@ func (o *StartBuildOptions) RunStartBuildWebHook() error {
716
719
// when using HTTPS, try to reuse the local config transport if possible to get a client cert
717
720
// TODO: search all configs
718
721
if hook .Scheme == "https" {
719
- config , err := o .ClientConfig .ClientConfig ()
720
- if err == nil {
721
- if url , _ , err := restclient .DefaultServerURL (config .Host , "" , schema.GroupVersion {}, true ); err == nil {
722
- if netutil .CanonicalAddr (url ) == netutil .CanonicalAddr (hook ) && url .Scheme == hook .Scheme {
723
- if rt , err := restclient .TransportFor (config ); err == nil {
724
- httpClient = & http.Client {Transport : rt }
725
- }
722
+ if url , _ , err := restclient .DefaultServerURL (o .ClientConfig .Host , "" , schema.GroupVersion {}, true ); err == nil {
723
+ if netutil .CanonicalAddr (url ) == netutil .CanonicalAddr (hook ) && url .Scheme == hook .Scheme {
724
+ if rt , err := restclient .TransportFor (o .ClientConfig ); err == nil {
725
+ httpClient = & http.Client {Transport : rt }
726
726
}
727
727
}
728
728
}
0 commit comments