Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
2 changes: 2 additions & 0 deletions examples/multitenancy/platform-engineering/steps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Platform Engineering team
$ helm install kubeplus "https://github.com/cloud-ark/operatorcharts/blob/master/kubeplus-chart-4.2.0.tgz?raw=true" --kubeconfig=kubeplus-saas-provider.json
- Wait till KubePlus Pod is Running
$ kubectl get pods -A
- Copy the provider kubeconfig into this directory so the commands below work (run from this directory):
$ cp ../../../kubeplus-saas-provider.json .

4. Create CustomMysqlService API wrapping the Helm chart:
- Check custom-mysql-service-composition-localchart.yaml. Notice that we are specifying our custom mysql chart
Expand Down
27 changes: 12 additions & 15 deletions plugins/kubeconfigretriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,29 @@ def retrieve_kubeconfig(self, serverURL, kubeconfigFor, kubeconfig):

kubeplusNS = self.get_kubeplus_namespace(kubeconfig)
if kubeconfigFor == 'provider':
cmd = "kubectl get configmaps kubeplus-saas-provider -n " + kubeplusNS + " -o jsonpath=\"{.data.kubeplus-saas-provider\.json}\""
cmd = "kubectl get configmaps kubeplus-saas-provider -n " + kubeplusNS + r" -o jsonpath='{.data.kubeplus-saas-provider\.json}'"
if kubeconfigFor == 'consumer':
cmd = "kubectl get configmaps kubeplus-saas-consumer-kubeconfig -n " + kubeplusNS + " -o jsonpath=\"{.data.kubeplus-saas-consumer\.json}\""
cmd = "kubectl get configmaps kubeplus-saas-consumer-kubeconfig -n " + kubeplusNS + r" -o jsonpath='{.data.kubeplus-saas-consumer\.json}'"

#kubeconfigParts = kubeconfig.split("=")
#kubeconfigPath = kubeconfigParts[1].strip()
cmd = cmd + " --kubeconfig=" + kubeconfig
out = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).communicate()[0]
#print(out)
out = out.decode('utf-8')
json_output = {}
try:
json_output = json.loads(out)
if isinstance(json_output, str):
json_output = json.loads(json_output)
except Exception as e:
print(e)
print("KubePlus might not be ready yet. Try again once the KubePlus Pod is running.")
if serverURL != '-1':
#parts = serverURL.split("=")
#sURL = parts[1].strip()
#if sURL != '':
json_output["clusters"][0]["cluster"]["server"] = serverURL
try:
pkubeconfig = json.dumps(json_output)
print(pkubeconfig)
except Exception as e:
print(e)
if isinstance(json_output, dict):
if serverURL != '-1':
json_output["clusters"][0]["cluster"]["server"] = serverURL
try:
pkubeconfig = json.dumps(json_output)
print(pkubeconfig)
except Exception as e:
print(e)

if __name__ == '__main__':

Expand Down