Documentation
¶
Index ¶
- func ApplicationStateFromApp(app *kappctrlv1alpha1.App) *domain.ApplicationState
- func ApplyApplication(ctx context.Context, c client.Client, app *kappctrlv1alpha1.App) error
- func BuildKappApplication(intent *intent.PackageIntent) (*kappctrlv1alpha1.App, error)
- func DeleteApplication(ctx context.Context, c client.Client, id domain.PackageID) error
- func PackageResultFromApplicationState(state *domain.ApplicationState) *domain.PackageResult
- type ApplicationProvider
- func (p *ApplicationProvider) Execute(ctx context.Context, intent *intent.PackageIntent) (*domain.PackageResult, error)
- func (p *ApplicationProvider) ObserveApplication(ctx context.Context, namespace, name string) (*domain.ApplicationState, error)
- func (p *ApplicationProvider) Teardown(ctx context.Context, id domain.PackageID) error
- type PackageProvider
- func (p *PackageProvider) Execute(ctx context.Context, intent *intent.PackageIntent) (*domain.PackageResult, error)
- func (p *PackageProvider) ObserveApplication(ctx context.Context, namespace, name string) (*domain.ApplicationState, error)
- func (p *PackageProvider) Teardown(ctx context.Context, id domain.PackageID) error
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplicationStateFromApp ¶
func ApplicationStateFromApp(app *kappctrlv1alpha1.App) *domain.ApplicationState
ApplicationStateFromApp derives an ApplicationState from what a kapp App reports about itself. It is the one place the App's conditions are interpreted, shared by the providers and by observers of the App.
kapp-controller reports success as ReconcileSucceeded and failure as a separate ReconcileFailed condition, with the detail in status.usefulErrorMessage. An App that has reported neither is pending.
func ApplyApplication ¶
ApplyApplication server-side applies the App with the blanketops-packages field manager, forcing ownership of any conflicting fields.
func BuildKappApplication ¶
func BuildKappApplication( intent *intent.PackageIntent, ) (*kappctrlv1alpha1.App, error)
BuildKappApplication constructs the kapp-controller App object for a package intent. Pure function: no side effects, no cluster access.
func DeleteApplication ¶
DeleteApplication deletes the kapp App named after the Package. A missing App is not an error.
Deleting an App is not immediate: kapp-controller first removes what the App deployed, as the App's service account. While the App still exists this returns domain.ErrTeardownInProgress, so the caller keeps that service account until a later call finds the App gone.
func PackageResultFromApplicationState ¶
func PackageResultFromApplicationState( state *domain.ApplicationState, ) *domain.PackageResult
PackageResultFromApplicationState translates an observed kapp-controller App state into a domain.PackageResult, explicitly mapping each ApplicationPhase to its corresponding PackagePhase.
Types ¶
type ApplicationProvider ¶
type ApplicationProvider struct {
Client client.Client
Scheme *runtime.Scheme
Log logr.Logger
Recorder events.EventRecorder // optional
}
ApplicationProvider executes a Package via a kapp-controller App. See PackageProvider for the newer implementation with corrected phase mapping.
func NewApplicationProvider ¶
func NewApplicationProvider( c client.Client, scheme *runtime.Scheme, log logr.Logger, rec events.EventRecorder, ) *ApplicationProvider
NewApplicationProvider constructs an ApplicationProvider.
func (*ApplicationProvider) Execute ¶
func (p *ApplicationProvider) Execute( ctx context.Context, intent *intent.PackageIntent, ) (*domain.PackageResult, error)
Execute builds the kapp-controller App for the intent and applies it.
func (*ApplicationProvider) ObserveApplication ¶
func (p *ApplicationProvider) ObserveApplication( ctx context.Context, namespace, name string, ) (*domain.ApplicationState, error)
ObserveApplication fetches the current state of the named App.
type PackageProvider ¶
type PackageProvider struct {
Client client.Client
Scheme *runtime.Scheme
Log logr.Logger
Recorder events.EventRecorder // optional; may be nil
}
PackageProvider executes a Package via a kapp-controller App, replacing ApplicationProvider's older behavior with a corrected phase mapping.
func NewPackageProvider ¶
func NewPackageProvider(c client.Client, scheme *runtime.Scheme, log logr.Logger, rec events.EventRecorder) *PackageProvider
NewPackageProvider constructs a PackageProvider.
func (*PackageProvider) Execute ¶
func (p *PackageProvider) Execute( ctx context.Context, intent *intent.PackageIntent, ) (*domain.PackageResult, error)
Execute builds a kapp App from intent, applies it, observes its resulting state, and translates that into a domain.PackageResult.
func (*PackageProvider) ObserveApplication ¶
func (p *PackageProvider) ObserveApplication( ctx context.Context, namespace, name string, ) (*domain.ApplicationState, error)
ObserveApplication reads the named kapp-controller App and derives its ApplicationState (see ApplicationStateFromApp).
type Provider ¶
type Provider interface {
Execute(ctx context.Context, intent *intent.PackageIntent) (*domain.PackageResult, error)
// Teardown removes what Execute created for the Package. It takes the
// identity only, not an intent, so a Package whose contract no longer
// resolves can still be removed. Idempotent — nothing to delete is not
// an error. While what was created is still being removed it returns
// domain.ErrTeardownInProgress; nil means it is gone.
Teardown(ctx context.Context, id domain.PackageID) error
}
Provider executes a PackageIntent against a concrete backend (e.g. kapp).