Resolve a todo in oidcclientsecretstorage.go

This commit is contained in:
Ryan Richard 2022-09-19 10:58:27 -07:00
parent 90f13225ef
commit b49dcc7d45

View File

@ -80,16 +80,16 @@ func (s *OIDCClientSecretStorage) Set(ctx context.Context, resourceVersion, oidc
name := uidToName(oidcClientUID) name := uidToName(oidcClientUID)
if mustBeCreate := len(resourceVersion) == 0; mustBeCreate { if mustBeCreate := len(resourceVersion) == 0; mustBeCreate {
ownerReferences := []metav1.OwnerReference{ // Setup an owner reference for garbage collection purposes. When the OIDCClient is deleted, then this
{ // corresponding client secret storage secret should also be automatically deleted (by Kube garbage collection).
ownerReferences := []metav1.OwnerReference{{
APIVersion: configv1alpha1.SchemeGroupVersion.String(), APIVersion: configv1alpha1.SchemeGroupVersion.String(),
Kind: "OIDCClient", Kind: "OIDCClient",
Name: oidcClientName, Name: oidcClientName,
UID: oidcClientUID, UID: oidcClientUID,
Controller: nil, // TODO should this be true? Controller: nil, // doesn't seem to matter, and there is no particular controller owning this
BlockOwnerDeletion: nil, BlockOwnerDeletion: nil,
}, }}
}
if _, err := s.storage.Create(ctx, name, secret, nil, ownerReferences); err != nil { if _, err := s.storage.Create(ctx, name, secret, nil, ownerReferences); err != nil {
return fmt.Errorf("failed to create client secret for uid %s: %w", oidcClientUID, err) return fmt.Errorf("failed to create client secret for uid %s: %w", oidcClientUID, err)
} }