cloud-ark / kubeplus

Kubernetes Operator for multi-instance multi-tenancy
https://cloudark.io/
Apache License 2.0
654 stars 78 forks source link

[WIP] Refactoring the provider-kubeconfig.py #1326

Open chiukapoor opened 2 months ago

chiukapoor commented 2 months ago

Issue

Updates

TODO

devdattakulkarni commented 2 months ago

Looks like CI has failed: https://github.com/cloud-ark/kubeplus/actions/runs/9838082051/job/27157203380?pr=1326#step:5:1896

devdattakulkarni commented 2 months ago

https://github.com/cloud-ark/kubeplus/actions/runs/9838401881/job/27158227902?pr=1326#step:5:1901

Need to add kubernetes to requirements.txt.

chiukapoor commented 2 months ago

@devdattakulkarni I would like to propose that we move the provider-kubeconfig.py and requirements.txt to a new folder (ex kubeconfig-generator)?

chiukapoor commented 2 months ago

Rebased with master

devdattakulkarni commented 1 month ago

@chiukapoor I have started testing the changes. Here is a gist with early results.

https://gist.github.com/devdattakulkarni/bb3833c9589ca3139c971da43ac2fa62

I would suggest you try all the flags with all the commands to verify whether all combinations of commands and flags are working correctly.

chiukapoor commented 1 month ago

@devdattakulkarni

Test 2: "Namespace does not exist" is working fine for me.

❯ kubectl get namespaces -A
NAME                 STATUS   AGE
default              Active   7m7s
kube-node-lease      Active   7m7s
kube-public          Active   7m7s
kube-system          Active   7m7s
local-path-storage   Active   7m4s
testkubeconfig2      Active   53s
❯ python3 provider-kubeconfig.py create -n testkubeconfig3 -s $apiserver
API Server IP: https://127.0.0.1:36921
Namespace 'testkubeconfig3' created successfully.
Namespace 'testkubeconfig3' labeled successfully.
ServiceAccount 'kubeplus-saas-provider' created successfully.
Secret 'kubeplus-saas-provider' created successfully.
Kubeconfig file 'kubeplus-saas-provider.json' created successfully.
ClusterRole 'kubeplus-saas-provider' replaced successfully.
ClusterRole 'kubeplus-saas-provider' replaced successfully.
Provider kubeconfig created: kubeplus-saas-provider.json

Rest of the issues are resolved in latest commit.

chiukapoor commented 2 weeks ago

Rebased the PR @devdattakulkarni