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 spark job #140

Merged
merged 9 commits into from
Dec 4, 2018
Merged

Add spark job #140

merged 9 commits into from
Dec 4, 2018

Conversation

pavolloffay
Copy link
Member

Resolves #44

Signed-off-by: Pavol Loffay [email protected]

@jpkrohling
Copy link
Contributor

This change is Reviewable

@codecov
Copy link

codecov bot commented Nov 29, 2018

Codecov Report

Merging #140 into master will increase coverage by 0.11%.
The diff coverage is 97.89%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #140      +/-   ##
==========================================
+ Coverage   96.21%   96.32%   +0.11%     
==========================================
  Files          28       29       +1     
  Lines        1267     1362      +95     
==========================================
+ Hits         1219     1312      +93     
- Misses         37       39       +2     
  Partials       11       11
Impacted Files Coverage Δ
pkg/apis/io/v1alpha1/jaeger_types.go 100% <ø> (ø) ⬆️
pkg/strategy/production.go 100% <100%> (ø) ⬆️
pkg/strategy/all-in-one.go 100% <100%> (ø) ⬆️
pkg/cronjob/spark_dependencies.go 97.64% <97.64%> (ø)
pkg/strategy/controller.go 100% <0%> (ø) ⬆️
pkg/util/util.go 100% <0%> (ø) ⬆️
pkg/service/query.go 100% <0%> (ø) ⬆️
pkg/config/ui/ui.go
pkg/configmap/ui.go 96.42% <0%> (ø)

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 610d415...3be05ea. Read the comment docs.

@pavolloffay
Copy link
Member Author

At the moment this does not change any UI configuration. Baed on the job configuration (enabled) and storage operator could enable/disable dependencies tab in UI. I will add it after this PR is merged.

@pavolloffay
Copy link
Member Author

Also the job is by default disabled - we can enable it by default for supported storages.

@@ -2,3 +2,13 @@ apiVersion: io.jaegertracing/v1alpha1
kind: Jaeger
metadata:
name: simplest
strategy: allInOne
Copy link
Member Author

Choose a reason for hiding this comment

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

I will remove this

Copy link
Contributor

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 10 files at r1, 1 of 1 files at r2, 9 of 9 files at r3.
Reviewable status: all files reviewed, 10 unresolved discussions (waiting on @pavolloffay)

a discussion (no related file):
Looks really nice. Just need to adjust a few imports. I had a couple of other minor comments as well, but LGTM otherwise.



deploy/examples/simple-prod.yaml, line 15 at r3 (raw file):

        username: elastic
        password: changeme
  sparkDependencies:

This is related to Elasticsearch, isn't it? Or is this job also available for Cassandra? If it's relevant only for ES, I'd place it under the StorageSpec. I would abstract the "how" from the "what", and name it dependenciesJob (or something like that).


pkg/cronjob/spark_dependencies.go, line 8 at r3 (raw file):

	"github.com/jaegertracing/jaeger-operator/pkg/storage"
	"github.com/spf13/viper"
	batchv1 "k8s.io/api/batch/v1"

Same comment as the other PR, regarding the imports: you are probably using a different tooling, but we are splitting the imports in three sections: stdlib, external, internal. I think we follow the same pattern in the Jaeger core repo.


pkg/cronjob/spark_dependencies.go, line 15 at r3 (raw file):

)

var supportedStorageTypes = map[string]bool{"elasticsearch": true, "cassandra": true}

This answers my previous question about the job being ES-specific.


pkg/cronjob/spark_dependencies_test.go, line 15 at r3 (raw file):

		expected  *v1alpha1.Jaeger
	}{
		{underTest: &v1alpha1.Jaeger{}, expected: &v1alpha1.Jaeger{Spec: v1alpha1.JaegerSpec{SparkDependencies: v1alpha1.JaegerSparkDependenciesSpec{Schedule: "55 23 * * *"}}}},

Could you split this into multiple lines, to make it easier to read?


pkg/cronjob/spark_dependencies_test.go, line 30 at r3 (raw file):

	}{
		{},
		{underTest: []v1.EnvVar{{Name: "foo", Value: "bar"}, {Name: "foo3"}, {Name: "foo2", ValueFrom: &v1.EnvVarSource{}}},

Same here, each pair on its line would make it more readable.


pkg/strategy/all-in-one.go, line 76 at r3 (raw file):

	if c.jaeger.Spec.SparkDependencies.Enabled && cronjob.SupportedStorage(c.jaeger.Spec.Storage.Type) {
		os = append(os, cronjob.Create(c.jaeger))

What's the default value for this Enabled? If it's false, then it means the user has explicitly set the flag to true. As such, the user deserves a log message, saying that the dependency job will be disabled because the storage isn't supported.

We similar log messages in a function called normalize(), as part of the controller. You could place it there.


pkg/strategy/all-in-one_test.go, line 167 at r3 (raw file):

		s := fce(test.jaeger)
		objs := s.Create()
		cronJobs := getTypesOf(objs, reflect.TypeOf(&batchv1beta1.CronJob{}))

Nice trick. We have a getDeployments func in some tests that could make use of this.


test/e2e/spark_dependencies_test.go, line 85 at r3 (raw file):

	}

	return e2eutil.WaitForDeployment(t, f.KubeClient, namespace, name, 1, retryInterval, timeout)

Do you want to wait for the SmokeTest to be merged? If so, you could add the smoke test here.

@pavolloffay
Copy link
Member Author

Just need to adjust a few imports

I prefer to get merged #151 first.

@pavolloffay
Copy link
Member Author

PR updated

@pavolloffay
Copy link
Member Author

@jpkrohling could you please review this PR?

Copy link
Contributor

@objectiser objectiser left a comment

Choose a reason for hiding this comment

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

Reviewable status: 4 of 15 files reviewed, 12 unresolved discussions (waiting on @jpkrohling and @pavolloffay)


deploy/examples/simple-prod.yaml, line 15 at r3 (raw file):

Previously, jpkrohling (Juraci Paixão Kröhling) wrote…

This is related to Elasticsearch, isn't it? Or is this job also available for Cassandra? If it's relevant only for ES, I'd place it under the StorageSpec. I would abstract the "how" from the "what", and name it dependenciesJob (or something like that).

Can this be renamed "dependencies", rather than "sparkDependencies", as in the future we may use other technology to derive the dependencies.


deploy/examples/simple-prod.yaml, line 7 at r4 (raw file):

  name: simple-prod
spec:
  strategy: allInOne

This example is supposed to relate to a simple production deployment using ES. So needs to be production.


pkg/apis/io/v1alpha1/jaeger_types.go, line 128 at r4 (raw file):

	Options               Options                         `json:"options"`
	CassandraCreateSchema JaegerCassandraCreateSchemaSpec `json:"cassandraCreateSchema"`
	SparkDependencies     JaegerSparkDependenciesSpec     `json:"sparkDependencies"`

As mentioned above - I think it would be better to keep Spark out of the type and field names - its just an implementation detail. For now, just changing the json node name would be fine if you didn't want to change all of the types.

@pavolloffay
Copy link
Member Author

As mentioned above - I think it would be better to keep Spark out of the type and field names - its just an

I am not sure if we could use that unknown future project with this interface - as the interface is highly dependent on the properties exposed by spark-dependencies project. For this reason I would keep it as with spark prefix.

Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
@pavolloffay pavolloffay merged commit 3aa97dd into jaegertracing:master Dec 4, 2018
Copy link
Contributor

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 12 files at r4, 11 of 11 files at r5.
Reviewable status: all files reviewed, 12 unresolved discussions (waiting on @pavolloffay and @objectiser)


pkg/apis/io/v1alpha1/jaeger_types.go, line 128 at r4 (raw file):

Previously, objectiser (Gary Brown) wrote…

As mentioned above - I think it would be better to keep Spark out of the type and field names - its just an implementation detail. For now, just changing the json node name would be fine if you didn't want to change all of the types.

+1, Spark shouldn't be there. Instead, we could have two levels:

dependencies:
  spark:
    option1: value1

pkg/cronjob/spark_dependencies_test.go, line 30 at r3 (raw file):

Previously, jpkrohling (Juraci Paixão Kröhling) wrote…

Same here, each pair on its line would make it more readable.

Looks like this was missing in the final version that got merged.


pkg/strategy/all-in-one.go, line 76 at r3 (raw file):

Previously, jpkrohling (Juraci Paixão Kröhling) wrote…

What's the default value for this Enabled? If it's false, then it means the user has explicitly set the flag to true. As such, the user deserves a log message, saying that the dependency job will be disabled because the storage isn't supported.

We similar log messages in a function called normalize(), as part of the controller. You could place it there.

I don't think the code that got merged makes sense regarding this...

  1. The log.Info will always be displayed in the default case, ie, when the user has omitted the flag. We do not want this. We want info logging when the user wants something and we cannot deliver.
  2. There's no logging when the user sets the enabled flag to true and uses a unsupported storage...

pkg/strategy/production.go, line 89 at r5 (raw file):

	if cronjob.SupportedStorage(c.jaeger.Spec.Storage.Type) {
		if c.jaeger.Spec.Storage.SparkDependencies.Enabled {

Same as the comment above: the logging should be about telling the user that the flag that was explicitly set is being ignored due to the usage of an unsupported storage.

@pavolloffay
Copy link
Member Author

@jpkrohling could you please create a separate issue for any missing comments?

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.

3 participants