Skip to content

Commit

Permalink
Add support for JaegerIngressSpec to all-in-one
Browse files Browse the repository at this point in the history
  • Loading branch information
secat authored and jpkrohling committed Oct 4, 2018
1 parent e0849b5 commit 57c3648
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 6 deletions.
5 changes: 3 additions & 2 deletions pkg/apis/io/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ type JaegerIngressSpec struct {

// JaegerAllInOneSpec defines the options to be used when deploying the query
type JaegerAllInOneSpec struct {
Image string `json:"image"`
Options Options `json:"options"`
Ingress JaegerIngressSpec `json:"ingress"`
Image string `json:"image"`
Options Options `json:"options"`
}

// JaegerCollectorSpec defines the options to be used when deploying the collector
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/io/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions pkg/deployment/all-in-one.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,13 @@ func (a *AllInOne) Services() []*v1.Service {

// Ingresses returns a list of ingress rules to be deployed along with the all-in-one deployment
func (a *AllInOne) Ingresses() []*v1beta1.Ingress {
return []*v1beta1.Ingress{
ingress.NewQueryIngress(a.jaeger),
if a.jaeger.Spec.AllInOne.Ingress.Enabled == nil || *a.jaeger.Spec.AllInOne.Ingress.Enabled == true {
return []*v1beta1.Ingress{
ingress.NewQueryIngress(a.jaeger),
}
}

return []*v1beta1.Ingress{}
}

func (a *AllInOne) selector() map[string]string {
Expand Down
36 changes: 34 additions & 2 deletions pkg/deployment/all-in-one_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,38 @@ func TestAllInOneNumberOfServices(t *testing.T) {

func TestAllInOneNumberOfIngresses(t *testing.T) {
name := "TestAllInOneNumberOfIngresses"
ingresses := NewAllInOne(v1alpha1.NewJaeger(name)).Ingresses()
assert.Len(t, ingresses, 1)
newBool := func(value bool) *bool {
return &value
}

subTestCases := []struct {
name string
ingressSpec v1alpha1.JaegerIngressSpec
expectedIngressesCount int
}{
{
name: "IngressEnabledDefault",
ingressSpec: v1alpha1.JaegerIngressSpec{},
expectedIngressesCount: 1,
},
{
name: "IngressEnabledFalse",
ingressSpec: v1alpha1.JaegerIngressSpec{Enabled: newBool(false)},
expectedIngressesCount: 0,
},
{
name: "IngressEnabledTrue",
ingressSpec: v1alpha1.JaegerIngressSpec{Enabled: newBool(true)},
expectedIngressesCount: 1,
},
}

for _, stc := range subTestCases {
t.Run(stc.name, func(t *testing.T) {
jaeger := v1alpha1.NewJaeger(name)
jaeger.Spec.AllInOne.Ingress = stc.ingressSpec
ingresses := NewAllInOne(jaeger).Ingresses()
assert.Len(t, ingresses, stc.expectedIngressesCount)
})
}
}

0 comments on commit 57c3648

Please sign in to comment.