Commit 1dd3cb58 authored by Saad Ali's avatar Saad Ali

Merge pull request #22160 from liggitt/token-e2e

Remove short-circuit of token reference cleanup
parents d1d03639 bd552c99
......@@ -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.
// Returns whether an update was performed, and any error that occurred
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
// so remove the secret from a freshly retrieved copy of the service account
serviceAccounts := e.client.Core().ServiceAccounts(serviceAccount.Namespace)
......
......@@ -492,8 +492,10 @@ func TestTokenCreation(t *testing.T) {
"deleted secret with serviceaccount without reference": {
ExistingServiceAccount: serviceAccount(emptySecretReferences()),
DeletedSecret: serviceAccountTokenSecret(),
ExpectedActions: []core.Action{},
DeletedSecret: serviceAccountTokenSecret(),
ExpectedActions: []core.Action{
core.NewGetAction("serviceaccounts", api.NamespaceDefault, "default"),
},
},
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment