File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,13 @@ type ClusterKubeAPIClient struct {
2727func NewClusterKubeAPIClient (ctx context.Context , kubeconfigPath string ) (* ClusterKubeAPIClient , error ) {
2828 kubeClient := & ClusterKubeAPIClient {}
2929
30- kubeconfig , err := clientcmd .BuildConfigFromFlags ("" , kubeconfigPath )
30+ var kubeconfig * rest.Config
31+ var err error
32+ if kubeconfigPath != "" {
33+ kubeconfig , err = clientcmd .BuildConfigFromFlags ("" , kubeconfigPath )
34+ } else {
35+ kubeconfig , err = rest .InClusterConfig ()
36+ }
3137 if err != nil {
3238 return nil , errors .Wrap (err , "error loading kubeconfig from assets" )
3339 }
Original file line number Diff line number Diff line change @@ -36,7 +36,13 @@ const (
3636func NewClusterOpenShiftAPIClient (ctx context.Context , kubeconfigPath string ) (* ClusterOpenShiftAPIClient , error ) {
3737 ocpClient := & ClusterOpenShiftAPIClient {}
3838
39- kubeconfig , err := clientcmd .BuildConfigFromFlags ("" , kubeconfigPath )
39+ var kubeconfig * rest.Config
40+ var err error
41+ if kubeconfigPath != "" {
42+ kubeconfig , err = clientcmd .BuildConfigFromFlags ("" , kubeconfigPath )
43+ } else {
44+ kubeconfig , err = rest .InClusterConfig ()
45+ }
4046 if err != nil {
4147 return nil , errors .Wrap (err , "creating kubeconfig for ocp config client" )
4248 }
@@ -58,7 +64,6 @@ func NewClusterOpenShiftAPIClient(ctx context.Context, kubeconfigPath string) (*
5864 ocpClient .configPath = kubeconfigPath
5965
6066 return ocpClient , nil
61-
6267}
6368
6469// AreClusterOperatorsInitialized Waits for all Openshift cluster operators to initialize
@@ -104,7 +109,6 @@ func (ocp *ClusterOpenShiftAPIClient) IsConsoleRouteAvailable() (bool, error) {
104109 }
105110 }
106111 return false , errors .Wrap (err , "Waiting for openshift-console route" )
107-
108112}
109113
110114// IsConsoleRouteURLAvailable Check if the console route URL is available
You can’t perform that action at this time.
0 commit comments