mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-04 15:16:58 +00:00
Add merge support for serviceaccounts
All properties from a backup will be merged into the ServiceAccount except for the default token secret. Signed-off-by: Nolan Brubaker <nolan@heptio.com>
This commit is contained in:
@@ -122,3 +122,14 @@ func Exists(root map[string]interface{}, path string) bool {
|
||||
_, err := GetValue(root, path)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// MergeMaps takes two map[string]string and merges missing keys from the second into the first.
|
||||
// If a key already exists, its value is not overwritten.
|
||||
func MergeMaps(first, second map[string]string) {
|
||||
for k, v := range second {
|
||||
_, ok := first[k]
|
||||
if !ok {
|
||||
first[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ limitations under the License.
|
||||
|
||||
package collections
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetString(t *testing.T) {
|
||||
var testCases = []struct {
|
||||
|
||||
@@ -64,3 +64,8 @@ func (c *FakeDynamicClient) Get(name string, opts metav1.GetOptions) (*unstructu
|
||||
args := c.Called(name, opts)
|
||||
return args.Get(0).(*unstructured.Unstructured), args.Error(1)
|
||||
}
|
||||
|
||||
func (c *FakeDynamicClient) Patch(name string, data []byte) (*unstructured.Unstructured, error) {
|
||||
args := c.Called(name, data)
|
||||
return args.Get(0).(*unstructured.Unstructured), args.Error(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user