Skip to content

Commit

Permalink
Setup cloudscale client
Browse files Browse the repository at this point in the history
  • Loading branch information
bastjan committed Oct 15, 2024
1 parent 7c25a82 commit 7b58254
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ package main

import (
"flag"
"fmt"
"os"
"runtime/debug"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v5"
configv1 "github.com/openshift/api/config/v1"
apifeatures "github.com/openshift/api/features"
machinev1 "github.com/openshift/api/machine/v1beta1"
Expand Down Expand Up @@ -138,7 +141,18 @@ func runManager(metricsAddr, probeAddr, watchNamespace string, enableLeaderElect
os.Exit(1)
}

machineActuator := machine.NewActuator(machine.ActuatorParams{})
versionString := "unknown"
if v, ok := debug.ReadBuildInfo(); ok {
versionString = fmt.Sprintf("%s (%s)", v.Main.Version, v.GoVersion)
}

cs := cloudscale.NewClient(nil)
cs.UserAgent = "machine-api-provider-cloudscale.appuio.io/" + versionString
cs.AuthToken = os.Getenv("CLOUDSCALE_API_TOKEN")

machineActuator := machine.NewActuator(machine.ActuatorParams{
K8sClient: mgr.GetClient(),
})

if err := capimachine.AddWithActuator(mgr, machineActuator, featureGate); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Machine")
Expand Down

0 comments on commit 7b58254

Please sign in to comment.