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

Add support for JaegerIngressSpec to all-in-one #49

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
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)
})
}
}