Skip to content

Commit

Permalink
consider batch/x/CronJob always done applying
Browse files Browse the repository at this point in the history
  • Loading branch information
cppforlife committed Jun 27, 2019
1 parent 1058432 commit d948f75
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/kapp/clusterapply/add_or_update_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ func (c AddOrUpdateChange) isResourceDoneApplying(res ctlres.Resource, isParent
func(res ctlres.Resource) SpecificResource { return ctlresm.NewAppsv1Deployment(res) },
func(res ctlres.Resource) SpecificResource { return ctlresm.NewAppsv1DaemonSet(res) },
func(res ctlres.Resource) SpecificResource { return ctlresm.NewBatchv1Job(res) },
func(res ctlres.Resource) SpecificResource { return ctlresm.NewBatchvxCronJob(res) },
}

for _, f := range specificResFactories {
Expand Down
26 changes: 26 additions & 0 deletions pkg/kapp/resourcesmisc/batch_vx_cronjob.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package resourcesmisc

import (
ctlres "github.com/k14s/kapp/pkg/kapp/resources"
)

type BatchvxCronJob struct {
resource ctlres.Resource
}

func NewBatchvxCronJob(resource ctlres.Resource) *BatchvxCronJob {
matcher := ctlres.APIGroupKindMatcher{
APIGroup: "batch",
Kind: "CronJob",
}
if matcher.Matches(resource) {
return &BatchvxCronJob{resource}
}
return nil
}

func (s BatchvxCronJob) IsDoneApplying() DoneApplyState {
// Always return success as we do not want to pick up associated
// pods that might have previously failed
return DoneApplyState{Done: true, Successful: true}
}

0 comments on commit d948f75

Please sign in to comment.