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

chore: support for health based on servlet available from 0.3.3-SNAPSHOT #676

Merged
merged 1 commit into from
May 21, 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
19 changes: 10 additions & 9 deletions pkg/apis/camel/v1alpha1/integration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion pkg/apis/camel/v1alpha1/integration_types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,26 @@ func (is *IntegrationSpec) Configurations() []ConfigurationSpec {
return is.Configuration
}

// 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 --
Expand Down
14 changes: 14 additions & 0 deletions pkg/trait/probes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down