-
Notifications
You must be signed in to change notification settings - Fork 123
feat: add deployment flag for printing out the graph of resources #1064
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,8 @@ type DeployFlags struct { | |
| AppMetadataFile string | ||
|
|
||
| DisableGKScoping bool | ||
|
|
||
| ChangeGraphFile string | ||
| } | ||
|
|
||
| func (s *DeployFlags) Set(cmd *cobra.Command) { | ||
|
|
@@ -63,4 +65,6 @@ func (s *DeployFlags) Set(cmd *cobra.Command) { | |
|
|
||
| cmd.Flags().BoolVar(&s.DisableGKScoping, "dangerous-disable-gk-scoping", | ||
| false, "Disable scoping of resource searching to used GroupKinds") | ||
|
|
||
| cmd.Flags().StringVar(&s.ChangeGraphFile, "change-graph-file-output", "", "Render the deployment graph to a file") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense that this option would only print the graph and not apply it?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see it as option to print out the graph that will be used to apply. This flag can then be used either with the apply or with the |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // Copyright 2024 The Carvel Authors. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package diffgraph | ||
|
|
||
| type RenderedNodeData struct { | ||
| Name string `json:"name"` | ||
| Namespace *string `json:"namespace"` | ||
| ChangeGroups []string `json:"changeGroups"` | ||
| GroupKind RenderedGroupKind `json:"groupKind"` | ||
| Op ActualChangeOp `json:"op"` | ||
| } | ||
|
|
||
| type RenderedNode struct { | ||
| ID string `json:"id"` | ||
| Data RenderedNodeData `json:"data"` | ||
| } | ||
|
|
||
| type RenderedGroupKind struct { | ||
| Group string `json:"group"` | ||
| Kind string `json:"kind"` | ||
| } | ||
|
|
||
| type RenderedEdge struct { | ||
| Source string `json:"source"` | ||
| Target string `json:"target"` | ||
| } | ||
|
|
||
| type RenderedGraph struct { | ||
| Nodes []RenderedNode `json:"nodes"` | ||
| Edges []RenderedEdge `json:"edges"` | ||
| } |
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.
Any particular reason we do this check in this line and in line 528?
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.
having it here makes it clear what the cli logic actually does. The check in the
writeChangeGraphToFilewas purely defensive/copying the pattern ofwriteAppMetadataToFile. Happy to remove that to remove any confusion