This is an automated email from the ASF dual-hosted git repository. valdar pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/master by this push: new b26d24b chore: support for health based on servlet available from 0.3.3-SNAPSHOT b26d24b is described below commit b26d24b764ef74f35a0ad281c78322cfcc92a90c Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Tue May 21 15:01:16 2019 +0200 chore: support for health based on servlet available from 0.3.3-SNAPSHOT --- pkg/apis/camel/v1alpha1/integration_types.go | 19 ++++++++++--------- pkg/apis/camel/v1alpha1/integration_types_support.go | 15 ++++++++++++++- pkg/trait/probes.go | 14 ++++++++++++++ 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/pkg/apis/camel/v1alpha1/integration_types.go b/pkg/apis/camel/v1alpha1/integration_types.go index 7b6b548..2e3e197 100644 --- a/pkg/apis/camel/v1alpha1/integration_types.go +++ b/pkg/apis/camel/v1alpha1/integration_types.go @@ -22,15 +22,16 @@ type IntegrationSpec struct { // IntegrationStatus defines the observed state of Integration type IntegrationStatus struct { - Phase IntegrationPhase `json:"phase,omitempty"` - Digest string `json:"digest,omitempty"` - Image string `json:"image,omitempty"` - Dependencies []string `json:"dependencies,omitempty"` - Context string `json:"context,omitempty"` - GeneratedSources []SourceSpec `json:"generatedSources,omitempty"` - Failure *Failure `json:"failure,omitempty"` - CamelVersion string `json:"camelVersion,omitempty"` - RuntimeVersion string `json:"runtimeVersion,omitempty"` + Phase IntegrationPhase `json:"phase,omitempty"` + Digest string `json:"digest,omitempty"` + Image string `json:"image,omitempty"` + Dependencies []string `json:"dependencies,omitempty"` + Context string `json:"context,omitempty"` + GeneratedSources []SourceSpec `json:"generatedSources,omitempty"` + Failure *Failure `json:"failure,omitempty"` + CamelVersion string `json:"camelVersion,omitempty"` + RuntimeVersion string `json:"runtimeVersion,omitempty"` + Configuration []ConfigurationSpec `json:"configuration,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/camel/v1alpha1/integration_types_support.go b/pkg/apis/camel/v1alpha1/integration_types_support.go index e801d74..3ed42f5 100644 --- a/pkg/apis/camel/v1alpha1/integration_types_support.go +++ b/pkg/apis/camel/v1alpha1/integration_types_support.go @@ -100,12 +100,25 @@ func (is *IntegrationSpec) Configurations() []ConfigurationSpec { } // Configurations -- +func (is *IntegrationStatus) Configurations() []ConfigurationSpec { + if is == nil { + return []ConfigurationSpec{} + } + + return is.Configuration +} + +// Configurations -- func (in *Integration) Configurations() []ConfigurationSpec { if in == nil { return []ConfigurationSpec{} } - return in.Spec.Configurations() + answer := make([]ConfigurationSpec, 0) + answer = append(answer, in.Status.Configuration...) + answer = append(answer, in.Spec.Configuration...) + + return answer } // NewSourceSpec -- diff --git a/pkg/trait/probes.go b/pkg/trait/probes.go index 4fb582d..7d76132 100644 --- a/pkg/trait/probes.go +++ b/pkg/trait/probes.go @@ -19,6 +19,7 @@ package trait import ( "sort" + "strconv" "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" "github.com/apache/camel-k/pkg/util" @@ -69,6 +70,19 @@ func (t *probesTrait) Apply(e *Environment) error { // sort the dependencies to get always the same list if they don't change sort.Strings(e.Integration.Status.Dependencies) + + e.Integration.Status.Configuration = append(e.Integration.Status.Configuration, + // + // TODO: At the moment the servlet engine is used only for health but we need to + // have a dedicated servlet trait and maybe an option to create a dedicated + // server for management stuffs like health + // + v1alpha1.ConfigurationSpec{Type: "property", Value: "customizer.servlet.enabled=true"}, + v1alpha1.ConfigurationSpec{Type: "property", Value: "customizer.servlet.bindHost=" + t.BindHost}, + v1alpha1.ConfigurationSpec{Type: "property", Value: "customizer.servlet.bindPort=" + strconv.Itoa(t.BindPort)}, + v1alpha1.ConfigurationSpec{Type: "property", Value: "customizer.health.enabled=true"}, + v1alpha1.ConfigurationSpec{Type: "property", Value: "customizer.health.path=" + t.Path}, + ) } if e.IntegrationInPhase(v1alpha1.IntegrationPhaseDeploying) {