Documentation
¶
Overview ¶
Package gitops reconciles Git repos of miabi.io/v1 manifests into a workspace by reusing the apply engine.
Index ¶
- Variables
- type Applier
- type Input
- type Service
- func (s *Service) Create(workspaceID uint, in Input) (*models.GitSource, error)
- func (s *Service) Declare(workspaceID, id uint, in apply.GitSourceInput) (*models.GitSource, error)
- func (s *Service) Delete(ctx context.Context, workspaceID, id uint, cascade bool) (*apply.Result, error)
- func (s *Service) DeleteResource(ctx context.Context, workspaceID, id uint, kind, name string) (*apply.Result, error)
- func (s *Service) Diff(ctx context.Context, workspaceID, id uint) (*declarative.Plan, error)
- func (s *Service) Get(workspaceID, id uint) (*models.GitSource, error)
- func (s *Service) IDByUID(uid string) (uint, error)
- func (s *Service) List(workspaceID uint) ([]models.GitSource, error)
- func (s *Service) Reconcile(ctx context.Context, src *models.GitSource) error
- func (s *Service) ReconcileAuto(ctx context.Context) error
- func (s *Service) Remove(ctx context.Context, workspaceID, id uint) error
- func (s *Service) RepositoryNames(workspaceID uint) (map[uint]string, error)
- func (s *Service) SetRestriction(f func(workspaceID uint) error)
- func (s *Service) SetSecrets(v gitrepo.Secrets)
- func (s *Service) Status(workspaceID, id uint) (map[string]string, error)
- func (s *Service) Sync(ctx context.Context, workspaceID, id uint) (*models.GitSource, error)
- func (s *Service) SyncByID(ctx context.Context, id uint) error
- func (s *Service) SyncInBackground(id uint)
- func (s *Service) SyncResource(ctx context.Context, workspaceID, id uint, kind, name string) (*apply.Result, error)
- func (s *Service) Topology(ctx context.Context, workspaceID, id uint) (*apply.Topology, error)
- func (s *Service) Update(workspaceID, id uint, in Input) (*models.GitSource, error)
- func (s *Service) VerifyWebhook(src *models.GitSource, signature string, body []byte) bool
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("git source not found") ErrNameTaken = errors.New("a git source with this name already exists") ErrNameRequired = errors.New("name is required") ErrURLRequired = errors.New("select a git repository (or provide a repository URL)") ErrRepoNotFound = errors.New("git repository not found") )
Functions ¶
This section is empty.
Types ¶
type Applier ¶
type Applier interface {
Apply(ctx context.Context, workspaceID uint, manifests []byte, opts apply.Options) (*apply.Result, error)
ApplyResource(ctx context.Context, workspaceID uint, manifests []byte, opts apply.Options, kind, name string) (*apply.Result, error)
DeleteResource(ctx context.Context, workspaceID uint, kind, name string) (*apply.Result, error)
Teardown(ctx context.Context, workspaceID uint, sourceID string) (*apply.Result, error)
Plan(ctx context.Context, workspaceID uint, manifests []byte, opts apply.Options) (*declarative.Plan, *declarative.ResourceSet, error)
Topology(ctx context.Context, workspaceID uint, manifests []byte, opts apply.Options) (*apply.Topology, error)
LiveTopology(ctx context.Context, workspaceID uint, syncError string) (*apply.Topology, error)
LiveStatus(workspaceID uint) map[string]string
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages GitSource bindings and reconciles them.
func NewService ¶
func NewService(repo *repositories.GitSourceRepository, gitRepos *repositories.GitRepoRepository, applier Applier) *Service
func (*Service) Delete ¶
func (s *Service) Delete(ctx context.Context, workspaceID, id uint, cascade bool) (*apply.Result, error)
Delete with cascade tears down the source's labelled resources first; without it they keep running unmanaged.
func (*Service) DeleteResource ¶ added in v1.6.5
func (s *Service) DeleteResource(ctx context.Context, workspaceID, id uint, kind, name string) (*apply.Result, error)
DeleteResource is recreated by the next auto-sync; scoped to the source so callers can't delete outside it.
func (*Service) Remove ¶ added in v1.10.20
Remove deletes a declared source, tearing its resources down only when its delete policy says cascade.
func (*Service) RepositoryNames ¶ added in v1.10.20
RepositoryNames maps the workspace's Git credential ids to their names.
func (*Service) SetRestriction ¶ added in v1.10.21
func (*Service) SetSecrets ¶ added in v1.7.3
nil allows literal credentials only.
func (*Service) Sync ¶
Sync reconciles a source addressed by workspace+id (manual trigger / webhook).
func (*Service) SyncByID ¶
SyncByID reconciles a source by id without workspace scoping (worker/cron).
func (*Service) SyncInBackground ¶ added in v1.10.20
Start only once the source row is final: the reconcile saves the whole row.
func (*Service) SyncResource ¶ added in v1.6.5
func (s *Service) SyncResource(ctx context.Context, workspaceID, id uint, kind, name string) (*apply.Result, error)
SyncResource does not update the source's sync status: a partial sync isn't a project sync.