Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes when creating the deploy account token, it comes back in a different order #12

Closed
tobiasmcnulty opened this issue Feb 4, 2020 · 2 comments · Fixed by #36
Closed

Comments

@tobiasmcnulty
Copy link
Member

TASK [caktus.django-k8s : Get deploy account token] ************************************************************************************************************************************
fatal: [testrestore]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'secrets'\n\nThe error appears to be in '.../ansible-role-django-k8s/tasks/main.yml': line 39, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Get deploy account token\n  ^ here\n"}

See #9

@JeremyGibson
Copy link
Contributor

I have run into this issue while testing, and in my testing it does not appear that the account token is even included in the deploy-account object in any location. I've removed a bunch of output for concision.

It appears that the output is registered before the ServiceAccount is fully created, which leaves the secrets field missing.

changed: [jmg-test-site] => changed=true 
  ....
  result:
    results:
    - changed: true
      duration: 0
      method: create
      result:
        apiVersion: v1
        kind: ServiceAccount
        metadata:
          creationTimestamp: '2021-01-26T16:58:57Z'
          name: deploy-account
          namespace: jmg-test-site
          resourceVersion: '3443488'
          selfLink:<REMOVED>
      warnings: []
...

I've set a wait_condition on this task, which fails since ServiceAccounts, don't have AFAIKT the right fields to be used by wait_condition. However after the wait condition timeout is exceeded and the task fails, the output shows the expected results

method: create
  msg: Resource creation timed out
  result:
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      creationTimestamp: '2021-01-26T16:19:04Z'
      name: deploy-account
      namespace: jmg-test-site
      resourceVersion: '3433921'
      selfLink: /api/v1/namespaces/jmg-test-site/serviceaccounts/deploy-account
      uid: eedc80e7-9c99-48b6-b547-f38d6cbcb1d8
    secrets:
    - name: deploy-account-token-67t9q

@JeremyGibson
Copy link
Contributor

This commit fixes the missing deploy-account name problem. I was unable to recreate the circumstances where a the name came back in a different location. However I believe this method adds some value in that it makes explicit where the information is coming from, so if it fails we know exactly why.
08e6f3c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants