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).
APIVersion: configv1alpha1.SchemeGroupVersion.String(), ownerReferences := []metav1.OwnerReference{{
Kind: "OIDCClient", APIVersion: configv1alpha1.SchemeGroupVersion.String(),
Name: oidcClientName, Kind: "OIDCClient",
UID: oidcClientUID, Name: oidcClientName,
Controller: nil, // TODO should this be true? UID: oidcClientUID,
BlockOwnerDeletion: nil, Controller: nil, // doesn't seem to matter, and there is no particular controller owning this
}, 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)
} }