Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit kind selection to deployer trait #543

Merged
merged 2 commits into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/traits.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ The following is a list of common traits that can be configured by the end users
! deployer.container-image
! Generates a container image for the Integration that includes the sources and resources in the generated images instead of mounting them to the pod.

! deployer.kind
! Allows to explicitly select the desired deployment kind between `deployment` or `knative-service` when creating the resources for running the integration.

!===

| deployment
Expand Down
3 changes: 2 additions & 1 deletion pkg/trait/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ package trait

type deployerTrait struct {
BaseTrait `property:",squash"`
ContainerImage bool `property:"container-image"`
ContainerImage bool `property:"container-image"`
Kind string `property:"kind"`
}

func newDeployerTrait() *deployerTrait {
Expand Down
10 changes: 10 additions & 0 deletions pkg/trait/trait_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ func (e *Environment) DetermineControllerStrategy(ctx context.Context, c client.
return ControllerStrategyDeployment, nil
}

trait := e.GetTrait("deployer")
if trait != nil {
deployerTrait := trait.(*deployerTrait)
if deployerTrait.Kind == ControllerStrategyDeployment {
return ControllerStrategyDeployment, nil
} else if deployerTrait.Kind == ControllerStrategyKnativeService {
return ControllerStrategyKnativeService, nil
}
}

var sources []v1alpha1.SourceSpec
var err error
if sources, err = kubernetes.ResolveIntegrationSources(ctx, c, e.Integration, e.Resources); err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/util/camel/camel_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func FindBestSemVerMatch(constraint *semver.Constraints, catalogs []v1alpha1.Cam
v, err := semver.NewVersion(catalog.Spec.Version)
if err != nil {
log.Debugf("Invalid semver version %s, skip it", catalog.Spec.Version)
continue
}

versions = append(versions, v)
Expand Down