Implementation status: beta
ApiToken
is a resource that allows you to create API tokens for an Unleash instance.
Creates a new unleash API token for the Unleash instance specified in the unleashInstance
field.
This can be either an Unleash
or a RemoteUnleash
resource in the same namespace.
sequenceDiagram
participant ApiToken
participant Unleasherator
participant Kubernetes
participant Unleash
ApiToken->>Unleasherator: Watch
Unleasherator->>Kubernetes: Get Unleash config
Unleasherator->>Unleash: Check if token exists
opt If token does not exist
Unleasherator->>Unleash: Create new token
Unleasherator->>Kubernetes: Save token in secret
end
Unleasherator->>ApiToken: Update status
The token will be stored in secret in the same namespace as the ApiToken
resource. The name of the secret is specified in the secretName
field and contains the following data:
Key | Default | Description |
---|---|---|
UNLEASH_SERVER_API_TOKEN |
The token itself | |
UNLEASH_SERVER_API_URL |
The URL of the Unleash instance (remember to add /api to the end when authenticating to the Unleash API) |
|
UNLEASH_SERVER_API_ENV |
development |
The environment the token is valid for |
UNLEASH_SERVER_API_PROJECTS |
default |
The projects the token is valid for (as a comma-separated list) |
UNLEASH_SERVER_API_TYPE |
CLIENT |
The type of the token (either CLIENT or FRONTEND ) |
apiVersion: unleash.nais.io/v1
kind: ApiToken
spec:
# The Unleash instance to create the token for
unleashInstance:
apiVersion: unleash.nais.io/v1
kind: Unleash
name: my-unleash-instance
# The name of the secret to store the token in
secretName: unleash-api-token
# Token type (optional, can be either 'CLIENT' or 'FRONTEND')
# defaults to 'CLIENT'
type: CLIENT
# Environment the token is valid for (optional)
# defaults to 'development'
environment: development
# Projects the token is valid for (optional)
# defaults to '*' (all projects)
projects:
- my-project
- my-other-project