Skip to content

Commit

Permalink
Cleanup OwnerReferences in template
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko Mikulicic committed Sep 10, 2019
1 parent 6bc2e54 commit bb72792
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/apis/sealed-secrets/v1alpha1/sealedsecret_expansion.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ func NewSealedSecret(codecs runtimeserializer.CodecFactory, pubKey *rsa.PublicKe
// See https://github.com/bitnami-labs/sealed-secrets/issues/227
StripLastAppliedAnnotations(s.Spec.Template.ObjectMeta.Annotations)

// Cleanup ownerReference (See #243)
s.Spec.Template.ObjectMeta.OwnerReferences = nil

// RSA-OAEP will fail to decrypt unless the same label is used
// during decryption.
label, clusterWide, namespaceWide := labelFor(secret)
Expand Down
11 changes: 11 additions & 0 deletions pkg/apis/sealed-secrets/v1alpha1/sealedsecret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,13 @@ func TestSealMetadataPreservation(t *testing.T) {
Name: "myname",
Namespace: "myns",
Annotations: map[string]string{tc.key: "test value"},
OwnerReferences: []metav1.OwnerReference{
{
APIVersion: "foo/v1",
Kind: "Foo",
Name: "foo",
},
},
},
Data: map[string][]byte{
"foo": []byte("bar"),
Expand All @@ -452,6 +459,10 @@ func TestSealMetadataPreservation(t *testing.T) {
if want := tc.preserved; got != want {
t.Errorf("key %q: exists: %v, expected to exist: %v", tc.key, got, want)
}

if got, want := len(ssecret.Spec.Template.OwnerReferences), 0; got != want {
t.Errorf("got: %d, want: %d", got, want)
}
}
}

Expand Down

0 comments on commit bb72792

Please sign in to comment.