Skip to content

Commit

Permalink
Expose SSH Private Keys (#91)
Browse files Browse the repository at this point in the history
Higher level services that have access to the identity resources can do
with it as they require, but not necessarily give it away to end users.
  • Loading branch information
spjmurray authored Dec 11, 2024
1 parent 661e0e4 commit dddcbb0
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 82 deletions.
4 changes: 2 additions & 2 deletions charts/region/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: A Helm chart for deploying Unikorn's Region Controller

type: application

version: v0.1.47-rc4
appVersion: v0.1.47-rc4
version: v0.1.47-rc5
appVersion: v0.1.47-rc5

icon: https://raw.githubusercontent.com/unikorn-cloud/assets/main/images/logos/dark-on-light/icon.png

Expand Down
7 changes: 7 additions & 0 deletions pkg/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,19 @@ func (h *Handler) convertIdentity(ctx context.Context, in *unikornv1.Identity) *
var openstackIdentity unikornv1.OpenstackIdentity

if err := h.client.Get(ctx, client.ObjectKey{Namespace: in.Namespace, Name: in.Name}, &openstackIdentity); err == nil {
var sshPrivateKey *string

if len(openstackIdentity.Spec.SSHPrivateKey) > 0 {
sshPrivateKey = ptr.To(string(openstackIdentity.Spec.SSHPrivateKey))
}

out.Spec.Openstack = &openapi.IdentitySpecOpenStack{
Cloud: openstackIdentity.Spec.Cloud,
UserId: openstackIdentity.Spec.UserID,
ProjectId: openstackIdentity.Spec.ProjectID,
ServerGroupId: openstackIdentity.Spec.ServerGroupID,
SshKeyName: openstackIdentity.Spec.SSHKeyName,
SshPrivateKey: sshPrivateKey,
}

if openstackIdentity.Spec.CloudConfig != nil {
Expand Down
161 changes: 81 additions & 80 deletions pkg/openapi/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/openapi/server.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,9 @@ components:
sshKeyName:
description: Ephemeral SSH key generated for the identity.
type: string
sshPrivateKey:
description: Ephemeral SSH private key to be used by higher order services.
type: string
identitySpec:
description: |-
A provider specific identity, while the client can list regions to infer the
Expand Down
3 changes: 3 additions & 0 deletions pkg/openapi/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dddcbb0

Please sign in to comment.