Skip to content

Commit

Permalink
drop support for knative < 0.4 apache#552
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli authored and ipolyzos committed Jul 31, 2019
1 parent 1e22e0b commit 995f0a3
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 465 deletions.
1 change: 1 addition & 0 deletions pkg/trait/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func (t *deploymentTrait) getDeploymentFor(e *Environment) *appsv1.Deployment {
if annotations == nil {
annotations = make(map[string]string)
}

// Resolve registry host names when used
annotations["alpha.image.policy.openshift.io/resolve-names"] = "*"

Expand Down
35 changes: 18 additions & 17 deletions pkg/trait/knative_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package trait

import (
"strconv"
"strings"

"github.com/apache/camel-k/pkg/util/kubernetes"

Expand All @@ -40,15 +41,14 @@ const (
)

type knativeServiceTrait struct {
BaseTrait `property:",squash"`
Class string `property:"autoscaling-class"`
Metric string `property:"autoscaling-metric"`
Target *int `property:"autoscaling-target"`
MinScale *int `property:"min-scale"`
MaxScale *int `property:"max-scale"`
Auto *bool `property:"auto"`
ConfigurationType string `property:"configuration-type"`
deployer deployerTrait
BaseTrait `property:",squash"`
Class string `property:"autoscaling-class"`
Metric string `property:"autoscaling-metric"`
Target *int `property:"autoscaling-target"`
MinScale *int `property:"min-scale"`
MaxScale *int `property:"max-scale"`
Auto *bool `property:"auto"`
deployer deployerTrait
}

func newKnativeServiceTrait() *knativeServiceTrait {
Expand Down Expand Up @@ -183,6 +183,7 @@ func (t *knativeServiceTrait) getServiceFor(e *Environment) (*serving.Service, e
},
}

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

// combine Environment of integration with context, integration
Expand All @@ -197,19 +198,19 @@ func (t *knativeServiceTrait) getServiceFor(e *Environment) (*serving.Service, e
// has been changed
envvar.SetVal(environment, "CAMEL_K_DIGEST", e.Integration.Status.Digest)

// optimizations
envvar.SetVal(environment, "AB_JOLOKIA_OFF", True)

if t.ConfigurationType == "volume" {
t.bindToVolumes(e, &svc)
} else if err := t.bindToEnvVar(e, &svc); err != nil {
return nil, err
}
envvar.SetVal(environment, "CAMEL_K_ROUTES", strings.Join(paths, ","))
envvar.SetVal(environment, "CAMEL_K_CONF", "/etc/camel/conf/application.properties")
envvar.SetVal(environment, "CAMEL_K_CONF_D", "/etc/camel/conf.d")

// add env vars from traits
for _, envVar := range e.EnvVars {
envvar.SetVar(&svc.Spec.RunLatest.Configuration.RevisionTemplate.Spec.Container.Env, envVar)
}

e.ConfigureVolumesAndMounts(
&svc.Spec.RunLatest.Configuration.RevisionTemplate.Spec.Volumes,
&svc.Spec.RunLatest.Configuration.RevisionTemplate.Spec.Container.VolumeMounts,
)

return &svc, nil
}
160 changes: 0 additions & 160 deletions pkg/trait/knative_service_env.go

This file was deleted.

Loading

0 comments on commit 995f0a3

Please sign in to comment.