mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Merge pull request #31515 from gjenkins8/gjenkins/copy_adopted
fix: Copy adopted resource info
This commit is contained in:
commit
698fcd2290
2 changed files with 6 additions and 2 deletions
|
|
@ -55,7 +55,8 @@ func requireAdoption(resources kube.ResourceList) (kube.ResourceList, error) {
|
|||
return fmt.Errorf("could not get information about the resource %s: %w", resourceString(info), err)
|
||||
}
|
||||
|
||||
requireUpdate.Append(info)
|
||||
infoCopy := *info
|
||||
requireUpdate.Append(&infoCopy)
|
||||
return nil
|
||||
})
|
||||
|
||||
|
|
@ -84,7 +85,8 @@ func existingResourceConflict(resources kube.ResourceList, releaseName, releaseN
|
|||
return fmt.Errorf("%s exists and cannot be imported into the current release: %s", resourceString(info), err)
|
||||
}
|
||||
|
||||
requireUpdate.Append(info)
|
||||
infoCopy := *info
|
||||
requireUpdate.Append(&infoCopy)
|
||||
return nil
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ func TestRequireAdoption(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Len(t, found, 1)
|
||||
assert.Equal(t, found[0], existing)
|
||||
assert.NotSame(t, found[0], existing)
|
||||
}
|
||||
|
||||
func TestExistingResourceConflict(t *testing.T) {
|
||||
|
|
@ -156,6 +157,7 @@ func TestExistingResourceConflict(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Len(t, found, 1)
|
||||
assert.Equal(t, found[0], existing)
|
||||
assert.NotSame(t, found[0], existing)
|
||||
|
||||
// Verify that an existing resource that lacks labels/annotations results in an error
|
||||
resources = append(resources, conflict)
|
||||
|
|
|
|||
Loading…
Reference in a new issue