Skip to content

Commit

Permalink
Improve intermediate status for Jobs
Browse files Browse the repository at this point in the history
As part of the normal Pod creation process, they will have unready containers
with a status of "containers with unready status". Since this warning isn't
actionable, only print it if the Job failed to become ready, and not as
part of the intermediate status for the Job.
  • Loading branch information
lblackstone committed Oct 8, 2019
1 parent c11e568 commit 679e877
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Improvements

- Aggregate error messages from Pods on Job Read. (https://github.com/pulumi/pulumi-kubernetes/pull/831).
- Improve interactive status for Jobs. (https://github.com/pulumi/pulumi-kubernetes/pull/832).

## 1.2.0 (October 4, 2019)

Expand Down
19 changes: 15 additions & 4 deletions pkg/await/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package await

import (
"strings"
"time"

"github.com/golang/glog"
Expand Down Expand Up @@ -135,10 +136,7 @@ func (jia *jobInitAwaiter) Await() error {
return err
}
case messages := <-podAggregator.ResultChan():
for _, message := range messages {
jia.errors.Add(message)
jia.config.logMessage(message)
}
jia.processPodMessages(messages)
}
}
}
Expand Down Expand Up @@ -211,6 +209,19 @@ func (jia *jobInitAwaiter) processJobEvent(event watch.Event) error {
return nil
}

func (jia *jobInitAwaiter) processPodMessages(messages logging.Messages) {
for _, message := range messages {
jia.errors.Add(message)

// The unready status condition always occurs as a normal part of a Job running, so don't print
// this as a warning. If the Job fails to complete, this warning will be included in the subErrors.
if strings.Contains(message.S, "containers with unready status") {
continue
}
jia.config.logMessage(message)
}
}

func (jia *jobInitAwaiter) errorMessages() []string {
messages := make([]string, 0)
for _, message := range jia.errors.Messages {
Expand Down

0 comments on commit 679e877

Please sign in to comment.