Skip to content
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

kubeadm: Fix omitempty in v1beta2 #77345

Merged
merged 1 commit into from May 4, 2019

Commits on May 3, 2019

  1. kubeadm: Fix omitempty in v1beta2

    There are a couple of problems with regards to the `omitempty` in v1beta1:
    
    - It is not applied to certain fields. This makes emitting YAML configuration
      files in v1beta1 config format verbose by both kubeadm and third party Go
      lang tools. Certain fields, that were never given an explicit value would
      show up in the marshalled YAML document. This can cause confusion and even
      misconfiguration.
    
    - It can be used in inappropriate places. In this case it's used for fields,
      that need to be always serialized. The only one such field at the moment is
      `NodeRegistrationOptions.Taints`. If the `Taints` field is nil, then it's
      defaulted to a slice containing a single control plane node taint. If it's
      an empty slice, no taints are applied, thus, the cluster behaves differently.
      With that in mind, a Go program, that uses v1beta1 with `omitempty` on the
      `Taints` field has no way to specify an explicit empty slice of taints, as
      this would get lost after marshalling to YAML.
    
    To fix these issues the following is done in this change:
    
    - A whole bunch of additional omitemptys are placed at many fields in v1beta2.
    - `omitempty` is removed from `NodeRegistrationOptions.Taints`
    - A test, that verifies the ability to specify empty slice value for `Taints`
      is included.
    
    Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
    rosti committed May 3, 2019
    Configuration menu
    Copy the full SHA
    81e3adc View commit details
    Browse the repository at this point in the history