Skip to content

Commit

Permalink
chore: makefile connect db
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI committed Oct 8, 2023
1 parent f02485f commit 6dea4c9
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,8 @@ commit-hook: $(GOLANGCI_LINT) ## Install commit hook.
.PHONY: connect
connect:
ifdef TENANT
mysql -h$(shell kubectl get pods -o jsonpath='{.items[1].status.podIP}') -P2881 -A -uroot@${TENANT}
$(eval pwd = $(shell kubectl get secret $(shell kubectl get obtenant ${TENANT} -o jsonpath='{.status.credentials.root}') -o jsonpath='{.data.password}' | base64 -d))
$(if $(strip $(pwd)), mysql -h$(shell kubectl get pods -o jsonpath='{.items[1].status.podIP}') -P2881 -A -uroot@${TENANT} -p$(pwd) -Doceanbase, mysql -h$(shell kubectl get pods -o jsonpath='{.items[1].status.podIP}') -P2881 -A -uroot@${TENANT} -Doceanbase)
else
mysql -h$(shell kubectl get pods -o jsonpath='{.items[0].status.podIP}') -P2881 -A -uroot -p
endif

.PHONY: connectob
connectob:
ifdef TENANT
ifdef PASSWD
mysql -h$(shell kubectl get pods -o jsonpath='{.items[1].status.podIP}') -P2881 -A -uroot@${TENANT} -Doceanbase -p${PASSWD}
else
mysql -h$(shell kubectl get pods -o jsonpath='{.items[1].status.podIP}') -P2881 -A -uroot@${TENANT} -Doceanbase
endif
else
mysql -h$(shell kubectl get pods -o jsonpath='{.items[0].status.podIP}') -P2881 -A -uroot -p -Doceanbase
mysql -h$(shell kubectl get pods -o jsonpath='{.items[1].status.podIP}') -P2881 -A -uroot -proot -Doceanbase
endif

0 comments on commit 6dea4c9

Please sign in to comment.