Skip to content

Commit

Permalink
Add way to set bindata
Browse files Browse the repository at this point in the history
Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
  • Loading branch information
bn222 committed Apr 14, 2024
1 parent 8e89acf commit e071c79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ func main() {
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
var binDataPath string
flag.StringVar(&metricsAddr, "metrics-bind-address", ":18090", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":18091", "The address the probe endpoint binds to.")
flag.StringVar(&binDataPath, "bindata", "./bindata", "bin data path")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
Expand Down Expand Up @@ -94,8 +96,9 @@ func main() {
}

if err = (&controller.DpuOperatorConfigReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
BinDataPath: binDataPath,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "DpuOperatorConfig")
os.Exit(1)
Expand Down
6 changes: 4 additions & 2 deletions internal/controller/dpuoperatorconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
"os"
"path/filepath"

"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/apply"
"github.com/openshift/cluster-network-operator/pkg/render"
Expand All @@ -35,7 +36,8 @@ import (
// DpuOperatorConfigReconciler reconciles a DpuOperatorConfig object
type DpuOperatorConfigReconciler struct {
client.Client
Scheme *runtime.Scheme
Scheme *runtime.Scheme
BinDataPath string
}

//+kubebuilder:rbac:groups=config.openshift.io,resources=dpuoperatorconfigs,verbs=get;list;watch;create;update;patch;delete
Expand Down Expand Up @@ -108,7 +110,7 @@ func (r *DpuOperatorConfigReconciler) ensureDpuDeamonSetRunning(ctx context.Cont
data.Data["DpuOperatorDaemonImage"] = dpuDaemonImage

logger.Info("Ensuring that DPU DaemonSet is running", "image", dpuDaemonImage)
objs, err := render.RenderDir("./bindata/daemon", &data)
objs, err := render.RenderDir(filepath.Join(r.BinDataPath, "/daemon"), &data)
if err != nil {
logger.Error(err, "Failed to render dpu daemon manifests")
return err
Expand Down

0 comments on commit e071c79

Please sign in to comment.