diff --git a/README.adoc b/README.adoc index ff165c105..b347baa22 100644 --- a/README.adoc +++ b/README.adoc @@ -111,8 +111,8 @@ kind: Jaeger metadata: name: my-jaeger spec: - strategy: all-in-one # <1> - all-in-one: + strategy: allInOne # <1> + allInOne: image: jaegertracing/all-in-one:1.7 # <2> options: # <3> log-level: debug # <4> @@ -123,7 +123,7 @@ spec: agent: strategy: DaemonSet # <7> ---- -<1> The default strategy is `all-in-one`. The only other possible value is `production`. +<1> The default strategy is `allInOne`. The only other possible value is `production`. <2> The image to use, in a regular Docker syntax <3> The options to be passed verbatim to the underlying binary.Refer to the Jaeger documentation and/or to the `--help` option from the related binary for all the available options <4> The option is a simple `key: value` map. In this case, we want the option `--log-level=debug` to be passed to the binary. @@ -255,10 +255,10 @@ kind: Jaeger metadata: name: cassandra-without-create-schema spec: - strategy: all-in-one + strategy: allInOne storage: type: cassandra - cassandra-create-schema: + cassandraCreateSchema: enabled: false # <1> ---- <1> Defaults to `true` @@ -272,14 +272,14 @@ kind: Jaeger metadata: name: cassandra-with-create-schema spec: - strategy: all-in-one # <1> + strategy: allInOne # <1> storage: type: cassandra options: # <2> cassandra: servers: cassandra keyspace: jaeger_v1_datacenter3 - cassandra-create-schema: # <3> + cassandraCreateSchema: # <3> datacenter: "datacenter3" mode: "test" ---- diff --git a/deploy/examples/all-in-one-with-options.yaml b/deploy/examples/all-in-one-with-options.yaml index 445eedd5a..c0897a80a 100644 --- a/deploy/examples/all-in-one-with-options.yaml +++ b/deploy/examples/all-in-one-with-options.yaml @@ -3,8 +3,8 @@ kind: "Jaeger" metadata: name: "my-jaeger" spec: - strategy: all-in-one - all-in-one: + strategy: allInOne + allInOne: image: jaegertracing/all-in-one:1.7 options: log-level: debug diff --git a/deploy/examples/disable-ingress.yaml b/deploy/examples/disable-ingress.yaml index e374a5480..493fa4e8f 100644 --- a/deploy/examples/disable-ingress.yaml +++ b/deploy/examples/disable-ingress.yaml @@ -4,4 +4,4 @@ metadata: name: disable-ingress spec: ingress: - enabled: false \ No newline at end of file + enabled: false diff --git a/pkg/apis/io/v1alpha1/types.go b/pkg/apis/io/v1alpha1/types.go index 88ab0e2c3..8d948e229 100644 --- a/pkg/apis/io/v1alpha1/types.go +++ b/pkg/apis/io/v1alpha1/types.go @@ -26,7 +26,7 @@ type Jaeger struct { // JaegerSpec defines the structure of the Jaeger JSON object from the CR type JaegerSpec struct { Strategy string `json:"strategy"` - AllInOne JaegerAllInOneSpec `json:"all-in-one"` + AllInOne JaegerAllInOneSpec `json:"allInOne"` Query JaegerQuerySpec `json:"query"` Collector JaegerCollectorSpec `json:"collector"` Agent JaegerAgentSpec `json:"agent"` @@ -79,7 +79,7 @@ type JaegerAgentSpec struct { type JaegerStorageSpec struct { Type string `json:"type"` // can be `memory` (default), `cassandra`, `elasticsearch`, `kafka` or `managed` Options Options `json:"options"` - CassandraCreateSchema JaegerCassandraCreateSchemaSpec `json:"cassandra-create-schema"` + CassandraCreateSchema JaegerCassandraCreateSchemaSpec `json:"cassandraCreateSchema"` } // JaegerCassandraCreateSchemaSpec holds the options related to the create-schema batch job diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index d7e6ad37f..47c8246d3 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -20,10 +20,15 @@ type Controller interface { // NewController build a new controller object for the given spec func NewController(ctx context.Context, jaeger *v1alpha1.Jaeger) Controller { + if strings.ToLower(jaeger.Spec.Strategy) == "all-in-one" { + logrus.Warnf("Strategy 'all-in-one' is no longer supported, please use 'allInOne'") + jaeger.Spec.Strategy = "allInOne" + } + normalize(jaeger) logrus.Debugf("Jaeger strategy: %s", jaeger.Spec.Strategy) - if jaeger.Spec.Strategy == "all-in-one" { + if strings.ToLower(jaeger.Spec.Strategy) == "allinone" { return newAllInOneController(ctx, jaeger) } @@ -57,18 +62,18 @@ func normalize(jaeger *v1alpha1.Jaeger) { // normalize the deployment strategy if strings.ToLower(jaeger.Spec.Strategy) != "production" { - jaeger.Spec.Strategy = "all-in-one" + jaeger.Spec.Strategy = "allInOne" } // check for incompatible options // if the storage is `memory`, then the only possible strategy is `all-in-one` - if strings.ToLower(jaeger.Spec.Storage.Type) == "memory" && strings.ToLower(jaeger.Spec.Strategy) != "all-in-one" { + if strings.ToLower(jaeger.Spec.Storage.Type) == "memory" && strings.ToLower(jaeger.Spec.Strategy) != "allinone" { logrus.Warnf( "No suitable storage was provided for the Jaeger instance '%v'. Falling back to all-in-one. Storage type: '%v'", jaeger.Name, jaeger.Spec.Storage.Type, ) - jaeger.Spec.Strategy = "all-in-one" + jaeger.Spec.Strategy = "allInOne" } } diff --git a/pkg/controller/controller_test.go b/pkg/controller/controller_test.go index 0a8f9ab72..af1f61df0 100644 --- a/pkg/controller/controller_test.go +++ b/pkg/controller/controller_test.go @@ -94,7 +94,30 @@ func TestIncompatibleStorageForProduction(t *testing.T) { }, } normalize(jaeger) - assert.Equal(t, "all-in-one", jaeger.Spec.Strategy) + assert.Equal(t, "allInOne", jaeger.Spec.Strategy) +} + +func TestDeprecatedAllInOneStrategy(t *testing.T) { + jaeger := &v1alpha1.Jaeger{ + Spec: v1alpha1.JaegerSpec{ + Strategy: "all-in-one", + }, + } + NewController(context.TODO(), jaeger) + assert.Equal(t, "allInOne", jaeger.Spec.Strategy) +} + +func TestStorageMemoryOnlyUsedWithAllInOneStrategy(t *testing.T) { + jaeger := &v1alpha1.Jaeger{ + Spec: v1alpha1.JaegerSpec{ + Strategy: "production", + Storage: v1alpha1.JaegerStorageSpec{ + Type: "memory", + }, + }, + } + NewController(context.TODO(), jaeger) + assert.Equal(t, "allInOne", jaeger.Spec.Strategy) } func getDeployments(objs []sdk.Object) []*appsv1.Deployment { diff --git a/test/e2e/all_in_one_test.go b/test/e2e/all_in_one_test.go index 6f0c5c268..bee5775fc 100644 --- a/test/e2e/all_in_one_test.go +++ b/test/e2e/all_in_one_test.go @@ -39,7 +39,7 @@ func allInOneTest(t *testing.T, f *framework.Framework, ctx *framework.TestCtx) Namespace: namespace, }, Spec: v1alpha1.JaegerSpec{ - Strategy: "all-in-one", + Strategy: "allInOne", AllInOne: v1alpha1.JaegerAllInOneSpec{ Options: v1alpha1.NewOptions(map[string]interface{}{ "log-level": "debug", diff --git a/test/e2e/cassandra.go b/test/e2e/cassandra.go index d740d87a7..8d624fc87 100644 --- a/test/e2e/cassandra.go +++ b/test/e2e/cassandra.go @@ -39,7 +39,7 @@ func cassandraTest(t *testing.T, f *framework.Framework, ctx *framework.TestCtx) Namespace: namespace, }, Spec: v1alpha1.JaegerSpec{ - Strategy: "all-in-one", + Strategy: "allInOne", AllInOne: v1alpha1.JaegerAllInOneSpec{}, Storage: v1alpha1.JaegerStorageSpec{ Type: "cassandra", diff --git a/test/e2e/daemonset.go b/test/e2e/daemonset.go index 55a54acc6..4a5a153aa 100644 --- a/test/e2e/daemonset.go +++ b/test/e2e/daemonset.go @@ -47,7 +47,7 @@ func daemonsetTest(t *testing.T, f *framework.Framework, ctx *framework.TestCtx) Namespace: namespace, }, Spec: v1alpha1.JaegerSpec{ - Strategy: "all-in-one", + Strategy: "allInOne", AllInOne: v1alpha1.JaegerAllInOneSpec{}, Agent: v1alpha1.JaegerAgentSpec{ Strategy: "DaemonSet", diff --git a/test/e2e/sidecar.go b/test/e2e/sidecar.go index 337891c78..7d01e24c0 100644 --- a/test/e2e/sidecar.go +++ b/test/e2e/sidecar.go @@ -47,7 +47,7 @@ func sidecarTest(t *testing.T, f *framework.Framework, ctx *framework.TestCtx) e Namespace: namespace, }, Spec: v1alpha1.JaegerSpec{ - Strategy: "all-in-one", + Strategy: "allInOne", AllInOne: v1alpha1.JaegerAllInOneSpec{}, Agent: v1alpha1.JaegerAgentSpec{ Options: v1alpha1.NewOptions(map[string]interface{}{