-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3969e1e
commit 05ccc35
Showing
6 changed files
with
648 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package networkconfig | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/openshift/cluster-network-operator/pkg/util/clusteroperator" | ||
|
||
"k8s.io/apimachinery/pkg/types" | ||
"sigs.k8s.io/controller-runtime/pkg/reconcile" | ||
) | ||
|
||
// newDaemonSetReconciler returns a new reconcile.Reconciler | ||
func newDaemonSetReconciler(status *clusteroperator.StatusManager) *ReconcileDaemonSets { | ||
return &ReconcileDaemonSets{status: status} | ||
} | ||
|
||
var _ reconcile.Reconciler = &ReconcileDaemonSets{} | ||
|
||
// ReconcileDaemonSets updates the ClusterOperator.Status according to the states of DaemonSet objects | ||
type ReconcileDaemonSets struct { | ||
status *clusteroperator.StatusManager | ||
|
||
daemonSets []types.NamespacedName | ||
} | ||
|
||
func (r *ReconcileDaemonSets) SetDaemonSets(daemonSets []types.NamespacedName) { | ||
r.daemonSets = daemonSets | ||
} | ||
|
||
// Reconcile updates the ClusterOperator.Status to match the current state of the | ||
// watched DaemonSets | ||
func (r *ReconcileDaemonSets) Reconcile(request reconcile.Request) (reconcile.Result, error) { | ||
found := false | ||
for _, ds := range r.daemonSets { | ||
if ds.Namespace == request.Namespace && ds.Name == request.Name { | ||
found = true | ||
break | ||
} | ||
} | ||
if !found { | ||
return reconcile.Result{}, nil | ||
} | ||
|
||
log.Printf("Reconciling update to DaemonSet %s/%s\n", request.Namespace, request.Name) | ||
r.status.SetFromDaemonSets(r.daemonSets) | ||
|
||
return reconcile.Result{RequeueAfter: ResyncPeriod}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.