-
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
Handle normalization of host:port addresses in operator upgrade for 1.18 #1033
Handle normalization of host:port addresses in operator upgrade for 1.18 #1033
Conversation
@rubenvp8510 Is this one ready for review? Still has the WIP |
@objectiser This is in WIP due the fact that the test fails because |
pkg/upgrade/v1_18_0.go
Outdated
return jaeger, nil | ||
} | ||
|
||
func transformCollectorPorts(jaeger *v1.Jaeger, opts v1.Options, flagMap []deprecationFlagMap) v1.Options { |
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.
I would narrow down the scope of params. Jaeger instance is not needed just the logger.
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.
nit: give flagMap
a more specific name
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.
+1 good observation, I'll do the changes.
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.
nit: give
flagMap
a more specific name
Ok, I'll try to give it a better name
pkg/upgrade/v1_18_0.go
Outdated
"collector.host-port", | ||
"reporter.tchannel.discovery.conn-check-timeout", | ||
"reporter.tchannel.discovery.min-peers", | ||
"reporter.tchannel.host-port", |
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.
Does the operator configure --reporter.grpc.host-port
when the channel flags are removed?
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.
Oh no, not at this time.
pkg/upgrade/v1_18_0.go
Outdated
return v1.NewOptions(in) | ||
} | ||
|
||
func migrateAgentOptions(jaeger *v1.Jaeger, collectorGrpcPort string) v1.Options { |
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.
I like that you moved code for agent to a separate method. Maybe It's better to also move collector migration code to a separate method and method upgrade1_18_0
would call two methods one for agent and one for collector.
) | ||
|
||
func upgrade1_18_0(ctx context.Context, client client.Client, jaeger v1.Jaeger) (v1.Jaeger, error) { | ||
collectorDeprecatedFlags := []deprecationFlagMap{ |
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.
Are we using one of these in our code base - either flag or env variable? We are definitely using zipkin (collector.zipkin.http-port
) in one or another form.
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.
I think we are using admin-http-port
and collector.zipkin.http-port
I don't see where we are using the other flags.
"from": d.from, | ||
"to": d.to, | ||
}).Debug("flag value migrated") | ||
if val, exists := in[d.to]; exists { |
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.
Let's say somebody already created 1.18 CR with new flag e.g. --admin.http.host-port
. Then the value would be :host:port
.
I am not sure at what time this method is called, so I am not sure if it can happen.
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.
if the CR is already on 1.18 this upgrade method should not be called, this is only called when we have an CR with version < 1.18 (and before call this v1_18_0 function, v1_17_0 should be called.. and before v1_15_0 and so on..)
Codecov Report
@@ Coverage Diff @@
## master #1033 +/- ##
==========================================
+ Coverage 64.34% 64.58% +0.24%
==========================================
Files 83 84 +1
Lines 6669 6715 +46
==========================================
+ Hits 4291 4337 +46
Misses 2236 2236
Partials 142 142
Continue to review full report at Codecov.
|
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.
LGTM, I would just remove those empty lines.
pkg/upgrade/v1_18_0.go
Outdated
} | ||
opts := migrateDeprecatedOptions(jaeger, jaeger.Spec.Collector.Options, collectorDeprecatedFlags) | ||
return transformCollectorPorts(jaeger.Logger(), opts, collectorDeprecatedFlags) | ||
|
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.
nit: remove line
pkg/upgrade/v1_18_0.go
Outdated
} | ||
|
||
return v1.NewOptions(opsMap) | ||
|
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.
nit: remove empty line
pkg/upgrade/v1_18_0.go
Outdated
} | ||
|
||
func migrateAgentOptions(jaeger *v1.Jaeger) v1.Options { | ||
|
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.
nit: remove empty line?
"context" | ||
"fmt" | ||
|
||
"sigs.k8s.io/controller-runtime/pkg/client" |
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.
this should be joined with the following block.
our import format tool seems to be flaky sometimes.
85914fc
to
862f9f7
Compare
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
862f9f7
to
88d7cd7
Compare
I've already rebased this PR. Any other comment? Thanks |
Signed-off-by: Ruben Vargas [email protected]