mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Fix int/float apply bug
This commit is contained in:
parent
4ea48886df
commit
10259c959e
@ -105,7 +105,12 @@ func (c *typeConverter) YAMLToTyped(from []byte) (typed.TypedValue, error) {
|
|||||||
return nil, fmt.Errorf("error decoding YAML: %v", err)
|
return nil, fmt.Errorf("error decoding YAML: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.ObjectToTyped(unstructured)
|
gvk := unstructured.GetObjectKind().GroupVersionKind()
|
||||||
|
t := c.parser.Type(gvk)
|
||||||
|
if t == nil {
|
||||||
|
return nil, fmt.Errorf("no corresponding type for %v", gvk)
|
||||||
|
}
|
||||||
|
return t.FromYAML(typed.YAMLObject(string(from)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *typeConverter) TypedToObject(value typed.TypedValue) (runtime.Object, error) {
|
func (c *typeConverter) TypedToObject(value typed.TypedValue) (runtime.Object, error) {
|
||||||
|
@ -68,7 +68,6 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
app: nginx
|
app: nginx
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: nginx
|
app: nginx
|
||||||
@ -91,7 +90,6 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
app: nginx
|
app: nginx
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: nginx
|
app: nginx
|
||||||
|
@ -119,6 +119,19 @@ func TestApplyAlsoCreates(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to retrieve object: %v", err)
|
t.Fatalf("Failed to retrieve object: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test that we can re apply with a different field manager and don't get conflicts
|
||||||
|
_, err = client.CoreV1().RESTClient().Patch(types.ApplyPatchType).
|
||||||
|
Namespace("default").
|
||||||
|
Resource(tc.resource).
|
||||||
|
Name(tc.name).
|
||||||
|
Param("fieldManager", "apply_test_2").
|
||||||
|
Body([]byte(tc.body)).
|
||||||
|
Do().
|
||||||
|
Get()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed to re-apply object using Apply patch: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user