Skip to content

Commit

Permalink
Fix apache#1234: add some known named trait orders that can be used b…
Browse files Browse the repository at this point in the history
…y addons
  • Loading branch information
nicolaferraro committed Feb 16, 2020
1 parent 5d94cf1 commit e4bcd8c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/master/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type masterTrait struct {
// NewMasterTrait --
func NewMasterTrait() trait.Trait {
return &masterTrait{
BaseTrait: trait.NewBaseTrait("master", 850),
BaseTrait: trait.NewBaseTrait("master", trait.TraitOrderBeforeControllerCreation),
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/trait/owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type ownerTrait struct {

func newOwnerTrait() Trait {
return &ownerTrait{
BaseTrait: NewBaseTrait("owner", 2600),
BaseTrait: NewBaseTrait("owner", 2500),
}
}

Expand Down
13 changes: 13 additions & 0 deletions pkg/trait/trait_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ type Trait interface {
Order() int
}

// A list of named orders, useful for correctly binding addons
const (
// TraitOrderBeforeControllerCreation can be used to inject configuration such as properties and environment variables
// into the running integration, before the actual controller is created.
TraitOrderBeforeControllerCreation = 850
// TraitOrderControllerSelection can be used if you intend to provide an alternative controller for the integration
// (e.g. Deployment, CronJob, ...).
TraitOrderControllerSelection = 950
// TraitOrderPostProcessResources is executed after all other traits are executed (except for important core traits such as
// the "owner" trait), so it can be used to post-process generated resources before their actual creation.
TraitOrderPostProcessResources = 2450
)

/* Base trait */

// NewBaseTrait --
Expand Down

0 comments on commit e4bcd8c

Please sign in to comment.