-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat(pkger): add ability to export resources by name from cli #19457
Conversation
these functions are not hit by the cli
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.
No hard blockers, just a couple of questions
@@ -27,7 +27,7 @@ type NameGenerator func() string | |||
// ResourceToClone is a resource that will be cloned. | |||
type ResourceToClone struct { | |||
Kind Kind `json:"kind"` | |||
ID influxdb.ID `json:"id"` | |||
ID influxdb.ID `json:"id,omitempty"` |
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.
do you know if any frontend code depends on this? changing how it handles empty might require changes on the javascript side.
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'm not certain the relationship, but it is required to be omitted when exporting by name (specifying only name in the payload). i suppose the swagger should be updated to note that it is only required when no name is specified and optional if it is specified. ...i don't love how if both are specified, the resource is found by the id and the exported result is renamed to the name provided.
pkger/service_logging.go
Outdated
@@ -148,7 +148,8 @@ func (s *loggingMW) Export(ctx context.Context, opts ...ExportOptFn) (template * | |||
s.logger.Error("failed to export template", zap.Error(err), dur) | |||
return | |||
} | |||
s.logger.Info("failed to export template", append(s.summaryLogFields(template.Summary()), dur)...) | |||
// todo: should these be Debug 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.
@russorat are you the man to answer this?
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.
Based on what i see in other parts of the app, i would think these "failed to" logs should be debug.
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.
the failed to
seemed to be copypasta. the logs in question are the success logs
s.logger.Info("template dry run successful", fields...)
// ...
s.logger.Info("template apply successful", fields...)
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.
Ah, if they are success logs, i would think they should be Info
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.
Works for me, but I haven't tested the swagger definition with yarn generate
. is the swagger def good to go?
@@ -135,7 +135,9 @@ func filterDashboardsFn(filter influxdb.DashboardFilter) func(d *influxdb.Dashbo | |||
} | |||
} | |||
|
|||
return func(d *influxdb.Dashboard) bool { return true } | |||
return func(d *influxdb.Dashboard) bool { | |||
return ((filter.OrganizationID == nil) || (*filter.OrganizationID == d.OrganizationID)) |
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.
Hoping this is kosher, it follows the pattern of labels
func filterLabelsFn(filter influxdb.LabelFilter) func(l *influxdb.Label) bool {
return func(label *influxdb.Label) bool {
return (filter.Name == "" || (strings.EqualFold(filter.Name, label.Name))) &&
((filter.OrgID == nil) || (filter.OrgID != nil && *filter.OrgID == label.OrgID))
}
}
Closes #18733
Export resources by name via the cli.