-
Notifications
You must be signed in to change notification settings - Fork 10
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
Sample config file generation #43
Conversation
Codecov Report
@@ Coverage Diff @@
## master #43 +/- ##
==========================================
+ Coverage 80.26% 80.51% +0.25%
==========================================
Files 7 8 +1
Lines 1140 1247 +107
==========================================
+ Hits 915 1004 +89
- Misses 118 127 +9
- Partials 107 116 +9
Continue to review full report at Codecov.
|
This looks very cool, I'll try it out. If we are eliminating the need for users to download the -envoy release package just to get the samples, that would be fantastic. Thoughts on the flags: We might as well add short flags as well. Thoughts? |
Short flags sounds good! But since the command is taking advantage of the shared.Resolve() right now, many characters such as I fully agree on the no-overwrite by default strategy. In fact the program didn't allow overwriting till I started the unit tests and went for the convenient route...Will address it. |
If the goal is to eliminate the need for the samples in -envoy repo, we may as well generate a |
Yes, removing the need for Resolve() sounds fine to me. Re: httpbin, yes... we could do that as well. If a user could do the sample create, apply, and run, without any additional work... that would make it less error-prone. But it only makes sense if they're actually specifying httpbin as their target. I suppose we could make that the default (I know, reversing what I said on making those entries required) and generate the whole thing. Then, if they do specify a target, we don't create it. |
…y overwrite by default
|
Working to bin the template files into templates.go. |
cmd/samples/samples.go
Outdated
c.Flags().StringVarP(&s.outDir, "out", "", "./samples", "directory to create config files within") | ||
c.Flags().StringVarP(&s.TargetService.Name, "name", "n", "httpbin", "target service name") | ||
c.Flags().StringVarP(&s.TargetService.Host, "host", "", "httpbin.org", "target service host") | ||
c.Flags().StringVarP(&s.TargetService.Prefix, "prefix", "p", "/", "target service prefix") |
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 should remove path rewrite because of the confusing issues around ordering. Thoughts?
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.
Sounds good to me.
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.
Sorry, but I already removed the prefix rewriting. This flag is taking the path for matching, i.e., for the Envoy router to take the request to the desired upstream cluster. Should we remove that as well? I think it probably should stay.
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.
Gotcha. Hmm. But the only benefit would be to allow other endpoints to not be captured by the matcher, correct? Is that important for sample generation?
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.
That's true. All traffics are meant for the only target in the sample. Let me remove it then.
cmd/samples/samples.go
Outdated
} | ||
|
||
c.Flags().StringVarP(&s.ConfigPath, "config", "c", "", "Path to Apigee Remote Service config file") | ||
c.Flags().BoolVarP(&s.isNative, "native", "", false, "generate config for native envoy (otherwise assuming istio)") |
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 wonder... could we pass a template name instead? So, for example, a user could pass in -t native
or -t istio-1.7
and have access to all 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.
Makes sense.
cmd/samples/samples.go
Outdated
}, | ||
} | ||
|
||
c.Flags().StringVarP(&s.ConfigPath, "config", "c", "", "Path to Apigee Remote Service config file") |
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.
de-capitalize - all the other descriptions start lowercase
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.
Actually, the config file description in the root.go is identical to this. I am going to change both to lower case.
cmd/samples/samples.go
Outdated
if err != nil { | ||
return errors.Wrap(err, "loading config yaml file") | ||
} | ||
return errors.Wrap(s.createSampleConfigs(printf), "creating sample config files") |
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.
We should emit a final message when it finishes successfully. Maybe remind them of the next steps: label the default namespace and run kubectl apply on the directory?
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.
Sure.
It works as the following:
./cli samples create -c config.yaml [--out-dir samples] [--native --host target-service-host --name target-service-cluster-name --prefix target-service-prefix --tls tls-directory]
--out-dir
defaults to./samples
and the cli overwrites existing files.Those target service related flags as well as tls are only for
--native
. Users are responsible for preparing the deployment related files for their target services if it's in Istio.Open to suggestions.
To fix #34