1
0
mirror of https://github.com/rancher/types.git synced 2025-06-27 14:06:49 +00:00

Fix marshal v1.Taint to yaml panic

**Problem:**
Marshal v1.Taint with timeAdded nil value to yaml panic.

**Solution:**
Use our own taint struct with omitempty flag of timeAdded field.
This commit is contained in:
orangedeng 2019-07-27 10:53:32 +08:00 committed by Alena Prokharchyk
parent 45caae4c52
commit 365da17d01

View File

@ -174,7 +174,7 @@ type RKEConfigNode struct {
// Node Labels
Labels map[string]string `yaml:"labels" json:"labels,omitempty"`
// Node Taints
Taints []v1.Taint `yaml:"taints" json:"taints,omitempty"`
Taints []RKETaint `yaml:"taints" json:"taints,omitempty"`
}
type RKEK8sSystemImage struct {
@ -386,7 +386,7 @@ type RKEConfigNodePlan struct {
// Node Labels
Labels map[string]string `json:"labels,omitempty"`
// Node Taints
Taints []v1.Taint `json:"taints,omitempty"`
Taints []RKETaint `json:"taints,omitempty"`
}
type Process struct {
@ -760,3 +760,10 @@ type DNSConfig struct {
// NodeSelector key pair
NodeSelector map[string]string `yaml:"node_selector" json:"nodeSelector,omitempty"`
}
type RKETaint struct {
Key string `json:"key,omitempty" yaml:"key"`
Value string `json:"value,omitempty" yaml:"value"`
Effect v1.TaintEffect `json:"effect,omitempty" yaml:"effect"`
TimeAdded *metav1.Time `json:"timeAdded,omitempty" yaml:"timeAdded,omitempty"`
}