Skip to content

Detect immutable field changes #730

Open

Description

@okozachenko1203

Is it possible to add the information in the change list if the change is for immutable fields of the resource type.

I was able to get the change path in dyff output format.

spec.selector.matchLabels.component  (Deployment/default/memcached-memcached)
  ± value change
    - server
    + server-new

I can see the default helm diff template in the code base.

package diff
const defaultTemplateReport = `[
{{- $global := . -}}
{{- range $idx, $entry := . -}}
{
"api": "{{ $entry.API }}",
"kind": "{{ $entry.Kind }}",
"namespace": "{{ $entry.Namespace }}",
"name": "{{ $entry.Name }}",
"change": "{{ $entry.Change }}"
}{{ if not (last $idx $global) }},{{ end }}
{{- end }}]`

It would be good if we can render the change path (for instance, spec.selector.matchLabels.component) in the tpl.

Activity

  1. yxxhero commented on Jan 24, 2025

    @yxxhero
    Collaborator

    @okozachenko1203 PR is welcome.

  2. harshit3355 commented on Nov 25, 2026

    @harshit3355

    I would like to work on this one. As I read it, the diff should say when a change touches a field that Kubernetes will not accept on upgrade, for example a Deployment spec.selector or a Service spec.clusterIP. My plan is a small built-in table of well-known immutable fields per kind and a warning line in the diff output for each resource where one of them changed, without changing the diff itself or the exit code. Is that what you had in mind, or would you rather start with the change path in the template (as in #729) and leave the immutable part out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions