You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 <[email protected]>
// BindPort sets the secure port for the API Server to bind to.
190
190
// Defaults to 6443.
191
-
BindPortint32`json:"bindPort"`
191
+
BindPortint32`json:"bindPort,omitempty"`
192
192
}
193
193
194
194
// NodeRegistrationOptions holds fields that relate to registering a new control-plane or node to the cluster, either via "kubeadm init" or "kubeadm join"
@@ -205,7 +205,7 @@ type NodeRegistrationOptions struct {
205
205
// Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process
206
206
// it will be defaulted to []v1.Taint{'node-role.kubernetes.io/master=""'}. If you don't want to taint your control-plane node, set this field to an
207
207
// empty slice, i.e. `taints: {}` in the YAML file. This field is solely used for Node registration.
208
-
Taints []v1.Taint`json:"taints,omitempty"`
208
+
Taints []v1.Taint`json:"taints"`
209
209
210
210
// KubeletExtraArgs passes through extra arguments to the kubelet. The arguments here are passed to the kubelet command line via the environment file
211
211
// kubeadm writes at runtime for the kubelet to source. This overrides the generic base-level configuration in the kubelet-config-1.X ConfigMap
@@ -216,11 +216,11 @@ type NodeRegistrationOptions struct {
216
216
// Networking contains elements describing cluster's networking configuration
217
217
typeNetworkingstruct {
218
218
// ServiceSubnet is the subnet used by k8s services. Defaults to "10.96.0.0/12".
0 commit comments