operator-framework / operator-controller

Apache License 2.0
28 stars 47 forks source link

Implement a Go struct for fetching and caching authentication tokens for a ServiceAccount #972

Open everettraven opened 1 week ago

everettraven commented 1 week ago

In order to utilize a provided ServiceAccount to install and manage content, operator-controller needs to be capable of fetching an authentication token for a given ServiceAccount. Once retrieved, this token can then be used to create clients that authenticate as the ServiceAccount to perform operations on the cluster.

The scope of this issue is limited to specifically implementing a Go type to fetch and cache these authentication tokens and does not include utilizing the token retrieved.

While the exact implementation may vary, here are some things to consider:

A high-level overview of what the logic flow could look like:

graph LR
  A(ServiceAccount)
  B(TokenGetter)
  C(TokenRequest)
  D(Token)
  E(Token Cache)
  F{In Cache?}
  G{Expired?}

  A -- Provided To --> B
  B --> F
  F -- Yes --> G
  F -- No --> C
  G -- Yes --> C
  G -- No --> E
  C -- Returns --> D
  E -- Returns --> D
  D -- Stored in --> E

Acceptance Criteria:

skattoju commented 5 days ago

/assign