crit
crit copied to clipboard
"crit create token" returns no output
When creating a bootstrap token using crit create token
, no output is returned to the user:
$ crit create token
$
This is inconvenient for the following reasons:
- There is no indication that the command was successful.
- The user is left to search for the token using
kubectl get secrets
. This becomes difficult when there are several tokens:
$ kg secrets
NAME TYPE DATA AGE
...
bootstrap-signer-token-dzqwn kubernetes.io/service-account-token 3 161m
bootstrap-token-8459vn bootstrap.kubernetes.io/token 6 4m10s
bootstrap-token-drwuzf bootstrap.kubernetes.io/token 6 2m14s
bootstrap-token-epw5fz bootstrap.kubernetes.io/token 6 31m
bootstrap-token-otgi8h bootstrap.kubernetes.io/token 6 2m3s
bootstrap-token-pxsarz bootstrap.kubernetes.io/token 6 3m2s
bootstrap-token-vygvaf bootstrap.kubernetes.io/token 6 2m11s
...
- The user has to base64 decode and concatenate
<token-id>.<token-secret>
:
$ kg secret bootstrap-token-8459vn -o yaml
apiVersion: v1
data:
auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6Y3JpdDpkZWZhdWx0LW5vZGUtdG9rZW4=
expiration: MjAzMC0xMC0wNVQxOTozODo1M1o=
token-id: ODQ1OXZu
token-secret: eXE0azkzZHhkd3Zxaml2cQ==
usage-bootstrap-authentication: dHJ1ZQ==
usage-bootstrap-signing: dHJ1ZQ==
kind: Secret
...
In addition to this, both crit create token
and crit generate token
specific cobra.MinimumNArgs(1)
. crit create token
should instead specify cobra.MaximumNArgs(1)
and crit generate token
should specify cobra.NoArgs
.