-
Notifications
You must be signed in to change notification settings - Fork 344
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
Support self provisioned ES in streaming strategy #842
Merged
pavolloffay
merged 4 commits into
jaegertracing:master
from
pavolloffay:kafka-es-self-provisioned
Jan 14, 2020
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ import ( | |
"strings" | ||
"time" | ||
|
||
"github.com/jaegertracing/jaeger-operator/pkg/storage" | ||
|
||
"github.com/pkg/errors" | ||
log "github.com/sirupsen/logrus" | ||
"github.com/spf13/viper" | ||
|
@@ -161,20 +163,7 @@ func (r *ReconcileJaeger) Reconcile(request reconcile.Request) (reconcile.Result | |
|
||
originalInstance := *instance | ||
|
||
opts := client.MatchingLabels(map[string]string{ | ||
"app.kubernetes.io/instance": instance.Name, | ||
"app.kubernetes.io/managed-by": "jaeger-operator", | ||
}) | ||
list := &corev1.SecretList{} | ||
if err := r.client.List(ctx, list, opts); err != nil { | ||
instance.Status.Phase = v1.JaegerPhaseFailed | ||
if err := r.client.Status().Update(ctx, instance); err != nil { | ||
// we let it return the real error later | ||
logFields.WithError(err).Error("failed to store the failed status into the current CustomResource after preconditions") | ||
} | ||
return reconcile.Result{}, tracing.HandleError(err, span) | ||
} | ||
str := r.runStrategyChooser(ctx, instance, list.Items) | ||
str := r.runStrategyChooser(ctx, instance) | ||
|
||
updated, err := r.apply(ctx, *instance, str) | ||
if err != nil { | ||
|
@@ -226,16 +215,16 @@ func validate(jaeger *v1.Jaeger) error { | |
return nil | ||
} | ||
|
||
func (r *ReconcileJaeger) runStrategyChooser(ctx context.Context, instance *v1.Jaeger, secrets []corev1.Secret) strategy.S { | ||
func (r *ReconcileJaeger) runStrategyChooser(ctx context.Context, instance *v1.Jaeger) strategy.S { | ||
if nil == r.strategyChooser { | ||
return defaultStrategyChooser(ctx, instance, secrets) | ||
return defaultStrategyChooser(ctx, instance) | ||
} | ||
|
||
return r.strategyChooser(ctx, instance) | ||
} | ||
|
||
func defaultStrategyChooser(ctx context.Context, instance *v1.Jaeger, secrets []corev1.Secret) strategy.S { | ||
return strategy.For(ctx, instance, secrets) | ||
func defaultStrategyChooser(ctx context.Context, instance *v1.Jaeger) strategy.S { | ||
return strategy.For(ctx, instance) | ||
} | ||
|
||
func (r *ReconcileJaeger) apply(ctx context.Context, jaeger v1.Jaeger, str strategy.S) (v1.Jaeger, error) { | ||
|
@@ -248,6 +237,31 @@ func (r *ReconcileJaeger) apply(ctx context.Context, jaeger v1.Jaeger, str strat | |
return jaeger, tracing.HandleError(err, span) | ||
} | ||
|
||
// ES cert handling requires secretes from environment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
// therefore running this here and not in the strategy | ||
if storage.ShouldDeployElasticsearch(jaeger.Spec.Storage) { | ||
opts := client.MatchingLabels(map[string]string{ | ||
"app.kubernetes.io/instance": jaeger.Name, | ||
"app.kubernetes.io/managed-by": "jaeger-operator", | ||
}) | ||
secrets := &corev1.SecretList{} | ||
if err := r.client.List(ctx, secrets, opts); err != nil { | ||
jaeger.Status.Phase = v1.JaegerPhaseFailed | ||
if err := r.client.Status().Update(ctx, &jaeger); err != nil { | ||
// we let it return the real error later | ||
jaeger.Logger().WithError(err).Error("failed to store the failed status into the current CustomResource after preconditions") | ||
} | ||
return jaeger, tracing.HandleError(err, span) | ||
} | ||
es := &storage.ElasticsearchDeployment{Jaeger: &jaeger, CertScript: "./scripts/cert_generation.sh", Secrets: secrets.Items} | ||
err = es.CreateCerts() | ||
if err != nil { | ||
es.Jaeger.Logger().WithError(err).Error("failed to create Elasticsearch certificates, Elasticsearch won't be deployed") | ||
return jaeger, err | ||
} | ||
str.WithSecrets(append(str.Secrets(), es.ExtractSecrets()...)) | ||
} | ||
|
||
// secrets have to be created before ES - they are mounted to the ES pod | ||
if err := r.applySecrets(ctx, jaeger, str.Secrets()); err != nil { | ||
return jaeger, tracing.HandleError(err, span) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was it placed here by
make format
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
It either places it after core imports or after 3rd party imports in a separate block. However when I put it into operator imports it leaves it there.