Skip to content

Feat: Show information about kubeconfig generated file#21

Merged
anton-kutin merged 8 commits intomainfrom
feat/kubeconfig-show-info
Sep 12, 2025
Merged

Feat: Show information about kubeconfig generated file#21
anton-kutin merged 8 commits intomainfrom
feat/kubeconfig-show-info

Conversation

@emmanuel-quevillon-outscale
Copy link
Contributor

This new option to kubeconfig subcommand display information as table about generated kubeconfig file such as:

$ oks-cli cluster kubeconfig --user dev --group devops --info
+---------+---------+-----------------+---------------------+--------------+--------------------------------------------------------------------------------------------------------+
| Context | User    | Cert Subject    | Expires At          | Cluster Name | Cluster Endpoint                                                                                       |
+---------+---------+-----------------+---------------------+--------------+--------------------------------------------------------------------------------------------------------+
| default | default | CN=dev/O=devops | 2025-09-04 15:08:51 | default      | https://cluster.project-XXXXXXXXX.project.cloudgouv-eu-west-1.oks.outscale.com:6443 |
+---------+---------+-----------------+---------------------+--------------+--------------------------------------------------------------------------------------------------------+

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.
Copy link
Contributor

@outscale-ykr outscale-ykr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@emmanuel-quevillon-outscale emmanuel-quevillon-outscale changed the title Feat: Show inforamtion about kubeconfig generated file Feat: Show information about kubeconfig generated file Aug 29, 2025
@emmanuel-quevillon-outscale
Copy link
Contributor Author

emmanuel-quevillon-outscale commented Aug 29, 2025

--info option has been replace with --output table and another option --wide (related to --output table only) in order to show supplementary info

$ 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 |
+--------+-------+---------------------+--------------+--------------+-----------------+--------------------------------------------------------------------------------------------------------+

Copy link
Contributor

@outscale-ykr outscale-ykr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ 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 |
+---------------+-------+---------------------+

Copy link
Contributor

@outscale-ykr outscale-ykr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for me.
@anton-kutin can you have a look, please ?

Copy link

@anton-kutin anton-kutin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My tests are ok

@emmanuel-quevillon-outscale
Copy link
Contributor Author

My tests are ok

Who is responsible to merge the PR then? @anton-kutin @outscale-ykr @outscale-rce

@outscale-rce
Copy link
Contributor

@anton-kutin is the code owner, I'll let him merge ;)

@anton-kutin anton-kutin merged commit 9bd80b7 into main Sep 12, 2025
4 checks passed
@anton-kutin anton-kutin deleted the feat/kubeconfig-show-info branch September 12, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants