Skip to content

Commit

Permalink
Merge pull request #9 from SchSeba/fix_multiple_issues
Browse files Browse the repository at this point in the history
Fix multiple issues
  • Loading branch information
SchSeba authored Apr 9, 2019
2 parents 0994764 + 39b6e8f commit 508de21
Show file tree
Hide file tree
Showing 10 changed files with 264 additions and 733 deletions.
7 changes: 2 additions & 5 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import (
"github.com/go-logr/logr"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/manager"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"

"github.com/K8sNetworkPlumbingWG/kubemacpool/pkg/controller"
"github.com/K8sNetworkPlumbingWG/kubemacpool/pkg/manager"
poolmanager "github.com/K8sNetworkPlumbingWG/kubemacpool/pkg/pool-manager"
"github.com/K8sNetworkPlumbingWG/kubemacpool/pkg/webhook"
)
Expand Down Expand Up @@ -126,10 +126,7 @@ func main() {
go waitForSignal()

log.Info("Setting up manager")
mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: metricsAddr,
LeaderElection: true,
LeaderElectionID: "kubemacpool-mac-election",
LeaderElectionNamespace: "kubemacpool-system"})
mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: metricsAddr})
ExitIfError(err, "unable to set up manager")

log.Info("Setting up controller")
Expand Down
10 changes: 10 additions & 0 deletions pkg/controller/pod/pod_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,15 @@ func (r *ReconcilePolicy) Reconcile(request reconcile.Request) (reconcile.Result
return reconcile.Result{}, err
}

// allocate only when the pod is ready
if instance.Annotations == nil {
return reconcile.Result{}, nil
}

err = r.poolManager.AllocatePodMac(instance)
if err != nil {
log.Error(err, "failed to allocate mac for pod")
}

return reconcile.Result{}, nil
}
321 changes: 0 additions & 321 deletions pkg/manager/internal.go

This file was deleted.

Loading

0 comments on commit 508de21

Please sign in to comment.