Documentation ¶
Index ¶
- Constants
- func IsDuplicateReconciler(err error) bool
- func RendererName(org string, repo string) string
- func SetTakeOverAnnotations(m *v1alpha1.ManifestSync, pause time.Duration) error
- type DuplicateReconciler
- type Item
- type Manager
- type Reconciler
- type RenderEvent
- type Renderer
- type RepoController
- type Syncer
- type SyncerOption
Constants ¶
const (
// RendererCheckName is the name "hydros-ai" name of the check run to use for the renderer
RendererCheckName = "hydros-ai"
)
Variables ¶
This section is empty.
Functions ¶
func IsDuplicateReconciler ¶
func RendererName ¶
func SetTakeOverAnnotations ¶ added in v0.0.5
func SetTakeOverAnnotations(m *v1alpha1.ManifestSync, pause time.Duration) error
SetTakeOverAnnotations sets the takeover annotations on the manifest.
Types ¶
type DuplicateReconciler ¶
type DuplicateReconciler struct {
Name string
}
func (*DuplicateReconciler) Error ¶
func (d *DuplicateReconciler) Error() string
type Item ¶
type Item struct { // Name of the reconciler Name string // Event is additional payload information Event any }
Item is a wrapper for a queue item
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages multiple reconcilers. Its job is to ensure that
- A given reconciler is never running more than once concurrently
- Distributing the reconcile events among a pool of workers
TODO(jeremy): What are the proper semantics for a GitHub reconciler? When does the reconciler get created? Should it get created on the first webhook? What should the resync period be? Should we eventually forget about a repository if there aren't webhooks in some time period.
func NewManager ¶
func NewManager(syncers []Reconciler) (*Manager, error)
NewManager starts a new sync manager.
func (*Manager) AddReconciler ¶
func (m *Manager) AddReconciler(r Reconciler) error
AddReconciler adds the reconciler. Returns an DuplicateReconcilerError if a reconciler with the same name already If reconciler isn't thread safe then caller should ensure that it isn't called again and let manager take ownership.
func (*Manager) HasReconciler ¶
type Reconciler ¶
type Reconciler interface { // Name is a unique name for the reconciler Name() string // Run runs the reconcile loop. event can provide additional information about the event specific to // the reconciler. // TODO(jeremy): Should we return a duration which is the time after which to requeue another reconcile event? Run(event any) error }
Reconciler defines a common interface for reconcilers so that Manager can be used to manage different types of reconcilers; i.e. we want to manage both Renderer and Syncer using the Manager interface.
TODO(jeremy): This interface is half baked and we will probably want to refactor it along with the Renderer and Syncer structs to implement it.
type RenderEvent ¶
type RenderEvent struct { Commit string // BranchConfig is the branch config for the branch being rendered // N.B. We don't actually verify that commit is on basebranch BranchConfig *v1alpha1.InPlaceConfig }
RenderEvent is additional information about the render event
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer is a reconciler that handles in place modification of YAML files. It is intended to run a bunch of KRM functions in place and then check the modifications back into the repository.
There is currently one renderer per repository. A single renderer can handle multiple branches but not concurrently.
TODO(jeremy): I don't think the semantics for specifying the KRM functions to apply is quite right. Right now we apply all KRM functions found at sourcePath. These functions get applied to all YAML below the location of the function path. This is ok as long as we don't have a mix of KRM functions that should be applied when hydrating into a different repository (e.g. via Syncer) but not when changes are to be checked into the source repository.
func NewRenderer ¶
type RepoController ¶ added in v0.0.3
type RepoController struct {
// contains filtered or unexported fields
}
RepoController is a controller for a repo. The controller will periodically checkout the repository and search it for resources. It will then sync those resources
func NewRepoController ¶ added in v0.0.3
func NewRepoController(appConfig config.Config, registry *controllers.Registry, config *v1alpha1.RepoConfig) (*RepoController, error)
func (*RepoController) Reconcile ¶ added in v0.0.3
func (c *RepoController) Reconcile(ctx context.Context) error
func (*RepoController) RunPeriodically ¶ added in v0.0.3
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
Syncer keeps two repos in sync by creating PRs to publish hydrated manifests from one repo to the other.
func NewSyncer ¶
func NewSyncer(m *v1alpha1.ManifestSync, manager *github.TransportManager, opts ...SyncerOption) (*Syncer, error)
NewSyncer creates a new syncer.
func (*Syncer) PushLocal ¶
PushLocal commits any changes in wDir and then pushes those changes to the branch of the sourceRepo A sync can then be applied. keyFile is the private PEM key file to use. If not specified it will try to load one from the home directory
func (*Syncer) RunOnce ¶
RunOnce runs the syncer once. If force is true a sync is run even if none is needed.
func (*Syncer) RunPeriodically ¶
RunPeriodically runs periodically with the specified period.
type SyncerOption ¶
SyncerOption is an option for instantiating the syncer.
func SyncWithAwsSession ¶
func SyncWithAwsSession(sess *session.Session) SyncerOption
SyncWithAwsSession creates an option to use the supplied session.
func SyncWithLogger ¶
func SyncWithLogger(log logr.Logger) SyncerOption
SyncWithLogger creates an option to use the supplied logger.
func SyncWithWorkDir ¶
func SyncWithWorkDir(wDir string) SyncerOption
SyncWithWorkDir creates an option to use the supplied working directory.