Skip to content

Commit

Permalink
Revert title to the state key (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvirsegev authored Aug 20, 2023
1 parent ada6c9b commit 4d2ba8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func main() {
klog.Fatalf("Error building Port client: %s", err.Error())
}

err = integration.NewIntegration(portClient, k8sConfig, stateKey)
err = integration.NewIntegration(portClient, stateKey)
if err != nil {
klog.Fatalf("Error creating K8s integration: %s", err.Error())
}
Expand Down
14 changes: 3 additions & 11 deletions pkg/port/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,16 @@ import (

"github.com/port-labs/port-k8s-exporter/pkg/port"
"github.com/port-labs/port-k8s-exporter/pkg/port/cli"
"k8s.io/client-go/tools/clientcmd"
)

func NewIntegration(portClient *cli.PortClient, k8sConfig clientcmd.ClientConfig, stateKey string) error {

k8sRawConfig, err := k8sConfig.RawConfig()
if err != nil {
return err
}

clusterName := k8sRawConfig.Contexts[k8sRawConfig.CurrentContext].Cluster
func NewIntegration(portClient *cli.PortClient, stateKey string) error {

integration := &port.Integration{
Title: clusterName,
Title: stateKey,
InstallationAppType: "kubernetes",
InstallationId: stateKey,
}
_, err = portClient.Authenticate(context.Background(), portClient.ClientID, portClient.ClientSecret)
_, err := portClient.Authenticate(context.Background(), portClient.ClientID, portClient.ClientSecret)
if err != nil {
return fmt.Errorf("error authenticating with Port: %v", err)
}
Expand Down

0 comments on commit 4d2ba8e

Please sign in to comment.