-
Notifications
You must be signed in to change notification settings - Fork 492
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
add egctl edit, egctl logs, update egctl create cmd #1067
Conversation
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #1067 +/- ##
==========================================
- Coverage 81.47% 81.41% -0.07%
==========================================
Files 136 141 +5
Lines 15404 15710 +306
==========================================
+ Hits 12551 12790 +239
- Misses 2276 2331 +55
- Partials 577 589 +12
☔ View full report in Codecov by Sentry. |
var sb strings.Builder | ||
sb.Grow(len(yamlBody)) | ||
for _, l := range lines { | ||
if strings.HasPrefix(l, "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.
if strings.HasPrefix(l, "name: ") { | |
if strings.HasPrefix(l, "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.
updated!
README.md
Outdated
You can also create them using `egctl create httpproxy` command. | ||
```bash | ||
egctl create httpproxy demo --port 10080 \ | ||
--rule="/pipeline=http:https://127.0.0.1:9095,http:https://127.0.0.1:9096,http:https://127.0.0.1:9097" | ||
``` | ||
this command will create `HTTPServer` `demo-server` and `Pipeline` `demo-pipeline-0` which work exactly same to `server-demo` and `pipeline-demo`. See more about [`egctl create httpproxy`](./doc/egctl-cheat-sheet.md#create-httpproxy). | ||
|
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.
propose not adding -server
suffix to the name, user may get confused what he/she has created.
for the pipeline names, also propose not using the pipeline-x
suffixes.
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.
good idea. I will update that!
cmd.Flags().BoolVar(&o.TLS, "tls", false, "Enable TLS") | ||
cmd.Flags().BoolVar(&o.AutoCert, "auto-cert", false, "Enable auto cert") | ||
cmd.Flags().StringVar(&o.CaCertFile, "ca-cert-file", "", "CA cert file") | ||
cmd.Flags().StringArrayVar(&o.CertFiles, "cert-file", []string{}, "Cert 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.
Cert 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.
It use as --cert-file filename1 --cert-file filename2
... If use --cert-files
it feels more like --cert-files filename1,filename2,filename3
, and it should use cmd.Flags().StringSliceVar
. But it may cause some problem, since filename may itself contains ,
.
Is this ok?
cmd.Flags().BoolVar(&o.AutoCert, "auto-cert", false, "Enable auto cert") | ||
cmd.Flags().StringVar(&o.CaCertFile, "ca-cert-file", "", "CA cert file") | ||
cmd.Flags().StringArrayVar(&o.CertFiles, "cert-file", []string{}, "Cert file") | ||
cmd.Flags().StringArrayVar(&o.KeyFiles, "key-file", []string{}, "Key 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.
Key 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.
same as --cert-file
part...
var n int | ||
var follow bool | ||
examples := []general.Example{ | ||
{Desc: "Print the most recent 500 logs by default.", Command: "egctl logs"}, |
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.
Why not print all logs like other logs by default.
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.
Yeah. Here are my concerns.
kubectl logs
will print help information. If print logskubectl logs <pod-name>
. And actuallyegctl create
,egctl apply
will print help information. So, based on this, user may thinkegctl logs
will print help information. They may think there are commands likeegctl logs std
oregctl logs http-access
etc. So, by default, I chooseegctl logs
not print all logs, just a few.- easegress logs can be really really long. So print all logs may be not necessary...
Just my naive opinions, I am ok to change it to print all logs.
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 don't know another command line to do like this, does this usage have a precedent?
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.
Well, I am not sure these cases are precedent. But for really long logs, these tools not print them all by default.
git log
only show a screen of logs, and allow scroll it.journalctl
,systemctl status
is similar.
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.
git log | cat
will output all of them with cat
to dismantle the pager effect. It just uses a pager to display logs, essentially it prints all of the logs. But egctl logs | cat
outputs the last 500 lines. Well, I just provided another thought as I don't strongly insist on my point. You can decide on the design.
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.
You are right. I am just a little afraid that in practice, when user run egctl logs
, and terminal starts to print logs, then they press CTRL+C
... (It happens to me all the time).
I am more prefer current design that provides a user-friendly default setting...
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.
Then it is.
// EditCmd returns edit command. | ||
func EditCmd() *cobra.Command { | ||
examples := []general.Example{ | ||
{Desc: "Edit a resource with name", Command: "egctl edit <resource> <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.
Could we specify editor like vim, nano.
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, in egctl-cheat-sheet.md
, mentioned use of env variable of EGCTL_EDITOR
to change editor. I will add an example about that in examples.
No description provided.