From 2ae319bc759910287d30ad575b90fc9ac5d27b41 Mon Sep 17 00:00:00 2001 From: Gerrit Date: Tue, 22 Sep 2026 11:44:15 +0200 Subject: [PATCH] Add infra endpoint to issue machine tokens for metal-hammer. --- doc/index.html | 91 ++++++ go/metalstack/infra/v2/boot.pb.go | 296 +++++++++++++----- .../infra/v2/infrav2connect/boot.connect.go | 35 +++ go/permissions/servicepermissions.go | 4 + go/tag/tenant.go | 4 + js/metalstack/infra/v2/boot_pb.d.ts | 73 +++++ js/metalstack/infra/v2/boot_pb.js | 34 +- js/metalstack/infra/v2/boot_pb.ts | 107 ++++++- proto/metalstack/infra/v2/boot.proto | 31 ++ python/metalstack/infra/v2/boot_connect.py | 65 ++++ python/metalstack/infra/v2/boot_pb2.py | 68 ++-- python/metalstack/infra/v2/boot_pb2.pyi | 24 ++ 12 files changed, 709 insertions(+), 123 deletions(-) diff --git a/doc/index.html b/doc/index.html index eda7b912..5de73e85 100644 --- a/doc/index.html +++ b/doc/index.html @@ -2754,6 +2754,14 @@

Table of Contents

MBootServiceInstallationSucceededResponse +
  • + MBootServiceMachineTokenRequest +
  • + +
  • + MBootServiceMachineTokenResponse +
  • +
  • MBootServiceRegisterRequest
  • @@ -22182,6 +22190,82 @@

    BootServic +

    BootServiceMachineTokenRequest

    +

    TokenServiceCreateRequest is the request payload for creating a machine token.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FieldTypeLabelDescription
    uuidstring

    UUID of the machine that will get the machine token.

    userstring

    User this token should be created for, it must be labelled in the backend with "tenant.metal-stack.io/machine-bootstrapper"

    expiresgoogle.protobuf.Duration

    Expires gives the duration since now, after which this token can not be used anymore.

    labelsmetalstack.api.v2.Labels

    Labels for this token.

    + + + + + +

    BootServiceMachineTokenResponse

    +

    TokenServiceCreateResponse is the response payload for the created machine token.

    + + + + + + + + + + + + + + + + + + + + + + + +
    FieldTypeLabelDescription
    tokenmetalstack.api.v2.Token

    Token contains the created token.

    secretstring

    Secret is the body if the JWT token, should be used in API requests as bearer token.

    + + + + +

    BootServiceRegisterRequest

    BootServiceRegisterRequest is called from metal-hammer to register a machine with as much hardware details as possible.

    @@ -22424,6 +22508,13 @@

    BootService

    Boot is called from pixie once the machine got the first DHCP response and ipxe asks for subsequent kernel and initrd.

    + + MachineToken + BootServiceMachineTokenRequest + BootServiceMachineTokenResponse +

    MachineToken is called from pixie to create machine role token for the metal-hammer. This way it does not need to have an admin token for token creation.

    + + SuperUserPassword BootServiceSuperUserPasswordRequest diff --git a/go/metalstack/infra/v2/boot.pb.go b/go/metalstack/infra/v2/boot.pb.go index a54578d7..03162a7b 100644 --- a/go/metalstack/infra/v2/boot.pb.go +++ b/go/metalstack/infra/v2/boot.pb.go @@ -11,6 +11,7 @@ import ( v2 "github.com/metal-stack/api/go/metalstack/api/v2" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + durationpb "google.golang.org/protobuf/types/known/durationpb" reflect "reflect" sync "sync" unsafe "unsafe" @@ -115,6 +116,134 @@ func (*BootServiceDhcpResponse) Descriptor() ([]byte, []int) { return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{1} } +// TokenServiceCreateRequest is the request payload for creating a machine token. +type BootServiceMachineTokenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // UUID of the machine that will get the machine token. + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + // User this token should be created for, it must be labelled in the backend with "tenant.metal-stack.io/machine-bootstrapper" + User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` + // Expires gives the duration since now, after which this token can not be used anymore. + Expires *durationpb.Duration `protobuf:"bytes,3,opt,name=expires,proto3" json:"expires,omitempty"` + // Labels for this token. + Labels *v2.Labels `protobuf:"bytes,4,opt,name=labels,proto3" json:"labels,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BootServiceMachineTokenRequest) Reset() { + *x = BootServiceMachineTokenRequest{} + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BootServiceMachineTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BootServiceMachineTokenRequest) ProtoMessage() {} + +func (x *BootServiceMachineTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BootServiceMachineTokenRequest.ProtoReflect.Descriptor instead. +func (*BootServiceMachineTokenRequest) Descriptor() ([]byte, []int) { + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{2} +} + +func (x *BootServiceMachineTokenRequest) GetUuid() string { + if x != nil { + return x.Uuid + } + return "" +} + +func (x *BootServiceMachineTokenRequest) GetUser() string { + if x != nil { + return x.User + } + return "" +} + +func (x *BootServiceMachineTokenRequest) GetExpires() *durationpb.Duration { + if x != nil { + return x.Expires + } + return nil +} + +func (x *BootServiceMachineTokenRequest) GetLabels() *v2.Labels { + if x != nil { + return x.Labels + } + return nil +} + +// TokenServiceCreateResponse is the response payload for the created machine token. +type BootServiceMachineTokenResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Token contains the created token. + Token *v2.Token `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + // Secret is the body if the JWT token, should be used in API requests as bearer token. + Secret string `protobuf:"bytes,2,opt,name=secret,proto3" json:"secret,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BootServiceMachineTokenResponse) Reset() { + *x = BootServiceMachineTokenResponse{} + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BootServiceMachineTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BootServiceMachineTokenResponse) ProtoMessage() {} + +func (x *BootServiceMachineTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BootServiceMachineTokenResponse.ProtoReflect.Descriptor instead. +func (*BootServiceMachineTokenResponse) Descriptor() ([]byte, []int) { + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{3} +} + +func (x *BootServiceMachineTokenResponse) GetToken() *v2.Token { + if x != nil { + return x.Token + } + return nil +} + +func (x *BootServiceMachineTokenResponse) GetSecret() string { + if x != nil { + return x.Secret + } + return "" +} + // BootServiceBootRequest is called to get specified parameters to boot a machine with the given mac. type BootServiceBootRequest struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -128,7 +257,7 @@ type BootServiceBootRequest struct { func (x *BootServiceBootRequest) Reset() { *x = BootServiceBootRequest{} - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[2] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -140,7 +269,7 @@ func (x *BootServiceBootRequest) String() string { func (*BootServiceBootRequest) ProtoMessage() {} func (x *BootServiceBootRequest) ProtoReflect() protoreflect.Message { - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[2] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -153,7 +282,7 @@ func (x *BootServiceBootRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use BootServiceBootRequest.ProtoReflect.Descriptor instead. func (*BootServiceBootRequest) Descriptor() ([]byte, []int) { - return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{2} + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{4} } func (x *BootServiceBootRequest) GetMac() string { @@ -185,7 +314,7 @@ type BootServiceBootResponse struct { func (x *BootServiceBootResponse) Reset() { *x = BootServiceBootResponse{} - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[3] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -197,7 +326,7 @@ func (x *BootServiceBootResponse) String() string { func (*BootServiceBootResponse) ProtoMessage() {} func (x *BootServiceBootResponse) ProtoReflect() protoreflect.Message { - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[3] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -210,7 +339,7 @@ func (x *BootServiceBootResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use BootServiceBootResponse.ProtoReflect.Descriptor instead. func (*BootServiceBootResponse) Descriptor() ([]byte, []int) { - return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{3} + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{5} } func (x *BootServiceBootResponse) GetKernel() string { @@ -259,7 +388,7 @@ type BootServiceRegisterRequest struct { func (x *BootServiceRegisterRequest) Reset() { *x = BootServiceRegisterRequest{} - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[4] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -271,7 +400,7 @@ func (x *BootServiceRegisterRequest) String() string { func (*BootServiceRegisterRequest) ProtoMessage() {} func (x *BootServiceRegisterRequest) ProtoReflect() protoreflect.Message { - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[4] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -284,7 +413,7 @@ func (x *BootServiceRegisterRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use BootServiceRegisterRequest.ProtoReflect.Descriptor instead. func (*BootServiceRegisterRequest) Descriptor() ([]byte, []int) { - return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{4} + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{6} } func (x *BootServiceRegisterRequest) GetUuid() string { @@ -358,7 +487,7 @@ type BootServiceRegisterResponse struct { func (x *BootServiceRegisterResponse) Reset() { *x = BootServiceRegisterResponse{} - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[5] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -370,7 +499,7 @@ func (x *BootServiceRegisterResponse) String() string { func (*BootServiceRegisterResponse) ProtoMessage() {} func (x *BootServiceRegisterResponse) ProtoReflect() protoreflect.Message { - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[5] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -383,7 +512,7 @@ func (x *BootServiceRegisterResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use BootServiceRegisterResponse.ProtoReflect.Descriptor instead. func (*BootServiceRegisterResponse) Descriptor() ([]byte, []int) { - return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{5} + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{7} } func (x *BootServiceRegisterResponse) GetUuid() string { @@ -418,7 +547,7 @@ type BootServiceWaitRequest struct { func (x *BootServiceWaitRequest) Reset() { *x = BootServiceWaitRequest{} - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[6] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -430,7 +559,7 @@ func (x *BootServiceWaitRequest) String() string { func (*BootServiceWaitRequest) ProtoMessage() {} func (x *BootServiceWaitRequest) ProtoReflect() protoreflect.Message { - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[6] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -443,7 +572,7 @@ func (x *BootServiceWaitRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use BootServiceWaitRequest.ProtoReflect.Descriptor instead. func (*BootServiceWaitRequest) Descriptor() ([]byte, []int) { - return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{6} + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{8} } func (x *BootServiceWaitRequest) GetUuid() string { @@ -464,7 +593,7 @@ type BootServiceWaitResponse struct { func (x *BootServiceWaitResponse) Reset() { *x = BootServiceWaitResponse{} - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[7] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -476,7 +605,7 @@ func (x *BootServiceWaitResponse) String() string { func (*BootServiceWaitResponse) ProtoMessage() {} func (x *BootServiceWaitResponse) ProtoReflect() protoreflect.Message { - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[7] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -489,7 +618,7 @@ func (x *BootServiceWaitResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use BootServiceWaitResponse.ProtoReflect.Descriptor instead. func (*BootServiceWaitResponse) Descriptor() ([]byte, []int) { - return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{7} + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{9} } func (x *BootServiceWaitResponse) GetAllocation() *v2.MachineAllocation { @@ -512,7 +641,7 @@ type BootServiceInstallationSucceededRequest struct { func (x *BootServiceInstallationSucceededRequest) Reset() { *x = BootServiceInstallationSucceededRequest{} - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[8] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -524,7 +653,7 @@ func (x *BootServiceInstallationSucceededRequest) String() string { func (*BootServiceInstallationSucceededRequest) ProtoMessage() {} func (x *BootServiceInstallationSucceededRequest) ProtoReflect() protoreflect.Message { - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[8] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -537,7 +666,7 @@ func (x *BootServiceInstallationSucceededRequest) ProtoReflect() protoreflect.Me // Deprecated: Use BootServiceInstallationSucceededRequest.ProtoReflect.Descriptor instead. func (*BootServiceInstallationSucceededRequest) Descriptor() ([]byte, []int) { - return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{8} + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{10} } func (x *BootServiceInstallationSucceededRequest) GetUuid() string { @@ -563,7 +692,7 @@ type BootServiceInstallationSucceededResponse struct { func (x *BootServiceInstallationSucceededResponse) Reset() { *x = BootServiceInstallationSucceededResponse{} - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[9] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -575,7 +704,7 @@ func (x *BootServiceInstallationSucceededResponse) String() string { func (*BootServiceInstallationSucceededResponse) ProtoMessage() {} func (x *BootServiceInstallationSucceededResponse) ProtoReflect() protoreflect.Message { - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[9] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -588,7 +717,7 @@ func (x *BootServiceInstallationSucceededResponse) ProtoReflect() protoreflect.M // Deprecated: Use BootServiceInstallationSucceededResponse.ProtoReflect.Descriptor instead. func (*BootServiceInstallationSucceededResponse) Descriptor() ([]byte, []int) { - return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{9} + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{11} } // BootServiceSuperUserPasswordRequest this call returns the password for the machine superuser. @@ -602,7 +731,7 @@ type BootServiceSuperUserPasswordRequest struct { func (x *BootServiceSuperUserPasswordRequest) Reset() { *x = BootServiceSuperUserPasswordRequest{} - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[10] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -614,7 +743,7 @@ func (x *BootServiceSuperUserPasswordRequest) String() string { func (*BootServiceSuperUserPasswordRequest) ProtoMessage() {} func (x *BootServiceSuperUserPasswordRequest) ProtoReflect() protoreflect.Message { - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[10] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -627,7 +756,7 @@ func (x *BootServiceSuperUserPasswordRequest) ProtoReflect() protoreflect.Messag // Deprecated: Use BootServiceSuperUserPasswordRequest.ProtoReflect.Descriptor instead. func (*BootServiceSuperUserPasswordRequest) Descriptor() ([]byte, []int) { - return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{10} + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{12} } func (x *BootServiceSuperUserPasswordRequest) GetUuid() string { @@ -650,7 +779,7 @@ type BootServiceSuperUserPasswordResponse struct { func (x *BootServiceSuperUserPasswordResponse) Reset() { *x = BootServiceSuperUserPasswordResponse{} - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[11] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -662,7 +791,7 @@ func (x *BootServiceSuperUserPasswordResponse) String() string { func (*BootServiceSuperUserPasswordResponse) ProtoMessage() {} func (x *BootServiceSuperUserPasswordResponse) ProtoReflect() protoreflect.Message { - mi := &file_metalstack_infra_v2_boot_proto_msgTypes[11] + mi := &file_metalstack_infra_v2_boot_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -675,7 +804,7 @@ func (x *BootServiceSuperUserPasswordResponse) ProtoReflect() protoreflect.Messa // Deprecated: Use BootServiceSuperUserPasswordResponse.ProtoReflect.Descriptor instead. func (*BootServiceSuperUserPasswordResponse) Descriptor() ([]byte, []int) { - return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{11} + return file_metalstack_infra_v2_boot_proto_rawDescGZIP(), []int{13} } func (x *BootServiceSuperUserPasswordResponse) GetFeatureDisabled() bool { @@ -696,11 +825,19 @@ var File_metalstack_infra_v2_boot_proto protoreflect.FileDescriptor const file_metalstack_infra_v2_boot_proto_rawDesc = "" + "\n" + - "\x1emetalstack/infra/v2/boot.proto\x12\x13metalstack.infra.v2\x1a\x1bbuf/validate/validate.proto\x1a\x1emetalstack/api/v2/common.proto\x1a\x1fmetalstack/api/v2/machine.proto\x1a(metalstack/api/v2/predefined_rules.proto\"a\n" + + "\x1emetalstack/infra/v2/boot.proto\x12\x13metalstack.infra.v2\x1a\x1bbuf/validate/validate.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1emetalstack/api/v2/common.proto\x1a\x1fmetalstack/api/v2/machine.proto\x1a(metalstack/api/v2/predefined_rules.proto\x1a\x1dmetalstack/api/v2/token.proto\"a\n" + "\x16BootServiceDhcpRequest\x12\x1c\n" + "\x04uuid\x18\x01 \x01(\tB\b\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\x12)\n" + "\tpartition\x18\x02 \x01(\tB\v\xbaH\br\x06г\xae\xb1\x02\x01R\tpartition\"\x19\n" + - "\x17BootServiceDhcpResponse\"b\n" + + "\x17BootServiceDhcpResponse\"\xda\x01\n" + + "\x1eBootServiceMachineTokenRequest\x12\x1c\n" + + "\x04uuid\x18\x01 \x01(\tB\b\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\x12\x1f\n" + + "\x04user\x18\x02 \x01(\tB\v\xbaH\br\x06\xf8\xb3\xae\xb1\x02\x01R\x04user\x12F\n" + + "\aexpires\x18\x03 \x01(\v2\x19.google.protobuf.DurationB\x11\xbaH\x0e\xaa\x01\v\x1a\x04\b\x80\xf5$2\x03\b\xd8\x04R\aexpires\x121\n" + + "\x06labels\x18\x04 \x01(\v2\x19.metalstack.api.v2.LabelsR\x06labels\"i\n" + + "\x1fBootServiceMachineTokenResponse\x12.\n" + + "\x05token\x18\x01 \x01(\v2\x18.metalstack.api.v2.TokenR\x05token\x12\x16\n" + + "\x06secret\x18\x02 \x01(\tR\x06secret\"b\n" + "\x16BootServiceBootRequest\x12\x1d\n" + "\x03mac\x18\x01 \x01(\tB\v\xbaH\br\x06\xb8\xb3\xae\xb1\x02\x01R\x03mac\x12)\n" + "\tpartition\x18\x02 \x01(\tB\v\xbaH\br\x06г\xae\xb1\x02\x01R\tpartition\"\x9c\x01\n" + @@ -739,10 +876,11 @@ const file_metalstack_infra_v2_boot_proto_rawDesc = "" + "$BootServiceSuperUserPasswordResponse\x12)\n" + "\x10feature_disabled\x18\x01 \x01(\bR\x0ffeatureDisabled\x12:\n" + "\x13super_user_password\x18\x02 \x01(\tB\n" + - "\xbaH\ar\x05\x10\x02\x18\x80\x01R\x11superUserPassword2\x8b\x06\n" + + "\xbaH\ar\x05\x10\x02\x18\x80\x01R\x11superUserPassword2\x92\a\n" + "\vBootService\x12l\n" + "\x04Dhcp\x12+.metalstack.infra.v2.BootServiceDhcpRequest\x1a,.metalstack.infra.v2.BootServiceDhcpResponse\"\t\xe0\xf3\x18\x01\xea\xf3\x18\x01\x01\x12l\n" + - "\x04Boot\x12+.metalstack.infra.v2.BootServiceBootRequest\x1a,.metalstack.infra.v2.BootServiceBootResponse\"\t\xe0\xf3\x18\x01\xea\xf3\x18\x01\x01\x12\x93\x01\n" + + "\x04Boot\x12+.metalstack.infra.v2.BootServiceBootRequest\x1a,.metalstack.infra.v2.BootServiceBootResponse\"\t\xe0\xf3\x18\x01\xea\xf3\x18\x01\x01\x12\x84\x01\n" + + "\fMachineToken\x123.metalstack.infra.v2.BootServiceMachineTokenRequest\x1a4.metalstack.infra.v2.BootServiceMachineTokenResponse\"\t\xe0\xf3\x18\x01\xea\xf3\x18\x01\x01\x12\x93\x01\n" + "\x11SuperUserPassword\x128.metalstack.infra.v2.BootServiceSuperUserPasswordRequest\x1a9.metalstack.infra.v2.BootServiceSuperUserPasswordResponse\"\t\xe0\xf3\x18\x01\xf2\xf3\x18\x01\x01\x12x\n" + "\bRegister\x12/.metalstack.infra.v2.BootServiceRegisterRequest\x1a0.metalstack.infra.v2.BootServiceRegisterResponse\"\t\xe0\xf3\x18\x01\xf2\xf3\x18\x01\x01\x12n\n" + "\x04Wait\x12+.metalstack.infra.v2.BootServiceWaitRequest\x1a,.metalstack.infra.v2.BootServiceWaitResponse\"\t\xe0\xf3\x18\x01\xf2\xf3\x18\x01\x010\x01\x12\x9f\x01\n" + @@ -761,49 +899,59 @@ func file_metalstack_infra_v2_boot_proto_rawDescGZIP() []byte { return file_metalstack_infra_v2_boot_proto_rawDescData } -var file_metalstack_infra_v2_boot_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_metalstack_infra_v2_boot_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_metalstack_infra_v2_boot_proto_goTypes = []any{ (*BootServiceDhcpRequest)(nil), // 0: metalstack.infra.v2.BootServiceDhcpRequest (*BootServiceDhcpResponse)(nil), // 1: metalstack.infra.v2.BootServiceDhcpResponse - (*BootServiceBootRequest)(nil), // 2: metalstack.infra.v2.BootServiceBootRequest - (*BootServiceBootResponse)(nil), // 3: metalstack.infra.v2.BootServiceBootResponse - (*BootServiceRegisterRequest)(nil), // 4: metalstack.infra.v2.BootServiceRegisterRequest - (*BootServiceRegisterResponse)(nil), // 5: metalstack.infra.v2.BootServiceRegisterResponse - (*BootServiceWaitRequest)(nil), // 6: metalstack.infra.v2.BootServiceWaitRequest - (*BootServiceWaitResponse)(nil), // 7: metalstack.infra.v2.BootServiceWaitResponse - (*BootServiceInstallationSucceededRequest)(nil), // 8: metalstack.infra.v2.BootServiceInstallationSucceededRequest - (*BootServiceInstallationSucceededResponse)(nil), // 9: metalstack.infra.v2.BootServiceInstallationSucceededResponse - (*BootServiceSuperUserPasswordRequest)(nil), // 10: metalstack.infra.v2.BootServiceSuperUserPasswordRequest - (*BootServiceSuperUserPasswordResponse)(nil), // 11: metalstack.infra.v2.BootServiceSuperUserPasswordResponse - (*v2.MachineHardware)(nil), // 12: metalstack.api.v2.MachineHardware - (*v2.MachineBios)(nil), // 13: metalstack.api.v2.MachineBios - (*v2.MachineBMC)(nil), // 14: metalstack.api.v2.MachineBMC - (*v2.MachineFRU)(nil), // 15: metalstack.api.v2.MachineFRU - (*v2.MachineAllocation)(nil), // 16: metalstack.api.v2.MachineAllocation + (*BootServiceMachineTokenRequest)(nil), // 2: metalstack.infra.v2.BootServiceMachineTokenRequest + (*BootServiceMachineTokenResponse)(nil), // 3: metalstack.infra.v2.BootServiceMachineTokenResponse + (*BootServiceBootRequest)(nil), // 4: metalstack.infra.v2.BootServiceBootRequest + (*BootServiceBootResponse)(nil), // 5: metalstack.infra.v2.BootServiceBootResponse + (*BootServiceRegisterRequest)(nil), // 6: metalstack.infra.v2.BootServiceRegisterRequest + (*BootServiceRegisterResponse)(nil), // 7: metalstack.infra.v2.BootServiceRegisterResponse + (*BootServiceWaitRequest)(nil), // 8: metalstack.infra.v2.BootServiceWaitRequest + (*BootServiceWaitResponse)(nil), // 9: metalstack.infra.v2.BootServiceWaitResponse + (*BootServiceInstallationSucceededRequest)(nil), // 10: metalstack.infra.v2.BootServiceInstallationSucceededRequest + (*BootServiceInstallationSucceededResponse)(nil), // 11: metalstack.infra.v2.BootServiceInstallationSucceededResponse + (*BootServiceSuperUserPasswordRequest)(nil), // 12: metalstack.infra.v2.BootServiceSuperUserPasswordRequest + (*BootServiceSuperUserPasswordResponse)(nil), // 13: metalstack.infra.v2.BootServiceSuperUserPasswordResponse + (*durationpb.Duration)(nil), // 14: google.protobuf.Duration + (*v2.Labels)(nil), // 15: metalstack.api.v2.Labels + (*v2.Token)(nil), // 16: metalstack.api.v2.Token + (*v2.MachineHardware)(nil), // 17: metalstack.api.v2.MachineHardware + (*v2.MachineBios)(nil), // 18: metalstack.api.v2.MachineBios + (*v2.MachineBMC)(nil), // 19: metalstack.api.v2.MachineBMC + (*v2.MachineFRU)(nil), // 20: metalstack.api.v2.MachineFRU + (*v2.MachineAllocation)(nil), // 21: metalstack.api.v2.MachineAllocation } var file_metalstack_infra_v2_boot_proto_depIdxs = []int32{ - 12, // 0: metalstack.infra.v2.BootServiceRegisterRequest.hardware:type_name -> metalstack.api.v2.MachineHardware - 13, // 1: metalstack.infra.v2.BootServiceRegisterRequest.bios:type_name -> metalstack.api.v2.MachineBios - 14, // 2: metalstack.infra.v2.BootServiceRegisterRequest.bmc:type_name -> metalstack.api.v2.MachineBMC - 15, // 3: metalstack.infra.v2.BootServiceRegisterRequest.fru:type_name -> metalstack.api.v2.MachineFRU - 16, // 4: metalstack.infra.v2.BootServiceWaitResponse.allocation:type_name -> metalstack.api.v2.MachineAllocation - 0, // 5: metalstack.infra.v2.BootService.Dhcp:input_type -> metalstack.infra.v2.BootServiceDhcpRequest - 2, // 6: metalstack.infra.v2.BootService.Boot:input_type -> metalstack.infra.v2.BootServiceBootRequest - 10, // 7: metalstack.infra.v2.BootService.SuperUserPassword:input_type -> metalstack.infra.v2.BootServiceSuperUserPasswordRequest - 4, // 8: metalstack.infra.v2.BootService.Register:input_type -> metalstack.infra.v2.BootServiceRegisterRequest - 6, // 9: metalstack.infra.v2.BootService.Wait:input_type -> metalstack.infra.v2.BootServiceWaitRequest - 8, // 10: metalstack.infra.v2.BootService.InstallationSucceeded:input_type -> metalstack.infra.v2.BootServiceInstallationSucceededRequest - 1, // 11: metalstack.infra.v2.BootService.Dhcp:output_type -> metalstack.infra.v2.BootServiceDhcpResponse - 3, // 12: metalstack.infra.v2.BootService.Boot:output_type -> metalstack.infra.v2.BootServiceBootResponse - 11, // 13: metalstack.infra.v2.BootService.SuperUserPassword:output_type -> metalstack.infra.v2.BootServiceSuperUserPasswordResponse - 5, // 14: metalstack.infra.v2.BootService.Register:output_type -> metalstack.infra.v2.BootServiceRegisterResponse - 7, // 15: metalstack.infra.v2.BootService.Wait:output_type -> metalstack.infra.v2.BootServiceWaitResponse - 9, // 16: metalstack.infra.v2.BootService.InstallationSucceeded:output_type -> metalstack.infra.v2.BootServiceInstallationSucceededResponse - 11, // [11:17] is the sub-list for method output_type - 5, // [5:11] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 14, // 0: metalstack.infra.v2.BootServiceMachineTokenRequest.expires:type_name -> google.protobuf.Duration + 15, // 1: metalstack.infra.v2.BootServiceMachineTokenRequest.labels:type_name -> metalstack.api.v2.Labels + 16, // 2: metalstack.infra.v2.BootServiceMachineTokenResponse.token:type_name -> metalstack.api.v2.Token + 17, // 3: metalstack.infra.v2.BootServiceRegisterRequest.hardware:type_name -> metalstack.api.v2.MachineHardware + 18, // 4: metalstack.infra.v2.BootServiceRegisterRequest.bios:type_name -> metalstack.api.v2.MachineBios + 19, // 5: metalstack.infra.v2.BootServiceRegisterRequest.bmc:type_name -> metalstack.api.v2.MachineBMC + 20, // 6: metalstack.infra.v2.BootServiceRegisterRequest.fru:type_name -> metalstack.api.v2.MachineFRU + 21, // 7: metalstack.infra.v2.BootServiceWaitResponse.allocation:type_name -> metalstack.api.v2.MachineAllocation + 0, // 8: metalstack.infra.v2.BootService.Dhcp:input_type -> metalstack.infra.v2.BootServiceDhcpRequest + 4, // 9: metalstack.infra.v2.BootService.Boot:input_type -> metalstack.infra.v2.BootServiceBootRequest + 2, // 10: metalstack.infra.v2.BootService.MachineToken:input_type -> metalstack.infra.v2.BootServiceMachineTokenRequest + 12, // 11: metalstack.infra.v2.BootService.SuperUserPassword:input_type -> metalstack.infra.v2.BootServiceSuperUserPasswordRequest + 6, // 12: metalstack.infra.v2.BootService.Register:input_type -> metalstack.infra.v2.BootServiceRegisterRequest + 8, // 13: metalstack.infra.v2.BootService.Wait:input_type -> metalstack.infra.v2.BootServiceWaitRequest + 10, // 14: metalstack.infra.v2.BootService.InstallationSucceeded:input_type -> metalstack.infra.v2.BootServiceInstallationSucceededRequest + 1, // 15: metalstack.infra.v2.BootService.Dhcp:output_type -> metalstack.infra.v2.BootServiceDhcpResponse + 5, // 16: metalstack.infra.v2.BootService.Boot:output_type -> metalstack.infra.v2.BootServiceBootResponse + 3, // 17: metalstack.infra.v2.BootService.MachineToken:output_type -> metalstack.infra.v2.BootServiceMachineTokenResponse + 13, // 18: metalstack.infra.v2.BootService.SuperUserPassword:output_type -> metalstack.infra.v2.BootServiceSuperUserPasswordResponse + 7, // 19: metalstack.infra.v2.BootService.Register:output_type -> metalstack.infra.v2.BootServiceRegisterResponse + 9, // 20: metalstack.infra.v2.BootService.Wait:output_type -> metalstack.infra.v2.BootServiceWaitResponse + 11, // 21: metalstack.infra.v2.BootService.InstallationSucceeded:output_type -> metalstack.infra.v2.BootServiceInstallationSucceededResponse + 15, // [15:22] is the sub-list for method output_type + 8, // [8:15] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_metalstack_infra_v2_boot_proto_init() } @@ -811,14 +959,14 @@ func file_metalstack_infra_v2_boot_proto_init() { if File_metalstack_infra_v2_boot_proto != nil { return } - file_metalstack_infra_v2_boot_proto_msgTypes[3].OneofWrappers = []any{} + file_metalstack_infra_v2_boot_proto_msgTypes[5].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_metalstack_infra_v2_boot_proto_rawDesc), len(file_metalstack_infra_v2_boot_proto_rawDesc)), NumEnums: 0, - NumMessages: 12, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, diff --git a/go/metalstack/infra/v2/infrav2connect/boot.connect.go b/go/metalstack/infra/v2/infrav2connect/boot.connect.go index 497b49ae..5a46ccdf 100644 --- a/go/metalstack/infra/v2/infrav2connect/boot.connect.go +++ b/go/metalstack/infra/v2/infrav2connect/boot.connect.go @@ -37,6 +37,9 @@ const ( BootServiceDhcpProcedure = "/metalstack.infra.v2.BootService/Dhcp" // BootServiceBootProcedure is the fully-qualified name of the BootService's Boot RPC. BootServiceBootProcedure = "/metalstack.infra.v2.BootService/Boot" + // BootServiceMachineTokenProcedure is the fully-qualified name of the BootService's MachineToken + // RPC. + BootServiceMachineTokenProcedure = "/metalstack.infra.v2.BootService/MachineToken" // BootServiceSuperUserPasswordProcedure is the fully-qualified name of the BootService's // SuperUserPassword RPC. BootServiceSuperUserPasswordProcedure = "/metalstack.infra.v2.BootService/SuperUserPassword" @@ -55,6 +58,8 @@ type BootServiceClient interface { Dhcp(context.Context, *v2.BootServiceDhcpRequest) (*v2.BootServiceDhcpResponse, error) // Boot is called from pixie once the machine got the first DHCP response and ipxe asks for subsequent kernel and initrd. Boot(context.Context, *v2.BootServiceBootRequest) (*v2.BootServiceBootResponse, error) + // MachineToken is called from pixie to create machine role token for the metal-hammer. This way it does not need to have an admin token for token creation. + MachineToken(context.Context, *v2.BootServiceMachineTokenRequest) (*v2.BootServiceMachineTokenResponse, error) // SuperUserPassword returns the configured root password for the BMC. SuperUserPassword(context.Context, *v2.BootServiceSuperUserPasswordRequest) (*v2.BootServiceSuperUserPasswordResponse, error) // Register is called from metal-hammer after hardware inventory is finished, tells metal-apiserver all details about that machine. @@ -88,6 +93,12 @@ func NewBootServiceClient(httpClient connect.HTTPClient, baseURL string, opts .. connect.WithSchema(bootServiceMethods.ByName("Boot")), connect.WithClientOptions(opts...), ), + machineToken: connect.NewClient[v2.BootServiceMachineTokenRequest, v2.BootServiceMachineTokenResponse]( + httpClient, + baseURL+BootServiceMachineTokenProcedure, + connect.WithSchema(bootServiceMethods.ByName("MachineToken")), + connect.WithClientOptions(opts...), + ), superUserPassword: connect.NewClient[v2.BootServiceSuperUserPasswordRequest, v2.BootServiceSuperUserPasswordResponse]( httpClient, baseURL+BootServiceSuperUserPasswordProcedure, @@ -119,6 +130,7 @@ func NewBootServiceClient(httpClient connect.HTTPClient, baseURL string, opts .. type bootServiceClient struct { dhcp *connect.Client[v2.BootServiceDhcpRequest, v2.BootServiceDhcpResponse] boot *connect.Client[v2.BootServiceBootRequest, v2.BootServiceBootResponse] + machineToken *connect.Client[v2.BootServiceMachineTokenRequest, v2.BootServiceMachineTokenResponse] superUserPassword *connect.Client[v2.BootServiceSuperUserPasswordRequest, v2.BootServiceSuperUserPasswordResponse] register *connect.Client[v2.BootServiceRegisterRequest, v2.BootServiceRegisterResponse] wait *connect.Client[v2.BootServiceWaitRequest, v2.BootServiceWaitResponse] @@ -143,6 +155,15 @@ func (c *bootServiceClient) Boot(ctx context.Context, req *v2.BootServiceBootReq return nil, err } +// MachineToken calls metalstack.infra.v2.BootService.MachineToken. +func (c *bootServiceClient) MachineToken(ctx context.Context, req *v2.BootServiceMachineTokenRequest) (*v2.BootServiceMachineTokenResponse, error) { + response, err := c.machineToken.CallUnary(ctx, connect.NewRequest(req)) + if response != nil { + return response.Msg, err + } + return nil, err +} + // SuperUserPassword calls metalstack.infra.v2.BootService.SuperUserPassword. func (c *bootServiceClient) SuperUserPassword(ctx context.Context, req *v2.BootServiceSuperUserPasswordRequest) (*v2.BootServiceSuperUserPasswordResponse, error) { response, err := c.superUserPassword.CallUnary(ctx, connect.NewRequest(req)) @@ -181,6 +202,8 @@ type BootServiceHandler interface { Dhcp(context.Context, *v2.BootServiceDhcpRequest) (*v2.BootServiceDhcpResponse, error) // Boot is called from pixie once the machine got the first DHCP response and ipxe asks for subsequent kernel and initrd. Boot(context.Context, *v2.BootServiceBootRequest) (*v2.BootServiceBootResponse, error) + // MachineToken is called from pixie to create machine role token for the metal-hammer. This way it does not need to have an admin token for token creation. + MachineToken(context.Context, *v2.BootServiceMachineTokenRequest) (*v2.BootServiceMachineTokenResponse, error) // SuperUserPassword returns the configured root password for the BMC. SuperUserPassword(context.Context, *v2.BootServiceSuperUserPasswordRequest) (*v2.BootServiceSuperUserPasswordResponse, error) // Register is called from metal-hammer after hardware inventory is finished, tells metal-apiserver all details about that machine. @@ -210,6 +233,12 @@ func NewBootServiceHandler(svc BootServiceHandler, opts ...connect.HandlerOption connect.WithSchema(bootServiceMethods.ByName("Boot")), connect.WithHandlerOptions(opts...), ) + bootServiceMachineTokenHandler := connect.NewUnaryHandlerSimple( + BootServiceMachineTokenProcedure, + svc.MachineToken, + connect.WithSchema(bootServiceMethods.ByName("MachineToken")), + connect.WithHandlerOptions(opts...), + ) bootServiceSuperUserPasswordHandler := connect.NewUnaryHandlerSimple( BootServiceSuperUserPasswordProcedure, svc.SuperUserPassword, @@ -240,6 +269,8 @@ func NewBootServiceHandler(svc BootServiceHandler, opts ...connect.HandlerOption bootServiceDhcpHandler.ServeHTTP(w, r) case BootServiceBootProcedure: bootServiceBootHandler.ServeHTTP(w, r) + case BootServiceMachineTokenProcedure: + bootServiceMachineTokenHandler.ServeHTTP(w, r) case BootServiceSuperUserPasswordProcedure: bootServiceSuperUserPasswordHandler.ServeHTTP(w, r) case BootServiceRegisterProcedure: @@ -265,6 +296,10 @@ func (UnimplementedBootServiceHandler) Boot(context.Context, *v2.BootServiceBoot return nil, connect.NewError(connect.CodeUnimplemented, errors.New("metalstack.infra.v2.BootService.Boot is not implemented")) } +func (UnimplementedBootServiceHandler) MachineToken(context.Context, *v2.BootServiceMachineTokenRequest) (*v2.BootServiceMachineTokenResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("metalstack.infra.v2.BootService.MachineToken is not implemented")) +} + func (UnimplementedBootServiceHandler) SuperUserPassword(context.Context, *v2.BootServiceSuperUserPasswordRequest) (*v2.BootServiceSuperUserPasswordResponse, error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("metalstack.infra.v2.BootService.SuperUserPassword is not implemented")) } diff --git a/go/permissions/servicepermissions.go b/go/permissions/servicepermissions.go index 54bddbb4..f6eaedd9 100755 --- a/go/permissions/servicepermissions.go +++ b/go/permissions/servicepermissions.go @@ -164,6 +164,7 @@ func GetServicePermissions() *ServicePermissions { "/metalstack.infra.v2.BMCService/WaitForBMCCommand": {}, "/metalstack.infra.v2.BootService/Boot": {}, "/metalstack.infra.v2.BootService/Dhcp": {}, + "/metalstack.infra.v2.BootService/MachineToken": {}, "/metalstack.infra.v2.ComponentService/Ping": {}, "/metalstack.infra.v2.EventService/Send": {}, "/metalstack.infra.v2.SwitchService/Get": {}, @@ -431,6 +432,7 @@ func GetServicePermissions() *ServicePermissions { "/metalstack.infra.v2.BootService/Boot": {}, "/metalstack.infra.v2.BootService/Dhcp": {}, "/metalstack.infra.v2.BootService/InstallationSucceeded": {}, + "/metalstack.infra.v2.BootService/MachineToken": {}, "/metalstack.infra.v2.BootService/Register": {}, "/metalstack.infra.v2.BootService/SuperUserPassword": {}, "/metalstack.infra.v2.BootService/Wait": {}, @@ -551,6 +553,7 @@ func GetServicePermissions() *ServicePermissions { "/metalstack.infra.v2.BMCService/WaitForBMCCommand": true, "/metalstack.infra.v2.BootService/Boot": true, "/metalstack.infra.v2.BootService/Dhcp": true, + "/metalstack.infra.v2.BootService/MachineToken": true, "/metalstack.infra.v2.ComponentService/Ping": true, "/metalstack.infra.v2.EventService/Send": true, "/metalstack.infra.v2.SwitchService/Get": true, @@ -757,6 +760,7 @@ func GetServicePermissions() *ServicePermissions { "/metalstack.infra.v2.BootService/Boot": true, "/metalstack.infra.v2.BootService/Dhcp": true, "/metalstack.infra.v2.BootService/InstallationSucceeded": true, + "/metalstack.infra.v2.BootService/MachineToken": true, "/metalstack.infra.v2.BootService/Register": true, "/metalstack.infra.v2.BootService/SuperUserPassword": true, "/metalstack.infra.v2.BootService/Wait": true, diff --git a/go/tag/tenant.go b/go/tag/tenant.go index 0e7fecf7..de007078 100644 --- a/go/tag/tenant.go +++ b/go/tag/tenant.go @@ -4,4 +4,8 @@ const ( // ProviderTenant if attached to a tenant with a non empty value, // this tenant is treated as the provider tenant. ProviderTenant = "tenant.metal-stack.io/provider" + // MachineBootstrapperTenant if attached to a tenant (empty value is fine), + // this tenant can be used for issuing machine tokens through the infra api. + // this is intended for pixie to create tokens for the metal-hammer. + MachineBootstrapperTenant = "tenant.metal-stack.io/machine-bootstrapper" ) diff --git a/js/metalstack/infra/v2/boot_pb.d.ts b/js/metalstack/infra/v2/boot_pb.d.ts index 88747f85..0d3344c7 100644 --- a/js/metalstack/infra/v2/boot_pb.d.ts +++ b/js/metalstack/infra/v2/boot_pb.d.ts @@ -1,5 +1,8 @@ import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import type { Duration } from "@bufbuild/protobuf/wkt"; +import type { Labels } from "../../api/v2/common_pb"; import type { MachineAllocation, MachineBios, MachineBMC, MachineFRU, MachineHardware } from "../../api/v2/machine_pb"; +import type { Token } from "../../api/v2/token_pb"; import type { Message } from "@bufbuild/protobuf"; /** * Describes the file metalstack/infra/v2/boot.proto. @@ -40,6 +43,66 @@ export type BootServiceDhcpResponse = Message<"metalstack.infra.v2.BootServiceDh * Use `create(BootServiceDhcpResponseSchema)` to create a new message. */ export declare const BootServiceDhcpResponseSchema: GenMessage; +/** + * TokenServiceCreateRequest is the request payload for creating a machine token. + * + * @generated from message metalstack.infra.v2.BootServiceMachineTokenRequest + */ +export type BootServiceMachineTokenRequest = Message<"metalstack.infra.v2.BootServiceMachineTokenRequest"> & { + /** + * UUID of the machine that will get the machine token. + * + * @generated from field: string uuid = 1; + */ + uuid: string; + /** + * User this token should be created for, it must be labelled in the backend with "tenant.metal-stack.io/machine-bootstrapper" + * + * @generated from field: string user = 2; + */ + user: string; + /** + * Expires gives the duration since now, after which this token can not be used anymore. + * + * @generated from field: google.protobuf.Duration expires = 3; + */ + expires?: Duration | undefined; + /** + * Labels for this token. + * + * @generated from field: metalstack.api.v2.Labels labels = 4; + */ + labels?: Labels | undefined; +}; +/** + * Describes the message metalstack.infra.v2.BootServiceMachineTokenRequest. + * Use `create(BootServiceMachineTokenRequestSchema)` to create a new message. + */ +export declare const BootServiceMachineTokenRequestSchema: GenMessage; +/** + * TokenServiceCreateResponse is the response payload for the created machine token. + * + * @generated from message metalstack.infra.v2.BootServiceMachineTokenResponse + */ +export type BootServiceMachineTokenResponse = Message<"metalstack.infra.v2.BootServiceMachineTokenResponse"> & { + /** + * Token contains the created token. + * + * @generated from field: metalstack.api.v2.Token token = 1; + */ + token?: Token | undefined; + /** + * Secret is the body if the JWT token, should be used in API requests as bearer token. + * + * @generated from field: string secret = 2; + */ + secret: string; +}; +/** + * Describes the message metalstack.infra.v2.BootServiceMachineTokenResponse. + * Use `create(BootServiceMachineTokenResponseSchema)` to create a new message. + */ +export declare const BootServiceMachineTokenResponseSchema: GenMessage; /** * BootServiceBootRequest is called to get specified parameters to boot a machine with the given mac. * @@ -325,6 +388,16 @@ export declare const BootService: GenService<{ input: typeof BootServiceBootRequestSchema; output: typeof BootServiceBootResponseSchema; }; + /** + * MachineToken is called from pixie to create machine role token for the metal-hammer. This way it does not need to have an admin token for token creation. + * + * @generated from rpc metalstack.infra.v2.BootService.MachineToken + */ + machineToken: { + methodKind: "unary"; + input: typeof BootServiceMachineTokenRequestSchema; + output: typeof BootServiceMachineTokenResponseSchema; + }; /** * SuperUserPassword returns the configured root password for the BMC. * diff --git a/js/metalstack/infra/v2/boot_pb.js b/js/metalstack/infra/v2/boot_pb.js index 1ebb831e..f529fd2b 100644 --- a/js/metalstack/infra/v2/boot_pb.js +++ b/js/metalstack/infra/v2/boot_pb.js @@ -3,13 +3,15 @@ /* eslint-disable */ import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; import { file_buf_validate_validate } from "../../../buf/validate/validate_pb"; +import { file_google_protobuf_duration } from "@bufbuild/protobuf/wkt"; import { file_metalstack_api_v2_common } from "../../api/v2/common_pb"; import { file_metalstack_api_v2_machine } from "../../api/v2/machine_pb"; import { file_metalstack_api_v2_predefined_rules } from "../../api/v2/predefined_rules_pb"; +import { file_metalstack_api_v2_token } from "../../api/v2/token_pb"; /** * Describes the file metalstack/infra/v2/boot.proto. */ -export const file_metalstack_infra_v2_boot = /*@__PURE__*/ fileDesc("Ch5tZXRhbHN0YWNrL2luZnJhL3YyL2Jvb3QucHJvdG8SE21ldGFsc3RhY2suaW5mcmEudjIiUAoWQm9vdFNlcnZpY2VEaGNwUmVxdWVzdBIWCgR1dWlkGAEgASgJQgi6SAVyA7ABARIeCglwYXJ0aXRpb24YAiABKAlCC7pICHIG0LOusQIBIhkKF0Jvb3RTZXJ2aWNlRGhjcFJlc3BvbnNlIlIKFkJvb3RTZXJ2aWNlQm9vdFJlcXVlc3QSGAoDbWFjGAEgASgJQgu6SAhyBrizrrECARIeCglwYXJ0aXRpb24YAiABKAlCC7pICHIG0LOusQIBIn0KF0Jvb3RTZXJ2aWNlQm9vdFJlc3BvbnNlEhsKBmtlcm5lbBgBIAEoCUILukgIcg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TdWNjZWVkZWQSPC5tZXRhbHN0YWNrLmluZnJhLnYyLkJvb3RTZXJ2aWNlSW5zdGFsbGF0aW9uU3VjY2VlZGVkUmVxdWVzdBo9Lm1ldGFsc3RhY2suaW5mcmEudjIuQm9vdFNlcnZpY2VJbnN0YWxsYXRpb25TdWNjZWVkZWRSZXNwb25zZSIJ4PMYAfLzGAEBQs0BChdjb20ubWV0YWxzdGFjay5pbmZyYS52MkIJQm9vdFByb3RvUAFaOWdpdGh1Yi5jb20vbWV0YWwtc3RhY2svYXBpL2dvL21ldGFsc3RhY2svaW5mcmEvdjI7aW5mcmF2MqICA01JWKoCE01ldGFsc3RhY2suSW5mcmEuVjLKAhNNZXRhbHN0YWNrXEluZnJhXFYy4gIfTWV0YWxzdGFja1xJbmZyYVxWMlxHUEJNZXRhZGF0YeoCFU1ldGFsc3RhY2s6OkluZnJhOjpWMmIGcHJvdG8z", [file_buf_validate_validate, file_metalstack_api_v2_common, file_metalstack_api_v2_machine, file_metalstack_api_v2_predefined_rules]); +export const file_metalstack_infra_v2_boot = /*@__PURE__*/ fileDesc("Ch5tZXRhbHN0YWNrL2luZnJhL3YyL2Jvb3QucHJvdG8SE21ldGFsc3RhY2suaW5mcmEudjIiUAoWQm9vdFNlcnZpY2VEaGNwUmVxdWVzdBIWCgR1dWlkGAEgASgJQgi6SAVyA7ABARIeCglwYXJ0aXRpb24YAiABKAlCC7pICHIG0LOusQIBIhkKF0Jvb3RTZXJ2aWNlRGhjcFJlc3BvbnNlIr0BCh5Cb290U2VydmljZU1hY2hpbmVUb2tlblJlcXVlc3QSFgoEdXVpZBgBIAEoCUIIukgFcgOwAQESGQoEdXNlchgCIAEoCUILukgIcgb4s66xAgESPQoHZXhwaXJlcxgDIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbkIRukgOqgELGgQIgPUkMgMI2AQSKQoGbGFiZWxzGAQgASgLMhkubWV0YWxzdGFjay5hcGkudjIuTGFiZWxzIloKH0Jvb3RTZX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dWVzdBo5Lm1ldGFsc3RhY2suaW5mcmEudjIuQm9vdFNlcnZpY2VTdXBlclVzZXJQYXNzd29yZFJlc3BvbnNlIgng8xgB8vMYAQESeAoIUmVnaXN0ZXISLy5tZXRhbHN0YWNrLmluZnJhLnYyLkJvb3RTZXJ2aWNlUmVnaXN0ZXJSZXF1ZXN0GjAubWV0YWxzdGFjay5pbmZyYS52Mi5Cb290U2VydmljZVJlZ2lzdGVyUmVzcG9uc2UiCeDzGAHy8xgBARJuCgRXYWl0EisubWV0YWxzdGFjay5pbmZyYS52Mi5Cb290U2VydmljZVdhaXRSZXF1ZXN0GiwubWV0YWxzdGFjay5pbmZyYS52Mi5Cb290U2VydmljZVdhaXRSZXNwb25zZSIJ4PMYAfLzGAEBMAESnwEKFUluc3RhbGxhdGlvblN1Y2NlZWRlZBI8Lm1ldGFsc3RhY2suaW5mcmEudjIuQm9vdFNlcnZpY2VJbnN0YWxsYXRpb25TdWNjZWVkZWRSZXF1ZXN0Gj0ubWV0YWxzdGFjay5pbmZyYS52Mi5Cb290U2VydmljZUluc3RhbGxhdGlvblN1Y2NlZWRlZFJlc3BvbnNlIgng8xgB8vMYAQFCzQEKF2NvbS5tZXRhbHN0YWNrLmluZnJhLnYyQglCb290UHJvdG9QAVo5Z2l0aHViLmNvbS9tZXRhbC1zdGFjay9hcGkvZ28vbWV0YWxzdGFjay9pbmZyYS92MjtpbmZyYXYyogIDTUlYqgITTWV0YWxzdGFjay5JbmZyYS5WMsoCE01ldGFsc3RhY2tcSW5mcmFcVjLiAh9NZXRhbHN0YWNrXEluZnJhXFYyXEdQQk1ldGFkYXRh6gIVTWV0YWxzdGFjazo6SW5mcmE6OlYyYgZwcm90bzM", [file_buf_validate_validate, file_google_protobuf_duration, file_metalstack_api_v2_common, file_metalstack_api_v2_machine, file_metalstack_api_v2_predefined_rules, file_metalstack_api_v2_token]); /** * Describes the message metalstack.infra.v2.BootServiceDhcpRequest. * Use `create(BootServiceDhcpRequestSchema)` to create a new message. @@ -20,56 +22,66 @@ export const BootServiceDhcpRequestSchema = /*@__PURE__*/ messageDesc(file_metal * Use `create(BootServiceDhcpResponseSchema)` to create a new message. */ export const BootServiceDhcpResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 1); +/** + * Describes the message metalstack.infra.v2.BootServiceMachineTokenRequest. + * Use `create(BootServiceMachineTokenRequestSchema)` to create a new message. + */ +export const BootServiceMachineTokenRequestSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 2); +/** + * Describes the message metalstack.infra.v2.BootServiceMachineTokenResponse. + * Use `create(BootServiceMachineTokenResponseSchema)` to create a new message. + */ +export const BootServiceMachineTokenResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 3); /** * Describes the message metalstack.infra.v2.BootServiceBootRequest. * Use `create(BootServiceBootRequestSchema)` to create a new message. */ -export const BootServiceBootRequestSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 2); +export const BootServiceBootRequestSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 4); /** * Describes the message metalstack.infra.v2.BootServiceBootResponse. * Use `create(BootServiceBootResponseSchema)` to create a new message. */ -export const BootServiceBootResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 3); +export const BootServiceBootResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 5); /** * Describes the message metalstack.infra.v2.BootServiceRegisterRequest. * Use `create(BootServiceRegisterRequestSchema)` to create a new message. */ -export const BootServiceRegisterRequestSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 4); +export const BootServiceRegisterRequestSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 6); /** * Describes the message metalstack.infra.v2.BootServiceRegisterResponse. * Use `create(BootServiceRegisterResponseSchema)` to create a new message. */ -export const BootServiceRegisterResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 5); +export const BootServiceRegisterResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 7); /** * Describes the message metalstack.infra.v2.BootServiceWaitRequest. * Use `create(BootServiceWaitRequestSchema)` to create a new message. */ -export const BootServiceWaitRequestSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 6); +export const BootServiceWaitRequestSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 8); /** * Describes the message metalstack.infra.v2.BootServiceWaitResponse. * Use `create(BootServiceWaitResponseSchema)` to create a new message. */ -export const BootServiceWaitResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 7); +export const BootServiceWaitResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 9); /** * Describes the message metalstack.infra.v2.BootServiceInstallationSucceededRequest. * Use `create(BootServiceInstallationSucceededRequestSchema)` to create a new message. */ -export const BootServiceInstallationSucceededRequestSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 8); +export const BootServiceInstallationSucceededRequestSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 10); /** * Describes the message metalstack.infra.v2.BootServiceInstallationSucceededResponse. * Use `create(BootServiceInstallationSucceededResponseSchema)` to create a new message. */ -export const BootServiceInstallationSucceededResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 9); +export const BootServiceInstallationSucceededResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 11); /** * Describes the message metalstack.infra.v2.BootServiceSuperUserPasswordRequest. * Use `create(BootServiceSuperUserPasswordRequestSchema)` to create a new message. */ -export const BootServiceSuperUserPasswordRequestSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 10); +export const BootServiceSuperUserPasswordRequestSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 12); /** * Describes the message metalstack.infra.v2.BootServiceSuperUserPasswordResponse. * Use `create(BootServiceSuperUserPasswordResponseSchema)` to create a new message. */ -export const BootServiceSuperUserPasswordResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 11); +export const BootServiceSuperUserPasswordResponseSchema = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 13); /** * BootService provides boot-related operations for pixiecore and metal-hammer. * diff --git a/js/metalstack/infra/v2/boot_pb.ts b/js/metalstack/infra/v2/boot_pb.ts index f1febc44..01cb711b 100644 --- a/js/metalstack/infra/v2/boot_pb.ts +++ b/js/metalstack/infra/v2/boot_pb.ts @@ -5,17 +5,22 @@ import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; import { file_buf_validate_validate } from "../../../buf/validate/validate_pb"; +import type { Duration } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_duration } from "@bufbuild/protobuf/wkt"; +import type { Labels } from "../../api/v2/common_pb"; import { file_metalstack_api_v2_common } from "../../api/v2/common_pb"; import type { MachineAllocation, MachineBios, MachineBMC, MachineFRU, MachineHardware } from "../../api/v2/machine_pb"; import { file_metalstack_api_v2_machine } from "../../api/v2/machine_pb"; import { file_metalstack_api_v2_predefined_rules } from "../../api/v2/predefined_rules_pb"; +import type { Token } from "../../api/v2/token_pb"; +import { file_metalstack_api_v2_token } from "../../api/v2/token_pb"; import type { Message } from "@bufbuild/protobuf"; /** * Describes the file metalstack/infra/v2/boot.proto. */ export const file_metalstack_infra_v2_boot: GenFile = /*@__PURE__*/ - fileDesc("Ch5tZXRhbHN0YWNrL2luZnJhL3YyL2Jvb3QucHJvdG8SE21ldGFsc3RhY2suaW5mcmEudjIiUAoWQm9vdFNlcnZpY2VEaGNwUmVxdWVzdBIWCgR1dWlkGAEgASgJQgi6SAVyA7ABARIeCglwYXJ0aXRpb24YAiABKAlCC7pICHIG0LOusQIBIhkKF0Jvb3RTZXJ2aWNlRGhjcFJlc3BvbnNlIlIKFkJvb3RTZXJ2aWNlQm9vdFJl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c3RhY2suaW5mcmEudjIuQm9vdFNlcnZpY2VXYWl0UmVxdWVzdBosLm1ldGFsc3RhY2suaW5mcmEudjIuQm9vdFNlcnZpY2VXYWl0UmVzcG9uc2UiCeDzGAHy8xgBATABEp8BChVJbnN0YWxsYXRpb25TdWNjZWVkZWQSPC5tZXRhbHN0YWNrLmluZnJhLnYyLkJvb3RTZXJ2aWNlSW5zdGFsbGF0aW9uU3VjY2VlZGVkUmVxdWVzdBo9Lm1ldGFsc3RhY2suaW5mcmEudjIuQm9vdFNlcnZpY2VJbnN0YWxsYXRpb25TdWNjZWVkZWRSZXNwb25zZSIJ4PMYAfLzGAEBQs0BChdjb20ubWV0YWxzdGFjay5pbmZyYS52MkIJQm9vdFByb3RvUAFaOWdpdGh1Yi5jb20vbWV0YWwtc3RhY2svYXBpL2dvL21ldGFsc3RhY2svaW5mcmEvdjI7aW5mcmF2MqICA01JWKoCE01ldGFsc3RhY2suSW5mcmEuVjLKAhNNZXRhbHN0YWNrXEluZnJhXFYy4gIfTWV0YWxzdGFja1xJbmZyYVxWMlxHUEJNZXRhZGF0YeoCFU1ldGFsc3RhY2s6OkluZnJhOjpWMmIGcHJvdG8z", [file_buf_validate_validate, file_metalstack_api_v2_common, file_metalstack_api_v2_machine, file_metalstack_api_v2_predefined_rules]); + fileDesc("Ch5tZXRhbHN0YWNrL2luZnJhL3YyL2Jvb3QucHJvdG8SE21ldGFsc3RhY2suaW5mcmEudjIiUAoWQm9vdFNlcnZpY2VEaGNwUmVxdWVzdBIWCgR1dWlkGAEgASgJQgi6SAVyA7ABARIeCglwYXJ0aXRpb24YAiABKAlCC7pICHIG0LOusQIBIhkKF0Jvb3RTZXJ2aWNlRGhjcFJlc3BvbnNlIr0BCh5Cb290U2VydmljZU1hY2hpbmVUb2tlblJlcXVlc3QSFgoEdXVpZBgBIAEoCUIIukgFcgOwAQESGQoEdXNlchgCIAEoCUILukgIcgb4s66xAgESPQoHZXhwaXJlcxgDIAEoCzIZLmdvb2dsZS5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_common, file_metalstack_api_v2_machine, file_metalstack_api_v2_predefined_rules, file_metalstack_api_v2_token]); /** * BootServiceDhcpRequest is called once a machine issues a dhcp request. @@ -60,6 +65,76 @@ export type BootServiceDhcpResponse = Message<"metalstack.infra.v2.BootServiceDh export const BootServiceDhcpResponseSchema: GenMessage = /*@__PURE__*/ messageDesc(file_metalstack_infra_v2_boot, 1); +/** + * TokenServiceCreateRequest is the request payload for creating a machine token. + * + * @generated from message metalstack.infra.v2.BootServiceMachineTokenRequest + */ +export type BootServiceMachineTokenRequest = Message<"metalstack.infra.v2.BootServiceMachineTokenRequest"> & { + /** + * UUID of the machine that will get the machine token. + * + * @generated from field: string uuid = 1; + */ + uuid: string; + + /** + * User this token should be created for, it must be labelled in the backend with "tenant.metal-stack.io/machine-bootstrapper" + * + * @generated from field: string user = 2; + */ + user: string; + + /** + * Expires gives the duration since now, after which this token can not be used anymore. + * + * @generated from field: google.protobuf.Duration expires = 3; + */ + expires?: Duration | undefined; + + /** + * Labels for this token. + * + * @generated from field: metalstack.api.v2.Labels labels = 4; + */ + labels?: Labels | undefined; +}; + +/** + * Describes the message metalstack.infra.v2.BootServiceMachineTokenRequest. + * Use `create(BootServiceMachineTokenRequestSchema)` to create a new message. + */ +export const BootServiceMachineTokenRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_metalstack_infra_v2_boot, 2); + +/** + * TokenServiceCreateResponse is the response payload for the created machine token. + * + * @generated from message metalstack.infra.v2.BootServiceMachineTokenResponse + */ +export type BootServiceMachineTokenResponse = Message<"metalstack.infra.v2.BootServiceMachineTokenResponse"> & { + /** + * Token contains the created token. + * + * @generated from field: metalstack.api.v2.Token token = 1; + */ + token?: Token | undefined; + + /** + * Secret is the body if the JWT token, should be used in API requests as bearer token. + * + * @generated from field: string secret = 2; + */ + secret: string; +}; + +/** + * Describes the message metalstack.infra.v2.BootServiceMachineTokenResponse. + * Use `create(BootServiceMachineTokenResponseSchema)` to create a new message. + */ +export const BootServiceMachineTokenResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_metalstack_infra_v2_boot, 3); + /** * BootServiceBootRequest is called to get specified parameters to boot a machine with the given mac. * @@ -86,7 +161,7 @@ export type BootServiceBootRequest = Message<"metalstack.infra.v2.BootServiceBoo * Use `create(BootServiceBootRequestSchema)` to create a new message. */ export const BootServiceBootRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_metalstack_infra_v2_boot, 2); + messageDesc(file_metalstack_infra_v2_boot, 4); /** * BootServiceBootResponse contains additional infos which are required to boot a machine. @@ -121,7 +196,7 @@ export type BootServiceBootResponse = Message<"metalstack.infra.v2.BootServiceBo * Use `create(BootServiceBootResponseSchema)` to create a new message. */ export const BootServiceBootResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_metalstack_infra_v2_boot, 3); + messageDesc(file_metalstack_infra_v2_boot, 5); /** * BootServiceRegisterRequest is called from metal-hammer to register a machine with as much hardware details as possible. @@ -191,7 +266,7 @@ export type BootServiceRegisterRequest = Message<"metalstack.infra.v2.BootServic * Use `create(BootServiceRegisterRequestSchema)` to create a new message. */ export const BootServiceRegisterRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_metalstack_infra_v2_boot, 4); + messageDesc(file_metalstack_infra_v2_boot, 6); /** * BootServiceRegisterResponse response to a BootServiceRegisterResponse request. @@ -226,7 +301,7 @@ export type BootServiceRegisterResponse = Message<"metalstack.infra.v2.BootServi * Use `create(BootServiceRegisterResponseSchema)` to create a new message. */ export const BootServiceRegisterResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_metalstack_infra_v2_boot, 5); + messageDesc(file_metalstack_infra_v2_boot, 7); /** * BootServiceWaitRequest is called when a machine was registered and is waiting for allocation. @@ -247,7 +322,7 @@ export type BootServiceWaitRequest = Message<"metalstack.infra.v2.BootServiceWai * Use `create(BootServiceWaitRequestSchema)` to create a new message. */ export const BootServiceWaitRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_metalstack_infra_v2_boot, 6); + messageDesc(file_metalstack_infra_v2_boot, 8); /** * BootServiceWaitResponse response to a wait request. @@ -268,7 +343,7 @@ export type BootServiceWaitResponse = Message<"metalstack.infra.v2.BootServiceWa * Use `create(BootServiceWaitResponseSchema)` to create a new message. */ export const BootServiceWaitResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_metalstack_infra_v2_boot, 7); + messageDesc(file_metalstack_infra_v2_boot, 9); /** * BootServiceInstallationSucceededRequest is sent from metal-hammer to the api to report the installation succeeded. @@ -296,7 +371,7 @@ export type BootServiceInstallationSucceededRequest = Message<"metalstack.infra. * Use `create(BootServiceInstallationSucceededRequestSchema)` to create a new message. */ export const BootServiceInstallationSucceededRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_metalstack_infra_v2_boot, 8); + messageDesc(file_metalstack_infra_v2_boot, 10); /** * BootServiceInstallationSucceededResponse is the response to a BootServiceInstallationSucceededRequest. @@ -311,7 +386,7 @@ export type BootServiceInstallationSucceededResponse = Message<"metalstack.infra * Use `create(BootServiceInstallationSucceededResponseSchema)` to create a new message. */ export const BootServiceInstallationSucceededResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_metalstack_infra_v2_boot, 9); + messageDesc(file_metalstack_infra_v2_boot, 11); /** * BootServiceSuperUserPasswordRequest this call returns the password for the machine superuser. @@ -332,7 +407,7 @@ export type BootServiceSuperUserPasswordRequest = Message<"metalstack.infra.v2.B * Use `create(BootServiceSuperUserPasswordRequestSchema)` to create a new message. */ export const BootServiceSuperUserPasswordRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_metalstack_infra_v2_boot, 10); + messageDesc(file_metalstack_infra_v2_boot, 12); /** * BootServiceSuperUserPasswordResponse the super user password is returned. @@ -360,7 +435,7 @@ export type BootServiceSuperUserPasswordResponse = Message<"metalstack.infra.v2. * Use `create(BootServiceSuperUserPasswordResponseSchema)` to create a new message. */ export const BootServiceSuperUserPasswordResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_metalstack_infra_v2_boot, 11); + messageDesc(file_metalstack_infra_v2_boot, 13); /** * BootService provides boot-related operations for pixiecore and metal-hammer. @@ -390,6 +465,16 @@ export const BootService: GenService<{ input: typeof BootServiceBootRequestSchema; output: typeof BootServiceBootResponseSchema; }, + /** + * MachineToken is called from pixie to create machine role token for the metal-hammer. This way it does not need to have an admin token for token creation. + * + * @generated from rpc metalstack.infra.v2.BootService.MachineToken + */ + machineToken: { + methodKind: "unary"; + input: typeof BootServiceMachineTokenRequestSchema; + output: typeof BootServiceMachineTokenResponseSchema; + }, /** * SuperUserPassword returns the configured root password for the BMC. * diff --git a/proto/metalstack/infra/v2/boot.proto b/proto/metalstack/infra/v2/boot.proto index 1e45cb9e..1401d1c3 100644 --- a/proto/metalstack/infra/v2/boot.proto +++ b/proto/metalstack/infra/v2/boot.proto @@ -3,9 +3,11 @@ syntax = "proto3"; package metalstack.infra.v2; import "buf/validate/validate.proto"; +import "google/protobuf/duration.proto"; import "metalstack/api/v2/common.proto"; import "metalstack/api/v2/machine.proto"; import "metalstack/api/v2/predefined_rules.proto"; +import "metalstack/api/v2/token.proto"; // BootService provides boot-related operations for pixiecore and metal-hammer. service BootService { @@ -21,6 +23,11 @@ service BootService { option (metalstack.api.v2.infra_roles) = INFRA_ROLE_EDITOR; option (metalstack.api.v2.auditing) = AUDITING_INCLUDED; } + // MachineToken is called from pixie to create machine role token for the metal-hammer. This way it does not need to have an admin token for token creation. + rpc MachineToken(BootServiceMachineTokenRequest) returns (BootServiceMachineTokenResponse) { + option (metalstack.api.v2.infra_roles) = INFRA_ROLE_EDITOR; + option (metalstack.api.v2.auditing) = AUDITING_INCLUDED; + } // Metal Hammer @@ -57,6 +64,30 @@ message BootServiceDhcpRequest { // BootServiceDhcpResponse contains the response to a dhcp request. message BootServiceDhcpResponse {} +// TokenServiceCreateRequest is the request payload for creating a machine token. +message BootServiceMachineTokenRequest { + // UUID of the machine that will get the machine token. + string uuid = 1 [(buf.validate.field).string.uuid = true]; + // User this token should be created for, it must be labelled in the backend with "tenant.metal-stack.io/machine-bootstrapper" + string user = 2 [(buf.validate.field).string.(metalstack.api.v2.is_user) = true]; + // Expires gives the duration since now, after which this token can not be used anymore. + google.protobuf.Duration expires = 3 [(buf.validate.field).duration = { + // Max token lifetime is a week, the metal-hammer reboots the machine after three days. + lt: {seconds: 604800} + gte: {seconds: 600} + }]; + // Labels for this token. + metalstack.api.v2.Labels labels = 4; +} + +// TokenServiceCreateResponse is the response payload for the created machine token. +message BootServiceMachineTokenResponse { + // Token contains the created token. + metalstack.api.v2.Token token = 1; + // Secret is the body if the JWT token, should be used in API requests as bearer token. + string secret = 2; +} + // BootServiceBootRequest is called to get specified parameters to boot a machine with the given mac. message BootServiceBootRequest { // Mac address of the machine. diff --git a/python/metalstack/infra/v2/boot_connect.py b/python/metalstack/infra/v2/boot_connect.py index 3cc39a22..7c4cf2f8 100644 --- a/python/metalstack/infra/v2/boot_connect.py +++ b/python/metalstack/infra/v2/boot_connect.py @@ -24,6 +24,9 @@ async def dhcp(self, request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServ async def boot(self, request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceBootRequest, ctx: RequestContext) -> metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceBootResponse: raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") + async def machine_token(self, request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenRequest, ctx: RequestContext) -> metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenResponse: + raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") + async def super_user_password(self, request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceSuperUserPasswordRequest, ctx: RequestContext) -> metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceSuperUserPasswordResponse: raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") @@ -62,6 +65,16 @@ def __init__(self, service: BootService | AsyncGenerator[BootService], *, interc ), function=svc.boot, ), + "/metalstack.infra.v2.BootService/MachineToken": Endpoint.unary( + method=MethodInfo( + name="MachineToken", + service_name="metalstack.infra.v2.BootService", + input=metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenRequest, + output=metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenResponse, + idempotency_level=IdempotencyLevel.UNKNOWN, + ), + function=svc.machine_token, + ), "/metalstack.infra.v2.BootService/SuperUserPassword": Endpoint.unary( method=MethodInfo( name="SuperUserPassword", @@ -156,6 +169,26 @@ async def boot( timeout_ms=timeout_ms, ) + async def machine_token( + self, + request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenRequest, + *, + headers: Headers | Mapping[str, str] | None = None, + timeout_ms: int | None = None, + ) -> metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenResponse: + return await self.execute_unary( + request=request, + method=MethodInfo( + name="MachineToken", + service_name="metalstack.infra.v2.BootService", + input=metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenRequest, + output=metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenResponse, + idempotency_level=IdempotencyLevel.UNKNOWN, + ), + headers=headers, + timeout_ms=timeout_ms, + ) + async def super_user_password( self, request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceSuperUserPasswordRequest, @@ -245,6 +278,8 @@ def dhcp(self, request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceDhc raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") def boot(self, request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceBootRequest, ctx: RequestContext) -> metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceBootResponse: raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") + def machine_token(self, request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenRequest, ctx: RequestContext) -> metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenResponse: + raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") def super_user_password(self, request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceSuperUserPasswordRequest, ctx: RequestContext) -> metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceSuperUserPasswordResponse: raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") def register(self, request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceRegisterRequest, ctx: RequestContext) -> metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceRegisterResponse: @@ -279,6 +314,16 @@ def __init__(self, service: BootServiceSync, interceptors: Iterable[InterceptorS ), function=service.boot, ), + "/metalstack.infra.v2.BootService/MachineToken": EndpointSync.unary( + method=MethodInfo( + name="MachineToken", + service_name="metalstack.infra.v2.BootService", + input=metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenRequest, + output=metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenResponse, + idempotency_level=IdempotencyLevel.UNKNOWN, + ), + function=service.machine_token, + ), "/metalstack.infra.v2.BootService/SuperUserPassword": EndpointSync.unary( method=MethodInfo( name="SuperUserPassword", @@ -373,6 +418,26 @@ def boot( timeout_ms=timeout_ms, ) + def machine_token( + self, + request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenRequest, + *, + headers: Headers | Mapping[str, str] | None = None, + timeout_ms: int | None = None, + ) -> metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenResponse: + return self.execute_unary( + request=request, + method=MethodInfo( + name="MachineToken", + service_name="metalstack.infra.v2.BootService", + input=metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenRequest, + output=metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceMachineTokenResponse, + idempotency_level=IdempotencyLevel.UNKNOWN, + ), + headers=headers, + timeout_ms=timeout_ms, + ) + def super_user_password( self, request: metalstack_dot_infra_dot_v2_dot_boot__pb2.BootServiceSuperUserPasswordRequest, diff --git a/python/metalstack/infra/v2/boot_pb2.py b/python/metalstack/infra/v2/boot_pb2.py index d724c74a..6e7b5574 100644 --- a/python/metalstack/infra/v2/boot_pb2.py +++ b/python/metalstack/infra/v2/boot_pb2.py @@ -23,12 +23,14 @@ from buf.validate import validate_pb2 as buf_dot_validate_dot_validate__pb2 +from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 from metalstack.api.v2 import common_pb2 as metalstack_dot_api_dot_v2_dot_common__pb2 from metalstack.api.v2 import machine_pb2 as metalstack_dot_api_dot_v2_dot_machine__pb2 from metalstack.api.v2 import predefined_rules_pb2 as metalstack_dot_api_dot_v2_dot_predefined__rules__pb2 +from metalstack.api.v2 import token_pb2 as metalstack_dot_api_dot_v2_dot_token__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1emetalstack/infra/v2/boot.proto\x12\x13metalstack.infra.v2\x1a\x1b\x62uf/validate/validate.proto\x1a\x1emetalstack/api/v2/common.proto\x1a\x1fmetalstack/api/v2/machine.proto\x1a(metalstack/api/v2/predefined_rules.proto\"a\n\x16\x42ootServiceDhcpRequest\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\x12)\n\tpartition\x18\x02 \x01(\tB\x0b\xbaH\x08r\x06\xd0\xb3\xae\xb1\x02\x01R\tpartition\"\x19\n\x17\x42ootServiceDhcpResponse\"b\n\x16\x42ootServiceBootRequest\x12\x1d\n\x03mac\x18\x01 \x01(\tB\x0b\xbaH\x08r\x06\xb8\xb3\xae\xb1\x02\x01R\x03mac\x12)\n\tpartition\x18\x02 \x01(\tB\x0b\xbaH\x08r\x06\xd0\xb3\xae\xb1\x02\x01R\tpartition\"\x9c\x01\n\x17\x42ootServiceBootResponse\x12#\n\x06kernel\x18\x01 \x01(\tB\x0b\xbaH\x08r\x06\xe0\xb3\xae\xb1\x02\x01R\x06kernel\x12$\n\x0einit_ram_disks\x18\x02 \x03(\tR\x0cinitRamDisks\x12*\n\x07\x63mdline\x18\x03 \x01(\tB\x0b\xbaH\x08r\x06\xc8\xb3\xae\xb1\x02\x01H\x00R\x07\x63mdline\x88\x01\x01\x42\n\n\x08_cmdline\"\x8e\x03\n\x1a\x42ootServiceRegisterRequest\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\x12>\n\x08hardware\x18\x02 \x01(\x0b\x32\".metalstack.api.v2.MachineHardwareR\x08hardware\x12\x32\n\x04\x62ios\x18\x03 \x01(\x0b\x32\x1e.metalstack.api.v2.MachineBiosR\x04\x62ios\x12/\n\x03\x62mc\x18\x04 \x01(\x0b\x32\x1d.metalstack.api.v2.MachineBMCR\x03\x62mc\x12/\n\x03\x66ru\x18\x05 \x01(\x0b\x32\x1d.metalstack.api.v2.MachineFRUR\x03\x66ru\x12\x12\n\x04tags\x18\x06 \x03(\tR\x04tags\x12=\n\x14metal_hammer_version\x18\x07 \x01(\tB\x0b\xbaH\x08r\x06\xc8\xb3\xae\xb1\x02\x01R\x12metalHammerVersion\x12)\n\tpartition\x18\x08 \x01(\tB\x0b\xbaH\x08r\x06\xd0\xb3\xae\xb1\x02\x01R\tpartition\"\x87\x01\n\x1b\x42ootServiceRegisterResponse\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\x12\x1f\n\x04size\x18\x02 \x01(\tB\x0b\xbaH\x08r\x06\xc8\xb3\xae\xb1\x02\x01R\x04size\x12)\n\tpartition\x18\x03 \x01(\tB\x0b\xbaH\x08r\x06\xd0\xb3\xae\xb1\x02\x01R\tpartition\"6\n\x16\x42ootServiceWaitRequest\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\"_\n\x17\x42ootServiceWaitResponse\x12\x44\n\nallocation\x18\x01 \x01(\x0b\x32$.metalstack.api.v2.MachineAllocationR\nallocation\"~\n\'BootServiceInstallationSucceededRequest\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\x12\x35\n\x10\x63onsole_password\x18\x02 \x01(\tB\n\xbaH\x07r\x05\x10\x02\x18\x80\x01R\x0f\x63onsolePassword\"*\n(BootServiceInstallationSucceededResponse\"C\n#BootServiceSuperUserPasswordRequest\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\"\x8d\x01\n$BootServiceSuperUserPasswordResponse\x12)\n\x10\x66\x65\x61ture_disabled\x18\x01 \x01(\x08R\x0f\x66\x65\x61tureDisabled\x12:\n\x13super_user_password\x18\x02 \x01(\tB\n\xbaH\x07r\x05\x10\x02\x18\x80\x01R\x11superUserPassword2\x8b\x06\n\x0b\x42ootService\x12l\n\x04\x44hcp\x12+.metalstack.infra.v2.BootServiceDhcpRequest\x1a,.metalstack.infra.v2.BootServiceDhcpResponse\"\t\xe0\xf3\x18\x01\xea\xf3\x18\x01\x01\x12l\n\x04\x42oot\x12+.metalstack.infra.v2.BootServiceBootRequest\x1a,.metalstack.infra.v2.BootServiceBootResponse\"\t\xe0\xf3\x18\x01\xea\xf3\x18\x01\x01\x12\x93\x01\n\x11SuperUserPassword\x12\x38.metalstack.infra.v2.BootServiceSuperUserPasswordRequest\x1a\x39.metalstack.infra.v2.BootServiceSuperUserPasswordResponse\"\t\xe0\xf3\x18\x01\xf2\xf3\x18\x01\x01\x12x\n\x08Register\x12/.metalstack.infra.v2.BootServiceRegisterRequest\x1a\x30.metalstack.infra.v2.BootServiceRegisterResponse\"\t\xe0\xf3\x18\x01\xf2\xf3\x18\x01\x01\x12n\n\x04Wait\x12+.metalstack.infra.v2.BootServiceWaitRequest\x1a,.metalstack.infra.v2.BootServiceWaitResponse\"\t\xe0\xf3\x18\x01\xf2\xf3\x18\x01\x01\x30\x01\x12\x9f\x01\n\x15InstallationSucceeded\x12<.metalstack.infra.v2.BootServiceInstallationSucceededRequest\x1a=.metalstack.infra.v2.BootServiceInstallationSucceededResponse\"\t\xe0\xf3\x18\x01\xf2\xf3\x18\x01\x01\x42\xcd\x01\n\x17\x63om.metalstack.infra.v2B\tBootProtoP\x01Z9github.com/metal-stack/api/go/metalstack/infra/v2;infrav2\xa2\x02\x03MIX\xaa\x02\x13Metalstack.Infra.V2\xca\x02\x13Metalstack\\Infra\\V2\xe2\x02\x1fMetalstack\\Infra\\V2\\GPBMetadata\xea\x02\x15Metalstack::Infra::V2b\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1emetalstack/infra/v2/boot.proto\x12\x13metalstack.infra.v2\x1a\x1b\x62uf/validate/validate.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1emetalstack/api/v2/common.proto\x1a\x1fmetalstack/api/v2/machine.proto\x1a(metalstack/api/v2/predefined_rules.proto\x1a\x1dmetalstack/api/v2/token.proto\"a\n\x16\x42ootServiceDhcpRequest\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\x12)\n\tpartition\x18\x02 \x01(\tB\x0b\xbaH\x08r\x06\xd0\xb3\xae\xb1\x02\x01R\tpartition\"\x19\n\x17\x42ootServiceDhcpResponse\"\xda\x01\n\x1e\x42ootServiceMachineTokenRequest\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\x12\x1f\n\x04user\x18\x02 \x01(\tB\x0b\xbaH\x08r\x06\xf8\xb3\xae\xb1\x02\x01R\x04user\x12\x46\n\x07\x65xpires\x18\x03 \x01(\x0b\x32\x19.google.protobuf.DurationB\x11\xbaH\x0e\xaa\x01\x0b\x1a\x04\x08\x80\xf5$2\x03\x08\xd8\x04R\x07\x65xpires\x12\x31\n\x06labels\x18\x04 \x01(\x0b\x32\x19.metalstack.api.v2.LabelsR\x06labels\"i\n\x1f\x42ootServiceMachineTokenResponse\x12.\n\x05token\x18\x01 \x01(\x0b\x32\x18.metalstack.api.v2.TokenR\x05token\x12\x16\n\x06secret\x18\x02 \x01(\tR\x06secret\"b\n\x16\x42ootServiceBootRequest\x12\x1d\n\x03mac\x18\x01 \x01(\tB\x0b\xbaH\x08r\x06\xb8\xb3\xae\xb1\x02\x01R\x03mac\x12)\n\tpartition\x18\x02 \x01(\tB\x0b\xbaH\x08r\x06\xd0\xb3\xae\xb1\x02\x01R\tpartition\"\x9c\x01\n\x17\x42ootServiceBootResponse\x12#\n\x06kernel\x18\x01 \x01(\tB\x0b\xbaH\x08r\x06\xe0\xb3\xae\xb1\x02\x01R\x06kernel\x12$\n\x0einit_ram_disks\x18\x02 \x03(\tR\x0cinitRamDisks\x12*\n\x07\x63mdline\x18\x03 \x01(\tB\x0b\xbaH\x08r\x06\xc8\xb3\xae\xb1\x02\x01H\x00R\x07\x63mdline\x88\x01\x01\x42\n\n\x08_cmdline\"\x8e\x03\n\x1a\x42ootServiceRegisterRequest\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\x12>\n\x08hardware\x18\x02 \x01(\x0b\x32\".metalstack.api.v2.MachineHardwareR\x08hardware\x12\x32\n\x04\x62ios\x18\x03 \x01(\x0b\x32\x1e.metalstack.api.v2.MachineBiosR\x04\x62ios\x12/\n\x03\x62mc\x18\x04 \x01(\x0b\x32\x1d.metalstack.api.v2.MachineBMCR\x03\x62mc\x12/\n\x03\x66ru\x18\x05 \x01(\x0b\x32\x1d.metalstack.api.v2.MachineFRUR\x03\x66ru\x12\x12\n\x04tags\x18\x06 \x03(\tR\x04tags\x12=\n\x14metal_hammer_version\x18\x07 \x01(\tB\x0b\xbaH\x08r\x06\xc8\xb3\xae\xb1\x02\x01R\x12metalHammerVersion\x12)\n\tpartition\x18\x08 \x01(\tB\x0b\xbaH\x08r\x06\xd0\xb3\xae\xb1\x02\x01R\tpartition\"\x87\x01\n\x1b\x42ootServiceRegisterResponse\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\x12\x1f\n\x04size\x18\x02 \x01(\tB\x0b\xbaH\x08r\x06\xc8\xb3\xae\xb1\x02\x01R\x04size\x12)\n\tpartition\x18\x03 \x01(\tB\x0b\xbaH\x08r\x06\xd0\xb3\xae\xb1\x02\x01R\tpartition\"6\n\x16\x42ootServiceWaitRequest\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\"_\n\x17\x42ootServiceWaitResponse\x12\x44\n\nallocation\x18\x01 \x01(\x0b\x32$.metalstack.api.v2.MachineAllocationR\nallocation\"~\n\'BootServiceInstallationSucceededRequest\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\x12\x35\n\x10\x63onsole_password\x18\x02 \x01(\tB\n\xbaH\x07r\x05\x10\x02\x18\x80\x01R\x0f\x63onsolePassword\"*\n(BootServiceInstallationSucceededResponse\"C\n#BootServiceSuperUserPasswordRequest\x12\x1c\n\x04uuid\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x04uuid\"\x8d\x01\n$BootServiceSuperUserPasswordResponse\x12)\n\x10\x66\x65\x61ture_disabled\x18\x01 \x01(\x08R\x0f\x66\x65\x61tureDisabled\x12:\n\x13super_user_password\x18\x02 \x01(\tB\n\xbaH\x07r\x05\x10\x02\x18\x80\x01R\x11superUserPassword2\x92\x07\n\x0b\x42ootService\x12l\n\x04\x44hcp\x12+.metalstack.infra.v2.BootServiceDhcpRequest\x1a,.metalstack.infra.v2.BootServiceDhcpResponse\"\t\xe0\xf3\x18\x01\xea\xf3\x18\x01\x01\x12l\n\x04\x42oot\x12+.metalstack.infra.v2.BootServiceBootRequest\x1a,.metalstack.infra.v2.BootServiceBootResponse\"\t\xe0\xf3\x18\x01\xea\xf3\x18\x01\x01\x12\x84\x01\n\x0cMachineToken\x12\x33.metalstack.infra.v2.BootServiceMachineTokenRequest\x1a\x34.metalstack.infra.v2.BootServiceMachineTokenResponse\"\t\xe0\xf3\x18\x01\xea\xf3\x18\x01\x01\x12\x93\x01\n\x11SuperUserPassword\x12\x38.metalstack.infra.v2.BootServiceSuperUserPasswordRequest\x1a\x39.metalstack.infra.v2.BootServiceSuperUserPasswordResponse\"\t\xe0\xf3\x18\x01\xf2\xf3\x18\x01\x01\x12x\n\x08Register\x12/.metalstack.infra.v2.BootServiceRegisterRequest\x1a\x30.metalstack.infra.v2.BootServiceRegisterResponse\"\t\xe0\xf3\x18\x01\xf2\xf3\x18\x01\x01\x12n\n\x04Wait\x12+.metalstack.infra.v2.BootServiceWaitRequest\x1a,.metalstack.infra.v2.BootServiceWaitResponse\"\t\xe0\xf3\x18\x01\xf2\xf3\x18\x01\x01\x30\x01\x12\x9f\x01\n\x15InstallationSucceeded\x12<.metalstack.infra.v2.BootServiceInstallationSucceededRequest\x1a=.metalstack.infra.v2.BootServiceInstallationSucceededResponse\"\t\xe0\xf3\x18\x01\xf2\xf3\x18\x01\x01\x42\xcd\x01\n\x17\x63om.metalstack.infra.v2B\tBootProtoP\x01Z9github.com/metal-stack/api/go/metalstack/infra/v2;infrav2\xa2\x02\x03MIX\xaa\x02\x13Metalstack.Infra.V2\xca\x02\x13Metalstack\\Infra\\V2\xe2\x02\x1fMetalstack\\Infra\\V2\\GPBMetadata\xea\x02\x15Metalstack::Infra::V2b\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -40,6 +42,12 @@ _globals['_BOOTSERVICEDHCPREQUEST'].fields_by_name['uuid']._serialized_options = b'\272H\005r\003\260\001\001' _globals['_BOOTSERVICEDHCPREQUEST'].fields_by_name['partition']._loaded_options = None _globals['_BOOTSERVICEDHCPREQUEST'].fields_by_name['partition']._serialized_options = b'\272H\010r\006\320\263\256\261\002\001' + _globals['_BOOTSERVICEMACHINETOKENREQUEST'].fields_by_name['uuid']._loaded_options = None + _globals['_BOOTSERVICEMACHINETOKENREQUEST'].fields_by_name['uuid']._serialized_options = b'\272H\005r\003\260\001\001' + _globals['_BOOTSERVICEMACHINETOKENREQUEST'].fields_by_name['user']._loaded_options = None + _globals['_BOOTSERVICEMACHINETOKENREQUEST'].fields_by_name['user']._serialized_options = b'\272H\010r\006\370\263\256\261\002\001' + _globals['_BOOTSERVICEMACHINETOKENREQUEST'].fields_by_name['expires']._loaded_options = None + _globals['_BOOTSERVICEMACHINETOKENREQUEST'].fields_by_name['expires']._serialized_options = b'\272H\016\252\001\013\032\004\010\200\365$2\003\010\330\004' _globals['_BOOTSERVICEBOOTREQUEST'].fields_by_name['mac']._loaded_options = None _globals['_BOOTSERVICEBOOTREQUEST'].fields_by_name['mac']._serialized_options = b'\272H\010r\006\270\263\256\261\002\001' _globals['_BOOTSERVICEBOOTREQUEST'].fields_by_name['partition']._loaded_options = None @@ -74,6 +82,8 @@ _globals['_BOOTSERVICE'].methods_by_name['Dhcp']._serialized_options = b'\340\363\030\001\352\363\030\001\001' _globals['_BOOTSERVICE'].methods_by_name['Boot']._loaded_options = None _globals['_BOOTSERVICE'].methods_by_name['Boot']._serialized_options = b'\340\363\030\001\352\363\030\001\001' + _globals['_BOOTSERVICE'].methods_by_name['MachineToken']._loaded_options = None + _globals['_BOOTSERVICE'].methods_by_name['MachineToken']._serialized_options = b'\340\363\030\001\352\363\030\001\001' _globals['_BOOTSERVICE'].methods_by_name['SuperUserPassword']._loaded_options = None _globals['_BOOTSERVICE'].methods_by_name['SuperUserPassword']._serialized_options = b'\340\363\030\001\362\363\030\001\001' _globals['_BOOTSERVICE'].methods_by_name['Register']._loaded_options = None @@ -82,30 +92,34 @@ _globals['_BOOTSERVICE'].methods_by_name['Wait']._serialized_options = b'\340\363\030\001\362\363\030\001\001' _globals['_BOOTSERVICE'].methods_by_name['InstallationSucceeded']._loaded_options = None _globals['_BOOTSERVICE'].methods_by_name['InstallationSucceeded']._serialized_options = b'\340\363\030\001\362\363\030\001\001' - _globals['_BOOTSERVICEDHCPREQUEST']._serialized_start=191 - _globals['_BOOTSERVICEDHCPREQUEST']._serialized_end=288 - _globals['_BOOTSERVICEDHCPRESPONSE']._serialized_start=290 - _globals['_BOOTSERVICEDHCPRESPONSE']._serialized_end=315 - _globals['_BOOTSERVICEBOOTREQUEST']._serialized_start=317 - _globals['_BOOTSERVICEBOOTREQUEST']._serialized_end=415 - _globals['_BOOTSERVICEBOOTRESPONSE']._serialized_start=418 - _globals['_BOOTSERVICEBOOTRESPONSE']._serialized_end=574 - _globals['_BOOTSERVICEREGISTERREQUEST']._serialized_start=577 - _globals['_BOOTSERVICEREGISTERREQUEST']._serialized_end=975 - _globals['_BOOTSERVICEREGISTERRESPONSE']._serialized_start=978 - _globals['_BOOTSERVICEREGISTERRESPONSE']._serialized_end=1113 - _globals['_BOOTSERVICEWAITREQUEST']._serialized_start=1115 - _globals['_BOOTSERVICEWAITREQUEST']._serialized_end=1169 - _globals['_BOOTSERVICEWAITRESPONSE']._serialized_start=1171 - _globals['_BOOTSERVICEWAITRESPONSE']._serialized_end=1266 - _globals['_BOOTSERVICEINSTALLATIONSUCCEEDEDREQUEST']._serialized_start=1268 - _globals['_BOOTSERVICEINSTALLATIONSUCCEEDEDREQUEST']._serialized_end=1394 - _globals['_BOOTSERVICEINSTALLATIONSUCCEEDEDRESPONSE']._serialized_start=1396 - _globals['_BOOTSERVICEINSTALLATIONSUCCEEDEDRESPONSE']._serialized_end=1438 - _globals['_BOOTSERVICESUPERUSERPASSWORDREQUEST']._serialized_start=1440 - _globals['_BOOTSERVICESUPERUSERPASSWORDREQUEST']._serialized_end=1507 - _globals['_BOOTSERVICESUPERUSERPASSWORDRESPONSE']._serialized_start=1510 - _globals['_BOOTSERVICESUPERUSERPASSWORDRESPONSE']._serialized_end=1651 - _globals['_BOOTSERVICE']._serialized_start=1654 - _globals['_BOOTSERVICE']._serialized_end=2433 + _globals['_BOOTSERVICEDHCPREQUEST']._serialized_start=254 + _globals['_BOOTSERVICEDHCPREQUEST']._serialized_end=351 + _globals['_BOOTSERVICEDHCPRESPONSE']._serialized_start=353 + _globals['_BOOTSERVICEDHCPRESPONSE']._serialized_end=378 + _globals['_BOOTSERVICEMACHINETOKENREQUEST']._serialized_start=381 + _globals['_BOOTSERVICEMACHINETOKENREQUEST']._serialized_end=599 + _globals['_BOOTSERVICEMACHINETOKENRESPONSE']._serialized_start=601 + _globals['_BOOTSERVICEMACHINETOKENRESPONSE']._serialized_end=706 + _globals['_BOOTSERVICEBOOTREQUEST']._serialized_start=708 + _globals['_BOOTSERVICEBOOTREQUEST']._serialized_end=806 + _globals['_BOOTSERVICEBOOTRESPONSE']._serialized_start=809 + _globals['_BOOTSERVICEBOOTRESPONSE']._serialized_end=965 + _globals['_BOOTSERVICEREGISTERREQUEST']._serialized_start=968 + _globals['_BOOTSERVICEREGISTERREQUEST']._serialized_end=1366 + _globals['_BOOTSERVICEREGISTERRESPONSE']._serialized_start=1369 + _globals['_BOOTSERVICEREGISTERRESPONSE']._serialized_end=1504 + _globals['_BOOTSERVICEWAITREQUEST']._serialized_start=1506 + _globals['_BOOTSERVICEWAITREQUEST']._serialized_end=1560 + _globals['_BOOTSERVICEWAITRESPONSE']._serialized_start=1562 + _globals['_BOOTSERVICEWAITRESPONSE']._serialized_end=1657 + _globals['_BOOTSERVICEINSTALLATIONSUCCEEDEDREQUEST']._serialized_start=1659 + _globals['_BOOTSERVICEINSTALLATIONSUCCEEDEDREQUEST']._serialized_end=1785 + _globals['_BOOTSERVICEINSTALLATIONSUCCEEDEDRESPONSE']._serialized_start=1787 + _globals['_BOOTSERVICEINSTALLATIONSUCCEEDEDRESPONSE']._serialized_end=1829 + _globals['_BOOTSERVICESUPERUSERPASSWORDREQUEST']._serialized_start=1831 + _globals['_BOOTSERVICESUPERUSERPASSWORDREQUEST']._serialized_end=1898 + _globals['_BOOTSERVICESUPERUSERPASSWORDRESPONSE']._serialized_start=1901 + _globals['_BOOTSERVICESUPERUSERPASSWORDRESPONSE']._serialized_end=2042 + _globals['_BOOTSERVICE']._serialized_start=2045 + _globals['_BOOTSERVICE']._serialized_end=2959 # @@protoc_insertion_point(module_scope) diff --git a/python/metalstack/infra/v2/boot_pb2.pyi b/python/metalstack/infra/v2/boot_pb2.pyi index 343eea94..4795f450 100644 --- a/python/metalstack/infra/v2/boot_pb2.pyi +++ b/python/metalstack/infra/v2/boot_pb2.pyi @@ -1,7 +1,11 @@ +import datetime + from buf.validate import validate_pb2 as _validate_pb2 +from google.protobuf import duration_pb2 as _duration_pb2 from metalstack.api.v2 import common_pb2 as _common_pb2 from metalstack.api.v2 import machine_pb2 as _machine_pb2 from metalstack.api.v2 import predefined_rules_pb2 as _predefined_rules_pb2 +from metalstack.api.v2 import token_pb2 as _token_pb2 from google.protobuf.internal import containers as _containers from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message @@ -22,6 +26,26 @@ class BootServiceDhcpResponse(_message.Message): __slots__ = () def __init__(self) -> None: ... +class BootServiceMachineTokenRequest(_message.Message): + __slots__ = ("uuid", "user", "expires", "labels") + UUID_FIELD_NUMBER: _ClassVar[int] + USER_FIELD_NUMBER: _ClassVar[int] + EXPIRES_FIELD_NUMBER: _ClassVar[int] + LABELS_FIELD_NUMBER: _ClassVar[int] + uuid: str + user: str + expires: _duration_pb2.Duration + labels: _common_pb2.Labels + def __init__(self, uuid: _Optional[str] = ..., user: _Optional[str] = ..., expires: _Optional[_Union[datetime.timedelta, _duration_pb2.Duration, _Mapping]] = ..., labels: _Optional[_Union[_common_pb2.Labels, _Mapping]] = ...) -> None: ... + +class BootServiceMachineTokenResponse(_message.Message): + __slots__ = ("token", "secret") + TOKEN_FIELD_NUMBER: _ClassVar[int] + SECRET_FIELD_NUMBER: _ClassVar[int] + token: _token_pb2.Token + secret: str + def __init__(self, token: _Optional[_Union[_token_pb2.Token, _Mapping]] = ..., secret: _Optional[str] = ...) -> None: ... + class BootServiceBootRequest(_message.Message): __slots__ = ("mac", "partition") MAC_FIELD_NUMBER: _ClassVar[int]