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

drop support for knative < 0.4 #658

Merged
merged 1 commit into from
May 15, 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
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