Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hcloud cli in Makefile to upload ssh-keys #1447

Open
guettli opened this issue Aug 15, 2024 · 0 comments
Open

Use hcloud cli in Makefile to upload ssh-keys #1447

guettli opened this issue Aug 15, 2024 · 0 comments

Comments

@guettli
Copy link
Contributor

guettli commented Aug 15, 2024

/kind feature

Describe the solution you'd like

At the moment we use curl to upload ssh-keys.

At other places we already use the hcloud cli tool:

hcloud ssh-key create --name ${SSH_KEY_NAME} --public-key-from-file ${SSH_KEY_PATH}.pub

hcloud ssh-key create --name caph --public-key-from-file ~/.ssh/hetzner-cluster.pub

I think we should update this part in the Makefile, and use hcloud instead:

add-ssh-pub-key:
	./hack/ensure-env-variables.sh HCLOUD_TOKEN SSH_KEY SSH_KEY_NAME
	SSH_KEY_CONTENT=$$(cat $(SSH_KEY)) ; \
	curl -sS \
		-X POST \
		-H "Authorization: Bearer $${HCLOUD_TOKEN}" \
		-H "Content-Type: application/json" \
		-d '{"labels":{},"name":"${SSH_KEY_NAME}","public_key":"'"$${SSH_KEY_CONTENT}"'"}' \
		'https://api.hetzner.cloud/v1/ssh_keys'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@guettli and others