-
Notifications
You must be signed in to change notification settings - Fork 3
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
Initial support for fancy(er) Diff output #89
base: main
Are you sure you want to change the base?
Conversation
@hnnsgstfssn(and team) WDYT about this diff format? |
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.
Hey, thanks! I've notified the team to take a look.
Doing a first pass.
I'm in general favour of adding the new format. We're going to use it in some new internal tooling we're building.
The "one list entry removed/added" seems a bit excessive, but that's just me.
How would we allow configuration of the new format?
Should we completely replace the old format?
- - name: "vault:[email protected]" | ||
- kind: Group | ||
! + one list entry added: | ||
+ - name: "vault:[email protected]" | ||
+ kind: Group |
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.
How come the indentation of the two differs? The added item has more indentation that the removed item.
if err != nil { | ||
return "", err | ||
log.Errorf("Failed to generate Dyff report: %v", err) |
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.
This should return the error and not just log it, no? What happens below in case of error here?
if err != nil { | ||
return "", err | ||
log.Errorf("Failed to format a Dyff report: %v", err) |
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 here, what happens below in case of error here? At least it could include the error message in the returned diff string or fail altogether.
kind := target.GetKind() | ||
name := target.GetName() | ||
apiVersion := target.GetAPIVersion() |
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.
Are these guaranteed to be available? If not, then should something be displayed differently when they are empty?
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.
This keys should exist in all k8s object(as opposed to "namespace" and such ), and the function used to get them returns empty strings in case of missing key, so the UX might not be amazing but its still "safe".
I can test for values in the formatting phase , do you think I should?
Do you want to make these part of Telefonistka consumable as a lib or use telefonistka just for diffs?
OK, let me see if there's an easy way to get rid of it
My initial thought was to use some configuration like |
Description
Things to note in new Diff format:
apiVersion
,kind
and object name are always displayed.@@ rbacBindings.security-audit-viewer-vault.subjects @@
include name of the array element: "security-audit-viewer-vault" (see old diff below)New:
Old:
TODO
Type of Change
Checklist