-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tiltrun: use apiserver data model in exit controller
This is the first increment towards moving towards a reconciler; the controller uses the API server `TiltRun` data model internally now and updates it, so it can be accessed externally: ``` KUBECONFIG=$(tilt alpha kubeconfig-path) kubectl describe tiltrun Tiltfile ```
- Loading branch information
Showing
13 changed files
with
1,076 additions
and
605 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 |
---|---|---|
@@ -1,8 +1,40 @@ | ||
package exit | ||
|
||
type Action struct { | ||
ExitSignal bool | ||
ExitError error | ||
import ( | ||
"errors" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
|
||
"github.com/tilt-dev/tilt/internal/store" | ||
tiltruns "github.com/tilt-dev/tilt/pkg/apis/core/v1alpha1" | ||
) | ||
|
||
type TiltRunUpdateStatusAction struct { | ||
ObjectMeta *metav1.ObjectMeta | ||
Status *tiltruns.TiltRunStatus | ||
} | ||
|
||
var _ store.Summarizer = TiltRunUpdateStatusAction{} | ||
|
||
func (a TiltRunUpdateStatusAction) Summarize(summary *store.ChangeSummary) { | ||
summary.TiltRuns.Add(types.NamespacedName{Namespace: a.ObjectMeta.Namespace, Name: a.ObjectMeta.Name}) | ||
} | ||
|
||
func NewTiltRunUpdateStatusAction(tiltRun *tiltruns.TiltRun) TiltRunUpdateStatusAction { | ||
return TiltRunUpdateStatusAction{ | ||
ObjectMeta: tiltRun.ObjectMeta.DeepCopy(), | ||
Status: tiltRun.Status.DeepCopy(), | ||
} | ||
} | ||
|
||
func (Action) Action() {} | ||
func (TiltRunUpdateStatusAction) Action() {} | ||
|
||
func HandleTiltRunUpdateStatusAction(state *store.EngineState, action TiltRunUpdateStatusAction) { | ||
if action.Status.Done { | ||
state.ExitSignal = true | ||
if action.Status.Error != "" { | ||
state.ExitError = errors.New(action.Status.Error) | ||
} | ||
} | ||
} |
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.