Skip to content

Commit

Permalink
fix: attach scheme to client for oc infra call
Browse files Browse the repository at this point in the history
updated to attach scheme to client for infra call
updated error message output to bubble up error from single node call

Signed-off-by: ehila <[email protected]>

refactor: moved client AddToScheme to main.go

Signed-off-by: ehila <[email protected]>
  • Loading branch information
eggfoobar committed Feb 7, 2022
1 parent 16174f6 commit 0e34e53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controllers/sriovoperatorconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (r *SriovOperatorConfigReconciler) Reconcile(ctx context.Context, req ctrl.
if errors.IsNotFound(err) {
singleNode, err := utils.IsSingleNodeCluster(r.Client)
if err != nil {
return reconcile.Result{}, fmt.Errorf("Couldn't check the amount of nodes in the cluster")
return reconcile.Result{}, fmt.Errorf("Couldn't get cluster single node status: %s", err)
}

// Default Config object not found, create it.
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"os"

netattdefv1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1"
configv1 "github.com/openshift/api/config/v1"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
"k8s.io/apimachinery/pkg/api/errors"

Expand Down Expand Up @@ -59,6 +60,7 @@ func init() {
utilruntime.Must(sriovnetworkv1.AddToScheme(scheme))
utilruntime.Must(netattdefv1.AddToScheme(scheme))
utilruntime.Must(mcfgv1.AddToScheme(scheme))
utilruntime.Must(configv1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}

Expand Down Expand Up @@ -238,7 +240,7 @@ func createDefaultOperatorConfig(c client.Client) error {
logger := setupLog.WithName("createDefaultOperatorConfig")
singleNode, err := utils.IsSingleNodeCluster(c)
if err != nil {
return fmt.Errorf("Couldn't check the amount of nodes in the cluster")
return fmt.Errorf("Couldn't get cluster single node status: %s", err)
}

enableAdmissionController := os.Getenv("ENABLE_ADMISSION_CONTROLLER") == "true"
Expand Down

0 comments on commit 0e34e53

Please sign in to comment.