Feat: Show information about kubeconfig generated file#21
Conversation
This feature adds a new option --info to kubeconfig subcommand to display information about kubeconfig file as table format. It for example show client certificate expiration date, as well as server endpoint and extract Common Name from client certificate.
outscale-ykr
left a comment
There was a problem hiding this comment.
Functionally of this command is a quite similar with existing oks-cli cache kubeconfigs command.
At least, some existing functions can be used instead of duplicating code.
On my point of view, if we want the --info flag for the kubeconfig command output to be the same as for oks-cli cache kubeconfigs, but for the requested kubeconfig configuration.
Example:
$ oks-cli cache kubeconfigs
+---------+---------+---------------------+
| user | group | expiration date |
+---------+---------+---------------------+
| ykasper | dev | 2025-09-04 09:21:52 |
| default | default | 2025-09-04 09:21:36 |
+---------+---------+---------------------+
$ oks-cli cluster kubeconfig --user ykasper --group dev --info
+---------+---------+---------------------+
| user | group | expiration date |
+---------+---------+---------------------+
| ykasper | dev | 2025-09-04 09:21:52 |
+---------+---------+---------------------+
Surely we can add cluster endpoint, cluster name and so on.
This way we standardize the output of these commands for better UX.
And we will avoid code duplication.
|
$ oks-cli cluster kubeconfig --user devops --group admin --output table
+--------+-------+---------------------+
| user | group | expiration date |
+--------+-------+---------------------+
| devops | admin | 2025-09-05 14:26:22 |
+--------+-------+---------------------+
$ oks-cli cluster kubeconfig --output table
+---------------+-------+---------------------+
| user | group | expiration date |
+---------------+-------+---------------------+
| cluster-admin | None | 2025-09-02 13:06:41 |
+---------------+-------+---------------------+
$ oks-cli cluster kubeconfig --user devops --group admin --output table --wide
+--------+-------+---------------------+--------------+--------------+-----------------+--------------------------------------------------------------------------------------------------------+
| user | group | expiration date | context:name | context:user | context:cluster | cluster endpoint |
+--------+-------+---------------------+--------------+--------------+-----------------+--------------------------------------------------------------------------------------------------------+
| devops | admin | 2025-09-05 14:26:22 | default | default | default | https://XXXXXX.YYYYYY-ZZZZZZZZZZZZ.project.cloudgouv-eu-west-1.oks.outscale.com:6443 |
+--------+-------+---------------------+--------------+--------------+-----------------+--------------------------------------------------------------------------------------------------------+ |
outscale-ykr
left a comment
There was a problem hiding this comment.
$ oks-cli --profile ppd cache kubeconfigs
+---------+---------+---------------------+
| user | group | expiration date |
+---------+---------+---------------------+
| ykasper | dev | 2025-09-04 09:21:52 |
| default | default | 2025-09-04 09:21:36 |
+---------+---------+---------------------+
$ oks-cli --profile ppd cluster kubeconfig -o table
+---------------+-------+---------------------+
| user | group | expiration date |
+---------------+-------+---------------------+
| cluster-admin | None | 2025-09-04 09:21:36 |
+---------------+-------+---------------------+
outscale-ykr
left a comment
There was a problem hiding this comment.
Looks good for me.
@anton-kutin can you have a look, please ?
Who is responsible to merge the PR then? @anton-kutin @outscale-ykr @outscale-rce |
|
@anton-kutin is the code owner, I'll let him merge ;) |
This new option to
kubeconfigsubcommand display information as table about generatedkubeconfigfile such as: