Open joshua9519 opened 1 year ago
I may be running into this as well. Are you using anything to control your argocd-secret Secret, such as an ExternalSecret? It looks like this secret gets updated with the new token data, but this quickly gets removed from the ExternalSecret syncing.
I also experienced generated tokens being deleted randomly.
Turns out it was because I re-applied my terraform configuration so the accounts.<myuser>.tokens
entry in the argocd-secret
Secret was removed.
A workaround is to ignore the argocd-secret
changes or to add the accounts.<myuser>.tokens
in the terraform configuration.
I think this is a reason we should do this: https://github.com/argoproj/argo-cd/issues/10393
I also experienced generated tokens being deleted randomly.
Turns out it was because I re-applied my terraform configuration so the
accounts.<myuser>.tokens
entry in theargocd-secret
Secret was removed.A workaround is to ignore the
argocd-secret
changes or to add theaccounts.<myuser>.tokens
in the terraform configuration.
is accounts.<myuser>.tokens
documented anywhere?
@patpicos nowhere besides a small mention here: https://argo-cd.readthedocs.io/en/stable/operator-manual/argocd-secret-yaml/
@john-jam - can you please elaborate on the workaround:
A workaround is ... to add the accounts.\<myuser>.tokens in the terraform configuration.
How is the token (not secret) being created/managed? When I create an API token and inspect argocd-secret, I see it has the following structure:
$ kubectl get secret argocd-secret -o yaml
...
data:
accounts.myuser.tokens: <base64>
and when I decode it I get something like this:
[{"id":"<UUID which is not the token>","iat":1724123456}]
@yair-segal My use case was probably different than yours but here is a more detailed description if that can help:
oidc.*
config or the server.secretKey
valueaccounts.myuser.tokens
was added to that secret (I guess the argocd service does that automatically within the cluster)accounts.myuser.tokens
entry definition)So the workaround was to ignore the accounts.myuser.tokens
with the lifecycle.ignore_change
option in the k8s secret terraform resource definition.
Hi @john-jam thanks for the added details. Our use case is similar -- we are using the terraform resource "helm_release" to manage the ArgoCD helm chart lifecycle (including the argocd-secret
Secret object), and pass the values to the values
field.
But yes, when changing a value in the Values to the helm chart, the argocd-secret
Secret wipes out the tokens.
Two thoughts:
argocd-secret
as out-of-sync when the tokens entries are added?Hi @yair-segal,
I'm not the right person to answer about how ArgoCD internally works. You might want to ask a maintainer instead. Hope you'll find your answers and a workaround for your use case!
Checklist:
argocd version
.Describe the bug
When I create a user - be it an apiToken or both login and apiToken user - and then attempt to generate a token for it via the UI or the CLI or API, a token is returned but it is not registered in the user's list of tokens and so can't be used. If I do attempt to use it, I see:
To Reproduce
argocd-cm
:accounts.githubci: apiKey,login
Via UI:
Alternatively, via the API:
Expected behavior
Expect that the generated token should be added to the account's list of tokens and thus can be used to run commands as that user.
Version
Logs