mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Remove cache-based short-circuit of token cleanup
This commit is contained in:
parent
577eb94c68
commit
bd552c99c5
@ -415,11 +415,6 @@ func (e *TokensController) deleteSecret(secret *api.Secret) error {
|
|||||||
// removeSecretReferenceIfNeeded updates the given ServiceAccount to remove a reference to the given secretName if needed.
|
// removeSecretReferenceIfNeeded updates the given ServiceAccount to remove a reference to the given secretName if needed.
|
||||||
// Returns whether an update was performed, and any error that occurred
|
// Returns whether an update was performed, and any error that occurred
|
||||||
func (e *TokensController) removeSecretReferenceIfNeeded(serviceAccount *api.ServiceAccount, secretName string) error {
|
func (e *TokensController) removeSecretReferenceIfNeeded(serviceAccount *api.ServiceAccount, secretName string) error {
|
||||||
// See if the account even referenced the secret
|
|
||||||
if !getSecretReferences(serviceAccount).Has(secretName) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't want to update the cache's copy of the service account
|
// We don't want to update the cache's copy of the service account
|
||||||
// so remove the secret from a freshly retrieved copy of the service account
|
// so remove the secret from a freshly retrieved copy of the service account
|
||||||
serviceAccounts := e.client.Core().ServiceAccounts(serviceAccount.Namespace)
|
serviceAccounts := e.client.Core().ServiceAccounts(serviceAccount.Namespace)
|
||||||
|
@ -493,7 +493,9 @@ func TestTokenCreation(t *testing.T) {
|
|||||||
ExistingServiceAccount: serviceAccount(emptySecretReferences()),
|
ExistingServiceAccount: serviceAccount(emptySecretReferences()),
|
||||||
|
|
||||||
DeletedSecret: serviceAccountTokenSecret(),
|
DeletedSecret: serviceAccountTokenSecret(),
|
||||||
ExpectedActions: []core.Action{},
|
ExpectedActions: []core.Action{
|
||||||
|
core.NewGetAction("serviceaccounts", api.NamespaceDefault, "default"),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user