Skip to content

Commit

Permalink
eks/configmaps: use Job
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
  • Loading branch information
gyuho committed Jun 26, 2020
1 parent d8bec15 commit a7519fb
Show file tree
Hide file tree
Showing 2 changed files with 160 additions and 385 deletions.
42 changes: 4 additions & 38 deletions eks/configmaps/local/configmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,34 +108,14 @@ func (ts *tester) Create() (err error) {
return err
}

if err = ts.compareResults(curWriteLatencies); err != nil {
if err = ts.checkResults(curWriteLatencies); err != nil {
return err
}
if err = ts.publishResults(); err != nil {
return err
}

waitDur, retryStart := 5*time.Minute, time.Now()
for time.Now().Sub(retryStart) < waitDur {
select {
case <-ts.cfg.Stopc:
ts.cfg.Logger.Warn("health check aborted")
return nil
case <-time.After(5 * time.Second):
}
err = ts.cfg.K8SClient.CheckHealth()
if err == nil {
break
}
ts.cfg.Logger.Warn("health check failed", zap.Error(err))
}
ts.cfg.EKSConfig.Sync()
if err == nil {
ts.cfg.Logger.Info("health check success after configmaps local tester")
} else {
ts.cfg.Logger.Warn("health check failed after configmaps local tester", zap.Error(err))
}
return err
return ts.cfg.EKSConfig.Sync()
}

func (ts *tester) Delete() error {
Expand Down Expand Up @@ -177,25 +157,11 @@ func (ts *tester) Delete() error {
return ts.cfg.EKSConfig.Sync()
}

func (ts *tester) AggregateResults() (err error) {
if !ts.cfg.EKSConfig.IsEnabledAddOnConfigmapsLocal() {
ts.cfg.Logger.Info("skipping tester.AggregateResults", zap.String("tester", pkgName))
return nil
}
if !ts.cfg.EKSConfig.AddOnConfigmapsLocal.Created {
ts.cfg.Logger.Info("skipping tester.AggregateResults", zap.String("tester", pkgName))
return nil
}

ts.cfg.Logger.Info("starting tester.AggregateResults", zap.String("tester", pkgName))
return nil
}

// 1. if previous summary exists, download and compare
// 2. upload new summary and overwrite the previous s3 key
func (ts *tester) compareResults(curWriteLatencies metrics.Durations) (err error) {
func (ts *tester) checkResults(curWriteLatencies metrics.Durations) (err error) {
tss := time.Now().UTC().Format(time.RFC3339Nano)
ts.cfg.Logger.Info("comparing results", zap.String("timestamp", tss))
ts.cfg.Logger.Info("checking results", zap.String("timestamp", tss))

s3Objects := make([]*s3.Object, 0)
if ts.cfg.EKSConfig.AddOnConfigmapsLocal.RequestsSummaryWritesCompareS3Dir != "" {
Expand Down
Loading

0 comments on commit a7519fb

Please sign in to comment.