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 Cassandra create-schema job #71

Merged
merged 3 commits into from
Oct 19, 2018

Conversation

jpkrohling
Copy link
Contributor

This PR adds support for the Cassandra create-schema job, backed by the create-schema script.

With this PR, the following template can be used:

apiVersion: io.jaegertracing/v1alpha1
kind: Jaeger
metadata:
  name: with-cassandra
spec:
  strategy: all-in-one
  storage:
    type: cassandra
    options:
      cassandra:
        servers: cassandra
        keyspace: jaeger_v1_datacenter3
    cassandra-create-schema:
      datacenter: "datacenter3"
      mode: "test"

I'm not 100% happy with the "datanceter" option duplicating part of the "keyspace" property from the options object, but that's how they are also today. Perhaps we can improve the create-schema script to not require a datacenter/mode, accepting only a "keyspace".

Signed-off-by: Juraci Paixão Kröhling juraci@kroehling.de

@jpkrohling
Copy link
Contributor Author

This change is Reviewable

@jpkrohling
Copy link
Contributor Author

jpkrohling commented Oct 17, 2018

Missing:

  • New e2e test
  • Documentation

@jpkrohling
Copy link
Contributor Author

@objectiser , @pavolloffay would one of you like to review this?

@codecov
Copy link

codecov bot commented Oct 17, 2018

Codecov Report

Merging #71 into master will increase coverage by 0.07%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #71      +/-   ##
==========================================
+ Coverage    99.3%   99.37%   +0.07%     
==========================================
  Files          17       19       +2     
  Lines         718      801      +83     
==========================================
+ Hits          713      796      +83     
  Misses          5        5
Impacted Files Coverage Δ
pkg/controller/controller.go 100% <ø> (ø) ⬆️
pkg/apis/io/v1alpha1/options.go 100% <100%> (ø) ⬆️
pkg/storage/dependency.go 100% <100%> (ø)
pkg/controller/production.go 100% <100%> (ø) ⬆️
pkg/controller/all-in-one.go 100% <100%> (ø) ⬆️
pkg/storage/cassandra_dependencies.go 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f520023...090da1a. Read the comment docs.

@jaegerci-bot
Copy link

@jpkrohling As a general comment, I think this has thrown up an issue for me with the use of options in the CR as a way to pass through a free format set of parameters.

Ideally I think the schema creation config should be a part of the overall cassandra config, e.g.

apiVersion: io.jaegertracing/v1alpha1
kind: Jaeger
metadata:
  name: with-cassandra
spec:
  strategy: all-in-one
  storage:
    type: cassandra
    cassandra:
      servers: cassandra
      keyspace: jaeger_v1_datacenter3
      schema:
        create: true
        datacenter: "datacenter3"
        mode: "test"

and I assume having the cassandra config statically typed would identify errors in the CR, rather than waiting for the Jaeger instance to be deployed and throw errors due to the passed parameters being incorrect.

Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are settings for TTL, replication and keyspace?


// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JaegerCassandraCreateSchemaSpec.
func (in *JaegerCassandraCreateSchemaSpec) DeepCopy() *JaegerCassandraCreateSchemaSpec {
if in == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in CopyInto this check is missing. Is it a convenience? They both could define the same behavior and preconditions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generated code

@jpkrohling
Copy link
Contributor Author

Where are settings for TTL, replication and keyspace?

They are missing on this first PR, but I'll probably add them before removing the WIP flag.

@jpkrohling jpkrohling changed the title WIP - Add support for Cassandra create-schema job Add support for Cassandra create-schema job Oct 18, 2018
@jpkrohling
Copy link
Contributor Author

@pavolloffay, @objectiser I just added a new commit with tests. I believe this is ready to be reviewed.


=== Cassandra

When the storage type is set to Cassandra, the operator will automatically create a batch job that creates the required schema for Jaeger to run. This batch job will block the Jaeger installation, so that it starts only after the schema is successfuly created. The creation of this batch job can be disabled by setting the `enabled` property to `false`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering if it would be safer to default to false? If someone is using an existing jaeger cassandra storage - what is the impact of the job running, is it a noop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current scripts are noop, as they have an "if not exists" clause:

https://github.com/jaegertracing/jaeger/blob/7d9d212b6d947742055fb4e38180152da687acf5/plugin/storage/cassandra/schema/v001.cql.tmpl#L25

But it might be a good idea to add a flag to the binary, to get this enabled/disabled by default, as we discussed today in the meeting. Something for a follow up PR, to be discussed with the ES parts?

@@ -87,3 +87,29 @@ func WaitForIngress(t *testing.T, kubeclient kubernetes.Interface, namespace, na
t.Logf("Ingress available\n")
return nil
}

// WaitForJob checks to see if a given job has the completed successfuly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove 'the'

Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
@jpkrohling jpkrohling merged commit 92fce64 into jaegertracing:master Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants