-
Notifications
You must be signed in to change notification settings - Fork 57
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
Expose clear transients in ecctl #649
Conversation
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.
functionally LGTM though someone more familiar (Dominik?) should give it the "binding review" :)
cmd/deployment/show.go
Outdated
@@ -112,4 +123,5 @@ func initShowFlags() { | |||
showCmd.Flags().BoolP("metadata", "m", false, "Shows the deployment metadata") | |||
showCmd.Flags().BoolP("settings", "s", false, "Shows the deployment settings") | |||
showCmd.Flags().Bool("generate-update-payload", false, "Outputs JSON which can be used as an argument for the --file flag with the update command.") | |||
showCmd.Flags().Bool("clear-transient", false, "Removes the `transient` field in order to make read - edit - write loop safe") |
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.
should the comment explain that its default is true when generate-update-payload is enabled?
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 I think so. I updated documentation.
docs/ecctl_deployment_show.adoc
Outdated
--plans Shows the deployment plans | ||
--ref-id string Optional deployment kind RefId, if not set, the RefId will be auto-discovered | ||
-s, --settings Shows the deployment settings | ||
--clear-transient transient Removes the transient field in order to make read - edit - write loop safer. The default value of clear-transient depends on the value of `generate-update-payload`. If `generate-update-payload` is true `clear-transient` defaults to true. Otherwise defaults to false. |
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.
Looks like some issue with the docs generator: It adds a transient that shouldn't be there --clear-transient transient Removes the
It seems like it is due to `` in the text. Maybe some special syntax 🤔
@@ -192,6 +192,7 @@ func Test_showCmd(t *testing.T) { | |||
Path: "/api/v1/deployments/29337f77410e23ab30e15c280060facf", | |||
Host: api.DefaultMockHost, | |||
Query: url.Values{ | |||
"clear_transient": {"true"}, |
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.
There is another test below succeeds with show flags set
where the --clear-transient
flag can be added to test that that works as well.
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, just two comments on a small issue with the docs and maybe a test that could be added
Description
Exposes new
clear_transients
field for ecctl for show deployment.The default value depends on on the value of
generate-update-payload
in order to facilitate safe usage of the "read - edit - write" loop. Ifgenerate-update-payload=true
thenclear-transients
also defaults to true and is false otherwise. If the flag is manually passed then that value takes precedence.Related Issues
https://elasticco.atlassian.net/browse/CP-4726
Motivation and Context
This change makes reading and writing deployments safer. We ran into this during the last security remediation and almost overwrote someone’s cluster from their most recent snapsho
How Has This Been Tested?
This has been tested by using local build to operate against QA ESS. I have verified that with
--generate-update-payload=true
the transient properties are not included (default behavior). If--generate-update-payload=true
and--clear-transient=false
is explicitly passed then transient properties are included.Types of Changes
Readiness Checklist