mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
kubeadm: fix diff order and add test for new default value manifest
This commit is contained in:
parent
0ee315b94c
commit
912041ce41
@ -372,7 +372,7 @@ func ManifestFilesAreEqual(path1, path2 string) (bool, error) {
|
|||||||
if bytes.Equal(hash1, hash2) {
|
if bytes.Equal(hash1, hash2) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
klog.V(4).Infof("Pod manifest files diff:\n%s\n", cmp.Diff(pod1, pod2))
|
klog.V(4).Infof("Pod manifest files diff:\n%s\n", cmp.Diff(pod2, pod1))
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,6 +652,22 @@ spec:
|
|||||||
- image: gcr.io/google_containers/etcd-amd64:3.1.11
|
- image: gcr.io/google_containers/etcd-amd64:3.1.11
|
||||||
status: {}
|
status: {}
|
||||||
`
|
`
|
||||||
|
invalidWithDefaultFields = `
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
tier: control-plane
|
||||||
|
component: etcd
|
||||||
|
name: etcd
|
||||||
|
namespace: kube-system
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: gcr.io/google_containers/etcd-amd64:3.1.11
|
||||||
|
restartPolicy: "Always"
|
||||||
|
status: {}
|
||||||
|
`
|
||||||
|
|
||||||
validPod2 = `
|
validPod2 = `
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
@ -749,6 +765,12 @@ func TestManifestFilesAreEqual(t *testing.T) {
|
|||||||
expectedResult: false,
|
expectedResult: false,
|
||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: "manifests are not equal for adding new defaults",
|
||||||
|
podYamls: []string{validPod, invalidWithDefaultFields},
|
||||||
|
expectedResult: false,
|
||||||
|
expectErr: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: "first manifest doesn't exist",
|
description: "first manifest doesn't exist",
|
||||||
podYamls: []string{validPod, ""},
|
podYamls: []string{validPod, ""},
|
||||||
|
Loading…
Reference in New Issue
Block a user