Skip to content

Commit

Permalink
Fix logging as dw serviceaccount when using make debug
Browse files Browse the repository at this point in the history
As of Kubernetes 1.24, serviceaccounttoken secrets are no longer created
by default, and so this method cannot be used to login as the workspace
serviceaccount when running locally.

Instead, it's possible to use
    kubectl create token <sa-name> -n <namespace>
to get the token used for the serviceaccount.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
  • Loading branch information
amisevsk committed Oct 19, 2022
1 parent 9dd78da commit 0377b01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion build/make/deploy.mk
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ _check_cert_manager:
endif

_login_with_devworkspace_sa:
$(eval SA_TOKEN := $(shell $(K8S_CLI) get secrets -o=json -n $(NAMESPACE) | jq -r '[.items[] | select (.type == "kubernetes.io/service-account-token" and .metadata.annotations."kubernetes.io/service-account.name" == "$(DEVWORKSPACE_CTRL_SA)")][0].data.token' | base64 --decode ))
$(eval SA_TOKEN := $(shell $(K8S_CLI) create token -n "$(NAMESPACE)" "$(DEVWORKSPACE_CTRL_SA)"))
echo "Logging as controller's SA in $(NAMESPACE)"
oc login --token=$(SA_TOKEN) --kubeconfig=$(BUMPED_KUBECONFIG)

Expand Down

0 comments on commit 0377b01

Please sign in to comment.