Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyAttempt ¶
ApplyAttempt stores the data from an attempt at applying a single file.
type BatchApplier ¶
type BatchApplier struct { KubeClient kube.ClientInterface Metrics metrics.PrometheusInterface }
BatchApplier makes apply calls for a batch of files, and updates metrics based on the results of each call.
func (*BatchApplier) Apply ¶
func (a *BatchApplier) Apply(applyList []string) ([]ApplyAttempt, []ApplyAttempt)
Apply takes a list of files and attempts an apply command on each. It returns two lists of ApplyAttempts - one for files that succeeded, and one for files that failed.
type BatchApplierInterface ¶
type BatchApplierInterface interface {
Apply([]string) ([]ApplyAttempt, []ApplyAttempt)
}
BatchApplierInterface allows for mocking out the functionality of BatchApplier when testing the full process of an apply run.
type MockBatchApplierInterface ¶
type MockBatchApplierInterface struct {
// contains filtered or unexported fields
}
Mock of BatchApplierInterface interface
func NewMockBatchApplierInterface ¶
func NewMockBatchApplierInterface(ctrl *gomock.Controller) *MockBatchApplierInterface
func (*MockBatchApplierInterface) Apply ¶
func (_m *MockBatchApplierInterface) Apply(_param0 []string) ([]ApplyAttempt, []ApplyAttempt)
func (*MockBatchApplierInterface) EXPECT ¶
func (_m *MockBatchApplierInterface) EXPECT() *_MockBatchApplierInterfaceRecorder
type Result ¶
type Result struct { Start time.Time Finish time.Time CommitHash string FullCommit string Blacklist []string Successes []ApplyAttempt Failures []ApplyAttempt DiffURLFormat string }
Result stores the data from a single run of the apply loop. The functions associated with Result convert raw data into the desired formats for insertion into the status page template.
func (*Result) FormattedFinish ¶
FormattedStart returns the Finish time in the format "YYYY-MM-DD hh:mm:ss -0000 GMT"
func (*Result) FormattedStart ¶
FormattedStart returns the Start time in the format "YYYY-MM-DD hh:mm:ss -0000 GMT"
func (*Result) LastCommitLink ¶
LastCommitLink returns a URL for the most recent commit if the envar $DIFF_URL_FORMAT is specified, otherwise it returns empty string.
func (*Result) Latency ¶
Latency returns the latency for the run in seconds, truncated to 3 decimal places.
func (*Result) TotalFiles ¶
TotalFiles returns the total count of apply attempts, both successes and failures.
type Runner ¶
type Runner struct { BatchApplier BatchApplierInterface ListFactory applylist.FactoryInterface GitUtil git.GitUtilInterface Clock sysutil.ClockInterface Metrics metrics.PrometheusInterface DiffURLFormat string RunQueue <-chan bool RunResults chan<- Result Errors chan<- error }
Runner manages the full process of an apply run, including getting the appropriate files, running apply commands on them, and handling the results.
type Scheduler ¶
type Scheduler struct { GitUtil git.GitUtilInterface PollInterval time.Duration FullRunInterval time.Duration RunQueue chan<- bool Errors chan<- error }
Scheduler handles queueing apply runs at a given time interval and upon every new Git commit.
func (*Scheduler) Start ¶
func (s *Scheduler) Start()
Start runs a continuous loop with two tickers for queueing runs. One ticker queues a new run every X seconds, where X is the value from $FULL_RUN_INTERVAL_SECONDS. The other ticker queues a new run upon every new Git commit, checking the repo every Y seconds where Y is the value from $POLL_INTERVAL_SECONDS.