Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
controllers: add a cmd controller (#4257)
- Loading branch information
Showing
5 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,30 @@ | ||
package cmd | ||
|
||
import ( | ||
"context" | ||
|
||
ctrl "sigs.k8s.io/controller-runtime" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
type Controller struct { | ||
client.Client | ||
} | ||
|
||
func NewController() *Controller { | ||
return &Controller{} | ||
} | ||
|
||
func (r *Controller) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
return ctrl.Result{}, nil | ||
} | ||
|
||
func (r *Controller) SetClient(client client.Client) { | ||
r.Client = client | ||
} | ||
|
||
func (r *Controller) SetupWithManager(mgr ctrl.Manager) error { | ||
return ctrl.NewControllerManagedBy(mgr). | ||
For(&Cmd{}). | ||
Complete(r) | ||
} |
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,5 @@ | ||
package cmd | ||
|
||
import "github.com/tilt-dev/tilt/pkg/apis/core/v1alpha1" | ||
|
||
type Cmd = v1alpha1.Cmd |
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,7 @@ | ||
package cmd | ||
|
||
import "github.com/google/wire" | ||
|
||
var WireSet = wire.NewSet( | ||
NewController, | ||
) |
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