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

Handle normalization of host:port addresses in operator upgrade for 1.18 #1033

Conversation

rubenvp8510
Copy link
Collaborator

Signed-off-by: Ruben Vargas [email protected]

@objectiser
Copy link
Contributor

@rubenvp8510 Is this one ready for review? Still has the WIP

@rubenvp8510
Copy link
Collaborator Author

@rubenvp8510 Is this one ready for review? Still has the WIP

@objectiser This is in WIP due the fact that the test fails because latest = 1_17_1, but the rest of the work is ready for review.

@objectiser objectiser requested a review from pavolloffay April 23, 2020 15:10
return jaeger, nil
}

func transformCollectorPorts(jaeger *v1.Jaeger, opts v1.Options, flagMap []deprecationFlagMap) v1.Options {
Copy link
Member

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.

Copy link
Member

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

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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

"collector.host-port",
"reporter.tchannel.discovery.conn-check-timeout",
"reporter.tchannel.discovery.min-peers",
"reporter.tchannel.host-port",
Copy link
Member

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?

Copy link
Collaborator Author

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 Show resolved Hide resolved
pkg/upgrade/v1_18_0.go Outdated Show resolved Hide resolved
return v1.NewOptions(in)
}

func migrateAgentOptions(jaeger *v1.Jaeger, collectorGrpcPort string) v1.Options {
Copy link
Member

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{
Copy link
Member

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.

Copy link
Collaborator Author

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 {
Copy link
Member

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.

Copy link
Collaborator Author

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

@rubenvp8510 rubenvp8510 changed the title WIP - Handle normalization of host:port addresses in operator upgrade for 1.18 Handle normalization of host:port addresses in operator upgrade for 1.18 Apr 28, 2020
@codecov
Copy link

codecov bot commented Apr 28, 2020

Codecov Report

Merging #1033 into master will increase coverage by 0.24%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
pkg/upgrade/v1_18_0.go 100.00% <100.00%> (ø)

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 db31a0c...88d7cd7. Read the comment docs.

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.

LGTM, I would just remove those empty lines.

}
opts := migrateDeprecatedOptions(jaeger, jaeger.Spec.Collector.Options, collectorDeprecatedFlags)
return transformCollectorPorts(jaeger.Logger(), opts, collectorDeprecatedFlags)

Copy link
Member

Choose a reason for hiding this comment

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

nit: remove line

}

return v1.NewOptions(opsMap)

Copy link
Member

Choose a reason for hiding this comment

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

nit: remove empty line

}

func migrateAgentOptions(jaeger *v1.Jaeger) v1.Options {

Copy link
Member

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"
Copy link
Member

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.

@rubenvp8510 rubenvp8510 force-pushed the normalization-portaddress-TRACING-1111 branch 2 times, most recently from 85914fc to 862f9f7 Compare April 29, 2020 14:00
@rubenvp8510 rubenvp8510 force-pushed the normalization-portaddress-TRACING-1111 branch from 862f9f7 to 88d7cd7 Compare April 29, 2020 17:51
@rubenvp8510
Copy link
Collaborator Author

I've already rebased this PR. Any other comment?

Thanks

@pavolloffay pavolloffay merged commit 67dc7d3 into jaegertracing:master May 4, 2020
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