Skip to content

feat: Improved diff on apiVersion changes #73

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

Merged
merged 2 commits into from
Jul 25, 2018

Conversation

novas0x2a
Copy link
Contributor

@novas0x2a novas0x2a commented Jul 13, 2018

Resolves #70

When the apiVersion of a Kind changes, helm-diff detects this as a
remove/readd of the whole manifest; this makes it difficult to see the
actual changes. This change enables a small heuristic so apiVersion
changes like authentication.k8s.io/v1beta1 ->
authentication.k8s.io/v1 show up as a one-line diff instead of a
full-manifest diff, while hopefully not meddling with unexpected
apiVersions too badly.

When the apiVersion of a Kind changes, helm-diff detects this as a
remove/readd of the whole manifest; this makes it difficult to see the
actual changes. This change enables a small heuristic so apiVersion
changes like `authentication.k8s.io/v1beta1` ->
`authentication.k8s.io/v1` show up as a one-line diff instead of a
full-manifest diff, while hopefully not meddling with unexpected
apiVersions too badly.
@helgi
Copy link
Contributor

helgi commented Jul 23, 2018

@mumoshu @databus23 Would be useful to have this in a release as people are starting to move from older APIs (beta) to the stable ones for Deployments and such; and it kinda freaks them out seeing an add/remove kind of diff when that isn't the case :)

Copy link
Collaborator

@mumoshu mumoshu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A neat feature! I appreciate your contribution, as well as your effort to improve test coverage 🎉

apiBase = strings.Join(sp[:len(sp)-1], "/")
}

return fmt.Sprintf("%s, %s, %s (%s)", m.Metadata.Namespace, m.Metadata.Name, m.Kind, apiBase)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For anyone interested - This is the heuristic to treat both apiVersions apps/v1 and apps/v1beta as just apps, so that we can give the same manifest name in mapping results for appropriate diffing.

@mumoshu mumoshu changed the title Improve output on apiVersion changes feat: Improve diff on apiVersion changes Jul 25, 2018
@mumoshu mumoshu changed the title feat: Improve diff on apiVersion changes feat: Improveed diff on apiVersion changes Jul 25, 2018
@mumoshu mumoshu changed the title feat: Improveed diff on apiVersion changes feat: Improved diff on apiVersion changes Jul 25, 2018
@mumoshu mumoshu merged commit 1846c74 into databus23:master Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants