Cluster-api-provider-azure: AZURE_SSH_PUBLIC_KEY should be B64_AZURE_SSH_PUBLIC_KEY

Created on 27 Aug 2020  路  3Comments  路  Source: kubernetes-sigs/cluster-api-provider-azure

/kind bug

What steps did you take and what happened:

I think its pretty typical to use 'B64' for paramaters that need to be B64 encoded, and not use B64 when something isnt b64 encoded...

  • AWS_B64ENCODED_CREDENTIALS (cluster-api-provider-vsphere)
  • VSPHERE_SSH_AUTHORIZED_KEY (cluster-api-provider-aws)

However

looks like AZURE_SSH_PUBLIC_KEY is an exception ~

  • supposed to be B64 encoded,
  • since it isn't indicating this in the name, this is pretty easy to screw up . This is a show-stopper since a non b64 encoded SSH key is blocked by admission controllers when making new kubeadm configurations (see https://github.com/kubernetes-sigs/cluster-api/issues/3540) ... and it will be a while probably before 3540 makes it into conditions... ultimately this means

seems trivial - but If a user doesnt b64 encode this variable, its pretty tricky to see where this occurs -- they won't know they made a mistake until they look in the logs of the CAPI core containers (this isn't noticeable by capz-controller-manager, bc it isn't a VM issue, but rather an issue of events upstream from the VM creation phase.

What did you expect to happen:

  • AZURE_SSH_PUBLIC_KEY would not require B64 encoding OR
  • AZURE_SSH_PUBLIC_KEY_B64 would be the name of the SSH input, so that the encoding requirement was obvious.

Environment:

  • cluster-api-provider-azure version: master
kinbug

Most helpful comment

I will take that!
/assign
/remove-help

All 3 comments

/help
/good-first-issue

@jayunit100 I'm surprised about "If a user doesnt b64 encode this variable, its pretty tricky to see where this occurs -- they won't know they made a mistake until they look in the logs of the CAPI core containers", https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/f8ca63979c28b5bc4d2d53c7a2cffd4d7edcbda4/api/v1alpha3/azuremachine_validation.go#L34 should catch that at create time.

Let's
1) change all occurrences of AZURE_SSH_PUBLIC_KEY to AZURE_SSH_PUBLIC_KEY_B64 in docs and templates
2) Validate if the azure machine webhook validation throws an error when sshKey is not b64 encoded and if not, fix it

I will take that!
/assign
/remove-help

thanks @CecileRobertMichon ! that sounds good

Was this page helpful?
0 / 5 - 0 ratings