Skip to content

Commit

Permalink
remove support for integration container image creation apache#650
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli authored and ipolyzos committed Jul 31, 2019
1 parent 91dee2b commit 9ea5c00
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 552 deletions.
4 changes: 0 additions & 4 deletions pkg/apis/camel/v1alpha1/integration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ const (
IntegrationPhaseBuildingContext IntegrationPhase = "Building Context"
// IntegrationPhaseResolvingContext --
IntegrationPhaseResolvingContext IntegrationPhase = "Resolving Context"
// IntegrationPhaseBuildImageSubmitted --
IntegrationPhaseBuildImageSubmitted IntegrationPhase = "Build Image Submitted"
// IntegrationPhaseBuildImageRunning --
IntegrationPhaseBuildImageRunning IntegrationPhase = "Build Image Running"
// IntegrationPhaseDeploying --
IntegrationPhaseDeploying IntegrationPhase = "Deploying"
// IntegrationPhaseRunning --
Expand Down
232 changes: 0 additions & 232 deletions pkg/controller/integration/build_image.go

This file was deleted.

1 change: 0 additions & 1 deletion pkg/controller/integration/integration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ func (r *ReconcileIntegration) Reconcile(request reconcile.Request) (reconcile.R
integrationActionPool := []Action{
NewInitializeAction(),
NewBuildContextAction(),
NewBuildImageAction(),
NewDeployAction(),
NewMonitorAction(),
NewDeleteAction(),
Expand Down
45 changes: 8 additions & 37 deletions pkg/trait/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package trait

import (
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/builder"
"github.com/apache/camel-k/pkg/builder/kaniko"
"github.com/apache/camel-k/pkg/builder/s2i"
"github.com/apache/camel-k/pkg/platform"
Expand All @@ -41,46 +40,18 @@ func (t *builderTrait) Configure(e *Environment) (bool, error) {
return false, nil
}

if e.IntegrationContextInPhase(v1alpha1.IntegrationContextPhaseBuildSubmitted) {
return true, nil
}

if e.InPhase(v1alpha1.IntegrationContextPhaseReady, v1alpha1.IntegrationPhaseBuildImageSubmitted) {
return true, nil
}

return false, nil
return e.IntegrationContextInPhase(v1alpha1.IntegrationContextPhaseBuildSubmitted), nil
}

func (t *builderTrait) Apply(e *Environment) error {
if e.IntegrationContextInPhase(v1alpha1.IntegrationContextPhaseBuildSubmitted) {
if platform.SupportsS2iPublishStrategy(e.Platform) {
e.Steps = s2i.DefaultSteps
if e.DetermineProfile() == v1alpha1.TraitProfileKnative {
e.Steps = append(e.Steps, s2i.Steps.ReplaceHost)
}
} else if platform.SupportsKanikoPublishStrategy(e.Platform) {
e.Steps = kaniko.DefaultSteps
e.BuildDir = kaniko.BuildDir
}
}

if e.InPhase(v1alpha1.IntegrationContextPhaseReady, v1alpha1.IntegrationPhaseBuildImageSubmitted) {
if platform.SupportsS2iPublishStrategy(e.Platform) {
e.Steps = []builder.Step{
builder.Steps.StandardPackager,
s2i.Steps.Publisher,
}
if e.DetermineProfile() == v1alpha1.TraitProfileKnative {
e.Steps = append(e.Steps, s2i.Steps.ReplaceHost)
}
} else if platform.SupportsKanikoPublishStrategy(e.Platform) {
e.Steps = []builder.Step{
builder.Steps.StandardPackager,
kaniko.Steps.Publisher,
}
e.BuildDir = kaniko.BuildDir
if platform.SupportsS2iPublishStrategy(e.Platform) {
e.Steps = s2i.DefaultSteps
if e.DetermineProfile() == v1alpha1.TraitProfileKnative {
e.Steps = append(e.Steps, s2i.Steps.ReplaceHost)
}
} else if platform.SupportsKanikoPublishStrategy(e.Platform) {
e.Steps = kaniko.DefaultSteps
e.BuildDir = kaniko.BuildDir
}

return nil
Expand Down
5 changes: 2 additions & 3 deletions pkg/trait/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ limitations under the License.
package trait

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

func newDeployerTrait() *deployerTrait {
Expand Down
23 changes: 7 additions & 16 deletions pkg/trait/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,17 @@ func (t *deploymentTrait) Apply(e *Environment) error {
if e.IntegrationContextInPhase(v1alpha1.IntegrationContextPhaseReady) &&
e.IntegrationInPhase(v1alpha1.IntegrationPhaseBuildingContext, v1alpha1.IntegrationPhaseResolvingContext) {

if t.deployer.ContainerImage {
e.PostProcessors = append(e.PostProcessors, func(environment *Environment) error {
// trigger container image build
e.Integration.Status.Phase = v1alpha1.IntegrationPhaseBuildImageSubmitted
return nil
})
} else {
e.PostProcessors = append(e.PostProcessors, func(environment *Environment) error {
// trigger integration deploy
e.Integration.Status.Phase = v1alpha1.IntegrationPhaseDeploying
return nil
})
}
e.PostProcessors = append(e.PostProcessors, func(environment *Environment) error {
// trigger integration deploy
e.Integration.Status.Phase = v1alpha1.IntegrationPhaseDeploying
return nil
})

return nil
}

if e.InPhase(v1alpha1.IntegrationContextPhaseReady, v1alpha1.IntegrationPhaseDeploying) {
e.Resources.AddAll(e.ComputeConfigMaps(t.deployer.ContainerImage))
e.Resources.AddAll(e.ComputeConfigMaps())
e.Resources.Add(t.getDeploymentFor(e))
}

Expand All @@ -106,7 +98,7 @@ func (t *deploymentTrait) Apply(e *Environment) error {
// **********************************

func (t *deploymentTrait) getDeploymentFor(e *Environment) *appsv1.Deployment {
paths := e.ComputeSourcesURI(t.deployer.ContainerImage)
paths := e.ComputeSourcesURI()
environment := make([]corev1.EnvVar, 0)

// combine Environment of integration with platform, context, integration
Expand Down Expand Up @@ -179,7 +171,6 @@ func (t *deploymentTrait) getDeploymentFor(e *Environment) *appsv1.Deployment {
}

e.ConfigureVolumesAndMounts(
t.deployer.ContainerImage,
&deployment.Spec.Template.Spec.Volumes,
&deployment.Spec.Template.Spec.Containers[0].VolumeMounts,
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/trait/knative_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (t *knativeServiceTrait) Apply(e *Environment) error {
return err
}

maps := e.ComputeConfigMaps(t.deployer.ContainerImage)
maps := e.ComputeConfigMaps()

e.Resources.Add(svc)
e.Resources.AddAll(maps)
Expand Down
4 changes: 1 addition & 3 deletions pkg/trait/knative_service_vol.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ import (

func (t *knativeServiceTrait) bindToVolumes(e *Environment, service *serving.Service) {
e.ConfigureVolumesAndMounts(
t.deployer.ContainerImage,
&service.Spec.RunLatest.Configuration.RevisionTemplate.Spec.Volumes,
&service.Spec.RunLatest.Configuration.RevisionTemplate.Spec.Container.VolumeMounts,
)

paths := e.ComputeSourcesURI(t.deployer.ContainerImage)

paths := e.ComputeSourcesURI()
environment := &service.Spec.RunLatest.Configuration.RevisionTemplate.Spec.Container.Env

envvar.SetVal(environment, "CAMEL_K_ROUTES", strings.Join(paths, ","))
Expand Down
Loading

0 comments on commit 9ea5c00

Please sign in to comment.