@@ -31,6 +31,7 @@ import (
3131 "sigs.k8s.io/controller-runtime/pkg/manager"
3232
3333 "github.com/jetstack/preflight/pkg/internal/cyberark/identity"
34+ "github.com/jetstack/preflight/pkg/internal/cyberark/servicediscovery"
3435 "github.com/jetstack/preflight/api"
3536 "github.com/jetstack/preflight/pkg/client"
3637 "github.com/jetstack/preflight/pkg/clusteruid"
@@ -82,7 +83,9 @@ func Run(cmd *cobra.Command, args []string) (returnErr error) {
8283
8384 var caClient * client.CyberArkClient
8485 {
85- identityClient , err := identity .New (ctx , cfg .MachineHub .Subdomain )
86+
87+ discoveryClient := servicediscovery .New (servicediscovery .WithIntegrationEndpoint ())
88+ identityClient , err := identity .NewWithDiscoveryClient (ctx , discoveryClient , cfg .MachineHub .Subdomain )
8689 if err != nil {
8790 return fmt .Errorf ("while creating the CyberArk identity client: %v" , err )
8891 }
@@ -91,7 +94,7 @@ func Run(cmd *cobra.Command, args []string) (returnErr error) {
9194 if err := identityClient .LoginUsernamePassword (ctx , username , password ); err != nil {
9295 return fmt .Errorf ("while logging in: %v" , err )
9396 }
94- caClient , err = client .NewCyberArkClient (nil , cfg . MachineHub . Subdomain , identityClient .AuthenticateRequest )
97+ caClient , err = client .NewCyberArkClient (nil , os . Getenv ( "ARK_API_URL" ) , identityClient .AuthenticateRequest )
9598 if err != nil {
9699 return fmt .Errorf ("while creating the CyberArk dataupload client: %v" , err )
97100 }
0 commit comments