Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
* Use python kube-client
* Modularize delete functionality
* Add -n, --namespace parameter for namespace
* Error handling

Signed-off-by: Chirayu Kapoor <[email protected]>
  • Loading branch information
chiukapoor committed Jul 8, 2024
1 parent c582411 commit a56266d
Show file tree
Hide file tree
Showing 5 changed files with 730 additions and 797 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ jobs:
echo "KUBEPLUS_HOME:$KUBEPLUS_HOME"
kubectl kubeplus commands
export KUBEPLUS_NS=default
python3 -m venv venv
sudo apt update && sudo apt install python3.10 python3.10-venv python3.10-dev -y
python3.10 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
apiserver=`kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}'`
echo "API_SERVER_URL:$apiserver"
python3 provider-kubeconfig.py -s $apiserver create $KUBEPLUS_NS
python3.10 provider-kubeconfig.py create -s $apiserver -n $KUBEPLUS_NS
deactivate
echo "Building mutating-webhook..."
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Let’s look at an example of creating a multi-instance WordPress Service using
source venv/bin/activate
pip3 install -r requirements.txt
apiserver=`kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}'`
python3 provider-kubeconfig.py -s $apiserver create $KUBEPLUS_NS
python3 provider-kubeconfig.py create -s $apiserver -n $KUBEPLUS_NS
deactivate
```

Expand Down
1 change: 1 addition & 0 deletions kubeplus-saas-provider.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"apiVersion": "v1", "kind": "Config", "clusters": [{"name": "kubeplus-saas-provider", "cluster": {"server": "https://127.0.0.1:37325", "insecure-skip-tls-verify": true}}], "users": [{"name": "kubeplus-saas-provider", "user": {"token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IlcxbXU1VUU3UDhaUTlLekNMZUVYZ3ZhSC1NUFF5cEpYLVFVTk1fdmt1aFEifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Imt1YmVwbHVzLXNhYXMtcHJvdmlkZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoia3ViZXBsdXMtc2Fhcy1wcm92aWRlciIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjQ0NTllNTFkLWE2MTQtNGYxNC04YTk2LWFlYjdmNzhiNWQ0OSIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkZWZhdWx0Omt1YmVwbHVzLXNhYXMtcHJvdmlkZXIifQ.lR0Jwqzrvv29Jg5a5KwIgl3YiIkm2KDksODTNcdEvhONpd_Lw08EhSle38kl6yZdktkXzy6nzAS4w-mzw6ZZJBXB6Udncy72WOMWu_oo7QCEcEqbk_8pQF9sopM9rRP7iQwCjwrlaIcjJyoxudNo2gKjA_mg_IeQFawilLo_1eWg4xD4KA5r6TT9MBOKuC9RvuW9TWFDIthDHRmOWfBIDlQMrw-EgizLy0xGo3WIMHDWtdrRIDl59Z3u7WyDab5JyIKhVP4WLb3BCkPqvqGISyIyghx6LhTr8aam0qZKrzwFzt2QafyRzmoR3TQUa6Tg2tgSZs2ggacTIZgRgJ9Xlw"}}], "contexts": [{"name": "kubeplus-saas-provider", "context": {"cluster": "kubeplus-saas-provider", "user": "kubeplus-saas-provider", "namespace": "default"}}], "current-context": "kubeplus-saas-provider"}
Loading

0 comments on commit a56266d

Please sign in to comment.