Skip to content

Commit

Permalink
Merge pull request #9 from codefresh-io/SAAS-8076
Browse files Browse the repository at this point in the history
support inCluster config
  • Loading branch information
oren-codefresh authored Jul 22, 2020
2 parents ff47677 + 99c6602 commit 1f12718
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.2
1.4.3
9 changes: 8 additions & 1 deletion pkg/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
log "github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubeConfig "k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/clientcmd/api"
Expand Down Expand Up @@ -55,7 +56,12 @@ func goOverContext(options *getOverContextOptions) error {
if e != nil {
message := fmt.Sprintf("Failed to create config with error:\n%s", e)
options.logger.Warn(message)
return e
clientCnf, e = rest.InClusterConfig()
if e != nil {
message = fmt.Sprintf("Failed to create in cluster config with error:\n%s", e)
options.logger.Warn(message)
return e
}
}
options.logger.Info("Created config for context")
host = clientCnf.Host
Expand All @@ -65,6 +71,7 @@ func goOverContext(options *getOverContextOptions) error {
if e != nil {
message := fmt.Sprintf("Failed to create kubernetes client with error:\n%s", e)
options.logger.Warn(message)

return e
}
options.logger.Info("Created client set for context")
Expand Down

0 comments on commit 1f12718

Please sign in to comment.