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

Use es-operator #191

Merged
merged 1 commit into from
Feb 21, 2019
Merged

Conversation

pavolloffay
Copy link
Member

@pavolloffay pavolloffay commented Feb 1, 2019

Resolves #183

depends on: openshift/origin-aggregated-logging#1500

  • create ES CR inside the operator
  • use client certs
  • create separate secret for jaeger
  • integration tests

The elasticsearch has to be deployed manually at the moment
https://github.com/openshift/elasticsearch-operator, The ES image has to with this change openshift/origin-aggregated-logging#1500

make deploy
oc create -f hack/cr.yaml - not necessary Jaeger operator deploys CR

If the es deployment has been created before jaeger deployement the ES pod has to be restarted so it can load correct certificates - actually it waits for volume with certificates, but needs to be restarted if certs are changed - jaeger redeploy. We might create a different volume with certs per jaeger deployment.

Note that ES requires limits settings on node:
minishift ssh -- 'sudo sysctl -w vm.max_map_count=262144'

@jpkrohling
Copy link
Contributor

This change is Reviewable

@pavolloffay
Copy link
Member Author

I will keep follow up issues in this comment

  • use separate secret for jaeger client certs - now all certs are in one secret
  • allow multiple jaeger instances access the same elasticsearch storage
  • use certificates with index-cleaner and spark-dependencies
  • deploy ES by creating CR and configuring jaeger storage flags and mounting volumes

@codecov
Copy link

codecov bot commented Feb 8, 2019

Codecov Report

Merging #191 into master will decrease coverage by 1.52%.
The diff coverage is 84.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #191      +/-   ##
==========================================
- Coverage    96.7%   95.18%   -1.53%     
==========================================
  Files          32       35       +3     
  Lines        1639     1848     +209     
==========================================
+ Hits         1585     1759     +174     
- Misses         41       75      +34     
- Partials       13       14       +1
Impacted Files Coverage Δ
pkg/apis/io/v1alpha1/jaeger_types.go 100% <ø> (ø) ⬆️
pkg/strategy/controller.go 100% <100%> (ø) ⬆️
pkg/deployment/all-in-one.go 100% <100%> (ø) ⬆️
pkg/deployment/collector.go 100% <100%> (ø) ⬆️
pkg/deployment/ingester.go 100% <100%> (ø) ⬆️
pkg/account/main.go 100% <100%> (ø) ⬆️
pkg/storage/elasticsearch_role.go 100% <100%> (ø)
pkg/storage/elasticsearch_secrets.go 100% <100%> (ø)
pkg/cronjob/spark_dependencies.go 97.56% <100%> (+0.09%) ⬆️
pkg/deployment/query.go 100% <100%> (ø) ⬆️
... and 6 more

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 07de1a2...91b6545. Read the comment docs.

@pavolloffay pavolloffay changed the title WIP: Use es-operator Use es-operator Feb 20, 2019
@pavolloffay
Copy link
Member Author

pavolloffay commented Feb 20, 2019

We should follow up on:

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 42 of 52 files at r1, 21 of 21 files at r2.
Reviewable status: all files reviewed, 19 unresolved discussions (waiting on @pavolloffay)

a discussion (no related file):
I'm OK with this change, except for a couple of things. Mostly, we need to either make sure that we support multiple ES instances (one per Jaeger instance, based on the Jaeger instance's name), or make it clear that a single ES will be used for all Jaeger instances in the same namespace/cluster/...

This PR is also missing documentation. And finally, please confirm you did execute the e2e tests and that they are passing.



jaeger.version, line 5 at r2 (raw file):

# stable Jaeger version. When you update this file, make sure to update the
# the docs as well.
latest

Please, revert this change.


Makefile, line 10 at r2 (raw file):

OPERATOR_NAME ?= jaeger-operator
NAMESPACE ?= jaegertracing

Please, revert this change.


Makefile, line 51 at r2 (raw file):

.PHONY: docker
docker: build

Please, revert this change.


Makefile, line 65 at r2 (raw file):

.PHONY: e2e-tests
e2e-tests: cassandra es crd build docker push

Please, revert this change.


build/Dockerfile, line 7 at r2 (raw file):

      " && \
    yum install -y $INSTALL_PKGS && \
    rpm -V $INSTALL_PKGS && \

Is this a debugging command?


deploy/role.yaml, line 73 at r2 (raw file):

  - jaeger
  verbs:
  - 'get'

Should get be within single quotes here?


deploy/examples/simple-prod-deploy-es.yaml, line 14 at r2 (raw file):

      resources:
    esIndexCleaner:
      eabled: true

s/eable/enable


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

type ElasticsearchSpec struct {
	Resources        v1.ResourceRequirements             `json:"resources"`
	NodeCount        int32                               `json:"nodeCount"`

This should be a pointer, so that we can differentiate between the user saying "I want 0 nodes" from the default value for an int32 var.


pkg/storage/elasticsearch.go, line 28 at r2 (raw file):

func ShouldDeployElasticsearch(s v1alpha1.JaegerStorageSpec) bool {
	if strings.ToLower(s.Type) != "elasticsearch" {

We are trying to standardize on EqualFold instead of ToLower == ...: #181


pkg/storage/elasticsearch.go, line 32 at r2 (raw file):

	}
	_, ok := s.Options.Map()["es.server-urls"]
	if ok {

return !ok?


pkg/storage/elasticsearch.go, line 47 at r2 (raw file):

		VolumeSource: v1.VolumeSource{
			Secret: &v1.SecretVolumeSource{
				SecretName: "jaeger-elasticsearch",

What happens if we have two Jaeger instances? Will they use the same secret? Typically, names use the Jaeger instance name so that we are able to have N Jaeger instances in the same location (namespace/cluster/...)


pkg/storage/elasticsearch.go, line 77 at r2 (raw file):

	// we assume jaeger containers are first
	if len(p.Containers) > 0 {
		// the size of arguments arr should be always 2

arr == p.Containers?


pkg/storage/elasticsearch.go, line 97 at r2 (raw file):

	if err != nil {
		logrus.Error("Failed to create Elasticsearch certificates: ", err)
		return nil, errors.Wrap(err, "failed to create Elasticsearch certificates")

This will cause the error to be logged several times, won't it? Either log, or return the error, assuming the caller will check/log the error.


pkg/storage/elasticsearch.go, line 113 at r2 (raw file):

		ObjectMeta: metav1.ObjectMeta{
			Namespace:       ed.Jaeger.Namespace,
			Name:            "elasticsearch",

Shouldn't this be named after the Jaeger instance? Same question as before: what happens if we have two similar Jaeger CRs in the same namespace?


pkg/storage/elasticsearch_secrets.go, line 77 at r2 (raw file):

			"out":    string(out)}).
			Error("Failed to create certificates")
		return fmt.Errorf("error running script %s: %v", script, err)

Can you get away without logging the error in the line above? Is the content of err good enough when logged by the caller? Otherwise, we might end up with two logs for the same error.


pkg/storage/elasticsearch_secrets.go, line 85 at r2 (raw file):

	return &v1.Secret{
		ObjectMeta: metav1.ObjectMeta{
			Name:            secretName,

Same as other comments: the name should be prefixed by the instance name.


pkg/storage/elasticsearch/v1alpha1/types.go, line 11 at r2 (raw file):

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// TODO temporal fix https://github.com/jaegertracing/jaeger-operator/issues/206

This is just a copy from the ES operator, right?

Copy link
Member Author

@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.

Reviewable status: 57 of 59 files reviewed, 19 unresolved discussions (waiting on @jpkrohling and @pavolloffay)


Makefile, line 10 at r2 (raw file):

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

Please, revert this change.

Done.


Makefile, line 51 at r2 (raw file):

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

Please, revert this change.

I find this useful, you need to build before packaging. I was running make docker and wondering why my change is not there..


Makefile, line 65 at r2 (raw file):

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

Please, revert this change.

Done.


build/Dockerfile, line 7 at r2 (raw file):

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

Is this a debugging command?

rpm {-V|--verify} [select-options] [verify-options]

   Verifying a package compares information about the installed files in the package with information about the files taken from the package metadata stored in the rpm database.  Among other things, verifying compares the size, digest, permis‐
   sions,  type,  owner  and  group  of  each file.  Any discrepancies are displayed.  Files that were not installed from the package, for example, documentation files excluded on installation using the "--excludedocs" option, will be silently
   ignored.

Maybe not only debugging, I have taken it from cluster logging operator. Do you want to remove it?


deploy/role.yaml, line 73 at r2 (raw file):

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

Should get be within single quotes here?

The '' and "" are mixed in the whole file.


deploy/examples/simple-prod-deploy-es.yaml, line 14 at r2 (raw file):

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

s/eable/enable

Done.


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

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

This should be a pointer, so that we can differentiate between the user saying "I want 0 nodes" from the default value for an int32 var.

0 nodes is invalid. In that case operator normalizes to default - 1 node.


pkg/storage/elasticsearch.go, line 28 at r2 (raw file):

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

We are trying to standardize on EqualFold instead of ToLower == ...: #181

Done.


pkg/storage/elasticsearch.go, line 32 at r2 (raw file):

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

return !ok?

No if there is URL we don't deploy ES


pkg/storage/elasticsearch.go, line 47 at r2 (raw file):

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

What happens if we have two Jaeger instances? Will they use the same secret? Typically, names use the Jaeger instance name so that we are able to have N Jaeger instances in the same location (namespace/cluster/...)

At the moment there is a limitation. ES expects secret to be elasticsearch. So now you can deploy only one ES in a namespace. I will change this secret to reflect instance name to make it better for future.

They plan to change the naming convention in future to embed instance name in objects.


pkg/storage/elasticsearch.go, line 77 at r2 (raw file):

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

arr == p.Containers?

Not sure what you mean.


pkg/storage/elasticsearch.go, line 97 at r2 (raw file):

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

This will cause the error to be logged several times, won't it? Either log, or return the error, assuming the caller will check/log the error.

Done.


pkg/storage/elasticsearch.go, line 113 at r2 (raw file):

the Jaeger instance? Same question as before: what happens if we have two similar Jaeger CRs in the same namespace?
No see previous comment


pkg/storage/elasticsearch_secrets.go, line 77 at r2 (raw file):

n you get away without logging the error in the line
I would keep the log, it contains full output of the script.


pkg/storage/elasticsearch_secrets.go, line 85 at r2 (raw file):

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

Same as other comments: the name should be prefixed by the instance name.

See previous comment, it's not possible at the moment for all secrets


pkg/storage/elasticsearch/v1alpha1/types.go, line 11 at r2 (raw file):

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

This is just a copy from the ES operator, right?

yes sir!

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 10 of 12 files at r3.
Reviewable status: 58 of 59 files reviewed, 4 unresolved discussions (waiting on @jpkrohling and @pavolloffay)

a discussion (no related file):
:lgtm:, as long as the e2e tests pass :-)



build/Dockerfile, line 7 at r2 (raw file):

Previously, pavolloffay (Pavol Loffay) wrote…

rpm {-V|--verify} [select-options] [verify-options]

   Verifying a package compares information about the installed files in the package with information about the files taken from the package metadata stored in the rpm database.  Among other things, verifying compares the size, digest, permis‐
   sions,  type,  owner  and  group  of  each file.  Any discrepancies are displayed.  Files that were not installed from the package, for example, documentation files excluded on installation using the "--excludedocs" option, will be silently
   ignored.

Maybe not only debugging, I have taken it from cluster logging operator. Do you want to remove it?

No, it's fine.


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

Previously, pavolloffay (Pavol Loffay) wrote…

0 nodes is invalid. In that case operator normalizes to default - 1 node.

OK, for "ReplicaSize", 0 is acceptable, even though it's currently not supported (this will change). Being consistent would be nice, but if it really can't be 0 (like, "temporarily disable ES"), then it's OK. Personally, I still prefer to have a pointer and have the normalize routine to set it to 1 if it's nil, but it's not blocking for this PR.


pkg/storage/elasticsearch.go, line 32 at r2 (raw file):

Previously, pavolloffay (Pavol Loffay) wrote…

No if there is URL we don't deploy ES

I mean:

if ok {
  return false
}
return true

is the same as:

return !ok


pkg/storage/elasticsearch.go, line 47 at r2 (raw file):

Previously, pavolloffay (Pavol Loffay) wrote…

At the moment there is a limitation. ES expects secret to be elasticsearch. So now you can deploy only one ES in a namespace. I will change this secret to reflect instance name to make it better for future.

They plan to change the naming convention in future to embed instance name in objects.

Ouch. Alright, understood, thanks for the explanation.


pkg/storage/elasticsearch.go, line 77 at r2 (raw file):

Previously, pavolloffay (Pavol Loffay) wrote…

Not sure what you mean.

The code comment mentions an arr, but there's no var named arr in the code. Perhaps arr is a previous iteration of what now is p.Containers?


pkg/storage/elasticsearch_secrets.go, line 77 at r2 (raw file):

Previously, pavolloffay (Pavol Loffay) wrote…

n you get away without logging the error in the line
I would keep the log, it contains full output of the script.

Is the script the shell script with dozens of lines? If it has a bug, it will always fail, which will make the log unreadable. I'd rather version the script somehow so that people can refer to the script at a given version.


pkg/storage/elasticsearch/v1alpha1/types.go, line 11 at r2 (raw file):

Previously, pavolloffay (Pavol Loffay) wrote…

yes sir!

OK, I think you did mention this in some other file, otherwise, it would be good to have it explicit as a comment, in addition to linking to the GitHub issue. Otherwise, we (or someone in the community) might be tempted to change stuff here in the future :-)

Not blocking, though.


Makefile, line 51 at r2 (raw file):

Previously, pavolloffay (Pavol Loffay) wrote…

I find this useful, you need to build before packaging. I was running make docker and wondering why my change is not there..

It might indeed be useful, but we can talk about it on a different PR.

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 1 of 1 files at r4, 3 of 4 files at r5.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @pavolloffay)


pkg/storage/elasticsearch_secrets.go, line 77 at r2 (raw file):

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

Is the script the shell script with dozens of lines? If it has a bug, it will always fail, which will make the log unreadable. I'd rather version the script somehow so that people can refer to the script at a given version.

I'm marking as resolved, but would be nice to keep an eye on this.

@pavolloffay
Copy link
Member Author

It's just a log print if it makes problems we can remove.

e2e tests passed

 ploffay  ~/projects/golang/src/github.com/jaegertracing/jaeger-operator   es-operator  NAMESPACE=pavolloffay make e2e-tests                                                       2:07 
Formatting code...
Building...
Sending build context to Docker daemon  84.97MB
Step 1/6 : FROM registry.svc.ci.openshift.org/openshift/origin-v4.0:base
 ---> 5f269bf34c29
Step 2/6 : RUN INSTALL_PKGS="       openssl       " &&     yum install -y $INSTALL_PKGS &&     rpm -V $INSTALL_PKGS &&     yum clean all &&     mkdir /tmp/_working_dir &&     chmod og+w /tmp/_working_dir
 ---> Using cache
 ---> 92cd24463204
Step 3/6 : COPY scripts/* /scripts/
 ---> Using cache
 ---> e680be3c29b0
Step 4/6 : USER nobody
 ---> Using cache
 ---> 5283fd5b7f41
Step 5/6 : ADD build/_output/bin/jaeger-operator /usr/local/bin/jaeger-operator
 ---> 0be97d0b9a48
Step 6/6 : ENTRYPOINT ["/usr/local/bin/jaeger-operator"]
 ---> Running in 51f4860e97d5
Removing intermediate container 51f4860e97d5
 ---> 8f80cd0c0086
Successfully built 8f80cd0c0086
Successfully tagged pavolloffay/jaeger-operator:latest
Pushing image pavolloffay/jaeger-operator:latest...
Running end-to-end tests...
ok  	github.com/jaegertracing/jaeger-operator/test/e2e	261.688s

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
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