diff --git a/api/ateapi/v1/ateapi.pb.go b/api/ateapi/v1/ateapi.pb.go index d63c010fb1..d29349628c 100644 --- a/api/ateapi/v1/ateapi.pb.go +++ b/api/ateapi/v1/ateapi.pb.go @@ -3994,13 +3994,23 @@ type ExternalVolumeTemplate struct { // +k8s:minimum=1 CapacityBytes int64 `protobuf:"varint,1,opt,name=capacity_bytes,json=capacityBytes,proto3" json:"capacity_bytes,omitempty"` // storage_class_name names the cluster-scoped Kubernetes StorageClass to - // create the volume from. Required. + // create the volume from. Prefer external_volume_class. // - // +k8s:required + // Exactly one of storage_class_name and external_volume_class must be set. + // + // +k8s:optional + // +k8s:unionMember // +k8s:format=k8s-long-name StorageClassName string `protobuf:"bytes,2,opt,name=storage_class_name,json=storageClassName,proto3" json:"storage_class_name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // external_volume_class names the ExternalVolumeClass to create the volume + // from. atespace must be empty. + // + // +k8s:optional + // +k8s:unionMember + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + ExternalVolumeClass *ObjectRef `protobuf:"bytes,3,opt,name=external_volume_class,json=externalVolumeClass,proto3" json:"external_volume_class,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ExternalVolumeTemplate) Reset() { @@ -4047,6 +4057,277 @@ func (x *ExternalVolumeTemplate) GetStorageClassName() string { return "" } +func (x *ExternalVolumeTemplate) GetExternalVolumeClass() *ObjectRef { + if x != nil { + return x.ExternalVolumeClass + } + return nil +} + +// ExternalVolumeClass names the CSI driver that provisions external volumes +// and the parameters for its CreateVolume call. Global-scoped and immutable: +// metadata.atespace must be empty. +type ExternalVolumeClass struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Common resource metadata: name, uid, version, timestamps. + // + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + Metadata *ResourceMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + // driver_name is the CSI driver that provisions the volumes, e.g. + // "nfs.csi.k8s.io". It is a DNS subdomain, optionally prefixed with + // "substrate.io/". + // + // +k8s:required + // +k8s:maxLength=63 + // +k8s:customValidation # optional "substrate.io/" prefix + DNS-1123 subdomain + DriverName string `protobuf:"bytes,2,opt,name=driver_name,json=driverName,proto3" json:"driver_name,omitempty"` + // parameters are passed unchanged to the driver's CreateVolume call. The + // driver defines their keys and values, so they are only bounded in size. + // + // +k8s:optional + // +k8s:maxProperties=32 + // +k8s:eachKey=+k8s:maxLength=128 + // +k8s:eachVal=+k8s:maxLength=256 + Parameters map[string]string `protobuf:"bytes,3,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExternalVolumeClass) Reset() { + *x = ExternalVolumeClass{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExternalVolumeClass) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExternalVolumeClass) ProtoMessage() {} + +func (x *ExternalVolumeClass) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[44] + 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 ExternalVolumeClass.ProtoReflect.Descriptor instead. +func (*ExternalVolumeClass) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{44} +} + +func (x *ExternalVolumeClass) GetMetadata() *ResourceMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *ExternalVolumeClass) GetDriverName() string { + if x != nil { + return x.DriverName + } + return "" +} + +func (x *ExternalVolumeClass) GetParameters() map[string]string { + if x != nil { + return x.Parameters + } + return nil +} + +// CsiDriverConfig configures how the control plane and worker nodes connect to +// a CSI driver. Global-scoped: metadata.atespace must be empty. +type CsiDriverConfig struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Common resource metadata: name, uid, version, timestamps. + // + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + Metadata *ResourceMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + // driver_name is the CSI driver name, e.g. "nfs.csi.k8s.io". It is a DNS + // subdomain, optionally prefixed with "substrate.io/", and is unique across + // all CsiDriverConfigs. + // + // +k8s:required + // +k8s:maxLength=63 + // +k8s:immutable + // +k8s:customValidation # optional "substrate.io/" prefix + DNS-1123 subdomain + DriverName string `protobuf:"bytes,2,opt,name=driver_name,json=driverName,proto3" json:"driver_name,omitempty"` + // controller_endpoint is the gRPC URI of the CSI Controller service, e.g. + // "dns:///csi-service:9000" or "tcp://127.0.0.1:9000". + // + // +k8s:required + // +k8s:maxLength=1024 + // +k8s:customValidation # tcp://host:port or dns://[authority]/host:port + ControllerEndpoint string `protobuf:"bytes,3,opt,name=controller_endpoint,json=controllerEndpoint,proto3" json:"controller_endpoint,omitempty"` + // node_socket_override overrides the Unix domain socket URI for the CSI Node + // service on worker nodes. When empty, worker nodes connect to + // `unix:///var/lib/kubelet/plugins//csi.sock`. + // + // +k8s:optional + // +k8s:maxLength=1024 + // +k8s:customValidation # unix:// followed by a clean absolute path + NodeSocketOverride string `protobuf:"bytes,4,opt,name=node_socket_override,json=nodeSocketOverride,proto3" json:"node_socket_override,omitempty"` + // tls configures TLS for connections to controller_endpoint. + // + // +k8s:optional + Tls *CsiDriverTlsConfig `protobuf:"bytes,5,opt,name=tls,proto3" json:"tls,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CsiDriverConfig) Reset() { + *x = CsiDriverConfig{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CsiDriverConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CsiDriverConfig) ProtoMessage() {} + +func (x *CsiDriverConfig) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[45] + 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 CsiDriverConfig.ProtoReflect.Descriptor instead. +func (*CsiDriverConfig) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{45} +} + +func (x *CsiDriverConfig) GetMetadata() *ResourceMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *CsiDriverConfig) GetDriverName() string { + if x != nil { + return x.DriverName + } + return "" +} + +func (x *CsiDriverConfig) GetControllerEndpoint() string { + if x != nil { + return x.ControllerEndpoint + } + return "" +} + +func (x *CsiDriverConfig) GetNodeSocketOverride() string { + if x != nil { + return x.NodeSocketOverride + } + return "" +} + +func (x *CsiDriverConfig) GetTls() *CsiDriverTlsConfig { + if x != nil { + return x.Tls + } + return nil +} + +// CsiDriverTlsConfig configures TLS for CSI controller gRPC connections. +// +// +k8s:customValidation # enabled requires use_pod_identity and server_name; disabled forbids both +type CsiDriverTlsConfig struct { + state protoimpl.MessageState `protogen:"open.v1"` + // enabled turns on TLS for controller_endpoint connections. + // + // +k8s:optional + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + // use_pod_identity authenticates the client with Substrate pod identity + // certificates. Must be true when enabled is true, and must not be set when + // enabled is false. + // + // +k8s:optional + UsePodIdentity bool `protobuf:"varint,2,opt,name=use_pod_identity,json=usePodIdentity,proto3" json:"use_pod_identity,omitempty"` + // server_name is the expected TLS server name on the controller certificate. + // Required when enabled is true, and must not be set when enabled is false. + // + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:maxLength=253 + ServerName string `protobuf:"bytes,3,opt,name=server_name,json=serverName,proto3" json:"server_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CsiDriverTlsConfig) Reset() { + *x = CsiDriverTlsConfig{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CsiDriverTlsConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CsiDriverTlsConfig) ProtoMessage() {} + +func (x *CsiDriverTlsConfig) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[46] + 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 CsiDriverTlsConfig.ProtoReflect.Descriptor instead. +func (*CsiDriverTlsConfig) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{46} +} + +func (x *CsiDriverTlsConfig) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +func (x *CsiDriverTlsConfig) GetUsePodIdentity() bool { + if x != nil { + return x.UsePodIdentity + } + return false +} + +func (x *CsiDriverTlsConfig) GetServerName() string { + if x != nil { + return x.ServerName + } + return "" +} + // SystemInfoVolumeSource is a read-only volume of substrate-generated // per-actor files (identity fields, projected trust bundles), regenerated by // atelet on every Run/Restore. @@ -4067,7 +4348,7 @@ type SystemInfoVolumeSource struct { func (x *SystemInfoVolumeSource) Reset() { *x = SystemInfoVolumeSource{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[44] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4079,7 +4360,7 @@ func (x *SystemInfoVolumeSource) String() string { func (*SystemInfoVolumeSource) ProtoMessage() {} func (x *SystemInfoVolumeSource) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[44] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[47] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4092,7 +4373,7 @@ func (x *SystemInfoVolumeSource) ProtoReflect() protoreflect.Message { // Deprecated: Use SystemInfoVolumeSource.ProtoReflect.Descriptor instead. func (*SystemInfoVolumeSource) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{44} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{47} } func (x *SystemInfoVolumeSource) GetDataSources() []*SystemInfoDataSource { @@ -4118,7 +4399,7 @@ type SystemInfoDataSource struct { func (x *SystemInfoDataSource) Reset() { *x = SystemInfoDataSource{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[45] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[48] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4130,7 +4411,7 @@ func (x *SystemInfoDataSource) String() string { func (*SystemInfoDataSource) ProtoMessage() {} func (x *SystemInfoDataSource) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[45] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[48] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4143,7 +4424,7 @@ func (x *SystemInfoDataSource) ProtoReflect() protoreflect.Message { // Deprecated: Use SystemInfoDataSource.ProtoReflect.Descriptor instead. func (*SystemInfoDataSource) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{45} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{48} } func (x *SystemInfoDataSource) GetActorMetadata() *ActorMetadataDataSource { @@ -4180,7 +4461,7 @@ type ActorMetadataDataSource struct { func (x *ActorMetadataDataSource) Reset() { *x = ActorMetadataDataSource{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[46] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[49] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4192,7 +4473,7 @@ func (x *ActorMetadataDataSource) String() string { func (*ActorMetadataDataSource) ProtoMessage() {} func (x *ActorMetadataDataSource) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[46] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[49] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4205,7 +4486,7 @@ func (x *ActorMetadataDataSource) ProtoReflect() protoreflect.Message { // Deprecated: Use ActorMetadataDataSource.ProtoReflect.Descriptor instead. func (*ActorMetadataDataSource) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{46} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{49} } func (x *ActorMetadataDataSource) GetItems() []*ActorMetadataItem { @@ -4237,7 +4518,7 @@ type ActorMetadataItem struct { func (x *ActorMetadataItem) Reset() { *x = ActorMetadataItem{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[47] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[50] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4249,7 +4530,7 @@ func (x *ActorMetadataItem) String() string { func (*ActorMetadataItem) ProtoMessage() {} func (x *ActorMetadataItem) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[47] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[50] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4262,7 +4543,7 @@ func (x *ActorMetadataItem) ProtoReflect() protoreflect.Message { // Deprecated: Use ActorMetadataItem.ProtoReflect.Descriptor instead. func (*ActorMetadataItem) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{47} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{50} } func (x *ActorMetadataItem) GetField() ActorMetadataField { @@ -4314,7 +4595,7 @@ type TrustBundleDataSource struct { func (x *TrustBundleDataSource) Reset() { *x = TrustBundleDataSource{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[48] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[51] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4326,7 +4607,7 @@ func (x *TrustBundleDataSource) String() string { func (*TrustBundleDataSource) ProtoMessage() {} func (x *TrustBundleDataSource) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[48] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[51] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4339,7 +4620,7 @@ func (x *TrustBundleDataSource) ProtoReflect() protoreflect.Message { // Deprecated: Use TrustBundleDataSource.ProtoReflect.Descriptor instead. func (*TrustBundleDataSource) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{48} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{51} } func (x *TrustBundleDataSource) GetNames() []string { @@ -4379,7 +4660,7 @@ type VolumeMount struct { func (x *VolumeMount) Reset() { *x = VolumeMount{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[49] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[52] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4391,7 +4672,7 @@ func (x *VolumeMount) String() string { func (*VolumeMount) ProtoMessage() {} func (x *VolumeMount) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[49] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[52] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4404,7 +4685,7 @@ func (x *VolumeMount) ProtoReflect() protoreflect.Message { // Deprecated: Use VolumeMount.ProtoReflect.Descriptor instead. func (*VolumeMount) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{49} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{52} } func (x *VolumeMount) GetName() string { @@ -4433,7 +4714,7 @@ type CreateAtespaceRequest struct { func (x *CreateAtespaceRequest) Reset() { *x = CreateAtespaceRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[50] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[53] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4445,7 +4726,7 @@ func (x *CreateAtespaceRequest) String() string { func (*CreateAtespaceRequest) ProtoMessage() {} func (x *CreateAtespaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[50] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[53] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4458,7 +4739,7 @@ func (x *CreateAtespaceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateAtespaceRequest.ProtoReflect.Descriptor instead. func (*CreateAtespaceRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{50} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{53} } func (x *CreateAtespaceRequest) GetAtespace() *Atespace { @@ -4479,7 +4760,7 @@ type GetAtespaceRequest struct { func (x *GetAtespaceRequest) Reset() { *x = GetAtespaceRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[51] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[54] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4491,7 +4772,7 @@ func (x *GetAtespaceRequest) String() string { func (*GetAtespaceRequest) ProtoMessage() {} func (x *GetAtespaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[51] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[54] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4504,7 +4785,7 @@ func (x *GetAtespaceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAtespaceRequest.ProtoReflect.Descriptor instead. func (*GetAtespaceRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{51} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{54} } func (x *GetAtespaceRequest) GetAtespace() *ObjectRef { @@ -4526,7 +4807,7 @@ type ListAtespacesRequest struct { func (x *ListAtespacesRequest) Reset() { *x = ListAtespacesRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[52] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4538,7 +4819,7 @@ func (x *ListAtespacesRequest) String() string { func (*ListAtespacesRequest) ProtoMessage() {} func (x *ListAtespacesRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[52] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[55] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4551,7 +4832,7 @@ func (x *ListAtespacesRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListAtespacesRequest.ProtoReflect.Descriptor instead. func (*ListAtespacesRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{52} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{55} } func (x *ListAtespacesRequest) GetOptions() *ListOptions { @@ -4571,21 +4852,611 @@ type ListAtespacesResponse struct { sizeCache protoimpl.SizeCache } -func (x *ListAtespacesResponse) Reset() { - *x = ListAtespacesResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[53] +func (x *ListAtespacesResponse) Reset() { + *x = ListAtespacesResponse{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[56] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListAtespacesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAtespacesResponse) ProtoMessage() {} + +func (x *ListAtespacesResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[56] + 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 ListAtespacesResponse.ProtoReflect.Descriptor instead. +func (*ListAtespacesResponse) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{56} +} + +func (x *ListAtespacesResponse) GetAtespaces() []*Atespace { + if x != nil { + return x.Atespaces + } + return nil +} + +func (x *ListAtespacesResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type DeleteAtespaceRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + Atespace *ObjectRef `protobuf:"bytes,1,opt,name=atespace,proto3" json:"atespace,omitempty"` + // Optional per-delete preconditions. + // + // +k8s:optional + Options *DeleteOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteAtespaceRequest) Reset() { + *x = DeleteAtespaceRequest{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[57] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteAtespaceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteAtespaceRequest) ProtoMessage() {} + +func (x *DeleteAtespaceRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[57] + 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 DeleteAtespaceRequest.ProtoReflect.Descriptor instead. +func (*DeleteAtespaceRequest) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{57} +} + +func (x *DeleteAtespaceRequest) GetAtespace() *ObjectRef { + if x != nil { + return x.Atespace + } + return nil +} + +func (x *DeleteAtespaceRequest) GetOptions() *DeleteOptions { + if x != nil { + return x.Options + } + return nil +} + +// CreateExternalVolumeClassRequest creates an ExternalVolumeClass. +type CreateExternalVolumeClassRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The class to create. metadata.name is required and metadata.atespace + // must be empty. + // + // +ate:preview=ExternalVolumes + // +k8s:ifDisabled(ExternalVolumes)=+k8s:forbidden + // +k8s:required + ExternalVolumeClass *ExternalVolumeClass `protobuf:"bytes,1,opt,name=external_volume_class,json=externalVolumeClass,proto3" json:"external_volume_class,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateExternalVolumeClassRequest) Reset() { + *x = CreateExternalVolumeClassRequest{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[58] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateExternalVolumeClassRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateExternalVolumeClassRequest) ProtoMessage() {} + +func (x *CreateExternalVolumeClassRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[58] + 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 CreateExternalVolumeClassRequest.ProtoReflect.Descriptor instead. +func (*CreateExternalVolumeClassRequest) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{58} +} + +func (x *CreateExternalVolumeClassRequest) GetExternalVolumeClass() *ExternalVolumeClass { + if x != nil { + return x.ExternalVolumeClass + } + return nil +} + +// GetExternalVolumeClassRequest identifies the ExternalVolumeClass to get. +type GetExternalVolumeClassRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The class to get. atespace must be empty. + // + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + ExternalVolumeClass *ObjectRef `protobuf:"bytes,1,opt,name=external_volume_class,json=externalVolumeClass,proto3" json:"external_volume_class,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetExternalVolumeClassRequest) Reset() { + *x = GetExternalVolumeClassRequest{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[59] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetExternalVolumeClassRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetExternalVolumeClassRequest) ProtoMessage() {} + +func (x *GetExternalVolumeClassRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[59] + 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 GetExternalVolumeClassRequest.ProtoReflect.Descriptor instead. +func (*GetExternalVolumeClassRequest) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{59} +} + +func (x *GetExternalVolumeClassRequest) GetExternalVolumeClass() *ObjectRef { + if x != nil { + return x.ExternalVolumeClass + } + return nil +} + +// ListExternalVolumeClassesRequest asks for a page of ExternalVolumeClasses. +type ListExternalVolumeClassesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Pagination controls. + // + // +k8s:optional + Options *ListOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListExternalVolumeClassesRequest) Reset() { + *x = ListExternalVolumeClassesRequest{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[60] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListExternalVolumeClassesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListExternalVolumeClassesRequest) ProtoMessage() {} + +func (x *ListExternalVolumeClassesRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[60] + 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 ListExternalVolumeClassesRequest.ProtoReflect.Descriptor instead. +func (*ListExternalVolumeClassesRequest) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{60} +} + +func (x *ListExternalVolumeClassesRequest) GetOptions() *ListOptions { + if x != nil { + return x.Options + } + return nil +} + +// ListExternalVolumeClassesResponse is one page of ExternalVolumeClasses. +type ListExternalVolumeClassesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The page of classes. This list may be empty even if there are more results. + ExternalVolumeClasses []*ExternalVolumeClass `protobuf:"bytes,1,rep,name=external_volume_classes,json=externalVolumeClasses,proto3" json:"external_volume_classes,omitempty"` + // Pagination token for the next page. Empty if this is the last page. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListExternalVolumeClassesResponse) Reset() { + *x = ListExternalVolumeClassesResponse{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[61] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListExternalVolumeClassesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListExternalVolumeClassesResponse) ProtoMessage() {} + +func (x *ListExternalVolumeClassesResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[61] + 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 ListExternalVolumeClassesResponse.ProtoReflect.Descriptor instead. +func (*ListExternalVolumeClassesResponse) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{61} +} + +func (x *ListExternalVolumeClassesResponse) GetExternalVolumeClasses() []*ExternalVolumeClass { + if x != nil { + return x.ExternalVolumeClasses + } + return nil +} + +func (x *ListExternalVolumeClassesResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// DeleteExternalVolumeClassRequest identifies the ExternalVolumeClass to delete. +type DeleteExternalVolumeClassRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The class to delete. atespace must be empty. + // + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + ExternalVolumeClass *ObjectRef `protobuf:"bytes,1,opt,name=external_volume_class,json=externalVolumeClass,proto3" json:"external_volume_class,omitempty"` + // Optional per-delete preconditions. + // + // +k8s:optional + Options *DeleteOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteExternalVolumeClassRequest) Reset() { + *x = DeleteExternalVolumeClassRequest{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[62] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteExternalVolumeClassRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteExternalVolumeClassRequest) ProtoMessage() {} + +func (x *DeleteExternalVolumeClassRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[62] + 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 DeleteExternalVolumeClassRequest.ProtoReflect.Descriptor instead. +func (*DeleteExternalVolumeClassRequest) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{62} +} + +func (x *DeleteExternalVolumeClassRequest) GetExternalVolumeClass() *ObjectRef { + if x != nil { + return x.ExternalVolumeClass + } + return nil +} + +func (x *DeleteExternalVolumeClassRequest) GetOptions() *DeleteOptions { + if x != nil { + return x.Options + } + return nil +} + +// CreateCsiDriverConfigRequest creates a CsiDriverConfig. +type CreateCsiDriverConfigRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The config to create. metadata.name is required and metadata.atespace + // must be empty. + // + // +ate:preview=ExternalVolumes + // +k8s:ifDisabled(ExternalVolumes)=+k8s:forbidden + // +k8s:required + CsiDriverConfig *CsiDriverConfig `protobuf:"bytes,1,opt,name=csi_driver_config,json=csiDriverConfig,proto3" json:"csi_driver_config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateCsiDriverConfigRequest) Reset() { + *x = CreateCsiDriverConfigRequest{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[63] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateCsiDriverConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateCsiDriverConfigRequest) ProtoMessage() {} + +func (x *CreateCsiDriverConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[63] + 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 CreateCsiDriverConfigRequest.ProtoReflect.Descriptor instead. +func (*CreateCsiDriverConfigRequest) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{63} +} + +func (x *CreateCsiDriverConfigRequest) GetCsiDriverConfig() *CsiDriverConfig { + if x != nil { + return x.CsiDriverConfig + } + return nil +} + +// GetCsiDriverConfigRequest identifies the CsiDriverConfig to get. +type GetCsiDriverConfigRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The config to get. atespace must be empty. + // + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + CsiDriverConfig *ObjectRef `protobuf:"bytes,1,opt,name=csi_driver_config,json=csiDriverConfig,proto3" json:"csi_driver_config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetCsiDriverConfigRequest) Reset() { + *x = GetCsiDriverConfigRequest{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[64] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCsiDriverConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCsiDriverConfigRequest) ProtoMessage() {} + +func (x *GetCsiDriverConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[64] + 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 GetCsiDriverConfigRequest.ProtoReflect.Descriptor instead. +func (*GetCsiDriverConfigRequest) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{64} +} + +func (x *GetCsiDriverConfigRequest) GetCsiDriverConfig() *ObjectRef { + if x != nil { + return x.CsiDriverConfig + } + return nil +} + +// ListCsiDriverConfigsRequest asks for a page of CsiDriverConfigs. +type ListCsiDriverConfigsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Pagination controls. + // + // +k8s:optional + Options *ListOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListCsiDriverConfigsRequest) Reset() { + *x = ListCsiDriverConfigsRequest{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[65] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListCsiDriverConfigsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListCsiDriverConfigsRequest) ProtoMessage() {} + +func (x *ListCsiDriverConfigsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[65] + 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 ListCsiDriverConfigsRequest.ProtoReflect.Descriptor instead. +func (*ListCsiDriverConfigsRequest) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{65} +} + +func (x *ListCsiDriverConfigsRequest) GetOptions() *ListOptions { + if x != nil { + return x.Options + } + return nil +} + +// ListCsiDriverConfigsResponse is one page of CsiDriverConfigs. +type ListCsiDriverConfigsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The page of configs. This list may be empty even if there are more results. + CsiDriverConfigs []*CsiDriverConfig `protobuf:"bytes,1,rep,name=csi_driver_configs,json=csiDriverConfigs,proto3" json:"csi_driver_configs,omitempty"` + // Pagination token for the next page. Empty if this is the last page. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListCsiDriverConfigsResponse) Reset() { + *x = ListCsiDriverConfigsResponse{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[66] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListCsiDriverConfigsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListCsiDriverConfigsResponse) ProtoMessage() {} + +func (x *ListCsiDriverConfigsResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[66] + 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 ListCsiDriverConfigsResponse.ProtoReflect.Descriptor instead. +func (*ListCsiDriverConfigsResponse) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{66} +} + +func (x *ListCsiDriverConfigsResponse) GetCsiDriverConfigs() []*CsiDriverConfig { + if x != nil { + return x.CsiDriverConfigs + } + return nil +} + +func (x *ListCsiDriverConfigsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// UpdateCsiDriverConfigRequest updates a CsiDriverConfig. +type UpdateCsiDriverConfigRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The config to update. csi_driver_config.metadata.name identifies which + // resource to update, and metadata.atespace must be empty. + // csi_driver_config.metadata.uid and csi_driver_config.metadata.version are + // required preconditions. + // + // controller_endpoint, node_socket_override, and tls are replaced with what + // the request carries, and any omitted optional field is cleared. + // driver_name is immutable. + // + // +ate:preview=ExternalVolumes + // +k8s:ifDisabled(ExternalVolumes)=+k8s:forbidden + // +k8s:required + // +k8s:opaqueType # updates are handled in 2 steps, do not descend + // +k8s:subfield(metadata)=+k8s:required + // +k8s:customValidation # TODO: when we get nested subfields, forbid metadata.atespace + CsiDriverConfig *CsiDriverConfig `protobuf:"bytes,1,opt,name=csi_driver_config,json=csiDriverConfig,proto3" json:"csi_driver_config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateCsiDriverConfigRequest) Reset() { + *x = UpdateCsiDriverConfigRequest{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[67] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ListAtespacesResponse) String() string { +func (x *UpdateCsiDriverConfigRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListAtespacesResponse) ProtoMessage() {} +func (*UpdateCsiDriverConfigRequest) ProtoMessage() {} -func (x *ListAtespacesResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[53] +func (x *UpdateCsiDriverConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[67] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4596,30 +5467,26 @@ func (x *ListAtespacesResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListAtespacesResponse.ProtoReflect.Descriptor instead. -func (*ListAtespacesResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{53} +// Deprecated: Use UpdateCsiDriverConfigRequest.ProtoReflect.Descriptor instead. +func (*UpdateCsiDriverConfigRequest) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{67} } -func (x *ListAtespacesResponse) GetAtespaces() []*Atespace { +func (x *UpdateCsiDriverConfigRequest) GetCsiDriverConfig() *CsiDriverConfig { if x != nil { - return x.Atespaces + return x.CsiDriverConfig } return nil } -func (x *ListAtespacesResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -type DeleteAtespaceRequest struct { +// DeleteCsiDriverConfigRequest identifies the CsiDriverConfig to delete. +type DeleteCsiDriverConfigRequest struct { state protoimpl.MessageState `protogen:"open.v1"` + // The config to delete. atespace must be empty. + // // +k8s:required // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix - Atespace *ObjectRef `protobuf:"bytes,1,opt,name=atespace,proto3" json:"atespace,omitempty"` + CsiDriverConfig *ObjectRef `protobuf:"bytes,1,opt,name=csi_driver_config,json=csiDriverConfig,proto3" json:"csi_driver_config,omitempty"` // Optional per-delete preconditions. // // +k8s:optional @@ -4628,21 +5495,21 @@ type DeleteAtespaceRequest struct { sizeCache protoimpl.SizeCache } -func (x *DeleteAtespaceRequest) Reset() { - *x = DeleteAtespaceRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[54] +func (x *DeleteCsiDriverConfigRequest) Reset() { + *x = DeleteCsiDriverConfigRequest{} + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[68] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *DeleteAtespaceRequest) String() string { +func (x *DeleteCsiDriverConfigRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DeleteAtespaceRequest) ProtoMessage() {} +func (*DeleteCsiDriverConfigRequest) ProtoMessage() {} -func (x *DeleteAtespaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[54] +func (x *DeleteCsiDriverConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[68] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4653,19 +5520,19 @@ func (x *DeleteAtespaceRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DeleteAtespaceRequest.ProtoReflect.Descriptor instead. -func (*DeleteAtespaceRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{54} +// Deprecated: Use DeleteCsiDriverConfigRequest.ProtoReflect.Descriptor instead. +func (*DeleteCsiDriverConfigRequest) Descriptor() ([]byte, []int) { + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{68} } -func (x *DeleteAtespaceRequest) GetAtespace() *ObjectRef { +func (x *DeleteCsiDriverConfigRequest) GetCsiDriverConfig() *ObjectRef { if x != nil { - return x.Atespace + return x.CsiDriverConfig } return nil } -func (x *DeleteAtespaceRequest) GetOptions() *DeleteOptions { +func (x *DeleteCsiDriverConfigRequest) GetOptions() *DeleteOptions { if x != nil { return x.Options } @@ -4686,7 +5553,7 @@ type CreateActorTemplateRequest struct { func (x *CreateActorTemplateRequest) Reset() { *x = CreateActorTemplateRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[55] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[69] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4698,7 +5565,7 @@ func (x *CreateActorTemplateRequest) String() string { func (*CreateActorTemplateRequest) ProtoMessage() {} func (x *CreateActorTemplateRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[55] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[69] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4711,7 +5578,7 @@ func (x *CreateActorTemplateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateActorTemplateRequest.ProtoReflect.Descriptor instead. func (*CreateActorTemplateRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{55} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{69} } func (x *CreateActorTemplateRequest) GetActorTemplate() *ActorTemplate { @@ -4732,7 +5599,7 @@ type GetActorTemplateRequest struct { func (x *GetActorTemplateRequest) Reset() { *x = GetActorTemplateRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[56] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[70] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4744,7 +5611,7 @@ func (x *GetActorTemplateRequest) String() string { func (*GetActorTemplateRequest) ProtoMessage() {} func (x *GetActorTemplateRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[56] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[70] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4757,7 +5624,7 @@ func (x *GetActorTemplateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetActorTemplateRequest.ProtoReflect.Descriptor instead. func (*GetActorTemplateRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{56} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{70} } func (x *GetActorTemplateRequest) GetActorTemplate() *ObjectRef { @@ -4785,7 +5652,7 @@ type ListActorTemplatesRequest struct { func (x *ListActorTemplatesRequest) Reset() { *x = ListActorTemplatesRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[57] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[71] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4797,7 +5664,7 @@ func (x *ListActorTemplatesRequest) String() string { func (*ListActorTemplatesRequest) ProtoMessage() {} func (x *ListActorTemplatesRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[57] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[71] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4810,7 +5677,7 @@ func (x *ListActorTemplatesRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListActorTemplatesRequest.ProtoReflect.Descriptor instead. func (*ListActorTemplatesRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{57} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{71} } func (x *ListActorTemplatesRequest) GetAtespace() string { @@ -4840,7 +5707,7 @@ type ListActorTemplatesResponse struct { func (x *ListActorTemplatesResponse) Reset() { *x = ListActorTemplatesResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[58] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[72] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4852,7 +5719,7 @@ func (x *ListActorTemplatesResponse) String() string { func (*ListActorTemplatesResponse) ProtoMessage() {} func (x *ListActorTemplatesResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[58] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[72] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4865,7 +5732,7 @@ func (x *ListActorTemplatesResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListActorTemplatesResponse.ProtoReflect.Descriptor instead. func (*ListActorTemplatesResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{58} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{72} } func (x *ListActorTemplatesResponse) GetActorTemplates() []*ActorTemplate { @@ -4897,7 +5764,7 @@ type DeleteActorTemplateRequest struct { func (x *DeleteActorTemplateRequest) Reset() { *x = DeleteActorTemplateRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[59] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[73] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4909,7 +5776,7 @@ func (x *DeleteActorTemplateRequest) String() string { func (*DeleteActorTemplateRequest) ProtoMessage() {} func (x *DeleteActorTemplateRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[59] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[73] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4922,7 +5789,7 @@ func (x *DeleteActorTemplateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteActorTemplateRequest.ProtoReflect.Descriptor instead. func (*DeleteActorTemplateRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{59} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{73} } func (x *DeleteActorTemplateRequest) GetActorTemplate() *ObjectRef { @@ -4950,7 +5817,7 @@ type GetActorRequest struct { func (x *GetActorRequest) Reset() { *x = GetActorRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[60] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[74] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4962,7 +5829,7 @@ func (x *GetActorRequest) String() string { func (*GetActorRequest) ProtoMessage() {} func (x *GetActorRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[60] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[74] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4975,7 +5842,7 @@ func (x *GetActorRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetActorRequest.ProtoReflect.Descriptor instead. func (*GetActorRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{60} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{74} } func (x *GetActorRequest) GetActor() *ObjectRef { @@ -4998,7 +5865,7 @@ type CreateActorRequest struct { func (x *CreateActorRequest) Reset() { *x = CreateActorRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[61] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[75] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5010,7 +5877,7 @@ func (x *CreateActorRequest) String() string { func (*CreateActorRequest) ProtoMessage() {} func (x *CreateActorRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[61] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[75] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5023,7 +5890,7 @@ func (x *CreateActorRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateActorRequest.ProtoReflect.Descriptor instead. func (*CreateActorRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{61} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{75} } func (x *CreateActorRequest) GetActor() *Actor { @@ -5054,7 +5921,7 @@ type UpdateActorRequest struct { func (x *UpdateActorRequest) Reset() { *x = UpdateActorRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[62] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[76] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5066,7 +5933,7 @@ func (x *UpdateActorRequest) String() string { func (*UpdateActorRequest) ProtoMessage() {} func (x *UpdateActorRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[62] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[76] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5079,7 +5946,7 @@ func (x *UpdateActorRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateActorRequest.ProtoReflect.Descriptor instead. func (*UpdateActorRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{62} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{76} } func (x *UpdateActorRequest) GetActor() *Actor { @@ -5104,7 +5971,7 @@ type SuspendActorRequest struct { func (x *SuspendActorRequest) Reset() { *x = SuspendActorRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[63] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[77] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5116,7 +5983,7 @@ func (x *SuspendActorRequest) String() string { func (*SuspendActorRequest) ProtoMessage() {} func (x *SuspendActorRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[63] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[77] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5129,7 +5996,7 @@ func (x *SuspendActorRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SuspendActorRequest.ProtoReflect.Descriptor instead. func (*SuspendActorRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{63} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{77} } func (x *SuspendActorRequest) GetActor() *ObjectRef { @@ -5155,7 +6022,7 @@ type SuspendActorResponse struct { func (x *SuspendActorResponse) Reset() { *x = SuspendActorResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[64] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[78] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5167,7 +6034,7 @@ func (x *SuspendActorResponse) String() string { func (*SuspendActorResponse) ProtoMessage() {} func (x *SuspendActorResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[64] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[78] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5180,7 +6047,7 @@ func (x *SuspendActorResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SuspendActorResponse.ProtoReflect.Descriptor instead. func (*SuspendActorResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{64} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{78} } func (x *SuspendActorResponse) GetActor() *Actor { @@ -5206,7 +6073,7 @@ type SuspendOptions struct { func (x *SuspendOptions) Reset() { *x = SuspendOptions{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[65] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[79] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5218,7 +6085,7 @@ func (x *SuspendOptions) String() string { func (*SuspendOptions) ProtoMessage() {} func (x *SuspendOptions) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[65] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[79] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5231,7 +6098,7 @@ func (x *SuspendOptions) ProtoReflect() protoreflect.Message { // Deprecated: Use SuspendOptions.ProtoReflect.Descriptor instead. func (*SuspendOptions) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{65} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{79} } func (x *SuspendOptions) GetMode() DurabilityMode { @@ -5252,7 +6119,7 @@ type ResumeActorRequest struct { func (x *ResumeActorRequest) Reset() { *x = ResumeActorRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[66] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[80] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5264,7 +6131,7 @@ func (x *ResumeActorRequest) String() string { func (*ResumeActorRequest) ProtoMessage() {} func (x *ResumeActorRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[66] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[80] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5277,7 +6144,7 @@ func (x *ResumeActorRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ResumeActorRequest.ProtoReflect.Descriptor instead. func (*ResumeActorRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{66} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{80} } func (x *ResumeActorRequest) GetActor() *ObjectRef { @@ -5299,7 +6166,7 @@ type ResumeActorResponse struct { func (x *ResumeActorResponse) Reset() { *x = ResumeActorResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[67] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[81] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5311,7 +6178,7 @@ func (x *ResumeActorResponse) String() string { func (*ResumeActorResponse) ProtoMessage() {} func (x *ResumeActorResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[67] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[81] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5324,7 +6191,7 @@ func (x *ResumeActorResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ResumeActorResponse.ProtoReflect.Descriptor instead. func (*ResumeActorResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{67} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{81} } func (x *ResumeActorResponse) GetActor() *Actor { @@ -5354,7 +6221,7 @@ type RevertActorRequest struct { func (x *RevertActorRequest) Reset() { *x = RevertActorRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[68] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[82] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5366,7 +6233,7 @@ func (x *RevertActorRequest) String() string { func (*RevertActorRequest) ProtoMessage() {} func (x *RevertActorRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[68] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[82] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5379,7 +6246,7 @@ func (x *RevertActorRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RevertActorRequest.ProtoReflect.Descriptor instead. func (*RevertActorRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{68} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{82} } func (x *RevertActorRequest) GetActor() *ObjectRef { @@ -5401,7 +6268,7 @@ type RevertActorResponse struct { func (x *RevertActorResponse) Reset() { *x = RevertActorResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[69] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[83] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5413,7 +6280,7 @@ func (x *RevertActorResponse) String() string { func (*RevertActorResponse) ProtoMessage() {} func (x *RevertActorResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[69] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[83] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5426,7 +6293,7 @@ func (x *RevertActorResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RevertActorResponse.ProtoReflect.Descriptor instead. func (*RevertActorResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{69} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{83} } func (x *RevertActorResponse) GetActor() *Actor { @@ -5451,7 +6318,7 @@ type DeleteActorRequest struct { func (x *DeleteActorRequest) Reset() { *x = DeleteActorRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[70] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[84] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5463,7 +6330,7 @@ func (x *DeleteActorRequest) String() string { func (*DeleteActorRequest) ProtoMessage() {} func (x *DeleteActorRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[70] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[84] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5476,7 +6343,7 @@ func (x *DeleteActorRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteActorRequest.ProtoReflect.Descriptor instead. func (*DeleteActorRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{70} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{84} } func (x *DeleteActorRequest) GetActor() *ObjectRef { @@ -5513,7 +6380,7 @@ type GetActorEgressPolicyRequest struct { func (x *GetActorEgressPolicyRequest) Reset() { *x = GetActorEgressPolicyRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[71] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[85] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5525,7 +6392,7 @@ func (x *GetActorEgressPolicyRequest) String() string { func (*GetActorEgressPolicyRequest) ProtoMessage() {} func (x *GetActorEgressPolicyRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[71] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[85] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5538,7 +6405,7 @@ func (x *GetActorEgressPolicyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetActorEgressPolicyRequest.ProtoReflect.Descriptor instead. func (*GetActorEgressPolicyRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{71} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{85} } func (x *GetActorEgressPolicyRequest) GetActor() *ObjectRef { @@ -5576,7 +6443,7 @@ type CreateActorEgressPolicyRequest struct { func (x *CreateActorEgressPolicyRequest) Reset() { *x = CreateActorEgressPolicyRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[72] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[86] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5588,7 +6455,7 @@ func (x *CreateActorEgressPolicyRequest) String() string { func (*CreateActorEgressPolicyRequest) ProtoMessage() {} func (x *CreateActorEgressPolicyRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[72] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[86] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5601,7 +6468,7 @@ func (x *CreateActorEgressPolicyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateActorEgressPolicyRequest.ProtoReflect.Descriptor instead. func (*CreateActorEgressPolicyRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{72} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{86} } func (x *CreateActorEgressPolicyRequest) GetActor() *ObjectRef { @@ -5639,7 +6506,7 @@ type UpdateActorEgressPolicyRequest struct { func (x *UpdateActorEgressPolicyRequest) Reset() { *x = UpdateActorEgressPolicyRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[73] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[87] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5651,7 +6518,7 @@ func (x *UpdateActorEgressPolicyRequest) String() string { func (*UpdateActorEgressPolicyRequest) ProtoMessage() {} func (x *UpdateActorEgressPolicyRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[73] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[87] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5664,7 +6531,7 @@ func (x *UpdateActorEgressPolicyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateActorEgressPolicyRequest.ProtoReflect.Descriptor instead. func (*UpdateActorEgressPolicyRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{73} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{87} } func (x *UpdateActorEgressPolicyRequest) GetActor() *ObjectRef { @@ -5705,7 +6572,7 @@ type DeleteActorEgressPolicyRequest struct { func (x *DeleteActorEgressPolicyRequest) Reset() { *x = DeleteActorEgressPolicyRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[74] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[88] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5717,7 +6584,7 @@ func (x *DeleteActorEgressPolicyRequest) String() string { func (*DeleteActorEgressPolicyRequest) ProtoMessage() {} func (x *DeleteActorEgressPolicyRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[74] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[88] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5730,7 +6597,7 @@ func (x *DeleteActorEgressPolicyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteActorEgressPolicyRequest.ProtoReflect.Descriptor instead. func (*DeleteActorEgressPolicyRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{74} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{88} } func (x *DeleteActorEgressPolicyRequest) GetActor() *ObjectRef { @@ -5765,7 +6632,7 @@ type GetTagRequest struct { func (x *GetTagRequest) Reset() { *x = GetTagRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[75] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[89] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5777,7 +6644,7 @@ func (x *GetTagRequest) String() string { func (*GetTagRequest) ProtoMessage() {} func (x *GetTagRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[75] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[89] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5790,7 +6657,7 @@ func (x *GetTagRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetTagRequest.ProtoReflect.Descriptor instead. func (*GetTagRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{75} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{89} } func (x *GetTagRequest) GetTag() *ObjectRef { @@ -5829,7 +6696,7 @@ type MintActorJwtRequest struct { func (x *MintActorJwtRequest) Reset() { *x = MintActorJwtRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[76] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[90] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5841,7 +6708,7 @@ func (x *MintActorJwtRequest) String() string { func (*MintActorJwtRequest) ProtoMessage() {} func (x *MintActorJwtRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[76] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[90] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5854,7 +6721,7 @@ func (x *MintActorJwtRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use MintActorJwtRequest.ProtoReflect.Descriptor instead. func (*MintActorJwtRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{76} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{90} } func (x *MintActorJwtRequest) GetActor() *ObjectRef { @@ -5909,7 +6776,7 @@ type MintActorJwtResponse struct { func (x *MintActorJwtResponse) Reset() { *x = MintActorJwtResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[77] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[91] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5921,7 +6788,7 @@ func (x *MintActorJwtResponse) String() string { func (*MintActorJwtResponse) ProtoMessage() {} func (x *MintActorJwtResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[77] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[91] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5934,7 +6801,7 @@ func (x *MintActorJwtResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use MintActorJwtResponse.ProtoReflect.Descriptor instead. func (*MintActorJwtResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{77} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{91} } func (x *MintActorJwtResponse) GetActorJwt() string { @@ -5968,7 +6835,7 @@ type ListTagsRequest struct { func (x *ListTagsRequest) Reset() { *x = ListTagsRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[78] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[92] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5980,7 +6847,7 @@ func (x *ListTagsRequest) String() string { func (*ListTagsRequest) ProtoMessage() {} func (x *ListTagsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[78] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[92] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5993,7 +6860,7 @@ func (x *ListTagsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListTagsRequest.ProtoReflect.Descriptor instead. func (*ListTagsRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{78} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{92} } func (x *ListTagsRequest) GetAtespace() string { @@ -6020,7 +6887,7 @@ type ListTagsResponse struct { func (x *ListTagsResponse) Reset() { *x = ListTagsResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[79] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[93] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6032,7 +6899,7 @@ func (x *ListTagsResponse) String() string { func (*ListTagsResponse) ProtoMessage() {} func (x *ListTagsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[79] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[93] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6045,7 +6912,7 @@ func (x *ListTagsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListTagsResponse.ProtoReflect.Descriptor instead. func (*ListTagsResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{79} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{93} } func (x *ListTagsResponse) GetTags() []*Tag { @@ -6090,7 +6957,7 @@ type CreateTagRequest struct { func (x *CreateTagRequest) Reset() { *x = CreateTagRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[80] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[94] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6102,7 +6969,7 @@ func (x *CreateTagRequest) String() string { func (*CreateTagRequest) ProtoMessage() {} func (x *CreateTagRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[80] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[94] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6115,7 +6982,7 @@ func (x *CreateTagRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateTagRequest.ProtoReflect.Descriptor instead. func (*CreateTagRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{80} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{94} } func (x *CreateTagRequest) GetTag() *Tag { @@ -6145,7 +7012,7 @@ type UpdateTagRequest struct { func (x *UpdateTagRequest) Reset() { *x = UpdateTagRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[81] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[95] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6157,7 +7024,7 @@ func (x *UpdateTagRequest) String() string { func (*UpdateTagRequest) ProtoMessage() {} func (x *UpdateTagRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[81] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[95] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6170,7 +7037,7 @@ func (x *UpdateTagRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateTagRequest.ProtoReflect.Descriptor instead. func (*UpdateTagRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{81} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{95} } func (x *UpdateTagRequest) GetTag() *Tag { @@ -6195,7 +7062,7 @@ type DeleteTagRequest struct { func (x *DeleteTagRequest) Reset() { *x = DeleteTagRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[82] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[96] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6207,7 +7074,7 @@ func (x *DeleteTagRequest) String() string { func (*DeleteTagRequest) ProtoMessage() {} func (x *DeleteTagRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[82] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[96] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6220,7 +7087,7 @@ func (x *DeleteTagRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteTagRequest.ProtoReflect.Descriptor instead. func (*DeleteTagRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{82} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{96} } func (x *DeleteTagRequest) GetTag() *ObjectRef { @@ -6259,7 +7126,7 @@ type DeleteOptions struct { func (x *DeleteOptions) Reset() { *x = DeleteOptions{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[83] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[97] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6271,7 +7138,7 @@ func (x *DeleteOptions) String() string { func (*DeleteOptions) ProtoMessage() {} func (x *DeleteOptions) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[83] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[97] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6284,7 +7151,7 @@ func (x *DeleteOptions) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteOptions.ProtoReflect.Descriptor instead. func (*DeleteOptions) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{83} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{97} } func (x *DeleteOptions) GetVersion() int64 { @@ -6323,7 +7190,7 @@ type ListOptions struct { func (x *ListOptions) Reset() { *x = ListOptions{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[84] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[98] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6335,7 +7202,7 @@ func (x *ListOptions) String() string { func (*ListOptions) ProtoMessage() {} func (x *ListOptions) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[84] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[98] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6348,7 +7215,7 @@ func (x *ListOptions) ProtoReflect() protoreflect.Message { // Deprecated: Use ListOptions.ProtoReflect.Descriptor instead. func (*ListOptions) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{84} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{98} } func (x *ListOptions) GetPageSize() int32 { @@ -6384,7 +7251,7 @@ type ListWorkerActorAssignmentsRequest struct { func (x *ListWorkerActorAssignmentsRequest) Reset() { *x = ListWorkerActorAssignmentsRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[85] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[99] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6396,7 +7263,7 @@ func (x *ListWorkerActorAssignmentsRequest) String() string { func (*ListWorkerActorAssignmentsRequest) ProtoMessage() {} func (x *ListWorkerActorAssignmentsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[85] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[99] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6409,7 +7276,7 @@ func (x *ListWorkerActorAssignmentsRequest) ProtoReflect() protoreflect.Message // Deprecated: Use ListWorkerActorAssignmentsRequest.ProtoReflect.Descriptor instead. func (*ListWorkerActorAssignmentsRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{85} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{99} } func (x *ListWorkerActorAssignmentsRequest) GetWorker() *ObjectRef { @@ -6439,7 +7306,7 @@ type ListWorkerActorAssignmentsResponse struct { func (x *ListWorkerActorAssignmentsResponse) Reset() { *x = ListWorkerActorAssignmentsResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[86] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[100] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6451,7 +7318,7 @@ func (x *ListWorkerActorAssignmentsResponse) String() string { func (*ListWorkerActorAssignmentsResponse) ProtoMessage() {} func (x *ListWorkerActorAssignmentsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[86] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[100] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6464,7 +7331,7 @@ func (x *ListWorkerActorAssignmentsResponse) ProtoReflect() protoreflect.Message // Deprecated: Use ListWorkerActorAssignmentsResponse.ProtoReflect.Descriptor instead. func (*ListWorkerActorAssignmentsResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{86} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{100} } func (x *ListWorkerActorAssignmentsResponse) GetActorAssignments() []*ActorAssignment { @@ -6493,7 +7360,7 @@ type ListWorkersRequest struct { func (x *ListWorkersRequest) Reset() { *x = ListWorkersRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[87] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[101] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6505,7 +7372,7 @@ func (x *ListWorkersRequest) String() string { func (*ListWorkersRequest) ProtoMessage() {} func (x *ListWorkersRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[87] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[101] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6518,7 +7385,7 @@ func (x *ListWorkersRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListWorkersRequest.ProtoReflect.Descriptor instead. func (*ListWorkersRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{87} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{101} } func (x *ListWorkersRequest) GetOptions() *ListOptions { @@ -6540,7 +7407,7 @@ type ListWorkersResponse struct { func (x *ListWorkersResponse) Reset() { *x = ListWorkersResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[88] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[102] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6552,7 +7419,7 @@ func (x *ListWorkersResponse) String() string { func (*ListWorkersResponse) ProtoMessage() {} func (x *ListWorkersResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[88] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[102] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6565,7 +7432,7 @@ func (x *ListWorkersResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListWorkersResponse.ProtoReflect.Descriptor instead. func (*ListWorkersResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{88} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{102} } func (x *ListWorkersResponse) GetWorkers() []*Worker { @@ -6595,7 +7462,7 @@ type GetWorkerRequest struct { func (x *GetWorkerRequest) Reset() { *x = GetWorkerRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[89] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[103] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6607,7 +7474,7 @@ func (x *GetWorkerRequest) String() string { func (*GetWorkerRequest) ProtoMessage() {} func (x *GetWorkerRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[89] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[103] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6620,7 +7487,7 @@ func (x *GetWorkerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetWorkerRequest.ProtoReflect.Descriptor instead. func (*GetWorkerRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{89} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{103} } func (x *GetWorkerRequest) GetWorker() *ObjectRef { @@ -6642,7 +7509,7 @@ type CreateWorkerRequest struct { func (x *CreateWorkerRequest) Reset() { *x = CreateWorkerRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[90] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[104] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6654,7 +7521,7 @@ func (x *CreateWorkerRequest) String() string { func (*CreateWorkerRequest) ProtoMessage() {} func (x *CreateWorkerRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[90] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[104] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6667,7 +7534,7 @@ func (x *CreateWorkerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateWorkerRequest.ProtoReflect.Descriptor instead. func (*CreateWorkerRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{90} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{104} } func (x *CreateWorkerRequest) GetWorker() *Worker { @@ -6702,7 +7569,7 @@ type UpdateWorkerRequest struct { func (x *UpdateWorkerRequest) Reset() { *x = UpdateWorkerRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[91] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[105] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6714,7 +7581,7 @@ func (x *UpdateWorkerRequest) String() string { func (*UpdateWorkerRequest) ProtoMessage() {} func (x *UpdateWorkerRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[91] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[105] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6727,7 +7594,7 @@ func (x *UpdateWorkerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateWorkerRequest.ProtoReflect.Descriptor instead. func (*UpdateWorkerRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{91} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{105} } func (x *UpdateWorkerRequest) GetWorker() *Worker { @@ -6754,7 +7621,7 @@ type DeleteWorkerRequest struct { func (x *DeleteWorkerRequest) Reset() { *x = DeleteWorkerRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[92] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[106] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6766,7 +7633,7 @@ func (x *DeleteWorkerRequest) String() string { func (*DeleteWorkerRequest) ProtoMessage() {} func (x *DeleteWorkerRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[92] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[106] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6779,7 +7646,7 @@ func (x *DeleteWorkerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteWorkerRequest.ProtoReflect.Descriptor instead. func (*DeleteWorkerRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{92} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{106} } func (x *DeleteWorkerRequest) GetWorker() *ObjectRef { @@ -6809,7 +7676,7 @@ type DrainWorkerRequest struct { func (x *DrainWorkerRequest) Reset() { *x = DrainWorkerRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[93] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[107] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6821,7 +7688,7 @@ func (x *DrainWorkerRequest) String() string { func (*DrainWorkerRequest) ProtoMessage() {} func (x *DrainWorkerRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[93] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[107] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6834,7 +7701,7 @@ func (x *DrainWorkerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DrainWorkerRequest.ProtoReflect.Descriptor instead. func (*DrainWorkerRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{93} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{107} } func (x *DrainWorkerRequest) GetWorker() *ObjectRef { @@ -6855,7 +7722,7 @@ type DrainWorkerResponse struct { func (x *DrainWorkerResponse) Reset() { *x = DrainWorkerResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[94] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[108] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6867,7 +7734,7 @@ func (x *DrainWorkerResponse) String() string { func (*DrainWorkerResponse) ProtoMessage() {} func (x *DrainWorkerResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[94] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[108] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6880,7 +7747,7 @@ func (x *DrainWorkerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DrainWorkerResponse.ProtoReflect.Descriptor instead. func (*DrainWorkerResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{94} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{108} } func (x *DrainWorkerResponse) GetWorker() *Worker { @@ -6904,7 +7771,7 @@ type MarkWorkerAvailableRequest struct { func (x *MarkWorkerAvailableRequest) Reset() { *x = MarkWorkerAvailableRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[95] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[109] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6916,7 +7783,7 @@ func (x *MarkWorkerAvailableRequest) String() string { func (*MarkWorkerAvailableRequest) ProtoMessage() {} func (x *MarkWorkerAvailableRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[95] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[109] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6929,7 +7796,7 @@ func (x *MarkWorkerAvailableRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use MarkWorkerAvailableRequest.ProtoReflect.Descriptor instead. func (*MarkWorkerAvailableRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{95} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{109} } func (x *MarkWorkerAvailableRequest) GetWorker() *ObjectRef { @@ -6950,7 +7817,7 @@ type MarkWorkerAvailableResponse struct { func (x *MarkWorkerAvailableResponse) Reset() { *x = MarkWorkerAvailableResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[96] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[110] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6962,7 +7829,7 @@ func (x *MarkWorkerAvailableResponse) String() string { func (*MarkWorkerAvailableResponse) ProtoMessage() {} func (x *MarkWorkerAvailableResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[96] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[110] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6975,7 +7842,7 @@ func (x *MarkWorkerAvailableResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use MarkWorkerAvailableResponse.ProtoReflect.Descriptor instead. func (*MarkWorkerAvailableResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{96} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{110} } func (x *MarkWorkerAvailableResponse) GetWorker() *Worker { @@ -6999,7 +7866,7 @@ type MarkWorkerUnavailableRequest struct { func (x *MarkWorkerUnavailableRequest) Reset() { *x = MarkWorkerUnavailableRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[97] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[111] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7011,7 +7878,7 @@ func (x *MarkWorkerUnavailableRequest) String() string { func (*MarkWorkerUnavailableRequest) ProtoMessage() {} func (x *MarkWorkerUnavailableRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[97] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[111] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7024,7 +7891,7 @@ func (x *MarkWorkerUnavailableRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use MarkWorkerUnavailableRequest.ProtoReflect.Descriptor instead. func (*MarkWorkerUnavailableRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{97} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{111} } func (x *MarkWorkerUnavailableRequest) GetWorker() *ObjectRef { @@ -7045,7 +7912,7 @@ type MarkWorkerUnavailableResponse struct { func (x *MarkWorkerUnavailableResponse) Reset() { *x = MarkWorkerUnavailableResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[98] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[112] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7057,7 +7924,7 @@ func (x *MarkWorkerUnavailableResponse) String() string { func (*MarkWorkerUnavailableResponse) ProtoMessage() {} func (x *MarkWorkerUnavailableResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[98] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[112] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7070,7 +7937,7 @@ func (x *MarkWorkerUnavailableResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use MarkWorkerUnavailableResponse.ProtoReflect.Descriptor instead. func (*MarkWorkerUnavailableResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{98} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{112} } func (x *MarkWorkerUnavailableResponse) GetWorker() *Worker { @@ -7099,7 +7966,7 @@ type ListActorsRequest struct { func (x *ListActorsRequest) Reset() { *x = ListActorsRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[99] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[113] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7111,7 +7978,7 @@ func (x *ListActorsRequest) String() string { func (*ListActorsRequest) ProtoMessage() {} func (x *ListActorsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[99] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[113] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7124,7 +7991,7 @@ func (x *ListActorsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListActorsRequest.ProtoReflect.Descriptor instead. func (*ListActorsRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{99} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{113} } func (x *ListActorsRequest) GetAtespace() string { @@ -7153,7 +8020,7 @@ type ListActorsResponse struct { func (x *ListActorsResponse) Reset() { *x = ListActorsResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[100] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[114] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7165,7 +8032,7 @@ func (x *ListActorsResponse) String() string { func (*ListActorsResponse) ProtoMessage() {} func (x *ListActorsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[100] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[114] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7178,7 +8045,7 @@ func (x *ListActorsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListActorsResponse.ProtoReflect.Descriptor instead. func (*ListActorsResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{100} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{114} } func (x *ListActorsResponse) GetActors() []*Actor { @@ -7266,7 +8133,7 @@ type Worker struct { func (x *Worker) Reset() { *x = Worker{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[101] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[115] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7278,7 +8145,7 @@ func (x *Worker) String() string { func (*Worker) ProtoMessage() {} func (x *Worker) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[101] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[115] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7291,7 +8158,7 @@ func (x *Worker) ProtoReflect() protoreflect.Message { // Deprecated: Use Worker.ProtoReflect.Descriptor instead. func (*Worker) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{101} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{115} } func (x *Worker) GetMetadata() *ResourceMetadata { @@ -7433,7 +8300,7 @@ type WorkerStatus struct { func (x *WorkerStatus) Reset() { *x = WorkerStatus{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[102] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[116] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7445,7 +8312,7 @@ func (x *WorkerStatus) String() string { func (*WorkerStatus) ProtoMessage() {} func (x *WorkerStatus) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[102] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[116] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7458,7 +8325,7 @@ func (x *WorkerStatus) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkerStatus.ProtoReflect.Descriptor instead. func (*WorkerStatus) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{102} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{116} } func (x *WorkerStatus) GetState() WorkerState { @@ -7546,7 +8413,7 @@ type WorkerSandboxClass struct { func (x *WorkerSandboxClass) Reset() { *x = WorkerSandboxClass{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[103] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[117] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7558,7 +8425,7 @@ func (x *WorkerSandboxClass) String() string { func (*WorkerSandboxClass) ProtoMessage() {} func (x *WorkerSandboxClass) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[103] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[117] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7571,7 +8438,7 @@ func (x *WorkerSandboxClass) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkerSandboxClass.ProtoReflect.Descriptor instead. func (*WorkerSandboxClass) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{103} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{117} } func (x *WorkerSandboxClass) GetSandboxClass() string { @@ -7623,7 +8490,7 @@ type WorkerSandboxRuntime struct { func (x *WorkerSandboxRuntime) Reset() { *x = WorkerSandboxRuntime{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[104] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[118] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7635,7 +8502,7 @@ func (x *WorkerSandboxRuntime) String() string { func (*WorkerSandboxRuntime) ProtoMessage() {} func (x *WorkerSandboxRuntime) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[104] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[118] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7648,7 +8515,7 @@ func (x *WorkerSandboxRuntime) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkerSandboxRuntime.ProtoReflect.Descriptor instead. func (*WorkerSandboxRuntime) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{104} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{118} } func (x *WorkerSandboxRuntime) GetVersion() *VersionedSandboxCompat { @@ -7689,7 +8556,7 @@ type RuntimeOverhead struct { func (x *RuntimeOverhead) Reset() { *x = RuntimeOverhead{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[105] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[119] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7701,7 +8568,7 @@ func (x *RuntimeOverhead) String() string { func (*RuntimeOverhead) ProtoMessage() {} func (x *RuntimeOverhead) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[105] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[119] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7714,7 +8581,7 @@ func (x *RuntimeOverhead) ProtoReflect() protoreflect.Message { // Deprecated: Use RuntimeOverhead.ProtoReflect.Descriptor instead. func (*RuntimeOverhead) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{105} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{119} } func (x *RuntimeOverhead) GetMemoryBytes() int64 { @@ -7753,7 +8620,7 @@ type ActorSandboxRuntime struct { func (x *ActorSandboxRuntime) Reset() { *x = ActorSandboxRuntime{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[106] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[120] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7765,7 +8632,7 @@ func (x *ActorSandboxRuntime) String() string { func (*ActorSandboxRuntime) ProtoMessage() {} func (x *ActorSandboxRuntime) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[106] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[120] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7778,7 +8645,7 @@ func (x *ActorSandboxRuntime) ProtoReflect() protoreflect.Message { // Deprecated: Use ActorSandboxRuntime.ProtoReflect.Descriptor instead. func (*ActorSandboxRuntime) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{106} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{120} } func (x *ActorSandboxRuntime) GetSandboxClass() string { @@ -7829,7 +8696,7 @@ type VersionedSandboxCompat struct { func (x *VersionedSandboxCompat) Reset() { *x = VersionedSandboxCompat{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[107] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[121] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7841,7 +8708,7 @@ func (x *VersionedSandboxCompat) String() string { func (*VersionedSandboxCompat) ProtoMessage() {} func (x *VersionedSandboxCompat) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[107] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[121] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7854,7 +8721,7 @@ func (x *VersionedSandboxCompat) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionedSandboxCompat.ProtoReflect.Descriptor instead. func (*VersionedSandboxCompat) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{107} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{121} } func (x *VersionedSandboxCompat) GetSchemaVersion() string { @@ -7890,7 +8757,7 @@ type AttributeEntry struct { func (x *AttributeEntry) Reset() { *x = AttributeEntry{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[108] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[122] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7902,7 +8769,7 @@ func (x *AttributeEntry) String() string { func (*AttributeEntry) ProtoMessage() {} func (x *AttributeEntry) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[108] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[122] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7915,7 +8782,7 @@ func (x *AttributeEntry) ProtoReflect() protoreflect.Message { // Deprecated: Use AttributeEntry.ProtoReflect.Descriptor instead. func (*AttributeEntry) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{108} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{122} } func (x *AttributeEntry) GetKey() string { @@ -7962,7 +8829,7 @@ type WorkerResources struct { func (x *WorkerResources) Reset() { *x = WorkerResources{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[109] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[123] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7974,7 +8841,7 @@ func (x *WorkerResources) String() string { func (*WorkerResources) ProtoMessage() {} func (x *WorkerResources) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[109] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[123] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7987,7 +8854,7 @@ func (x *WorkerResources) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkerResources.ProtoReflect.Descriptor instead. func (*WorkerResources) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{109} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{123} } func (x *WorkerResources) GetCpuMillicores() int64 { @@ -8043,7 +8910,7 @@ type ActorAssignment struct { func (x *ActorAssignment) Reset() { *x = ActorAssignment{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[110] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[124] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8055,7 +8922,7 @@ func (x *ActorAssignment) String() string { func (*ActorAssignment) ProtoMessage() {} func (x *ActorAssignment) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[110] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[124] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8068,7 +8935,7 @@ func (x *ActorAssignment) ProtoReflect() protoreflect.Message { // Deprecated: Use ActorAssignment.ProtoReflect.Descriptor instead. func (*ActorAssignment) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{110} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{124} } func (x *ActorAssignment) GetMetadata() *ResourceMetadata { @@ -8113,7 +8980,7 @@ type AcquireWorkerEpochRequest struct { func (x *AcquireWorkerEpochRequest) Reset() { *x = AcquireWorkerEpochRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[111] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[125] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8125,7 +8992,7 @@ func (x *AcquireWorkerEpochRequest) String() string { func (*AcquireWorkerEpochRequest) ProtoMessage() {} func (x *AcquireWorkerEpochRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[111] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[125] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8138,7 +9005,7 @@ func (x *AcquireWorkerEpochRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AcquireWorkerEpochRequest.ProtoReflect.Descriptor instead. func (*AcquireWorkerEpochRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{111} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{125} } func (x *AcquireWorkerEpochRequest) GetWorker() *ObjectRef { @@ -8158,7 +9025,7 @@ type AcquireWorkerEpochResponse struct { func (x *AcquireWorkerEpochResponse) Reset() { *x = AcquireWorkerEpochResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[112] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[126] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8170,7 +9037,7 @@ func (x *AcquireWorkerEpochResponse) String() string { func (*AcquireWorkerEpochResponse) ProtoMessage() {} func (x *AcquireWorkerEpochResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[112] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[126] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8183,7 +9050,7 @@ func (x *AcquireWorkerEpochResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AcquireWorkerEpochResponse.ProtoReflect.Descriptor instead. func (*AcquireWorkerEpochResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{112} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{126} } func (x *AcquireWorkerEpochResponse) GetEpoch() int64 { @@ -8226,7 +9093,7 @@ type RegisterWorkerRequest struct { func (x *RegisterWorkerRequest) Reset() { *x = RegisterWorkerRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[113] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[127] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8238,7 +9105,7 @@ func (x *RegisterWorkerRequest) String() string { func (*RegisterWorkerRequest) ProtoMessage() {} func (x *RegisterWorkerRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[113] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[127] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8251,7 +9118,7 @@ func (x *RegisterWorkerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RegisterWorkerRequest.ProtoReflect.Descriptor instead. func (*RegisterWorkerRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{113} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{127} } func (x *RegisterWorkerRequest) GetWorker() *ObjectRef { @@ -8292,7 +9159,7 @@ type RegisterWorkerResponse struct { func (x *RegisterWorkerResponse) Reset() { *x = RegisterWorkerResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[114] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[128] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8304,7 +9171,7 @@ func (x *RegisterWorkerResponse) String() string { func (*RegisterWorkerResponse) ProtoMessage() {} func (x *RegisterWorkerResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[114] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[128] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8317,7 +9184,7 @@ func (x *RegisterWorkerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RegisterWorkerResponse.ProtoReflect.Descriptor instead. func (*RegisterWorkerResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{114} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{128} } func (x *RegisterWorkerResponse) GetWorker() *Worker { @@ -8357,7 +9224,7 @@ type SetWorkerSandboxRuntimesRequest struct { func (x *SetWorkerSandboxRuntimesRequest) Reset() { *x = SetWorkerSandboxRuntimesRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[115] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[129] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8369,7 +9236,7 @@ func (x *SetWorkerSandboxRuntimesRequest) String() string { func (*SetWorkerSandboxRuntimesRequest) ProtoMessage() {} func (x *SetWorkerSandboxRuntimesRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[115] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[129] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8382,7 +9249,7 @@ func (x *SetWorkerSandboxRuntimesRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SetWorkerSandboxRuntimesRequest.ProtoReflect.Descriptor instead. func (*SetWorkerSandboxRuntimesRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{115} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{129} } func (x *SetWorkerSandboxRuntimesRequest) GetWorker() *ObjectRef { @@ -8416,7 +9283,7 @@ type SetWorkerSandboxRuntimesResponse struct { func (x *SetWorkerSandboxRuntimesResponse) Reset() { *x = SetWorkerSandboxRuntimesResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[116] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[130] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8428,7 +9295,7 @@ func (x *SetWorkerSandboxRuntimesResponse) String() string { func (*SetWorkerSandboxRuntimesResponse) ProtoMessage() {} func (x *SetWorkerSandboxRuntimesResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[116] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[130] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8441,7 +9308,7 @@ func (x *SetWorkerSandboxRuntimesResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SetWorkerSandboxRuntimesResponse.ProtoReflect.Descriptor instead. func (*SetWorkerSandboxRuntimesResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{116} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{130} } func (x *SetWorkerSandboxRuntimesResponse) GetWorker() *Worker { @@ -8488,7 +9355,7 @@ type MintWorkerActorCertificateRequest struct { func (x *MintWorkerActorCertificateRequest) Reset() { *x = MintWorkerActorCertificateRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[117] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[131] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8500,7 +9367,7 @@ func (x *MintWorkerActorCertificateRequest) String() string { func (*MintWorkerActorCertificateRequest) ProtoMessage() {} func (x *MintWorkerActorCertificateRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[117] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[131] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8513,7 +9380,7 @@ func (x *MintWorkerActorCertificateRequest) ProtoReflect() protoreflect.Message // Deprecated: Use MintWorkerActorCertificateRequest.ProtoReflect.Descriptor instead. func (*MintWorkerActorCertificateRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{117} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{131} } func (x *MintWorkerActorCertificateRequest) GetActor() *ObjectRef { @@ -8557,7 +9424,7 @@ type MintWorkerActorCertificateResponse struct { func (x *MintWorkerActorCertificateResponse) Reset() { *x = MintWorkerActorCertificateResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[118] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[132] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8569,7 +9436,7 @@ func (x *MintWorkerActorCertificateResponse) String() string { func (*MintWorkerActorCertificateResponse) ProtoMessage() {} func (x *MintWorkerActorCertificateResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[118] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[132] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8582,7 +9449,7 @@ func (x *MintWorkerActorCertificateResponse) ProtoReflect() protoreflect.Message // Deprecated: Use MintWorkerActorCertificateResponse.ProtoReflect.Descriptor instead. func (*MintWorkerActorCertificateResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{118} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{132} } func (x *MintWorkerActorCertificateResponse) GetActorCertificates() [][]byte { @@ -8623,7 +9490,7 @@ type MintWorkerActorJwtRequest struct { func (x *MintWorkerActorJwtRequest) Reset() { *x = MintWorkerActorJwtRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[119] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[133] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8635,7 +9502,7 @@ func (x *MintWorkerActorJwtRequest) String() string { func (*MintWorkerActorJwtRequest) ProtoMessage() {} func (x *MintWorkerActorJwtRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[119] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[133] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8648,7 +9515,7 @@ func (x *MintWorkerActorJwtRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use MintWorkerActorJwtRequest.ProtoReflect.Descriptor instead. func (*MintWorkerActorJwtRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{119} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{133} } func (x *MintWorkerActorJwtRequest) GetActor() *ObjectRef { @@ -8696,7 +9563,7 @@ type MintWorkerActorJwtResponse struct { func (x *MintWorkerActorJwtResponse) Reset() { *x = MintWorkerActorJwtResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[120] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[134] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8708,7 +9575,7 @@ func (x *MintWorkerActorJwtResponse) String() string { func (*MintWorkerActorJwtResponse) ProtoMessage() {} func (x *MintWorkerActorJwtResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[120] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[134] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8721,7 +9588,7 @@ func (x *MintWorkerActorJwtResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use MintWorkerActorJwtResponse.ProtoReflect.Descriptor instead. func (*MintWorkerActorJwtResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{120} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{134} } func (x *MintWorkerActorJwtResponse) GetActorJwt() string { @@ -8772,7 +9639,7 @@ type RequestActorSuspendRequest struct { func (x *RequestActorSuspendRequest) Reset() { *x = RequestActorSuspendRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[121] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[135] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8784,7 +9651,7 @@ func (x *RequestActorSuspendRequest) String() string { func (*RequestActorSuspendRequest) ProtoMessage() {} func (x *RequestActorSuspendRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[121] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[135] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8797,7 +9664,7 @@ func (x *RequestActorSuspendRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestActorSuspendRequest.ProtoReflect.Descriptor instead. func (*RequestActorSuspendRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{121} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{135} } func (x *RequestActorSuspendRequest) GetWorker() *ObjectRef { @@ -8831,7 +9698,7 @@ type RequestActorSuspendResponse struct { func (x *RequestActorSuspendResponse) Reset() { *x = RequestActorSuspendResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[122] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[136] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8843,7 +9710,7 @@ func (x *RequestActorSuspendResponse) String() string { func (*RequestActorSuspendResponse) ProtoMessage() {} func (x *RequestActorSuspendResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[122] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[136] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8856,7 +9723,7 @@ func (x *RequestActorSuspendResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestActorSuspendResponse.ProtoReflect.Descriptor instead. func (*RequestActorSuspendResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{122} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{136} } func (x *RequestActorSuspendResponse) GetActor() *Actor { @@ -8896,7 +9763,7 @@ type ReportActorCrashedRequest struct { func (x *ReportActorCrashedRequest) Reset() { *x = ReportActorCrashedRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[123] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[137] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8908,7 +9775,7 @@ func (x *ReportActorCrashedRequest) String() string { func (*ReportActorCrashedRequest) ProtoMessage() {} func (x *ReportActorCrashedRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[123] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[137] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8921,7 +9788,7 @@ func (x *ReportActorCrashedRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReportActorCrashedRequest.ProtoReflect.Descriptor instead. func (*ReportActorCrashedRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{123} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{137} } func (x *ReportActorCrashedRequest) GetWorker() *ObjectRef { @@ -8962,7 +9829,7 @@ type ReportActorCrashedResponse struct { func (x *ReportActorCrashedResponse) Reset() { *x = ReportActorCrashedResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[124] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[138] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8974,7 +9841,7 @@ func (x *ReportActorCrashedResponse) String() string { func (*ReportActorCrashedResponse) ProtoMessage() {} func (x *ReportActorCrashedResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[124] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[138] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8987,7 +9854,7 @@ func (x *ReportActorCrashedResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ReportActorCrashedResponse.ProtoReflect.Descriptor instead. func (*ReportActorCrashedResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{124} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{138} } func (x *ReportActorCrashedResponse) GetActor() *Actor { @@ -9018,7 +9885,7 @@ type ReportActorSnapshotStateRequest struct { func (x *ReportActorSnapshotStateRequest) Reset() { *x = ReportActorSnapshotStateRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[125] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[139] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9030,7 +9897,7 @@ func (x *ReportActorSnapshotStateRequest) String() string { func (*ReportActorSnapshotStateRequest) ProtoMessage() {} func (x *ReportActorSnapshotStateRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[125] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[139] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9043,7 +9910,7 @@ func (x *ReportActorSnapshotStateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReportActorSnapshotStateRequest.ProtoReflect.Descriptor instead. func (*ReportActorSnapshotStateRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{125} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{139} } func (x *ReportActorSnapshotStateRequest) GetActor() *ObjectRef { @@ -9075,7 +9942,7 @@ type ReportActorSnapshotStateResponse struct { func (x *ReportActorSnapshotStateResponse) Reset() { *x = ReportActorSnapshotStateResponse{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[126] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[140] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9087,7 +9954,7 @@ func (x *ReportActorSnapshotStateResponse) String() string { func (*ReportActorSnapshotStateResponse) ProtoMessage() {} func (x *ReportActorSnapshotStateResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[126] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[140] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9100,7 +9967,7 @@ func (x *ReportActorSnapshotStateResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ReportActorSnapshotStateResponse.ProtoReflect.Descriptor instead. func (*ReportActorSnapshotStateResponse) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{126} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{140} } // ActorSnapshotState is what atelet holds for one Actor on its node. It @@ -9134,7 +10001,7 @@ type ActorSnapshotState struct { func (x *ActorSnapshotState) Reset() { *x = ActorSnapshotState{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[127] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[141] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9146,7 +10013,7 @@ func (x *ActorSnapshotState) String() string { func (*ActorSnapshotState) ProtoMessage() {} func (x *ActorSnapshotState) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[127] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[141] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9159,7 +10026,7 @@ func (x *ActorSnapshotState) ProtoReflect() protoreflect.Message { // Deprecated: Use ActorSnapshotState.ProtoReflect.Descriptor instead. func (*ActorSnapshotState) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{127} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{141} } func (x *ActorSnapshotState) GetLatestLocal() *SnapshotReport { @@ -9231,7 +10098,7 @@ type SnapshotReport struct { func (x *SnapshotReport) Reset() { *x = SnapshotReport{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[128] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[142] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9243,7 +10110,7 @@ func (x *SnapshotReport) String() string { func (*SnapshotReport) ProtoMessage() {} func (x *SnapshotReport) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[128] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[142] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9256,7 +10123,7 @@ func (x *SnapshotReport) ProtoReflect() protoreflect.Message { // Deprecated: Use SnapshotReport.ProtoReflect.Descriptor instead. func (*SnapshotReport) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{128} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{142} } func (x *SnapshotReport) GetUuid() string { @@ -9326,7 +10193,7 @@ type AccessPolicy struct { func (x *AccessPolicy) Reset() { *x = AccessPolicy{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[129] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[143] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9338,7 +10205,7 @@ func (x *AccessPolicy) String() string { func (*AccessPolicy) ProtoMessage() {} func (x *AccessPolicy) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[129] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[143] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9351,7 +10218,7 @@ func (x *AccessPolicy) ProtoReflect() protoreflect.Message { // Deprecated: Use AccessPolicy.ProtoReflect.Descriptor instead. func (*AccessPolicy) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{129} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{143} } func (x *AccessPolicy) GetMetadata() *ResourceMetadata { @@ -9393,7 +10260,7 @@ type Binding struct { func (x *Binding) Reset() { *x = Binding{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[130] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[144] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9405,7 +10272,7 @@ func (x *Binding) String() string { func (*Binding) ProtoMessage() {} func (x *Binding) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[130] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[144] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9418,7 +10285,7 @@ func (x *Binding) ProtoReflect() protoreflect.Message { // Deprecated: Use Binding.ProtoReflect.Descriptor instead. func (*Binding) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{130} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{144} } func (x *Binding) GetRole() string { @@ -9450,7 +10317,7 @@ type GetGlobalAccessPolicyRequest struct { func (x *GetGlobalAccessPolicyRequest) Reset() { *x = GetGlobalAccessPolicyRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[131] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[145] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9462,7 +10329,7 @@ func (x *GetGlobalAccessPolicyRequest) String() string { func (*GetGlobalAccessPolicyRequest) ProtoMessage() {} func (x *GetGlobalAccessPolicyRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[131] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[145] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9475,7 +10342,7 @@ func (x *GetGlobalAccessPolicyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetGlobalAccessPolicyRequest.ProtoReflect.Descriptor instead. func (*GetGlobalAccessPolicyRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{131} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{145} } func (x *GetGlobalAccessPolicyRequest) GetName() string { @@ -9499,7 +10366,7 @@ type CreateGlobalAccessPolicyRequest struct { func (x *CreateGlobalAccessPolicyRequest) Reset() { *x = CreateGlobalAccessPolicyRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[132] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[146] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9511,7 +10378,7 @@ func (x *CreateGlobalAccessPolicyRequest) String() string { func (*CreateGlobalAccessPolicyRequest) ProtoMessage() {} func (x *CreateGlobalAccessPolicyRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[132] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[146] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9524,7 +10391,7 @@ func (x *CreateGlobalAccessPolicyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateGlobalAccessPolicyRequest.ProtoReflect.Descriptor instead. func (*CreateGlobalAccessPolicyRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{132} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{146} } func (x *CreateGlobalAccessPolicyRequest) GetAccessPolicy() *AccessPolicy { @@ -9548,7 +10415,7 @@ type UpdateGlobalAccessPolicyRequest struct { func (x *UpdateGlobalAccessPolicyRequest) Reset() { *x = UpdateGlobalAccessPolicyRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[133] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[147] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9560,7 +10427,7 @@ func (x *UpdateGlobalAccessPolicyRequest) String() string { func (*UpdateGlobalAccessPolicyRequest) ProtoMessage() {} func (x *UpdateGlobalAccessPolicyRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[133] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[147] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9573,7 +10440,7 @@ func (x *UpdateGlobalAccessPolicyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateGlobalAccessPolicyRequest.ProtoReflect.Descriptor instead. func (*UpdateGlobalAccessPolicyRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{133} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{147} } func (x *UpdateGlobalAccessPolicyRequest) GetAccessPolicy() *AccessPolicy { @@ -9603,7 +10470,7 @@ type GetAtespaceAccessPolicyRequest struct { func (x *GetAtespaceAccessPolicyRequest) Reset() { *x = GetAtespaceAccessPolicyRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[134] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[148] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9615,7 +10482,7 @@ func (x *GetAtespaceAccessPolicyRequest) String() string { func (*GetAtespaceAccessPolicyRequest) ProtoMessage() {} func (x *GetAtespaceAccessPolicyRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[134] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[148] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9628,7 +10495,7 @@ func (x *GetAtespaceAccessPolicyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAtespaceAccessPolicyRequest.ProtoReflect.Descriptor instead. func (*GetAtespaceAccessPolicyRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{134} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{148} } func (x *GetAtespaceAccessPolicyRequest) GetAtespace() *ObjectRef { @@ -9664,7 +10531,7 @@ type CreateAtespaceAccessPolicyRequest struct { func (x *CreateAtespaceAccessPolicyRequest) Reset() { *x = CreateAtespaceAccessPolicyRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[135] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[149] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9676,7 +10543,7 @@ func (x *CreateAtespaceAccessPolicyRequest) String() string { func (*CreateAtespaceAccessPolicyRequest) ProtoMessage() {} func (x *CreateAtespaceAccessPolicyRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[135] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[149] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9689,7 +10556,7 @@ func (x *CreateAtespaceAccessPolicyRequest) ProtoReflect() protoreflect.Message // Deprecated: Use CreateAtespaceAccessPolicyRequest.ProtoReflect.Descriptor instead. func (*CreateAtespaceAccessPolicyRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{135} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{149} } func (x *CreateAtespaceAccessPolicyRequest) GetAtespace() *ObjectRef { @@ -9725,7 +10592,7 @@ type UpdateAtespaceAccessPolicyRequest struct { func (x *UpdateAtespaceAccessPolicyRequest) Reset() { *x = UpdateAtespaceAccessPolicyRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[136] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[150] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9737,7 +10604,7 @@ func (x *UpdateAtespaceAccessPolicyRequest) String() string { func (*UpdateAtespaceAccessPolicyRequest) ProtoMessage() {} func (x *UpdateAtespaceAccessPolicyRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[136] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[150] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9750,7 +10617,7 @@ func (x *UpdateAtespaceAccessPolicyRequest) ProtoReflect() protoreflect.Message // Deprecated: Use UpdateAtespaceAccessPolicyRequest.ProtoReflect.Descriptor instead. func (*UpdateAtespaceAccessPolicyRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{136} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{150} } func (x *UpdateAtespaceAccessPolicyRequest) GetAtespace() *ObjectRef { @@ -9791,7 +10658,7 @@ type DeleteAtespaceAccessPolicyRequest struct { func (x *DeleteAtespaceAccessPolicyRequest) Reset() { *x = DeleteAtespaceAccessPolicyRequest{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[137] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[151] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9803,7 +10670,7 @@ func (x *DeleteAtespaceAccessPolicyRequest) String() string { func (*DeleteAtespaceAccessPolicyRequest) ProtoMessage() {} func (x *DeleteAtespaceAccessPolicyRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[137] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[151] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9816,7 +10683,7 @@ func (x *DeleteAtespaceAccessPolicyRequest) ProtoReflect() protoreflect.Message // Deprecated: Use DeleteAtespaceAccessPolicyRequest.ProtoReflect.Descriptor instead. func (*DeleteAtespaceAccessPolicyRequest) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{137} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{151} } func (x *DeleteAtespaceAccessPolicyRequest) GetAtespace() *ObjectRef { @@ -9862,7 +10729,7 @@ type ResourceAnnotation struct { func (x *ResourceAnnotation) Reset() { *x = ResourceAnnotation{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[138] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[152] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9874,7 +10741,7 @@ func (x *ResourceAnnotation) String() string { func (*ResourceAnnotation) ProtoMessage() {} func (x *ResourceAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[138] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[152] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9887,7 +10754,7 @@ func (x *ResourceAnnotation) ProtoReflect() protoreflect.Message { // Deprecated: Use ResourceAnnotation.ProtoReflect.Descriptor instead. func (*ResourceAnnotation) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{138} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{152} } func (x *ResourceAnnotation) GetParents() []string { @@ -9930,7 +10797,7 @@ type MethodAnnotation struct { func (x *MethodAnnotation) Reset() { *x = MethodAnnotation{} - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[139] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[153] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9942,7 +10809,7 @@ func (x *MethodAnnotation) String() string { func (*MethodAnnotation) ProtoMessage() {} func (x *MethodAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[139] + mi := &file_api_ateapi_v1_ateapi_proto_msgTypes[153] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9955,7 +10822,7 @@ func (x *MethodAnnotation) ProtoReflect() protoreflect.Message { // Deprecated: Use MethodAnnotation.ProtoReflect.Descriptor instead. func (*MethodAnnotation) Descriptor() ([]byte, []int) { - return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{139} + return file_api_ateapi_v1_ateapi_proto_rawDescGZIP(), []int{153} } func (x *MethodAnnotation) GetResource() string { @@ -10194,10 +11061,33 @@ const file_api_ateapi_v1_ateapi_proto_rawDesc = "" + "\btemplate\x18\x01 \x01(\v2+.substrate.ateapi.v1.ExternalVolumeTemplateR\btemplate\"1\n" + "\x11ImageVolumeSource\x12\x1c\n" + "\treference\x18\x01 \x01(\tR\treference\"\x18\n" + - "\x16DurableDirVolumeSource\"m\n" + + "\x16DurableDirVolumeSource\"\xc1\x01\n" + "\x16ExternalVolumeTemplate\x12%\n" + "\x0ecapacity_bytes\x18\x01 \x01(\x03R\rcapacityBytes\x12,\n" + - "\x12storage_class_name\x18\x02 \x01(\tR\x10storageClassName\"f\n" + + "\x12storage_class_name\x18\x02 \x01(\tR\x10storageClassName\x12R\n" + + "\x15external_volume_class\x18\x03 \x01(\v2\x1e.substrate.ateapi.v1.ObjectRefR\x13externalVolumeClass\"\xb1\x02\n" + + "\x13ExternalVolumeClass\x12A\n" + + "\bmetadata\x18\x01 \x01(\v2%.substrate.ateapi.v1.ResourceMetadataR\bmetadata\x12\x1f\n" + + "\vdriver_name\x18\x02 \x01(\tR\n" + + "driverName\x12X\n" + + "\n" + + "parameters\x18\x03 \x03(\v28.substrate.ateapi.v1.ExternalVolumeClass.ParametersEntryR\n" + + "parameters\x1a=\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01:\x1d\x82\xb5\x18\x19\x18\x02\"\x15ExternalVolumeClasses\"\xad\x02\n" + + "\x0fCsiDriverConfig\x12A\n" + + "\bmetadata\x18\x01 \x01(\v2%.substrate.ateapi.v1.ResourceMetadataR\bmetadata\x12\x1f\n" + + "\vdriver_name\x18\x02 \x01(\tR\n" + + "driverName\x12/\n" + + "\x13controller_endpoint\x18\x03 \x01(\tR\x12controllerEndpoint\x120\n" + + "\x14node_socket_override\x18\x04 \x01(\tR\x12nodeSocketOverride\x129\n" + + "\x03tls\x18\x05 \x01(\v2'.substrate.ateapi.v1.CsiDriverTlsConfigR\x03tls:\x18\x82\xb5\x18\x14\x18\x02\"\x10CsiDriverConfigs\"y\n" + + "\x12CsiDriverTlsConfig\x12\x18\n" + + "\aenabled\x18\x01 \x01(\bR\aenabled\x12(\n" + + "\x10use_pod_identity\x18\x02 \x01(\bR\x0eusePodIdentity\x12\x1f\n" + + "\vserver_name\x18\x03 \x01(\tR\n" + + "serverName\"f\n" + "\x16SystemInfoVolumeSource\x12L\n" + "\fdata_sources\x18\x01 \x03(\v2).substrate.ateapi.v1.SystemInfoDataSourceR\vdataSources\"\xba\x01\n" + "\x14SystemInfoDataSource\x12S\n" + @@ -10226,6 +11116,32 @@ const file_api_ateapi_v1_ateapi_proto_rawDesc = "" + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x91\x01\n" + "\x15DeleteAtespaceRequest\x12:\n" + "\batespace\x18\x01 \x01(\v2\x1e.substrate.ateapi.v1.ObjectRefR\batespace\x12<\n" + + "\aoptions\x18\x02 \x01(\v2\".substrate.ateapi.v1.DeleteOptionsR\aoptions\"\x80\x01\n" + + " CreateExternalVolumeClassRequest\x12\\\n" + + "\x15external_volume_class\x18\x01 \x01(\v2(.substrate.ateapi.v1.ExternalVolumeClassR\x13externalVolumeClass\"s\n" + + "\x1dGetExternalVolumeClassRequest\x12R\n" + + "\x15external_volume_class\x18\x01 \x01(\v2\x1e.substrate.ateapi.v1.ObjectRefR\x13externalVolumeClass\"^\n" + + " ListExternalVolumeClassesRequest\x12:\n" + + "\aoptions\x18\x01 \x01(\v2 .substrate.ateapi.v1.ListOptionsR\aoptions\"\xad\x01\n" + + "!ListExternalVolumeClassesResponse\x12`\n" + + "\x17external_volume_classes\x18\x01 \x03(\v2(.substrate.ateapi.v1.ExternalVolumeClassR\x15externalVolumeClasses\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xb4\x01\n" + + " DeleteExternalVolumeClassRequest\x12R\n" + + "\x15external_volume_class\x18\x01 \x01(\v2\x1e.substrate.ateapi.v1.ObjectRefR\x13externalVolumeClass\x12<\n" + + "\aoptions\x18\x02 \x01(\v2\".substrate.ateapi.v1.DeleteOptionsR\aoptions\"p\n" + + "\x1cCreateCsiDriverConfigRequest\x12P\n" + + "\x11csi_driver_config\x18\x01 \x01(\v2$.substrate.ateapi.v1.CsiDriverConfigR\x0fcsiDriverConfig\"g\n" + + "\x19GetCsiDriverConfigRequest\x12J\n" + + "\x11csi_driver_config\x18\x01 \x01(\v2\x1e.substrate.ateapi.v1.ObjectRefR\x0fcsiDriverConfig\"Y\n" + + "\x1bListCsiDriverConfigsRequest\x12:\n" + + "\aoptions\x18\x01 \x01(\v2 .substrate.ateapi.v1.ListOptionsR\aoptions\"\x9a\x01\n" + + "\x1cListCsiDriverConfigsResponse\x12R\n" + + "\x12csi_driver_configs\x18\x01 \x03(\v2$.substrate.ateapi.v1.CsiDriverConfigR\x10csiDriverConfigs\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"p\n" + + "\x1cUpdateCsiDriverConfigRequest\x12P\n" + + "\x11csi_driver_config\x18\x01 \x01(\v2$.substrate.ateapi.v1.CsiDriverConfigR\x0fcsiDriverConfig\"\xa8\x01\n" + + "\x1cDeleteCsiDriverConfigRequest\x12J\n" + + "\x11csi_driver_config\x18\x01 \x01(\v2\x1e.substrate.ateapi.v1.ObjectRefR\x0fcsiDriverConfig\x12<\n" + "\aoptions\x18\x02 \x01(\v2\".substrate.ateapi.v1.DeleteOptionsR\aoptions\"g\n" + "\x1aCreateActorTemplateRequest\x12I\n" + "\x0eactor_template\x18\x01 \x01(\v2\".substrate.ateapi.v1.ActorTemplateR\ractorTemplate\"`\n" + @@ -10547,7 +11463,7 @@ const file_api_ateapi_v1_ateapi_proto_rawDesc = "" + "\x05Scope\x12\x15\n" + "\x11SCOPE_UNSPECIFIED\x10\x00\x12\x12\n" + "\x0eSCOPE_ATESPACE\x10\x01\x12\x10\n" + - "\fSCOPE_GLOBAL\x10\x022\xca&\n" + + "\fSCOPE_GLOBAL\x10\x022\xf10\n" + "\aControl\x12Y\n" + "\bGetActor\x12$.substrate.ateapi.v1.GetActorRequest\x1a\x1a.substrate.ateapi.v1.Actor\"\v\x82\xb5\x18\a\n" + "\x05Actor\x12_\n" + @@ -10615,7 +11531,25 @@ const file_api_ateapi_v1_ateapi_proto_rawDesc = "" + "\bAtespace\x12k\n" + "\x0eDeleteAtespace\x12*.substrate.ateapi.v1.DeleteAtespaceRequest\x1a\x1d.substrate.ateapi.v1.Atespace\"\x0e\x82\xb5\x18\n" + "\n" + - "\bAtespace\x12\x7f\n" + + "\bAtespace\x12\x97\x01\n" + + "\x19CreateExternalVolumeClass\x125.substrate.ateapi.v1.CreateExternalVolumeClassRequest\x1a(.substrate.ateapi.v1.ExternalVolumeClass\"\x19\x82\xb5\x18\x15\n" + + "\x13ExternalVolumeClass\x12\x91\x01\n" + + "\x16GetExternalVolumeClass\x122.substrate.ateapi.v1.GetExternalVolumeClassRequest\x1a(.substrate.ateapi.v1.ExternalVolumeClass\"\x19\x82\xb5\x18\x15\n" + + "\x13ExternalVolumeClass\x12\xa5\x01\n" + + "\x19ListExternalVolumeClasses\x125.substrate.ateapi.v1.ListExternalVolumeClassesRequest\x1a6.substrate.ateapi.v1.ListExternalVolumeClassesResponse\"\x19\x82\xb5\x18\x15\n" + + "\x13ExternalVolumeClass\x12\x97\x01\n" + + "\x19DeleteExternalVolumeClass\x125.substrate.ateapi.v1.DeleteExternalVolumeClassRequest\x1a(.substrate.ateapi.v1.ExternalVolumeClass\"\x19\x82\xb5\x18\x15\n" + + "\x13ExternalVolumeClass\x12\x87\x01\n" + + "\x15CreateCsiDriverConfig\x121.substrate.ateapi.v1.CreateCsiDriverConfigRequest\x1a$.substrate.ateapi.v1.CsiDriverConfig\"\x15\x82\xb5\x18\x11\n" + + "\x0fCsiDriverConfig\x12\x81\x01\n" + + "\x12GetCsiDriverConfig\x12..substrate.ateapi.v1.GetCsiDriverConfigRequest\x1a$.substrate.ateapi.v1.CsiDriverConfig\"\x15\x82\xb5\x18\x11\n" + + "\x0fCsiDriverConfig\x12\x92\x01\n" + + "\x14ListCsiDriverConfigs\x120.substrate.ateapi.v1.ListCsiDriverConfigsRequest\x1a1.substrate.ateapi.v1.ListCsiDriverConfigsResponse\"\x15\x82\xb5\x18\x11\n" + + "\x0fCsiDriverConfig\x12\x87\x01\n" + + "\x15UpdateCsiDriverConfig\x121.substrate.ateapi.v1.UpdateCsiDriverConfigRequest\x1a$.substrate.ateapi.v1.CsiDriverConfig\"\x15\x82\xb5\x18\x11\n" + + "\x0fCsiDriverConfig\x12\x87\x01\n" + + "\x15DeleteCsiDriverConfig\x121.substrate.ateapi.v1.DeleteCsiDriverConfigRequest\x1a$.substrate.ateapi.v1.CsiDriverConfig\"\x15\x82\xb5\x18\x11\n" + + "\x0fCsiDriverConfig\x12\x7f\n" + "\x13CreateActorTemplate\x12/.substrate.ateapi.v1.CreateActorTemplateRequest\x1a\".substrate.ateapi.v1.ActorTemplate\"\x13\x82\xb5\x18\x0f\n" + "\rActorTemplate\x12y\n" + "\x10GetActorTemplate\x12,.substrate.ateapi.v1.GetActorTemplateRequest\x1a\".substrate.ateapi.v1.ActorTemplate\"\x13\x82\xb5\x18\x0f\n" + @@ -10663,7 +11597,7 @@ func file_api_ateapi_v1_ateapi_proto_rawDescGZIP() []byte { } var file_api_ateapi_v1_ateapi_proto_enumTypes = make([]protoimpl.EnumInfo, 10) -var file_api_ateapi_v1_ateapi_proto_msgTypes = make([]protoimpl.MessageInfo, 143) +var file_api_ateapi_v1_ateapi_proto_msgTypes = make([]protoimpl.MessageInfo, 158) var file_api_ateapi_v1_ateapi_proto_goTypes = []any{ (SnapshotOwner)(0), // 0: substrate.ateapi.v1.SnapshotOwner (SnapshotStorageState)(0), // 1: substrate.ateapi.v1.SnapshotStorageState @@ -10719,108 +11653,123 @@ var file_api_ateapi_v1_ateapi_proto_goTypes = []any{ (*ImageVolumeSource)(nil), // 51: substrate.ateapi.v1.ImageVolumeSource (*DurableDirVolumeSource)(nil), // 52: substrate.ateapi.v1.DurableDirVolumeSource (*ExternalVolumeTemplate)(nil), // 53: substrate.ateapi.v1.ExternalVolumeTemplate - (*SystemInfoVolumeSource)(nil), // 54: substrate.ateapi.v1.SystemInfoVolumeSource - (*SystemInfoDataSource)(nil), // 55: substrate.ateapi.v1.SystemInfoDataSource - (*ActorMetadataDataSource)(nil), // 56: substrate.ateapi.v1.ActorMetadataDataSource - (*ActorMetadataItem)(nil), // 57: substrate.ateapi.v1.ActorMetadataItem - (*TrustBundleDataSource)(nil), // 58: substrate.ateapi.v1.TrustBundleDataSource - (*VolumeMount)(nil), // 59: substrate.ateapi.v1.VolumeMount - (*CreateAtespaceRequest)(nil), // 60: substrate.ateapi.v1.CreateAtespaceRequest - (*GetAtespaceRequest)(nil), // 61: substrate.ateapi.v1.GetAtespaceRequest - (*ListAtespacesRequest)(nil), // 62: substrate.ateapi.v1.ListAtespacesRequest - (*ListAtespacesResponse)(nil), // 63: substrate.ateapi.v1.ListAtespacesResponse - (*DeleteAtespaceRequest)(nil), // 64: substrate.ateapi.v1.DeleteAtespaceRequest - (*CreateActorTemplateRequest)(nil), // 65: substrate.ateapi.v1.CreateActorTemplateRequest - (*GetActorTemplateRequest)(nil), // 66: substrate.ateapi.v1.GetActorTemplateRequest - (*ListActorTemplatesRequest)(nil), // 67: substrate.ateapi.v1.ListActorTemplatesRequest - (*ListActorTemplatesResponse)(nil), // 68: substrate.ateapi.v1.ListActorTemplatesResponse - (*DeleteActorTemplateRequest)(nil), // 69: substrate.ateapi.v1.DeleteActorTemplateRequest - (*GetActorRequest)(nil), // 70: substrate.ateapi.v1.GetActorRequest - (*CreateActorRequest)(nil), // 71: substrate.ateapi.v1.CreateActorRequest - (*UpdateActorRequest)(nil), // 72: substrate.ateapi.v1.UpdateActorRequest - (*SuspendActorRequest)(nil), // 73: substrate.ateapi.v1.SuspendActorRequest - (*SuspendActorResponse)(nil), // 74: substrate.ateapi.v1.SuspendActorResponse - (*SuspendOptions)(nil), // 75: substrate.ateapi.v1.SuspendOptions - (*ResumeActorRequest)(nil), // 76: substrate.ateapi.v1.ResumeActorRequest - (*ResumeActorResponse)(nil), // 77: substrate.ateapi.v1.ResumeActorResponse - (*RevertActorRequest)(nil), // 78: substrate.ateapi.v1.RevertActorRequest - (*RevertActorResponse)(nil), // 79: substrate.ateapi.v1.RevertActorResponse - (*DeleteActorRequest)(nil), // 80: substrate.ateapi.v1.DeleteActorRequest - (*GetActorEgressPolicyRequest)(nil), // 81: substrate.ateapi.v1.GetActorEgressPolicyRequest - (*CreateActorEgressPolicyRequest)(nil), // 82: substrate.ateapi.v1.CreateActorEgressPolicyRequest - (*UpdateActorEgressPolicyRequest)(nil), // 83: substrate.ateapi.v1.UpdateActorEgressPolicyRequest - (*DeleteActorEgressPolicyRequest)(nil), // 84: substrate.ateapi.v1.DeleteActorEgressPolicyRequest - (*GetTagRequest)(nil), // 85: substrate.ateapi.v1.GetTagRequest - (*MintActorJwtRequest)(nil), // 86: substrate.ateapi.v1.MintActorJwtRequest - (*MintActorJwtResponse)(nil), // 87: substrate.ateapi.v1.MintActorJwtResponse - (*ListTagsRequest)(nil), // 88: substrate.ateapi.v1.ListTagsRequest - (*ListTagsResponse)(nil), // 89: substrate.ateapi.v1.ListTagsResponse - (*CreateTagRequest)(nil), // 90: substrate.ateapi.v1.CreateTagRequest - (*UpdateTagRequest)(nil), // 91: substrate.ateapi.v1.UpdateTagRequest - (*DeleteTagRequest)(nil), // 92: substrate.ateapi.v1.DeleteTagRequest - (*DeleteOptions)(nil), // 93: substrate.ateapi.v1.DeleteOptions - (*ListOptions)(nil), // 94: substrate.ateapi.v1.ListOptions - (*ListWorkerActorAssignmentsRequest)(nil), // 95: substrate.ateapi.v1.ListWorkerActorAssignmentsRequest - (*ListWorkerActorAssignmentsResponse)(nil), // 96: substrate.ateapi.v1.ListWorkerActorAssignmentsResponse - (*ListWorkersRequest)(nil), // 97: substrate.ateapi.v1.ListWorkersRequest - (*ListWorkersResponse)(nil), // 98: substrate.ateapi.v1.ListWorkersResponse - (*GetWorkerRequest)(nil), // 99: substrate.ateapi.v1.GetWorkerRequest - (*CreateWorkerRequest)(nil), // 100: substrate.ateapi.v1.CreateWorkerRequest - (*UpdateWorkerRequest)(nil), // 101: substrate.ateapi.v1.UpdateWorkerRequest - (*DeleteWorkerRequest)(nil), // 102: substrate.ateapi.v1.DeleteWorkerRequest - (*DrainWorkerRequest)(nil), // 103: substrate.ateapi.v1.DrainWorkerRequest - (*DrainWorkerResponse)(nil), // 104: substrate.ateapi.v1.DrainWorkerResponse - (*MarkWorkerAvailableRequest)(nil), // 105: substrate.ateapi.v1.MarkWorkerAvailableRequest - (*MarkWorkerAvailableResponse)(nil), // 106: substrate.ateapi.v1.MarkWorkerAvailableResponse - (*MarkWorkerUnavailableRequest)(nil), // 107: substrate.ateapi.v1.MarkWorkerUnavailableRequest - (*MarkWorkerUnavailableResponse)(nil), // 108: substrate.ateapi.v1.MarkWorkerUnavailableResponse - (*ListActorsRequest)(nil), // 109: substrate.ateapi.v1.ListActorsRequest - (*ListActorsResponse)(nil), // 110: substrate.ateapi.v1.ListActorsResponse - (*Worker)(nil), // 111: substrate.ateapi.v1.Worker - (*WorkerStatus)(nil), // 112: substrate.ateapi.v1.WorkerStatus - (*WorkerSandboxClass)(nil), // 113: substrate.ateapi.v1.WorkerSandboxClass - (*WorkerSandboxRuntime)(nil), // 114: substrate.ateapi.v1.WorkerSandboxRuntime - (*RuntimeOverhead)(nil), // 115: substrate.ateapi.v1.RuntimeOverhead - (*ActorSandboxRuntime)(nil), // 116: substrate.ateapi.v1.ActorSandboxRuntime - (*VersionedSandboxCompat)(nil), // 117: substrate.ateapi.v1.VersionedSandboxCompat - (*AttributeEntry)(nil), // 118: substrate.ateapi.v1.AttributeEntry - (*WorkerResources)(nil), // 119: substrate.ateapi.v1.WorkerResources - (*ActorAssignment)(nil), // 120: substrate.ateapi.v1.ActorAssignment - (*AcquireWorkerEpochRequest)(nil), // 121: substrate.ateapi.v1.AcquireWorkerEpochRequest - (*AcquireWorkerEpochResponse)(nil), // 122: substrate.ateapi.v1.AcquireWorkerEpochResponse - (*RegisterWorkerRequest)(nil), // 123: substrate.ateapi.v1.RegisterWorkerRequest - (*RegisterWorkerResponse)(nil), // 124: substrate.ateapi.v1.RegisterWorkerResponse - (*SetWorkerSandboxRuntimesRequest)(nil), // 125: substrate.ateapi.v1.SetWorkerSandboxRuntimesRequest - (*SetWorkerSandboxRuntimesResponse)(nil), // 126: substrate.ateapi.v1.SetWorkerSandboxRuntimesResponse - (*MintWorkerActorCertificateRequest)(nil), // 127: substrate.ateapi.v1.MintWorkerActorCertificateRequest - (*MintWorkerActorCertificateResponse)(nil), // 128: substrate.ateapi.v1.MintWorkerActorCertificateResponse - (*MintWorkerActorJwtRequest)(nil), // 129: substrate.ateapi.v1.MintWorkerActorJwtRequest - (*MintWorkerActorJwtResponse)(nil), // 130: substrate.ateapi.v1.MintWorkerActorJwtResponse - (*RequestActorSuspendRequest)(nil), // 131: substrate.ateapi.v1.RequestActorSuspendRequest - (*RequestActorSuspendResponse)(nil), // 132: substrate.ateapi.v1.RequestActorSuspendResponse - (*ReportActorCrashedRequest)(nil), // 133: substrate.ateapi.v1.ReportActorCrashedRequest - (*ReportActorCrashedResponse)(nil), // 134: substrate.ateapi.v1.ReportActorCrashedResponse - (*ReportActorSnapshotStateRequest)(nil), // 135: substrate.ateapi.v1.ReportActorSnapshotStateRequest - (*ReportActorSnapshotStateResponse)(nil), // 136: substrate.ateapi.v1.ReportActorSnapshotStateResponse - (*ActorSnapshotState)(nil), // 137: substrate.ateapi.v1.ActorSnapshotState - (*SnapshotReport)(nil), // 138: substrate.ateapi.v1.SnapshotReport - (*AccessPolicy)(nil), // 139: substrate.ateapi.v1.AccessPolicy - (*Binding)(nil), // 140: substrate.ateapi.v1.Binding - (*GetGlobalAccessPolicyRequest)(nil), // 141: substrate.ateapi.v1.GetGlobalAccessPolicyRequest - (*CreateGlobalAccessPolicyRequest)(nil), // 142: substrate.ateapi.v1.CreateGlobalAccessPolicyRequest - (*UpdateGlobalAccessPolicyRequest)(nil), // 143: substrate.ateapi.v1.UpdateGlobalAccessPolicyRequest - (*GetAtespaceAccessPolicyRequest)(nil), // 144: substrate.ateapi.v1.GetAtespaceAccessPolicyRequest - (*CreateAtespaceAccessPolicyRequest)(nil), // 145: substrate.ateapi.v1.CreateAtespaceAccessPolicyRequest - (*UpdateAtespaceAccessPolicyRequest)(nil), // 146: substrate.ateapi.v1.UpdateAtespaceAccessPolicyRequest - (*DeleteAtespaceAccessPolicyRequest)(nil), // 147: substrate.ateapi.v1.DeleteAtespaceAccessPolicyRequest - (*ResourceAnnotation)(nil), // 148: substrate.ateapi.v1.ResourceAnnotation - (*MethodAnnotation)(nil), // 149: substrate.ateapi.v1.MethodAnnotation - nil, // 150: substrate.ateapi.v1.Selector.MatchLabelsEntry - nil, // 151: substrate.ateapi.v1.ExternalVolumeStatus.VolumeContextEntry - nil, // 152: substrate.ateapi.v1.Worker.LabelsEntry - (*timestamppb.Timestamp)(nil), // 153: google.protobuf.Timestamp - (*descriptorpb.MessageOptions)(nil), // 154: google.protobuf.MessageOptions - (*descriptorpb.MethodOptions)(nil), // 155: google.protobuf.MethodOptions + (*ExternalVolumeClass)(nil), // 54: substrate.ateapi.v1.ExternalVolumeClass + (*CsiDriverConfig)(nil), // 55: substrate.ateapi.v1.CsiDriverConfig + (*CsiDriverTlsConfig)(nil), // 56: substrate.ateapi.v1.CsiDriverTlsConfig + (*SystemInfoVolumeSource)(nil), // 57: substrate.ateapi.v1.SystemInfoVolumeSource + (*SystemInfoDataSource)(nil), // 58: substrate.ateapi.v1.SystemInfoDataSource + (*ActorMetadataDataSource)(nil), // 59: substrate.ateapi.v1.ActorMetadataDataSource + (*ActorMetadataItem)(nil), // 60: substrate.ateapi.v1.ActorMetadataItem + (*TrustBundleDataSource)(nil), // 61: substrate.ateapi.v1.TrustBundleDataSource + (*VolumeMount)(nil), // 62: substrate.ateapi.v1.VolumeMount + (*CreateAtespaceRequest)(nil), // 63: substrate.ateapi.v1.CreateAtespaceRequest + (*GetAtespaceRequest)(nil), // 64: substrate.ateapi.v1.GetAtespaceRequest + (*ListAtespacesRequest)(nil), // 65: substrate.ateapi.v1.ListAtespacesRequest + (*ListAtespacesResponse)(nil), // 66: substrate.ateapi.v1.ListAtespacesResponse + (*DeleteAtespaceRequest)(nil), // 67: substrate.ateapi.v1.DeleteAtespaceRequest + (*CreateExternalVolumeClassRequest)(nil), // 68: substrate.ateapi.v1.CreateExternalVolumeClassRequest + (*GetExternalVolumeClassRequest)(nil), // 69: substrate.ateapi.v1.GetExternalVolumeClassRequest + (*ListExternalVolumeClassesRequest)(nil), // 70: substrate.ateapi.v1.ListExternalVolumeClassesRequest + (*ListExternalVolumeClassesResponse)(nil), // 71: substrate.ateapi.v1.ListExternalVolumeClassesResponse + (*DeleteExternalVolumeClassRequest)(nil), // 72: substrate.ateapi.v1.DeleteExternalVolumeClassRequest + (*CreateCsiDriverConfigRequest)(nil), // 73: substrate.ateapi.v1.CreateCsiDriverConfigRequest + (*GetCsiDriverConfigRequest)(nil), // 74: substrate.ateapi.v1.GetCsiDriverConfigRequest + (*ListCsiDriverConfigsRequest)(nil), // 75: substrate.ateapi.v1.ListCsiDriverConfigsRequest + (*ListCsiDriverConfigsResponse)(nil), // 76: substrate.ateapi.v1.ListCsiDriverConfigsResponse + (*UpdateCsiDriverConfigRequest)(nil), // 77: substrate.ateapi.v1.UpdateCsiDriverConfigRequest + (*DeleteCsiDriverConfigRequest)(nil), // 78: substrate.ateapi.v1.DeleteCsiDriverConfigRequest + (*CreateActorTemplateRequest)(nil), // 79: substrate.ateapi.v1.CreateActorTemplateRequest + (*GetActorTemplateRequest)(nil), // 80: substrate.ateapi.v1.GetActorTemplateRequest + (*ListActorTemplatesRequest)(nil), // 81: substrate.ateapi.v1.ListActorTemplatesRequest + (*ListActorTemplatesResponse)(nil), // 82: substrate.ateapi.v1.ListActorTemplatesResponse + (*DeleteActorTemplateRequest)(nil), // 83: substrate.ateapi.v1.DeleteActorTemplateRequest + (*GetActorRequest)(nil), // 84: substrate.ateapi.v1.GetActorRequest + (*CreateActorRequest)(nil), // 85: substrate.ateapi.v1.CreateActorRequest + (*UpdateActorRequest)(nil), // 86: substrate.ateapi.v1.UpdateActorRequest + (*SuspendActorRequest)(nil), // 87: substrate.ateapi.v1.SuspendActorRequest + (*SuspendActorResponse)(nil), // 88: substrate.ateapi.v1.SuspendActorResponse + (*SuspendOptions)(nil), // 89: substrate.ateapi.v1.SuspendOptions + (*ResumeActorRequest)(nil), // 90: substrate.ateapi.v1.ResumeActorRequest + (*ResumeActorResponse)(nil), // 91: substrate.ateapi.v1.ResumeActorResponse + (*RevertActorRequest)(nil), // 92: substrate.ateapi.v1.RevertActorRequest + (*RevertActorResponse)(nil), // 93: substrate.ateapi.v1.RevertActorResponse + (*DeleteActorRequest)(nil), // 94: substrate.ateapi.v1.DeleteActorRequest + (*GetActorEgressPolicyRequest)(nil), // 95: substrate.ateapi.v1.GetActorEgressPolicyRequest + (*CreateActorEgressPolicyRequest)(nil), // 96: substrate.ateapi.v1.CreateActorEgressPolicyRequest + (*UpdateActorEgressPolicyRequest)(nil), // 97: substrate.ateapi.v1.UpdateActorEgressPolicyRequest + (*DeleteActorEgressPolicyRequest)(nil), // 98: substrate.ateapi.v1.DeleteActorEgressPolicyRequest + (*GetTagRequest)(nil), // 99: substrate.ateapi.v1.GetTagRequest + (*MintActorJwtRequest)(nil), // 100: substrate.ateapi.v1.MintActorJwtRequest + (*MintActorJwtResponse)(nil), // 101: substrate.ateapi.v1.MintActorJwtResponse + (*ListTagsRequest)(nil), // 102: substrate.ateapi.v1.ListTagsRequest + (*ListTagsResponse)(nil), // 103: substrate.ateapi.v1.ListTagsResponse + (*CreateTagRequest)(nil), // 104: substrate.ateapi.v1.CreateTagRequest + (*UpdateTagRequest)(nil), // 105: substrate.ateapi.v1.UpdateTagRequest + (*DeleteTagRequest)(nil), // 106: substrate.ateapi.v1.DeleteTagRequest + (*DeleteOptions)(nil), // 107: substrate.ateapi.v1.DeleteOptions + (*ListOptions)(nil), // 108: substrate.ateapi.v1.ListOptions + (*ListWorkerActorAssignmentsRequest)(nil), // 109: substrate.ateapi.v1.ListWorkerActorAssignmentsRequest + (*ListWorkerActorAssignmentsResponse)(nil), // 110: substrate.ateapi.v1.ListWorkerActorAssignmentsResponse + (*ListWorkersRequest)(nil), // 111: substrate.ateapi.v1.ListWorkersRequest + (*ListWorkersResponse)(nil), // 112: substrate.ateapi.v1.ListWorkersResponse + (*GetWorkerRequest)(nil), // 113: substrate.ateapi.v1.GetWorkerRequest + (*CreateWorkerRequest)(nil), // 114: substrate.ateapi.v1.CreateWorkerRequest + (*UpdateWorkerRequest)(nil), // 115: substrate.ateapi.v1.UpdateWorkerRequest + (*DeleteWorkerRequest)(nil), // 116: substrate.ateapi.v1.DeleteWorkerRequest + (*DrainWorkerRequest)(nil), // 117: substrate.ateapi.v1.DrainWorkerRequest + (*DrainWorkerResponse)(nil), // 118: substrate.ateapi.v1.DrainWorkerResponse + (*MarkWorkerAvailableRequest)(nil), // 119: substrate.ateapi.v1.MarkWorkerAvailableRequest + (*MarkWorkerAvailableResponse)(nil), // 120: substrate.ateapi.v1.MarkWorkerAvailableResponse + (*MarkWorkerUnavailableRequest)(nil), // 121: substrate.ateapi.v1.MarkWorkerUnavailableRequest + (*MarkWorkerUnavailableResponse)(nil), // 122: substrate.ateapi.v1.MarkWorkerUnavailableResponse + (*ListActorsRequest)(nil), // 123: substrate.ateapi.v1.ListActorsRequest + (*ListActorsResponse)(nil), // 124: substrate.ateapi.v1.ListActorsResponse + (*Worker)(nil), // 125: substrate.ateapi.v1.Worker + (*WorkerStatus)(nil), // 126: substrate.ateapi.v1.WorkerStatus + (*WorkerSandboxClass)(nil), // 127: substrate.ateapi.v1.WorkerSandboxClass + (*WorkerSandboxRuntime)(nil), // 128: substrate.ateapi.v1.WorkerSandboxRuntime + (*RuntimeOverhead)(nil), // 129: substrate.ateapi.v1.RuntimeOverhead + (*ActorSandboxRuntime)(nil), // 130: substrate.ateapi.v1.ActorSandboxRuntime + (*VersionedSandboxCompat)(nil), // 131: substrate.ateapi.v1.VersionedSandboxCompat + (*AttributeEntry)(nil), // 132: substrate.ateapi.v1.AttributeEntry + (*WorkerResources)(nil), // 133: substrate.ateapi.v1.WorkerResources + (*ActorAssignment)(nil), // 134: substrate.ateapi.v1.ActorAssignment + (*AcquireWorkerEpochRequest)(nil), // 135: substrate.ateapi.v1.AcquireWorkerEpochRequest + (*AcquireWorkerEpochResponse)(nil), // 136: substrate.ateapi.v1.AcquireWorkerEpochResponse + (*RegisterWorkerRequest)(nil), // 137: substrate.ateapi.v1.RegisterWorkerRequest + (*RegisterWorkerResponse)(nil), // 138: substrate.ateapi.v1.RegisterWorkerResponse + (*SetWorkerSandboxRuntimesRequest)(nil), // 139: substrate.ateapi.v1.SetWorkerSandboxRuntimesRequest + (*SetWorkerSandboxRuntimesResponse)(nil), // 140: substrate.ateapi.v1.SetWorkerSandboxRuntimesResponse + (*MintWorkerActorCertificateRequest)(nil), // 141: substrate.ateapi.v1.MintWorkerActorCertificateRequest + (*MintWorkerActorCertificateResponse)(nil), // 142: substrate.ateapi.v1.MintWorkerActorCertificateResponse + (*MintWorkerActorJwtRequest)(nil), // 143: substrate.ateapi.v1.MintWorkerActorJwtRequest + (*MintWorkerActorJwtResponse)(nil), // 144: substrate.ateapi.v1.MintWorkerActorJwtResponse + (*RequestActorSuspendRequest)(nil), // 145: substrate.ateapi.v1.RequestActorSuspendRequest + (*RequestActorSuspendResponse)(nil), // 146: substrate.ateapi.v1.RequestActorSuspendResponse + (*ReportActorCrashedRequest)(nil), // 147: substrate.ateapi.v1.ReportActorCrashedRequest + (*ReportActorCrashedResponse)(nil), // 148: substrate.ateapi.v1.ReportActorCrashedResponse + (*ReportActorSnapshotStateRequest)(nil), // 149: substrate.ateapi.v1.ReportActorSnapshotStateRequest + (*ReportActorSnapshotStateResponse)(nil), // 150: substrate.ateapi.v1.ReportActorSnapshotStateResponse + (*ActorSnapshotState)(nil), // 151: substrate.ateapi.v1.ActorSnapshotState + (*SnapshotReport)(nil), // 152: substrate.ateapi.v1.SnapshotReport + (*AccessPolicy)(nil), // 153: substrate.ateapi.v1.AccessPolicy + (*Binding)(nil), // 154: substrate.ateapi.v1.Binding + (*GetGlobalAccessPolicyRequest)(nil), // 155: substrate.ateapi.v1.GetGlobalAccessPolicyRequest + (*CreateGlobalAccessPolicyRequest)(nil), // 156: substrate.ateapi.v1.CreateGlobalAccessPolicyRequest + (*UpdateGlobalAccessPolicyRequest)(nil), // 157: substrate.ateapi.v1.UpdateGlobalAccessPolicyRequest + (*GetAtespaceAccessPolicyRequest)(nil), // 158: substrate.ateapi.v1.GetAtespaceAccessPolicyRequest + (*CreateAtespaceAccessPolicyRequest)(nil), // 159: substrate.ateapi.v1.CreateAtespaceAccessPolicyRequest + (*UpdateAtespaceAccessPolicyRequest)(nil), // 160: substrate.ateapi.v1.UpdateAtespaceAccessPolicyRequest + (*DeleteAtespaceAccessPolicyRequest)(nil), // 161: substrate.ateapi.v1.DeleteAtespaceAccessPolicyRequest + (*ResourceAnnotation)(nil), // 162: substrate.ateapi.v1.ResourceAnnotation + (*MethodAnnotation)(nil), // 163: substrate.ateapi.v1.MethodAnnotation + nil, // 164: substrate.ateapi.v1.Selector.MatchLabelsEntry + nil, // 165: substrate.ateapi.v1.ExternalVolumeStatus.VolumeContextEntry + nil, // 166: substrate.ateapi.v1.ExternalVolumeClass.ParametersEntry + nil, // 167: substrate.ateapi.v1.Worker.LabelsEntry + (*timestamppb.Timestamp)(nil), // 168: google.protobuf.Timestamp + (*descriptorpb.MessageOptions)(nil), // 169: google.protobuf.MessageOptions + (*descriptorpb.MethodOptions)(nil), // 170: google.protobuf.MethodOptions } var file_api_ateapi_v1_ateapi_proto_depIdxs = []int32{ 1, // 0: substrate.ateapi.v1.SnapshotStorage.state:type_name -> substrate.ateapi.v1.SnapshotStorageState @@ -10828,13 +11777,13 @@ var file_api_ateapi_v1_ateapi_proto_depIdxs = []int32{ 0, // 2: substrate.ateapi.v1.Snapshot.owner:type_name -> substrate.ateapi.v1.SnapshotOwner 2, // 3: substrate.ateapi.v1.Snapshot.fidelity:type_name -> substrate.ateapi.v1.SnapshotFidelity 11, // 4: substrate.ateapi.v1.Snapshot.durable_snapshot:type_name -> substrate.ateapi.v1.SnapshotStorage - 116, // 5: substrate.ateapi.v1.Snapshot.sandbox_runtime:type_name -> substrate.ateapi.v1.ActorSandboxRuntime - 150, // 6: substrate.ateapi.v1.Selector.match_labels:type_name -> substrate.ateapi.v1.Selector.MatchLabelsEntry - 153, // 7: substrate.ateapi.v1.ResourceMetadata.create_time:type_name -> google.protobuf.Timestamp - 153, // 8: substrate.ateapi.v1.ResourceMetadata.update_time:type_name -> google.protobuf.Timestamp - 153, // 9: substrate.ateapi.v1.ResourceMetadata.delete_time:type_name -> google.protobuf.Timestamp + 130, // 5: substrate.ateapi.v1.Snapshot.sandbox_runtime:type_name -> substrate.ateapi.v1.ActorSandboxRuntime + 164, // 6: substrate.ateapi.v1.Selector.match_labels:type_name -> substrate.ateapi.v1.Selector.MatchLabelsEntry + 168, // 7: substrate.ateapi.v1.ResourceMetadata.create_time:type_name -> google.protobuf.Timestamp + 168, // 8: substrate.ateapi.v1.ResourceMetadata.update_time:type_name -> google.protobuf.Timestamp + 168, // 9: substrate.ateapi.v1.ResourceMetadata.delete_time:type_name -> google.protobuf.Timestamp 16, // 10: substrate.ateapi.v1.ExternalVolumes.volumes:type_name -> substrate.ateapi.v1.ExternalVolumeStatus - 151, // 11: substrate.ateapi.v1.ExternalVolumeStatus.volume_context:type_name -> substrate.ateapi.v1.ExternalVolumeStatus.VolumeContextEntry + 165, // 11: substrate.ateapi.v1.ExternalVolumeStatus.volume_context:type_name -> substrate.ateapi.v1.ExternalVolumeStatus.VolumeContextEntry 14, // 12: substrate.ateapi.v1.Actor.metadata:type_name -> substrate.ateapi.v1.ResourceMetadata 35, // 13: substrate.ateapi.v1.Actor.actor_template:type_name -> substrate.ateapi.v1.ObjectRef 13, // 14: substrate.ateapi.v1.Actor.worker_selector:type_name -> substrate.ateapi.v1.Selector @@ -10859,9 +11808,9 @@ var file_api_ateapi_v1_ateapi_proto_depIdxs = []int32{ 15, // 33: substrate.ateapi.v1.ActorStatus.external_volumes:type_name -> substrate.ateapi.v1.ExternalVolumes 30, // 34: substrate.ateapi.v1.ActorStatus.crash:type_name -> substrate.ateapi.v1.ActorCrash 12, // 35: substrate.ateapi.v1.ActorStatus.snapshots:type_name -> substrate.ateapi.v1.Snapshot - 153, // 36: substrate.ateapi.v1.ActorCrash.crash_time:type_name -> google.protobuf.Timestamp + 168, // 36: substrate.ateapi.v1.ActorCrash.crash_time:type_name -> google.protobuf.Timestamp 35, // 37: substrate.ateapi.v1.WorkerAssignment.worker:type_name -> substrate.ateapi.v1.ObjectRef - 116, // 38: substrate.ateapi.v1.WorkerAssignment.sandbox_runtime:type_name -> substrate.ateapi.v1.ActorSandboxRuntime + 130, // 38: substrate.ateapi.v1.WorkerAssignment.sandbox_runtime:type_name -> substrate.ateapi.v1.ActorSandboxRuntime 12, // 39: substrate.ateapi.v1.TagStatus.snapshot:type_name -> substrate.ateapi.v1.Snapshot 14, // 40: substrate.ateapi.v1.Tag.metadata:type_name -> substrate.ateapi.v1.ResourceMetadata 32, // 41: substrate.ateapi.v1.Tag.status:type_name -> substrate.ateapi.v1.TagStatus @@ -10878,251 +11827,287 @@ var file_api_ateapi_v1_ateapi_proto_depIdxs = []int32{ 40, // 52: substrate.ateapi.v1.ActorTemplate.status:type_name -> substrate.ateapi.v1.ActorTemplateStatus 38, // 53: substrate.ateapi.v1.ResourceRequirements.limits:type_name -> substrate.ateapi.v1.Resources 35, // 54: substrate.ateapi.v1.GoldenSnapshotStatus.golden_tag:type_name -> substrate.ateapi.v1.ObjectRef - 153, // 55: substrate.ateapi.v1.GoldenSnapshotStatus.snapshot_time:type_name -> google.protobuf.Timestamp + 168, // 55: substrate.ateapi.v1.GoldenSnapshotStatus.snapshot_time:type_name -> google.protobuf.Timestamp 39, // 56: substrate.ateapi.v1.ActorTemplateStatus.golden_snapshot_status:type_name -> substrate.ateapi.v1.GoldenSnapshotStatus 2, // 57: substrate.ateapi.v1.SnapshotConfig.preferred_fidelity:type_name -> substrate.ateapi.v1.SnapshotFidelity 42, // 58: substrate.ateapi.v1.SnapshotConfig.golden_snapshot_config:type_name -> substrate.ateapi.v1.GoldenSnapshotConfig 5, // 59: substrate.ateapi.v1.GoldenSnapshotConfig.mode:type_name -> substrate.ateapi.v1.GoldenSnapshotMode 46, // 60: substrate.ateapi.v1.Container.env:type_name -> substrate.ateapi.v1.EnvVar 47, // 61: substrate.ateapi.v1.Container.wakeup_probe:type_name -> substrate.ateapi.v1.WakeupProbe - 59, // 62: substrate.ateapi.v1.Container.volume_mounts:type_name -> substrate.ateapi.v1.VolumeMount + 62, // 62: substrate.ateapi.v1.Container.volume_mounts:type_name -> substrate.ateapi.v1.VolumeMount 44, // 63: substrate.ateapi.v1.Container.security_context:type_name -> substrate.ateapi.v1.SecurityContext 37, // 64: substrate.ateapi.v1.Container.resources:type_name -> substrate.ateapi.v1.ResourceRequirements 45, // 65: substrate.ateapi.v1.SecurityContext.capabilities:type_name -> substrate.ateapi.v1.Capabilities 48, // 66: substrate.ateapi.v1.WakeupProbe.http_get:type_name -> substrate.ateapi.v1.HttpGetAction 52, // 67: substrate.ateapi.v1.Volume.durable_dir:type_name -> substrate.ateapi.v1.DurableDirVolumeSource 50, // 68: substrate.ateapi.v1.Volume.external:type_name -> substrate.ateapi.v1.ExternalVolumeSource - 54, // 69: substrate.ateapi.v1.Volume.system_info:type_name -> substrate.ateapi.v1.SystemInfoVolumeSource + 57, // 69: substrate.ateapi.v1.Volume.system_info:type_name -> substrate.ateapi.v1.SystemInfoVolumeSource 51, // 70: substrate.ateapi.v1.Volume.image:type_name -> substrate.ateapi.v1.ImageVolumeSource 53, // 71: substrate.ateapi.v1.ExternalVolumeSource.template:type_name -> substrate.ateapi.v1.ExternalVolumeTemplate - 55, // 72: substrate.ateapi.v1.SystemInfoVolumeSource.data_sources:type_name -> substrate.ateapi.v1.SystemInfoDataSource - 56, // 73: substrate.ateapi.v1.SystemInfoDataSource.actor_metadata:type_name -> substrate.ateapi.v1.ActorMetadataDataSource - 58, // 74: substrate.ateapi.v1.SystemInfoDataSource.trust_bundle:type_name -> substrate.ateapi.v1.TrustBundleDataSource - 57, // 75: substrate.ateapi.v1.ActorMetadataDataSource.items:type_name -> substrate.ateapi.v1.ActorMetadataItem - 6, // 76: substrate.ateapi.v1.ActorMetadataItem.field:type_name -> substrate.ateapi.v1.ActorMetadataField - 34, // 77: substrate.ateapi.v1.CreateAtespaceRequest.atespace:type_name -> substrate.ateapi.v1.Atespace - 35, // 78: substrate.ateapi.v1.GetAtespaceRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef - 94, // 79: substrate.ateapi.v1.ListAtespacesRequest.options:type_name -> substrate.ateapi.v1.ListOptions - 34, // 80: substrate.ateapi.v1.ListAtespacesResponse.atespaces:type_name -> substrate.ateapi.v1.Atespace - 35, // 81: substrate.ateapi.v1.DeleteAtespaceRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef - 93, // 82: substrate.ateapi.v1.DeleteAtespaceRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions - 36, // 83: substrate.ateapi.v1.CreateActorTemplateRequest.actor_template:type_name -> substrate.ateapi.v1.ActorTemplate - 35, // 84: substrate.ateapi.v1.GetActorTemplateRequest.actor_template:type_name -> substrate.ateapi.v1.ObjectRef - 94, // 85: substrate.ateapi.v1.ListActorTemplatesRequest.options:type_name -> substrate.ateapi.v1.ListOptions - 36, // 86: substrate.ateapi.v1.ListActorTemplatesResponse.actor_templates:type_name -> substrate.ateapi.v1.ActorTemplate - 35, // 87: substrate.ateapi.v1.DeleteActorTemplateRequest.actor_template:type_name -> substrate.ateapi.v1.ObjectRef - 93, // 88: substrate.ateapi.v1.DeleteActorTemplateRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions - 35, // 89: substrate.ateapi.v1.GetActorRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 17, // 90: substrate.ateapi.v1.CreateActorRequest.actor:type_name -> substrate.ateapi.v1.Actor - 17, // 91: substrate.ateapi.v1.UpdateActorRequest.actor:type_name -> substrate.ateapi.v1.Actor - 35, // 92: substrate.ateapi.v1.SuspendActorRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 75, // 93: substrate.ateapi.v1.SuspendActorRequest.options:type_name -> substrate.ateapi.v1.SuspendOptions - 17, // 94: substrate.ateapi.v1.SuspendActorResponse.actor:type_name -> substrate.ateapi.v1.Actor - 7, // 95: substrate.ateapi.v1.SuspendOptions.mode:type_name -> substrate.ateapi.v1.DurabilityMode - 35, // 96: substrate.ateapi.v1.ResumeActorRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 17, // 97: substrate.ateapi.v1.ResumeActorResponse.actor:type_name -> substrate.ateapi.v1.Actor - 35, // 98: substrate.ateapi.v1.RevertActorRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 17, // 99: substrate.ateapi.v1.RevertActorResponse.actor:type_name -> substrate.ateapi.v1.Actor - 35, // 100: substrate.ateapi.v1.DeleteActorRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 93, // 101: substrate.ateapi.v1.DeleteActorRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions - 35, // 102: substrate.ateapi.v1.GetActorEgressPolicyRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 35, // 103: substrate.ateapi.v1.CreateActorEgressPolicyRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 18, // 104: substrate.ateapi.v1.CreateActorEgressPolicyRequest.egress_policy:type_name -> substrate.ateapi.v1.EgressPolicy - 35, // 105: substrate.ateapi.v1.UpdateActorEgressPolicyRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 18, // 106: substrate.ateapi.v1.UpdateActorEgressPolicyRequest.egress_policy:type_name -> substrate.ateapi.v1.EgressPolicy - 35, // 107: substrate.ateapi.v1.DeleteActorEgressPolicyRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 93, // 108: substrate.ateapi.v1.DeleteActorEgressPolicyRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions - 35, // 109: substrate.ateapi.v1.GetTagRequest.tag:type_name -> substrate.ateapi.v1.ObjectRef - 35, // 110: substrate.ateapi.v1.MintActorJwtRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 153, // 111: substrate.ateapi.v1.MintActorJwtResponse.expire_time:type_name -> google.protobuf.Timestamp - 94, // 112: substrate.ateapi.v1.ListTagsRequest.options:type_name -> substrate.ateapi.v1.ListOptions - 33, // 113: substrate.ateapi.v1.ListTagsResponse.tags:type_name -> substrate.ateapi.v1.Tag - 33, // 114: substrate.ateapi.v1.CreateTagRequest.tag:type_name -> substrate.ateapi.v1.Tag - 33, // 115: substrate.ateapi.v1.UpdateTagRequest.tag:type_name -> substrate.ateapi.v1.Tag - 35, // 116: substrate.ateapi.v1.DeleteTagRequest.tag:type_name -> substrate.ateapi.v1.ObjectRef - 93, // 117: substrate.ateapi.v1.DeleteTagRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions - 35, // 118: substrate.ateapi.v1.ListWorkerActorAssignmentsRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 94, // 119: substrate.ateapi.v1.ListWorkerActorAssignmentsRequest.options:type_name -> substrate.ateapi.v1.ListOptions - 120, // 120: substrate.ateapi.v1.ListWorkerActorAssignmentsResponse.actor_assignments:type_name -> substrate.ateapi.v1.ActorAssignment - 94, // 121: substrate.ateapi.v1.ListWorkersRequest.options:type_name -> substrate.ateapi.v1.ListOptions - 111, // 122: substrate.ateapi.v1.ListWorkersResponse.workers:type_name -> substrate.ateapi.v1.Worker - 35, // 123: substrate.ateapi.v1.GetWorkerRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 111, // 124: substrate.ateapi.v1.CreateWorkerRequest.worker:type_name -> substrate.ateapi.v1.Worker - 111, // 125: substrate.ateapi.v1.UpdateWorkerRequest.worker:type_name -> substrate.ateapi.v1.Worker - 35, // 126: substrate.ateapi.v1.DeleteWorkerRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 93, // 127: substrate.ateapi.v1.DeleteWorkerRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions - 35, // 128: substrate.ateapi.v1.DrainWorkerRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 111, // 129: substrate.ateapi.v1.DrainWorkerResponse.worker:type_name -> substrate.ateapi.v1.Worker - 35, // 130: substrate.ateapi.v1.MarkWorkerAvailableRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 111, // 131: substrate.ateapi.v1.MarkWorkerAvailableResponse.worker:type_name -> substrate.ateapi.v1.Worker - 35, // 132: substrate.ateapi.v1.MarkWorkerUnavailableRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 111, // 133: substrate.ateapi.v1.MarkWorkerUnavailableResponse.worker:type_name -> substrate.ateapi.v1.Worker - 94, // 134: substrate.ateapi.v1.ListActorsRequest.options:type_name -> substrate.ateapi.v1.ListOptions - 17, // 135: substrate.ateapi.v1.ListActorsResponse.actors:type_name -> substrate.ateapi.v1.Actor - 14, // 136: substrate.ateapi.v1.Worker.metadata:type_name -> substrate.ateapi.v1.ResourceMetadata - 152, // 137: substrate.ateapi.v1.Worker.labels:type_name -> substrate.ateapi.v1.Worker.LabelsEntry - 112, // 138: substrate.ateapi.v1.Worker.status:type_name -> substrate.ateapi.v1.WorkerStatus - 8, // 139: substrate.ateapi.v1.WorkerStatus.state:type_name -> substrate.ateapi.v1.WorkerState - 119, // 140: substrate.ateapi.v1.WorkerStatus.capacity:type_name -> substrate.ateapi.v1.WorkerResources - 119, // 141: substrate.ateapi.v1.WorkerStatus.allocated:type_name -> substrate.ateapi.v1.WorkerResources - 113, // 142: substrate.ateapi.v1.WorkerStatus.sandbox_classes:type_name -> substrate.ateapi.v1.WorkerSandboxClass - 114, // 143: substrate.ateapi.v1.WorkerSandboxClass.default_runtime:type_name -> substrate.ateapi.v1.WorkerSandboxRuntime - 114, // 144: substrate.ateapi.v1.WorkerSandboxClass.restorable_runtimes:type_name -> substrate.ateapi.v1.WorkerSandboxRuntime - 117, // 145: substrate.ateapi.v1.WorkerSandboxRuntime.version:type_name -> substrate.ateapi.v1.VersionedSandboxCompat - 115, // 146: substrate.ateapi.v1.WorkerSandboxRuntime.actor_overhead:type_name -> substrate.ateapi.v1.RuntimeOverhead - 117, // 147: substrate.ateapi.v1.ActorSandboxRuntime.version:type_name -> substrate.ateapi.v1.VersionedSandboxCompat - 118, // 148: substrate.ateapi.v1.VersionedSandboxCompat.attributes:type_name -> substrate.ateapi.v1.AttributeEntry - 14, // 149: substrate.ateapi.v1.ActorAssignment.metadata:type_name -> substrate.ateapi.v1.ResourceMetadata - 35, // 150: substrate.ateapi.v1.ActorAssignment.actor:type_name -> substrate.ateapi.v1.ObjectRef - 38, // 151: substrate.ateapi.v1.ActorAssignment.resources:type_name -> substrate.ateapi.v1.Resources - 35, // 152: substrate.ateapi.v1.AcquireWorkerEpochRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 35, // 153: substrate.ateapi.v1.RegisterWorkerRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 119, // 154: substrate.ateapi.v1.RegisterWorkerRequest.capacity:type_name -> substrate.ateapi.v1.WorkerResources - 111, // 155: substrate.ateapi.v1.RegisterWorkerResponse.worker:type_name -> substrate.ateapi.v1.Worker - 35, // 156: substrate.ateapi.v1.SetWorkerSandboxRuntimesRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 113, // 157: substrate.ateapi.v1.SetWorkerSandboxRuntimesRequest.sandbox_classes:type_name -> substrate.ateapi.v1.WorkerSandboxClass - 111, // 158: substrate.ateapi.v1.SetWorkerSandboxRuntimesResponse.worker:type_name -> substrate.ateapi.v1.Worker - 35, // 159: substrate.ateapi.v1.MintWorkerActorCertificateRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 35, // 160: substrate.ateapi.v1.MintWorkerActorCertificateRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 35, // 161: substrate.ateapi.v1.MintWorkerActorJwtRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 153, // 162: substrate.ateapi.v1.MintWorkerActorJwtResponse.expire_time:type_name -> google.protobuf.Timestamp - 35, // 163: substrate.ateapi.v1.RequestActorSuspendRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 35, // 164: substrate.ateapi.v1.RequestActorSuspendRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 17, // 165: substrate.ateapi.v1.RequestActorSuspendResponse.actor:type_name -> substrate.ateapi.v1.Actor - 35, // 166: substrate.ateapi.v1.ReportActorCrashedRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef - 35, // 167: substrate.ateapi.v1.ReportActorCrashedRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 17, // 168: substrate.ateapi.v1.ReportActorCrashedResponse.actor:type_name -> substrate.ateapi.v1.Actor - 35, // 169: substrate.ateapi.v1.ReportActorSnapshotStateRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef - 137, // 170: substrate.ateapi.v1.ReportActorSnapshotStateRequest.state:type_name -> substrate.ateapi.v1.ActorSnapshotState - 138, // 171: substrate.ateapi.v1.ActorSnapshotState.latest_local:type_name -> substrate.ateapi.v1.SnapshotReport - 138, // 172: substrate.ateapi.v1.ActorSnapshotState.uploading:type_name -> substrate.ateapi.v1.SnapshotReport - 138, // 173: substrate.ateapi.v1.ActorSnapshotState.latest_durable:type_name -> substrate.ateapi.v1.SnapshotReport - 153, // 174: substrate.ateapi.v1.ActorSnapshotState.upload_due_time:type_name -> google.protobuf.Timestamp - 2, // 175: substrate.ateapi.v1.SnapshotReport.fidelity:type_name -> substrate.ateapi.v1.SnapshotFidelity - 10, // 176: substrate.ateapi.v1.SnapshotReport.object:type_name -> substrate.ateapi.v1.ObjectSnapshot - 153, // 177: substrate.ateapi.v1.SnapshotReport.local_commit_time:type_name -> google.protobuf.Timestamp - 153, // 178: substrate.ateapi.v1.SnapshotReport.durable_complete_time:type_name -> google.protobuf.Timestamp - 14, // 179: substrate.ateapi.v1.AccessPolicy.metadata:type_name -> substrate.ateapi.v1.ResourceMetadata - 140, // 180: substrate.ateapi.v1.AccessPolicy.bindings:type_name -> substrate.ateapi.v1.Binding - 139, // 181: substrate.ateapi.v1.CreateGlobalAccessPolicyRequest.access_policy:type_name -> substrate.ateapi.v1.AccessPolicy - 139, // 182: substrate.ateapi.v1.UpdateGlobalAccessPolicyRequest.access_policy:type_name -> substrate.ateapi.v1.AccessPolicy - 35, // 183: substrate.ateapi.v1.GetAtespaceAccessPolicyRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef - 35, // 184: substrate.ateapi.v1.CreateAtespaceAccessPolicyRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef - 139, // 185: substrate.ateapi.v1.CreateAtespaceAccessPolicyRequest.access_policy:type_name -> substrate.ateapi.v1.AccessPolicy - 35, // 186: substrate.ateapi.v1.UpdateAtespaceAccessPolicyRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef - 139, // 187: substrate.ateapi.v1.UpdateAtespaceAccessPolicyRequest.access_policy:type_name -> substrate.ateapi.v1.AccessPolicy - 35, // 188: substrate.ateapi.v1.DeleteAtespaceAccessPolicyRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef - 93, // 189: substrate.ateapi.v1.DeleteAtespaceAccessPolicyRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions - 9, // 190: substrate.ateapi.v1.ResourceAnnotation.scope:type_name -> substrate.ateapi.v1.Scope - 154, // 191: substrate.ateapi.v1.resource:extendee -> google.protobuf.MessageOptions - 155, // 192: substrate.ateapi.v1.method:extendee -> google.protobuf.MethodOptions - 148, // 193: substrate.ateapi.v1.resource:type_name -> substrate.ateapi.v1.ResourceAnnotation - 149, // 194: substrate.ateapi.v1.method:type_name -> substrate.ateapi.v1.MethodAnnotation - 70, // 195: substrate.ateapi.v1.Control.GetActor:input_type -> substrate.ateapi.v1.GetActorRequest - 71, // 196: substrate.ateapi.v1.Control.CreateActor:input_type -> substrate.ateapi.v1.CreateActorRequest - 72, // 197: substrate.ateapi.v1.Control.UpdateActor:input_type -> substrate.ateapi.v1.UpdateActorRequest - 73, // 198: substrate.ateapi.v1.Control.SuspendActor:input_type -> substrate.ateapi.v1.SuspendActorRequest - 76, // 199: substrate.ateapi.v1.Control.ResumeActor:input_type -> substrate.ateapi.v1.ResumeActorRequest - 78, // 200: substrate.ateapi.v1.Control.RevertActor:input_type -> substrate.ateapi.v1.RevertActorRequest - 80, // 201: substrate.ateapi.v1.Control.DeleteActor:input_type -> substrate.ateapi.v1.DeleteActorRequest - 81, // 202: substrate.ateapi.v1.Control.GetActorEgressPolicy:input_type -> substrate.ateapi.v1.GetActorEgressPolicyRequest - 82, // 203: substrate.ateapi.v1.Control.CreateActorEgressPolicy:input_type -> substrate.ateapi.v1.CreateActorEgressPolicyRequest - 83, // 204: substrate.ateapi.v1.Control.UpdateActorEgressPolicy:input_type -> substrate.ateapi.v1.UpdateActorEgressPolicyRequest - 84, // 205: substrate.ateapi.v1.Control.DeleteActorEgressPolicy:input_type -> substrate.ateapi.v1.DeleteActorEgressPolicyRequest - 86, // 206: substrate.ateapi.v1.Control.MintActorJwt:input_type -> substrate.ateapi.v1.MintActorJwtRequest - 90, // 207: substrate.ateapi.v1.Control.CreateTag:input_type -> substrate.ateapi.v1.CreateTagRequest - 85, // 208: substrate.ateapi.v1.Control.GetTag:input_type -> substrate.ateapi.v1.GetTagRequest - 88, // 209: substrate.ateapi.v1.Control.ListTags:input_type -> substrate.ateapi.v1.ListTagsRequest - 91, // 210: substrate.ateapi.v1.Control.UpdateTag:input_type -> substrate.ateapi.v1.UpdateTagRequest - 92, // 211: substrate.ateapi.v1.Control.DeleteTag:input_type -> substrate.ateapi.v1.DeleteTagRequest - 97, // 212: substrate.ateapi.v1.Control.ListWorkers:input_type -> substrate.ateapi.v1.ListWorkersRequest - 99, // 213: substrate.ateapi.v1.Control.GetWorker:input_type -> substrate.ateapi.v1.GetWorkerRequest - 100, // 214: substrate.ateapi.v1.Control.CreateWorker:input_type -> substrate.ateapi.v1.CreateWorkerRequest - 101, // 215: substrate.ateapi.v1.Control.UpdateWorker:input_type -> substrate.ateapi.v1.UpdateWorkerRequest - 102, // 216: substrate.ateapi.v1.Control.DeleteWorker:input_type -> substrate.ateapi.v1.DeleteWorkerRequest - 103, // 217: substrate.ateapi.v1.Control.DrainWorker:input_type -> substrate.ateapi.v1.DrainWorkerRequest - 105, // 218: substrate.ateapi.v1.Control.MarkWorkerAvailable:input_type -> substrate.ateapi.v1.MarkWorkerAvailableRequest - 107, // 219: substrate.ateapi.v1.Control.MarkWorkerUnavailable:input_type -> substrate.ateapi.v1.MarkWorkerUnavailableRequest - 95, // 220: substrate.ateapi.v1.Control.ListWorkerActorAssignments:input_type -> substrate.ateapi.v1.ListWorkerActorAssignmentsRequest - 109, // 221: substrate.ateapi.v1.Control.ListActors:input_type -> substrate.ateapi.v1.ListActorsRequest - 60, // 222: substrate.ateapi.v1.Control.CreateAtespace:input_type -> substrate.ateapi.v1.CreateAtespaceRequest - 61, // 223: substrate.ateapi.v1.Control.GetAtespace:input_type -> substrate.ateapi.v1.GetAtespaceRequest - 62, // 224: substrate.ateapi.v1.Control.ListAtespaces:input_type -> substrate.ateapi.v1.ListAtespacesRequest - 64, // 225: substrate.ateapi.v1.Control.DeleteAtespace:input_type -> substrate.ateapi.v1.DeleteAtespaceRequest - 65, // 226: substrate.ateapi.v1.Control.CreateActorTemplate:input_type -> substrate.ateapi.v1.CreateActorTemplateRequest - 66, // 227: substrate.ateapi.v1.Control.GetActorTemplate:input_type -> substrate.ateapi.v1.GetActorTemplateRequest - 67, // 228: substrate.ateapi.v1.Control.ListActorTemplates:input_type -> substrate.ateapi.v1.ListActorTemplatesRequest - 69, // 229: substrate.ateapi.v1.Control.DeleteActorTemplate:input_type -> substrate.ateapi.v1.DeleteActorTemplateRequest - 141, // 230: substrate.ateapi.v1.Control.GetGlobalAccessPolicy:input_type -> substrate.ateapi.v1.GetGlobalAccessPolicyRequest - 142, // 231: substrate.ateapi.v1.Control.CreateGlobalAccessPolicy:input_type -> substrate.ateapi.v1.CreateGlobalAccessPolicyRequest - 143, // 232: substrate.ateapi.v1.Control.UpdateGlobalAccessPolicy:input_type -> substrate.ateapi.v1.UpdateGlobalAccessPolicyRequest - 144, // 233: substrate.ateapi.v1.Control.GetAtespaceAccessPolicy:input_type -> substrate.ateapi.v1.GetAtespaceAccessPolicyRequest - 145, // 234: substrate.ateapi.v1.Control.CreateAtespaceAccessPolicy:input_type -> substrate.ateapi.v1.CreateAtespaceAccessPolicyRequest - 146, // 235: substrate.ateapi.v1.Control.UpdateAtespaceAccessPolicy:input_type -> substrate.ateapi.v1.UpdateAtespaceAccessPolicyRequest - 147, // 236: substrate.ateapi.v1.Control.DeleteAtespaceAccessPolicy:input_type -> substrate.ateapi.v1.DeleteAtespaceAccessPolicyRequest - 121, // 237: substrate.ateapi.v1.WorkerService.AcquireWorkerEpoch:input_type -> substrate.ateapi.v1.AcquireWorkerEpochRequest - 123, // 238: substrate.ateapi.v1.WorkerService.RegisterWorker:input_type -> substrate.ateapi.v1.RegisterWorkerRequest - 125, // 239: substrate.ateapi.v1.WorkerService.SetWorkerSandboxRuntimes:input_type -> substrate.ateapi.v1.SetWorkerSandboxRuntimesRequest - 127, // 240: substrate.ateapi.v1.WorkerService.MintWorkerActorCertificate:input_type -> substrate.ateapi.v1.MintWorkerActorCertificateRequest - 129, // 241: substrate.ateapi.v1.WorkerService.MintWorkerActorJwt:input_type -> substrate.ateapi.v1.MintWorkerActorJwtRequest - 131, // 242: substrate.ateapi.v1.WorkerService.RequestActorSuspend:input_type -> substrate.ateapi.v1.RequestActorSuspendRequest - 135, // 243: substrate.ateapi.v1.WorkerService.ReportActorSnapshotState:input_type -> substrate.ateapi.v1.ReportActorSnapshotStateRequest - 133, // 244: substrate.ateapi.v1.WorkerService.ReportActorCrashed:input_type -> substrate.ateapi.v1.ReportActorCrashedRequest - 17, // 245: substrate.ateapi.v1.Control.GetActor:output_type -> substrate.ateapi.v1.Actor - 17, // 246: substrate.ateapi.v1.Control.CreateActor:output_type -> substrate.ateapi.v1.Actor - 17, // 247: substrate.ateapi.v1.Control.UpdateActor:output_type -> substrate.ateapi.v1.Actor - 74, // 248: substrate.ateapi.v1.Control.SuspendActor:output_type -> substrate.ateapi.v1.SuspendActorResponse - 77, // 249: substrate.ateapi.v1.Control.ResumeActor:output_type -> substrate.ateapi.v1.ResumeActorResponse - 79, // 250: substrate.ateapi.v1.Control.RevertActor:output_type -> substrate.ateapi.v1.RevertActorResponse - 17, // 251: substrate.ateapi.v1.Control.DeleteActor:output_type -> substrate.ateapi.v1.Actor - 18, // 252: substrate.ateapi.v1.Control.GetActorEgressPolicy:output_type -> substrate.ateapi.v1.EgressPolicy - 18, // 253: substrate.ateapi.v1.Control.CreateActorEgressPolicy:output_type -> substrate.ateapi.v1.EgressPolicy - 18, // 254: substrate.ateapi.v1.Control.UpdateActorEgressPolicy:output_type -> substrate.ateapi.v1.EgressPolicy - 18, // 255: substrate.ateapi.v1.Control.DeleteActorEgressPolicy:output_type -> substrate.ateapi.v1.EgressPolicy - 87, // 256: substrate.ateapi.v1.Control.MintActorJwt:output_type -> substrate.ateapi.v1.MintActorJwtResponse - 33, // 257: substrate.ateapi.v1.Control.CreateTag:output_type -> substrate.ateapi.v1.Tag - 33, // 258: substrate.ateapi.v1.Control.GetTag:output_type -> substrate.ateapi.v1.Tag - 89, // 259: substrate.ateapi.v1.Control.ListTags:output_type -> substrate.ateapi.v1.ListTagsResponse - 33, // 260: substrate.ateapi.v1.Control.UpdateTag:output_type -> substrate.ateapi.v1.Tag - 33, // 261: substrate.ateapi.v1.Control.DeleteTag:output_type -> substrate.ateapi.v1.Tag - 98, // 262: substrate.ateapi.v1.Control.ListWorkers:output_type -> substrate.ateapi.v1.ListWorkersResponse - 111, // 263: substrate.ateapi.v1.Control.GetWorker:output_type -> substrate.ateapi.v1.Worker - 111, // 264: substrate.ateapi.v1.Control.CreateWorker:output_type -> substrate.ateapi.v1.Worker - 111, // 265: substrate.ateapi.v1.Control.UpdateWorker:output_type -> substrate.ateapi.v1.Worker - 111, // 266: substrate.ateapi.v1.Control.DeleteWorker:output_type -> substrate.ateapi.v1.Worker - 104, // 267: substrate.ateapi.v1.Control.DrainWorker:output_type -> substrate.ateapi.v1.DrainWorkerResponse - 106, // 268: substrate.ateapi.v1.Control.MarkWorkerAvailable:output_type -> substrate.ateapi.v1.MarkWorkerAvailableResponse - 108, // 269: substrate.ateapi.v1.Control.MarkWorkerUnavailable:output_type -> substrate.ateapi.v1.MarkWorkerUnavailableResponse - 96, // 270: substrate.ateapi.v1.Control.ListWorkerActorAssignments:output_type -> substrate.ateapi.v1.ListWorkerActorAssignmentsResponse - 110, // 271: substrate.ateapi.v1.Control.ListActors:output_type -> substrate.ateapi.v1.ListActorsResponse - 34, // 272: substrate.ateapi.v1.Control.CreateAtespace:output_type -> substrate.ateapi.v1.Atespace - 34, // 273: substrate.ateapi.v1.Control.GetAtespace:output_type -> substrate.ateapi.v1.Atespace - 63, // 274: substrate.ateapi.v1.Control.ListAtespaces:output_type -> substrate.ateapi.v1.ListAtespacesResponse - 34, // 275: substrate.ateapi.v1.Control.DeleteAtespace:output_type -> substrate.ateapi.v1.Atespace - 36, // 276: substrate.ateapi.v1.Control.CreateActorTemplate:output_type -> substrate.ateapi.v1.ActorTemplate - 36, // 277: substrate.ateapi.v1.Control.GetActorTemplate:output_type -> substrate.ateapi.v1.ActorTemplate - 68, // 278: substrate.ateapi.v1.Control.ListActorTemplates:output_type -> substrate.ateapi.v1.ListActorTemplatesResponse - 36, // 279: substrate.ateapi.v1.Control.DeleteActorTemplate:output_type -> substrate.ateapi.v1.ActorTemplate - 139, // 280: substrate.ateapi.v1.Control.GetGlobalAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy - 139, // 281: substrate.ateapi.v1.Control.CreateGlobalAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy - 139, // 282: substrate.ateapi.v1.Control.UpdateGlobalAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy - 139, // 283: substrate.ateapi.v1.Control.GetAtespaceAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy - 139, // 284: substrate.ateapi.v1.Control.CreateAtespaceAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy - 139, // 285: substrate.ateapi.v1.Control.UpdateAtespaceAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy - 139, // 286: substrate.ateapi.v1.Control.DeleteAtespaceAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy - 122, // 287: substrate.ateapi.v1.WorkerService.AcquireWorkerEpoch:output_type -> substrate.ateapi.v1.AcquireWorkerEpochResponse - 124, // 288: substrate.ateapi.v1.WorkerService.RegisterWorker:output_type -> substrate.ateapi.v1.RegisterWorkerResponse - 126, // 289: substrate.ateapi.v1.WorkerService.SetWorkerSandboxRuntimes:output_type -> substrate.ateapi.v1.SetWorkerSandboxRuntimesResponse - 128, // 290: substrate.ateapi.v1.WorkerService.MintWorkerActorCertificate:output_type -> substrate.ateapi.v1.MintWorkerActorCertificateResponse - 130, // 291: substrate.ateapi.v1.WorkerService.MintWorkerActorJwt:output_type -> substrate.ateapi.v1.MintWorkerActorJwtResponse - 132, // 292: substrate.ateapi.v1.WorkerService.RequestActorSuspend:output_type -> substrate.ateapi.v1.RequestActorSuspendResponse - 136, // 293: substrate.ateapi.v1.WorkerService.ReportActorSnapshotState:output_type -> substrate.ateapi.v1.ReportActorSnapshotStateResponse - 134, // 294: substrate.ateapi.v1.WorkerService.ReportActorCrashed:output_type -> substrate.ateapi.v1.ReportActorCrashedResponse - 245, // [245:295] is the sub-list for method output_type - 195, // [195:245] is the sub-list for method input_type - 193, // [193:195] is the sub-list for extension type_name - 191, // [191:193] is the sub-list for extension extendee - 0, // [0:191] is the sub-list for field type_name + 35, // 72: substrate.ateapi.v1.ExternalVolumeTemplate.external_volume_class:type_name -> substrate.ateapi.v1.ObjectRef + 14, // 73: substrate.ateapi.v1.ExternalVolumeClass.metadata:type_name -> substrate.ateapi.v1.ResourceMetadata + 166, // 74: substrate.ateapi.v1.ExternalVolumeClass.parameters:type_name -> substrate.ateapi.v1.ExternalVolumeClass.ParametersEntry + 14, // 75: substrate.ateapi.v1.CsiDriverConfig.metadata:type_name -> substrate.ateapi.v1.ResourceMetadata + 56, // 76: substrate.ateapi.v1.CsiDriverConfig.tls:type_name -> substrate.ateapi.v1.CsiDriverTlsConfig + 58, // 77: substrate.ateapi.v1.SystemInfoVolumeSource.data_sources:type_name -> substrate.ateapi.v1.SystemInfoDataSource + 59, // 78: substrate.ateapi.v1.SystemInfoDataSource.actor_metadata:type_name -> substrate.ateapi.v1.ActorMetadataDataSource + 61, // 79: substrate.ateapi.v1.SystemInfoDataSource.trust_bundle:type_name -> substrate.ateapi.v1.TrustBundleDataSource + 60, // 80: substrate.ateapi.v1.ActorMetadataDataSource.items:type_name -> substrate.ateapi.v1.ActorMetadataItem + 6, // 81: substrate.ateapi.v1.ActorMetadataItem.field:type_name -> substrate.ateapi.v1.ActorMetadataField + 34, // 82: substrate.ateapi.v1.CreateAtespaceRequest.atespace:type_name -> substrate.ateapi.v1.Atespace + 35, // 83: substrate.ateapi.v1.GetAtespaceRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef + 108, // 84: substrate.ateapi.v1.ListAtespacesRequest.options:type_name -> substrate.ateapi.v1.ListOptions + 34, // 85: substrate.ateapi.v1.ListAtespacesResponse.atespaces:type_name -> substrate.ateapi.v1.Atespace + 35, // 86: substrate.ateapi.v1.DeleteAtespaceRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef + 107, // 87: substrate.ateapi.v1.DeleteAtespaceRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions + 54, // 88: substrate.ateapi.v1.CreateExternalVolumeClassRequest.external_volume_class:type_name -> substrate.ateapi.v1.ExternalVolumeClass + 35, // 89: substrate.ateapi.v1.GetExternalVolumeClassRequest.external_volume_class:type_name -> substrate.ateapi.v1.ObjectRef + 108, // 90: substrate.ateapi.v1.ListExternalVolumeClassesRequest.options:type_name -> substrate.ateapi.v1.ListOptions + 54, // 91: substrate.ateapi.v1.ListExternalVolumeClassesResponse.external_volume_classes:type_name -> substrate.ateapi.v1.ExternalVolumeClass + 35, // 92: substrate.ateapi.v1.DeleteExternalVolumeClassRequest.external_volume_class:type_name -> substrate.ateapi.v1.ObjectRef + 107, // 93: substrate.ateapi.v1.DeleteExternalVolumeClassRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions + 55, // 94: substrate.ateapi.v1.CreateCsiDriverConfigRequest.csi_driver_config:type_name -> substrate.ateapi.v1.CsiDriverConfig + 35, // 95: substrate.ateapi.v1.GetCsiDriverConfigRequest.csi_driver_config:type_name -> substrate.ateapi.v1.ObjectRef + 108, // 96: substrate.ateapi.v1.ListCsiDriverConfigsRequest.options:type_name -> substrate.ateapi.v1.ListOptions + 55, // 97: substrate.ateapi.v1.ListCsiDriverConfigsResponse.csi_driver_configs:type_name -> substrate.ateapi.v1.CsiDriverConfig + 55, // 98: substrate.ateapi.v1.UpdateCsiDriverConfigRequest.csi_driver_config:type_name -> substrate.ateapi.v1.CsiDriverConfig + 35, // 99: substrate.ateapi.v1.DeleteCsiDriverConfigRequest.csi_driver_config:type_name -> substrate.ateapi.v1.ObjectRef + 107, // 100: substrate.ateapi.v1.DeleteCsiDriverConfigRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions + 36, // 101: substrate.ateapi.v1.CreateActorTemplateRequest.actor_template:type_name -> substrate.ateapi.v1.ActorTemplate + 35, // 102: substrate.ateapi.v1.GetActorTemplateRequest.actor_template:type_name -> substrate.ateapi.v1.ObjectRef + 108, // 103: substrate.ateapi.v1.ListActorTemplatesRequest.options:type_name -> substrate.ateapi.v1.ListOptions + 36, // 104: substrate.ateapi.v1.ListActorTemplatesResponse.actor_templates:type_name -> substrate.ateapi.v1.ActorTemplate + 35, // 105: substrate.ateapi.v1.DeleteActorTemplateRequest.actor_template:type_name -> substrate.ateapi.v1.ObjectRef + 107, // 106: substrate.ateapi.v1.DeleteActorTemplateRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions + 35, // 107: substrate.ateapi.v1.GetActorRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 17, // 108: substrate.ateapi.v1.CreateActorRequest.actor:type_name -> substrate.ateapi.v1.Actor + 17, // 109: substrate.ateapi.v1.UpdateActorRequest.actor:type_name -> substrate.ateapi.v1.Actor + 35, // 110: substrate.ateapi.v1.SuspendActorRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 89, // 111: substrate.ateapi.v1.SuspendActorRequest.options:type_name -> substrate.ateapi.v1.SuspendOptions + 17, // 112: substrate.ateapi.v1.SuspendActorResponse.actor:type_name -> substrate.ateapi.v1.Actor + 7, // 113: substrate.ateapi.v1.SuspendOptions.mode:type_name -> substrate.ateapi.v1.DurabilityMode + 35, // 114: substrate.ateapi.v1.ResumeActorRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 17, // 115: substrate.ateapi.v1.ResumeActorResponse.actor:type_name -> substrate.ateapi.v1.Actor + 35, // 116: substrate.ateapi.v1.RevertActorRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 17, // 117: substrate.ateapi.v1.RevertActorResponse.actor:type_name -> substrate.ateapi.v1.Actor + 35, // 118: substrate.ateapi.v1.DeleteActorRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 107, // 119: substrate.ateapi.v1.DeleteActorRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions + 35, // 120: substrate.ateapi.v1.GetActorEgressPolicyRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 35, // 121: substrate.ateapi.v1.CreateActorEgressPolicyRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 18, // 122: substrate.ateapi.v1.CreateActorEgressPolicyRequest.egress_policy:type_name -> substrate.ateapi.v1.EgressPolicy + 35, // 123: substrate.ateapi.v1.UpdateActorEgressPolicyRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 18, // 124: substrate.ateapi.v1.UpdateActorEgressPolicyRequest.egress_policy:type_name -> substrate.ateapi.v1.EgressPolicy + 35, // 125: substrate.ateapi.v1.DeleteActorEgressPolicyRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 107, // 126: substrate.ateapi.v1.DeleteActorEgressPolicyRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions + 35, // 127: substrate.ateapi.v1.GetTagRequest.tag:type_name -> substrate.ateapi.v1.ObjectRef + 35, // 128: substrate.ateapi.v1.MintActorJwtRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 168, // 129: substrate.ateapi.v1.MintActorJwtResponse.expire_time:type_name -> google.protobuf.Timestamp + 108, // 130: substrate.ateapi.v1.ListTagsRequest.options:type_name -> substrate.ateapi.v1.ListOptions + 33, // 131: substrate.ateapi.v1.ListTagsResponse.tags:type_name -> substrate.ateapi.v1.Tag + 33, // 132: substrate.ateapi.v1.CreateTagRequest.tag:type_name -> substrate.ateapi.v1.Tag + 33, // 133: substrate.ateapi.v1.UpdateTagRequest.tag:type_name -> substrate.ateapi.v1.Tag + 35, // 134: substrate.ateapi.v1.DeleteTagRequest.tag:type_name -> substrate.ateapi.v1.ObjectRef + 107, // 135: substrate.ateapi.v1.DeleteTagRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions + 35, // 136: substrate.ateapi.v1.ListWorkerActorAssignmentsRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 108, // 137: substrate.ateapi.v1.ListWorkerActorAssignmentsRequest.options:type_name -> substrate.ateapi.v1.ListOptions + 134, // 138: substrate.ateapi.v1.ListWorkerActorAssignmentsResponse.actor_assignments:type_name -> substrate.ateapi.v1.ActorAssignment + 108, // 139: substrate.ateapi.v1.ListWorkersRequest.options:type_name -> substrate.ateapi.v1.ListOptions + 125, // 140: substrate.ateapi.v1.ListWorkersResponse.workers:type_name -> substrate.ateapi.v1.Worker + 35, // 141: substrate.ateapi.v1.GetWorkerRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 125, // 142: substrate.ateapi.v1.CreateWorkerRequest.worker:type_name -> substrate.ateapi.v1.Worker + 125, // 143: substrate.ateapi.v1.UpdateWorkerRequest.worker:type_name -> substrate.ateapi.v1.Worker + 35, // 144: substrate.ateapi.v1.DeleteWorkerRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 107, // 145: substrate.ateapi.v1.DeleteWorkerRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions + 35, // 146: substrate.ateapi.v1.DrainWorkerRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 125, // 147: substrate.ateapi.v1.DrainWorkerResponse.worker:type_name -> substrate.ateapi.v1.Worker + 35, // 148: substrate.ateapi.v1.MarkWorkerAvailableRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 125, // 149: substrate.ateapi.v1.MarkWorkerAvailableResponse.worker:type_name -> substrate.ateapi.v1.Worker + 35, // 150: substrate.ateapi.v1.MarkWorkerUnavailableRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 125, // 151: substrate.ateapi.v1.MarkWorkerUnavailableResponse.worker:type_name -> substrate.ateapi.v1.Worker + 108, // 152: substrate.ateapi.v1.ListActorsRequest.options:type_name -> substrate.ateapi.v1.ListOptions + 17, // 153: substrate.ateapi.v1.ListActorsResponse.actors:type_name -> substrate.ateapi.v1.Actor + 14, // 154: substrate.ateapi.v1.Worker.metadata:type_name -> substrate.ateapi.v1.ResourceMetadata + 167, // 155: substrate.ateapi.v1.Worker.labels:type_name -> substrate.ateapi.v1.Worker.LabelsEntry + 126, // 156: substrate.ateapi.v1.Worker.status:type_name -> substrate.ateapi.v1.WorkerStatus + 8, // 157: substrate.ateapi.v1.WorkerStatus.state:type_name -> substrate.ateapi.v1.WorkerState + 133, // 158: substrate.ateapi.v1.WorkerStatus.capacity:type_name -> substrate.ateapi.v1.WorkerResources + 133, // 159: substrate.ateapi.v1.WorkerStatus.allocated:type_name -> substrate.ateapi.v1.WorkerResources + 127, // 160: substrate.ateapi.v1.WorkerStatus.sandbox_classes:type_name -> substrate.ateapi.v1.WorkerSandboxClass + 128, // 161: substrate.ateapi.v1.WorkerSandboxClass.default_runtime:type_name -> substrate.ateapi.v1.WorkerSandboxRuntime + 128, // 162: substrate.ateapi.v1.WorkerSandboxClass.restorable_runtimes:type_name -> substrate.ateapi.v1.WorkerSandboxRuntime + 131, // 163: substrate.ateapi.v1.WorkerSandboxRuntime.version:type_name -> substrate.ateapi.v1.VersionedSandboxCompat + 129, // 164: substrate.ateapi.v1.WorkerSandboxRuntime.actor_overhead:type_name -> substrate.ateapi.v1.RuntimeOverhead + 131, // 165: substrate.ateapi.v1.ActorSandboxRuntime.version:type_name -> substrate.ateapi.v1.VersionedSandboxCompat + 132, // 166: substrate.ateapi.v1.VersionedSandboxCompat.attributes:type_name -> substrate.ateapi.v1.AttributeEntry + 14, // 167: substrate.ateapi.v1.ActorAssignment.metadata:type_name -> substrate.ateapi.v1.ResourceMetadata + 35, // 168: substrate.ateapi.v1.ActorAssignment.actor:type_name -> substrate.ateapi.v1.ObjectRef + 38, // 169: substrate.ateapi.v1.ActorAssignment.resources:type_name -> substrate.ateapi.v1.Resources + 35, // 170: substrate.ateapi.v1.AcquireWorkerEpochRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 35, // 171: substrate.ateapi.v1.RegisterWorkerRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 133, // 172: substrate.ateapi.v1.RegisterWorkerRequest.capacity:type_name -> substrate.ateapi.v1.WorkerResources + 125, // 173: substrate.ateapi.v1.RegisterWorkerResponse.worker:type_name -> substrate.ateapi.v1.Worker + 35, // 174: substrate.ateapi.v1.SetWorkerSandboxRuntimesRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 127, // 175: substrate.ateapi.v1.SetWorkerSandboxRuntimesRequest.sandbox_classes:type_name -> substrate.ateapi.v1.WorkerSandboxClass + 125, // 176: substrate.ateapi.v1.SetWorkerSandboxRuntimesResponse.worker:type_name -> substrate.ateapi.v1.Worker + 35, // 177: substrate.ateapi.v1.MintWorkerActorCertificateRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 35, // 178: substrate.ateapi.v1.MintWorkerActorCertificateRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 35, // 179: substrate.ateapi.v1.MintWorkerActorJwtRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 168, // 180: substrate.ateapi.v1.MintWorkerActorJwtResponse.expire_time:type_name -> google.protobuf.Timestamp + 35, // 181: substrate.ateapi.v1.RequestActorSuspendRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 35, // 182: substrate.ateapi.v1.RequestActorSuspendRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 17, // 183: substrate.ateapi.v1.RequestActorSuspendResponse.actor:type_name -> substrate.ateapi.v1.Actor + 35, // 184: substrate.ateapi.v1.ReportActorCrashedRequest.worker:type_name -> substrate.ateapi.v1.ObjectRef + 35, // 185: substrate.ateapi.v1.ReportActorCrashedRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 17, // 186: substrate.ateapi.v1.ReportActorCrashedResponse.actor:type_name -> substrate.ateapi.v1.Actor + 35, // 187: substrate.ateapi.v1.ReportActorSnapshotStateRequest.actor:type_name -> substrate.ateapi.v1.ObjectRef + 151, // 188: substrate.ateapi.v1.ReportActorSnapshotStateRequest.state:type_name -> substrate.ateapi.v1.ActorSnapshotState + 152, // 189: substrate.ateapi.v1.ActorSnapshotState.latest_local:type_name -> substrate.ateapi.v1.SnapshotReport + 152, // 190: substrate.ateapi.v1.ActorSnapshotState.uploading:type_name -> substrate.ateapi.v1.SnapshotReport + 152, // 191: substrate.ateapi.v1.ActorSnapshotState.latest_durable:type_name -> substrate.ateapi.v1.SnapshotReport + 168, // 192: substrate.ateapi.v1.ActorSnapshotState.upload_due_time:type_name -> google.protobuf.Timestamp + 2, // 193: substrate.ateapi.v1.SnapshotReport.fidelity:type_name -> substrate.ateapi.v1.SnapshotFidelity + 10, // 194: substrate.ateapi.v1.SnapshotReport.object:type_name -> substrate.ateapi.v1.ObjectSnapshot + 168, // 195: substrate.ateapi.v1.SnapshotReport.local_commit_time:type_name -> google.protobuf.Timestamp + 168, // 196: substrate.ateapi.v1.SnapshotReport.durable_complete_time:type_name -> google.protobuf.Timestamp + 14, // 197: substrate.ateapi.v1.AccessPolicy.metadata:type_name -> substrate.ateapi.v1.ResourceMetadata + 154, // 198: substrate.ateapi.v1.AccessPolicy.bindings:type_name -> substrate.ateapi.v1.Binding + 153, // 199: substrate.ateapi.v1.CreateGlobalAccessPolicyRequest.access_policy:type_name -> substrate.ateapi.v1.AccessPolicy + 153, // 200: substrate.ateapi.v1.UpdateGlobalAccessPolicyRequest.access_policy:type_name -> substrate.ateapi.v1.AccessPolicy + 35, // 201: substrate.ateapi.v1.GetAtespaceAccessPolicyRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef + 35, // 202: substrate.ateapi.v1.CreateAtespaceAccessPolicyRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef + 153, // 203: substrate.ateapi.v1.CreateAtespaceAccessPolicyRequest.access_policy:type_name -> substrate.ateapi.v1.AccessPolicy + 35, // 204: substrate.ateapi.v1.UpdateAtespaceAccessPolicyRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef + 153, // 205: substrate.ateapi.v1.UpdateAtespaceAccessPolicyRequest.access_policy:type_name -> substrate.ateapi.v1.AccessPolicy + 35, // 206: substrate.ateapi.v1.DeleteAtespaceAccessPolicyRequest.atespace:type_name -> substrate.ateapi.v1.ObjectRef + 107, // 207: substrate.ateapi.v1.DeleteAtespaceAccessPolicyRequest.options:type_name -> substrate.ateapi.v1.DeleteOptions + 9, // 208: substrate.ateapi.v1.ResourceAnnotation.scope:type_name -> substrate.ateapi.v1.Scope + 169, // 209: substrate.ateapi.v1.resource:extendee -> google.protobuf.MessageOptions + 170, // 210: substrate.ateapi.v1.method:extendee -> google.protobuf.MethodOptions + 162, // 211: substrate.ateapi.v1.resource:type_name -> substrate.ateapi.v1.ResourceAnnotation + 163, // 212: substrate.ateapi.v1.method:type_name -> substrate.ateapi.v1.MethodAnnotation + 84, // 213: substrate.ateapi.v1.Control.GetActor:input_type -> substrate.ateapi.v1.GetActorRequest + 85, // 214: substrate.ateapi.v1.Control.CreateActor:input_type -> substrate.ateapi.v1.CreateActorRequest + 86, // 215: substrate.ateapi.v1.Control.UpdateActor:input_type -> substrate.ateapi.v1.UpdateActorRequest + 87, // 216: substrate.ateapi.v1.Control.SuspendActor:input_type -> substrate.ateapi.v1.SuspendActorRequest + 90, // 217: substrate.ateapi.v1.Control.ResumeActor:input_type -> substrate.ateapi.v1.ResumeActorRequest + 92, // 218: substrate.ateapi.v1.Control.RevertActor:input_type -> substrate.ateapi.v1.RevertActorRequest + 94, // 219: substrate.ateapi.v1.Control.DeleteActor:input_type -> substrate.ateapi.v1.DeleteActorRequest + 95, // 220: substrate.ateapi.v1.Control.GetActorEgressPolicy:input_type -> substrate.ateapi.v1.GetActorEgressPolicyRequest + 96, // 221: substrate.ateapi.v1.Control.CreateActorEgressPolicy:input_type -> substrate.ateapi.v1.CreateActorEgressPolicyRequest + 97, // 222: substrate.ateapi.v1.Control.UpdateActorEgressPolicy:input_type -> substrate.ateapi.v1.UpdateActorEgressPolicyRequest + 98, // 223: substrate.ateapi.v1.Control.DeleteActorEgressPolicy:input_type -> substrate.ateapi.v1.DeleteActorEgressPolicyRequest + 100, // 224: substrate.ateapi.v1.Control.MintActorJwt:input_type -> substrate.ateapi.v1.MintActorJwtRequest + 104, // 225: substrate.ateapi.v1.Control.CreateTag:input_type -> substrate.ateapi.v1.CreateTagRequest + 99, // 226: substrate.ateapi.v1.Control.GetTag:input_type -> substrate.ateapi.v1.GetTagRequest + 102, // 227: substrate.ateapi.v1.Control.ListTags:input_type -> substrate.ateapi.v1.ListTagsRequest + 105, // 228: substrate.ateapi.v1.Control.UpdateTag:input_type -> substrate.ateapi.v1.UpdateTagRequest + 106, // 229: substrate.ateapi.v1.Control.DeleteTag:input_type -> substrate.ateapi.v1.DeleteTagRequest + 111, // 230: substrate.ateapi.v1.Control.ListWorkers:input_type -> substrate.ateapi.v1.ListWorkersRequest + 113, // 231: substrate.ateapi.v1.Control.GetWorker:input_type -> substrate.ateapi.v1.GetWorkerRequest + 114, // 232: substrate.ateapi.v1.Control.CreateWorker:input_type -> substrate.ateapi.v1.CreateWorkerRequest + 115, // 233: substrate.ateapi.v1.Control.UpdateWorker:input_type -> substrate.ateapi.v1.UpdateWorkerRequest + 116, // 234: substrate.ateapi.v1.Control.DeleteWorker:input_type -> substrate.ateapi.v1.DeleteWorkerRequest + 117, // 235: substrate.ateapi.v1.Control.DrainWorker:input_type -> substrate.ateapi.v1.DrainWorkerRequest + 119, // 236: substrate.ateapi.v1.Control.MarkWorkerAvailable:input_type -> substrate.ateapi.v1.MarkWorkerAvailableRequest + 121, // 237: substrate.ateapi.v1.Control.MarkWorkerUnavailable:input_type -> substrate.ateapi.v1.MarkWorkerUnavailableRequest + 109, // 238: substrate.ateapi.v1.Control.ListWorkerActorAssignments:input_type -> substrate.ateapi.v1.ListWorkerActorAssignmentsRequest + 123, // 239: substrate.ateapi.v1.Control.ListActors:input_type -> substrate.ateapi.v1.ListActorsRequest + 63, // 240: substrate.ateapi.v1.Control.CreateAtespace:input_type -> substrate.ateapi.v1.CreateAtespaceRequest + 64, // 241: substrate.ateapi.v1.Control.GetAtespace:input_type -> substrate.ateapi.v1.GetAtespaceRequest + 65, // 242: substrate.ateapi.v1.Control.ListAtespaces:input_type -> substrate.ateapi.v1.ListAtespacesRequest + 67, // 243: substrate.ateapi.v1.Control.DeleteAtespace:input_type -> substrate.ateapi.v1.DeleteAtespaceRequest + 68, // 244: substrate.ateapi.v1.Control.CreateExternalVolumeClass:input_type -> substrate.ateapi.v1.CreateExternalVolumeClassRequest + 69, // 245: substrate.ateapi.v1.Control.GetExternalVolumeClass:input_type -> substrate.ateapi.v1.GetExternalVolumeClassRequest + 70, // 246: substrate.ateapi.v1.Control.ListExternalVolumeClasses:input_type -> substrate.ateapi.v1.ListExternalVolumeClassesRequest + 72, // 247: substrate.ateapi.v1.Control.DeleteExternalVolumeClass:input_type -> substrate.ateapi.v1.DeleteExternalVolumeClassRequest + 73, // 248: substrate.ateapi.v1.Control.CreateCsiDriverConfig:input_type -> substrate.ateapi.v1.CreateCsiDriverConfigRequest + 74, // 249: substrate.ateapi.v1.Control.GetCsiDriverConfig:input_type -> substrate.ateapi.v1.GetCsiDriverConfigRequest + 75, // 250: substrate.ateapi.v1.Control.ListCsiDriverConfigs:input_type -> substrate.ateapi.v1.ListCsiDriverConfigsRequest + 77, // 251: substrate.ateapi.v1.Control.UpdateCsiDriverConfig:input_type -> substrate.ateapi.v1.UpdateCsiDriverConfigRequest + 78, // 252: substrate.ateapi.v1.Control.DeleteCsiDriverConfig:input_type -> substrate.ateapi.v1.DeleteCsiDriverConfigRequest + 79, // 253: substrate.ateapi.v1.Control.CreateActorTemplate:input_type -> substrate.ateapi.v1.CreateActorTemplateRequest + 80, // 254: substrate.ateapi.v1.Control.GetActorTemplate:input_type -> substrate.ateapi.v1.GetActorTemplateRequest + 81, // 255: substrate.ateapi.v1.Control.ListActorTemplates:input_type -> substrate.ateapi.v1.ListActorTemplatesRequest + 83, // 256: substrate.ateapi.v1.Control.DeleteActorTemplate:input_type -> substrate.ateapi.v1.DeleteActorTemplateRequest + 155, // 257: substrate.ateapi.v1.Control.GetGlobalAccessPolicy:input_type -> substrate.ateapi.v1.GetGlobalAccessPolicyRequest + 156, // 258: substrate.ateapi.v1.Control.CreateGlobalAccessPolicy:input_type -> substrate.ateapi.v1.CreateGlobalAccessPolicyRequest + 157, // 259: substrate.ateapi.v1.Control.UpdateGlobalAccessPolicy:input_type -> substrate.ateapi.v1.UpdateGlobalAccessPolicyRequest + 158, // 260: substrate.ateapi.v1.Control.GetAtespaceAccessPolicy:input_type -> substrate.ateapi.v1.GetAtespaceAccessPolicyRequest + 159, // 261: substrate.ateapi.v1.Control.CreateAtespaceAccessPolicy:input_type -> substrate.ateapi.v1.CreateAtespaceAccessPolicyRequest + 160, // 262: substrate.ateapi.v1.Control.UpdateAtespaceAccessPolicy:input_type -> substrate.ateapi.v1.UpdateAtespaceAccessPolicyRequest + 161, // 263: substrate.ateapi.v1.Control.DeleteAtespaceAccessPolicy:input_type -> substrate.ateapi.v1.DeleteAtespaceAccessPolicyRequest + 135, // 264: substrate.ateapi.v1.WorkerService.AcquireWorkerEpoch:input_type -> substrate.ateapi.v1.AcquireWorkerEpochRequest + 137, // 265: substrate.ateapi.v1.WorkerService.RegisterWorker:input_type -> substrate.ateapi.v1.RegisterWorkerRequest + 139, // 266: substrate.ateapi.v1.WorkerService.SetWorkerSandboxRuntimes:input_type -> substrate.ateapi.v1.SetWorkerSandboxRuntimesRequest + 141, // 267: substrate.ateapi.v1.WorkerService.MintWorkerActorCertificate:input_type -> substrate.ateapi.v1.MintWorkerActorCertificateRequest + 143, // 268: substrate.ateapi.v1.WorkerService.MintWorkerActorJwt:input_type -> substrate.ateapi.v1.MintWorkerActorJwtRequest + 145, // 269: substrate.ateapi.v1.WorkerService.RequestActorSuspend:input_type -> substrate.ateapi.v1.RequestActorSuspendRequest + 149, // 270: substrate.ateapi.v1.WorkerService.ReportActorSnapshotState:input_type -> substrate.ateapi.v1.ReportActorSnapshotStateRequest + 147, // 271: substrate.ateapi.v1.WorkerService.ReportActorCrashed:input_type -> substrate.ateapi.v1.ReportActorCrashedRequest + 17, // 272: substrate.ateapi.v1.Control.GetActor:output_type -> substrate.ateapi.v1.Actor + 17, // 273: substrate.ateapi.v1.Control.CreateActor:output_type -> substrate.ateapi.v1.Actor + 17, // 274: substrate.ateapi.v1.Control.UpdateActor:output_type -> substrate.ateapi.v1.Actor + 88, // 275: substrate.ateapi.v1.Control.SuspendActor:output_type -> substrate.ateapi.v1.SuspendActorResponse + 91, // 276: substrate.ateapi.v1.Control.ResumeActor:output_type -> substrate.ateapi.v1.ResumeActorResponse + 93, // 277: substrate.ateapi.v1.Control.RevertActor:output_type -> substrate.ateapi.v1.RevertActorResponse + 17, // 278: substrate.ateapi.v1.Control.DeleteActor:output_type -> substrate.ateapi.v1.Actor + 18, // 279: substrate.ateapi.v1.Control.GetActorEgressPolicy:output_type -> substrate.ateapi.v1.EgressPolicy + 18, // 280: substrate.ateapi.v1.Control.CreateActorEgressPolicy:output_type -> substrate.ateapi.v1.EgressPolicy + 18, // 281: substrate.ateapi.v1.Control.UpdateActorEgressPolicy:output_type -> substrate.ateapi.v1.EgressPolicy + 18, // 282: substrate.ateapi.v1.Control.DeleteActorEgressPolicy:output_type -> substrate.ateapi.v1.EgressPolicy + 101, // 283: substrate.ateapi.v1.Control.MintActorJwt:output_type -> substrate.ateapi.v1.MintActorJwtResponse + 33, // 284: substrate.ateapi.v1.Control.CreateTag:output_type -> substrate.ateapi.v1.Tag + 33, // 285: substrate.ateapi.v1.Control.GetTag:output_type -> substrate.ateapi.v1.Tag + 103, // 286: substrate.ateapi.v1.Control.ListTags:output_type -> substrate.ateapi.v1.ListTagsResponse + 33, // 287: substrate.ateapi.v1.Control.UpdateTag:output_type -> substrate.ateapi.v1.Tag + 33, // 288: substrate.ateapi.v1.Control.DeleteTag:output_type -> substrate.ateapi.v1.Tag + 112, // 289: substrate.ateapi.v1.Control.ListWorkers:output_type -> substrate.ateapi.v1.ListWorkersResponse + 125, // 290: substrate.ateapi.v1.Control.GetWorker:output_type -> substrate.ateapi.v1.Worker + 125, // 291: substrate.ateapi.v1.Control.CreateWorker:output_type -> substrate.ateapi.v1.Worker + 125, // 292: substrate.ateapi.v1.Control.UpdateWorker:output_type -> substrate.ateapi.v1.Worker + 125, // 293: substrate.ateapi.v1.Control.DeleteWorker:output_type -> substrate.ateapi.v1.Worker + 118, // 294: substrate.ateapi.v1.Control.DrainWorker:output_type -> substrate.ateapi.v1.DrainWorkerResponse + 120, // 295: substrate.ateapi.v1.Control.MarkWorkerAvailable:output_type -> substrate.ateapi.v1.MarkWorkerAvailableResponse + 122, // 296: substrate.ateapi.v1.Control.MarkWorkerUnavailable:output_type -> substrate.ateapi.v1.MarkWorkerUnavailableResponse + 110, // 297: substrate.ateapi.v1.Control.ListWorkerActorAssignments:output_type -> substrate.ateapi.v1.ListWorkerActorAssignmentsResponse + 124, // 298: substrate.ateapi.v1.Control.ListActors:output_type -> substrate.ateapi.v1.ListActorsResponse + 34, // 299: substrate.ateapi.v1.Control.CreateAtespace:output_type -> substrate.ateapi.v1.Atespace + 34, // 300: substrate.ateapi.v1.Control.GetAtespace:output_type -> substrate.ateapi.v1.Atespace + 66, // 301: substrate.ateapi.v1.Control.ListAtespaces:output_type -> substrate.ateapi.v1.ListAtespacesResponse + 34, // 302: substrate.ateapi.v1.Control.DeleteAtespace:output_type -> substrate.ateapi.v1.Atespace + 54, // 303: substrate.ateapi.v1.Control.CreateExternalVolumeClass:output_type -> substrate.ateapi.v1.ExternalVolumeClass + 54, // 304: substrate.ateapi.v1.Control.GetExternalVolumeClass:output_type -> substrate.ateapi.v1.ExternalVolumeClass + 71, // 305: substrate.ateapi.v1.Control.ListExternalVolumeClasses:output_type -> substrate.ateapi.v1.ListExternalVolumeClassesResponse + 54, // 306: substrate.ateapi.v1.Control.DeleteExternalVolumeClass:output_type -> substrate.ateapi.v1.ExternalVolumeClass + 55, // 307: substrate.ateapi.v1.Control.CreateCsiDriverConfig:output_type -> substrate.ateapi.v1.CsiDriverConfig + 55, // 308: substrate.ateapi.v1.Control.GetCsiDriverConfig:output_type -> substrate.ateapi.v1.CsiDriverConfig + 76, // 309: substrate.ateapi.v1.Control.ListCsiDriverConfigs:output_type -> substrate.ateapi.v1.ListCsiDriverConfigsResponse + 55, // 310: substrate.ateapi.v1.Control.UpdateCsiDriverConfig:output_type -> substrate.ateapi.v1.CsiDriverConfig + 55, // 311: substrate.ateapi.v1.Control.DeleteCsiDriverConfig:output_type -> substrate.ateapi.v1.CsiDriverConfig + 36, // 312: substrate.ateapi.v1.Control.CreateActorTemplate:output_type -> substrate.ateapi.v1.ActorTemplate + 36, // 313: substrate.ateapi.v1.Control.GetActorTemplate:output_type -> substrate.ateapi.v1.ActorTemplate + 82, // 314: substrate.ateapi.v1.Control.ListActorTemplates:output_type -> substrate.ateapi.v1.ListActorTemplatesResponse + 36, // 315: substrate.ateapi.v1.Control.DeleteActorTemplate:output_type -> substrate.ateapi.v1.ActorTemplate + 153, // 316: substrate.ateapi.v1.Control.GetGlobalAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy + 153, // 317: substrate.ateapi.v1.Control.CreateGlobalAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy + 153, // 318: substrate.ateapi.v1.Control.UpdateGlobalAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy + 153, // 319: substrate.ateapi.v1.Control.GetAtespaceAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy + 153, // 320: substrate.ateapi.v1.Control.CreateAtespaceAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy + 153, // 321: substrate.ateapi.v1.Control.UpdateAtespaceAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy + 153, // 322: substrate.ateapi.v1.Control.DeleteAtespaceAccessPolicy:output_type -> substrate.ateapi.v1.AccessPolicy + 136, // 323: substrate.ateapi.v1.WorkerService.AcquireWorkerEpoch:output_type -> substrate.ateapi.v1.AcquireWorkerEpochResponse + 138, // 324: substrate.ateapi.v1.WorkerService.RegisterWorker:output_type -> substrate.ateapi.v1.RegisterWorkerResponse + 140, // 325: substrate.ateapi.v1.WorkerService.SetWorkerSandboxRuntimes:output_type -> substrate.ateapi.v1.SetWorkerSandboxRuntimesResponse + 142, // 326: substrate.ateapi.v1.WorkerService.MintWorkerActorCertificate:output_type -> substrate.ateapi.v1.MintWorkerActorCertificateResponse + 144, // 327: substrate.ateapi.v1.WorkerService.MintWorkerActorJwt:output_type -> substrate.ateapi.v1.MintWorkerActorJwtResponse + 146, // 328: substrate.ateapi.v1.WorkerService.RequestActorSuspend:output_type -> substrate.ateapi.v1.RequestActorSuspendResponse + 150, // 329: substrate.ateapi.v1.WorkerService.ReportActorSnapshotState:output_type -> substrate.ateapi.v1.ReportActorSnapshotStateResponse + 148, // 330: substrate.ateapi.v1.WorkerService.ReportActorCrashed:output_type -> substrate.ateapi.v1.ReportActorCrashedResponse + 272, // [272:331] is the sub-list for method output_type + 213, // [213:272] is the sub-list for method input_type + 211, // [211:213] is the sub-list for extension type_name + 209, // [209:211] is the sub-list for extension extendee + 0, // [0:209] is the sub-list for field type_name } func init() { file_api_ateapi_v1_ateapi_proto_init() } @@ -11136,7 +12121,7 @@ func file_api_ateapi_v1_ateapi_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_ateapi_v1_ateapi_proto_rawDesc), len(file_api_ateapi_v1_ateapi_proto_rawDesc)), NumEnums: 10, - NumMessages: 143, + NumMessages: 158, NumExtensions: 2, NumServices: 2, }, diff --git a/api/ateapi/v1/ateapi.proto b/api/ateapi/v1/ateapi.proto index 51ed7d1e32..f083b38504 100644 --- a/api/ateapi/v1/ateapi.proto +++ b/api/ateapi/v1/ateapi.proto @@ -203,6 +203,54 @@ service Control { option (method).resource = "Atespace"; } + // Create an ExternalVolumeClass. + rpc CreateExternalVolumeClass(CreateExternalVolumeClassRequest) returns (ExternalVolumeClass) { + option (method).resource = "ExternalVolumeClass"; + } + + // Get an ExternalVolumeClass by name. + rpc GetExternalVolumeClass(GetExternalVolumeClassRequest) returns (ExternalVolumeClass) { + option (method).resource = "ExternalVolumeClass"; + } + + // List ExternalVolumeClasses. + rpc ListExternalVolumeClasses(ListExternalVolumeClassesRequest) returns (ListExternalVolumeClassesResponse) { + option (method).resource = "ExternalVolumeClass"; + } + + // Delete an ExternalVolumeClass. Delete does not check for ActorTemplates + // that still reference the class. Volumes from those templates then fail to + // provision. + rpc DeleteExternalVolumeClass(DeleteExternalVolumeClassRequest) returns (ExternalVolumeClass) { + option (method).resource = "ExternalVolumeClass"; + } + + // Create a CsiDriverConfig. + rpc CreateCsiDriverConfig(CreateCsiDriverConfigRequest) returns (CsiDriverConfig) { + option (method).resource = "CsiDriverConfig"; + } + + // Get a CsiDriverConfig by name. + rpc GetCsiDriverConfig(GetCsiDriverConfigRequest) returns (CsiDriverConfig) { + option (method).resource = "CsiDriverConfig"; + } + + // List CsiDriverConfigs. + rpc ListCsiDriverConfigs(ListCsiDriverConfigsRequest) returns (ListCsiDriverConfigsResponse) { + option (method).resource = "CsiDriverConfig"; + } + + // Update a CsiDriverConfig. + rpc UpdateCsiDriverConfig(UpdateCsiDriverConfigRequest) returns (CsiDriverConfig) { + option (method).resource = "CsiDriverConfig"; + } + + // Delete a CsiDriverConfig. Rejects (FailedPrecondition) if an + // ExternalVolumeClass still references its driver_name. + rpc DeleteCsiDriverConfig(DeleteCsiDriverConfigRequest) returns (CsiDriverConfig) { + option (method).resource = "CsiDriverConfig"; + } + rpc CreateActorTemplate(CreateActorTemplateRequest) returns (ActorTemplate) { option (method).resource = "ActorTemplate"; } @@ -1554,11 +1602,128 @@ message ExternalVolumeTemplate { int64 capacity_bytes = 1; // storage_class_name names the cluster-scoped Kubernetes StorageClass to - // create the volume from. Required. + // create the volume from. Prefer external_volume_class. // - // +k8s:required + // Exactly one of storage_class_name and external_volume_class must be set. + // + // +k8s:optional + // +k8s:unionMember // +k8s:format=k8s-long-name string storage_class_name = 2; + + // external_volume_class names the ExternalVolumeClass to create the volume + // from. atespace must be empty. + // + // +k8s:optional + // +k8s:unionMember + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + ObjectRef external_volume_class = 3; +} + +// ExternalVolumeClass names the CSI driver that provisions external volumes +// and the parameters for its CreateVolume call. Global-scoped and immutable: +// metadata.atespace must be empty. +message ExternalVolumeClass { + option (resource) = { + scope : SCOPE_GLOBAL + plural : "ExternalVolumeClasses" + }; + + // Common resource metadata: name, uid, version, timestamps. + // + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + ResourceMetadata metadata = 1; + + // driver_name is the CSI driver that provisions the volumes, e.g. + // "nfs.csi.k8s.io". It is a DNS subdomain, optionally prefixed with + // "substrate.io/". + // + // +k8s:required + // +k8s:maxLength=63 + // +k8s:customValidation # optional "substrate.io/" prefix + DNS-1123 subdomain + string driver_name = 2; + + // parameters are passed unchanged to the driver's CreateVolume call. The + // driver defines their keys and values, so they are only bounded in size. + // + // +k8s:optional + // +k8s:maxProperties=32 + // +k8s:eachKey=+k8s:maxLength=128 + // +k8s:eachVal=+k8s:maxLength=256 + map parameters = 3; +} + +// CsiDriverConfig configures how the control plane and worker nodes connect to +// a CSI driver. Global-scoped: metadata.atespace must be empty. +message CsiDriverConfig { + option (resource) = { + scope : SCOPE_GLOBAL + plural : "CsiDriverConfigs" + }; + + // Common resource metadata: name, uid, version, timestamps. + // + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + ResourceMetadata metadata = 1; + + // driver_name is the CSI driver name, e.g. "nfs.csi.k8s.io". It is a DNS + // subdomain, optionally prefixed with "substrate.io/", and is unique across + // all CsiDriverConfigs. + // + // +k8s:required + // +k8s:maxLength=63 + // +k8s:immutable + // +k8s:customValidation # optional "substrate.io/" prefix + DNS-1123 subdomain + string driver_name = 2; + + // controller_endpoint is the gRPC URI of the CSI Controller service, e.g. + // "dns:///csi-service:9000" or "tcp://127.0.0.1:9000". + // + // +k8s:required + // +k8s:maxLength=1024 + // +k8s:customValidation # tcp://host:port or dns://[authority]/host:port + string controller_endpoint = 3; + + // node_socket_override overrides the Unix domain socket URI for the CSI Node + // service on worker nodes. When empty, worker nodes connect to + // `unix:///var/lib/kubelet/plugins//csi.sock`. + // + // +k8s:optional + // +k8s:maxLength=1024 + // +k8s:customValidation # unix:// followed by a clean absolute path + string node_socket_override = 4; + + // tls configures TLS for connections to controller_endpoint. + // + // +k8s:optional + CsiDriverTlsConfig tls = 5; +} + +// CsiDriverTlsConfig configures TLS for CSI controller gRPC connections. +// +// +k8s:customValidation # enabled requires use_pod_identity and server_name; disabled forbids both +message CsiDriverTlsConfig { + // enabled turns on TLS for controller_endpoint connections. + // + // +k8s:optional + bool enabled = 1; + + // use_pod_identity authenticates the client with Substrate pod identity + // certificates. Must be true when enabled is true, and must not be set when + // enabled is false. + // + // +k8s:optional + bool use_pod_identity = 2; + + // server_name is the expected TLS server name on the controller certificate. + // Required when enabled is true, and must not be set when enabled is false. + // + // +k8s:optional + // +k8s:format=k8s-long-name + // +k8s:maxLength=253 + string server_name = 3; } // SystemInfoVolumeSource is a read-only volume of substrate-generated @@ -1719,6 +1884,128 @@ message DeleteAtespaceRequest { DeleteOptions options = 2; } +// CreateExternalVolumeClassRequest creates an ExternalVolumeClass. +message CreateExternalVolumeClassRequest { + // The class to create. metadata.name is required and metadata.atespace + // must be empty. + // + // +ate:preview=ExternalVolumes + // +k8s:ifDisabled(ExternalVolumes)=+k8s:forbidden + // +k8s:required + ExternalVolumeClass external_volume_class = 1; +} + +// GetExternalVolumeClassRequest identifies the ExternalVolumeClass to get. +message GetExternalVolumeClassRequest { + // The class to get. atespace must be empty. + // + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + ObjectRef external_volume_class = 1; +} + +// ListExternalVolumeClassesRequest asks for a page of ExternalVolumeClasses. +message ListExternalVolumeClassesRequest { + // Pagination controls. + // + // +k8s:optional + ListOptions options = 1; +} + +// ListExternalVolumeClassesResponse is one page of ExternalVolumeClasses. +message ListExternalVolumeClassesResponse { + // The page of classes. This list may be empty even if there are more results. + repeated ExternalVolumeClass external_volume_classes = 1; + + // Pagination token for the next page. Empty if this is the last page. + string next_page_token = 2; +} + +// DeleteExternalVolumeClassRequest identifies the ExternalVolumeClass to delete. +message DeleteExternalVolumeClassRequest { + // The class to delete. atespace must be empty. + // + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + ObjectRef external_volume_class = 1; + + // Optional per-delete preconditions. + // + // +k8s:optional + DeleteOptions options = 2; +} + +// CreateCsiDriverConfigRequest creates a CsiDriverConfig. +message CreateCsiDriverConfigRequest { + // The config to create. metadata.name is required and metadata.atespace + // must be empty. + // + // +ate:preview=ExternalVolumes + // +k8s:ifDisabled(ExternalVolumes)=+k8s:forbidden + // +k8s:required + CsiDriverConfig csi_driver_config = 1; +} + +// GetCsiDriverConfigRequest identifies the CsiDriverConfig to get. +message GetCsiDriverConfigRequest { + // The config to get. atespace must be empty. + // + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + ObjectRef csi_driver_config = 1; +} + +// ListCsiDriverConfigsRequest asks for a page of CsiDriverConfigs. +message ListCsiDriverConfigsRequest { + // Pagination controls. + // + // +k8s:optional + ListOptions options = 1; +} + +// ListCsiDriverConfigsResponse is one page of CsiDriverConfigs. +message ListCsiDriverConfigsResponse { + // The page of configs. This list may be empty even if there are more results. + repeated CsiDriverConfig csi_driver_configs = 1; + + // Pagination token for the next page. Empty if this is the last page. + string next_page_token = 2; +} + +// UpdateCsiDriverConfigRequest updates a CsiDriverConfig. +message UpdateCsiDriverConfigRequest { + // The config to update. csi_driver_config.metadata.name identifies which + // resource to update, and metadata.atespace must be empty. + // csi_driver_config.metadata.uid and csi_driver_config.metadata.version are + // required preconditions. + // + // controller_endpoint, node_socket_override, and tls are replaced with what + // the request carries, and any omitted optional field is cleared. + // driver_name is immutable. + // + // +ate:preview=ExternalVolumes + // +k8s:ifDisabled(ExternalVolumes)=+k8s:forbidden + // +k8s:required + // +k8s:opaqueType # updates are handled in 2 steps, do not descend + // +k8s:subfield(metadata)=+k8s:required + // +k8s:customValidation # TODO: when we get nested subfields, forbid metadata.atespace + CsiDriverConfig csi_driver_config = 1; +} + +// DeleteCsiDriverConfigRequest identifies the CsiDriverConfig to delete. +message DeleteCsiDriverConfigRequest { + // The config to delete. atespace must be empty. + // + // +k8s:required + // +k8s:beta(since: "0.0")=+k8s:subfield(atespace)=+k8s:forbidden # TODO: get rid of beta prefix + ObjectRef csi_driver_config = 1; + + // Optional per-delete preconditions. + // + // +k8s:optional + DeleteOptions options = 2; +} + message CreateActorTemplateRequest { // The actor template version to create. Server-assigned metadata (uid, // version, timestamps) is ignored, as are the status fields. diff --git a/api/ateapi/v1/ateapi_grpc.pb.go b/api/ateapi/v1/ateapi_grpc.pb.go index e54c306d67..771735f2bb 100644 --- a/api/ateapi/v1/ateapi_grpc.pb.go +++ b/api/ateapi/v1/ateapi_grpc.pb.go @@ -64,6 +64,15 @@ const ( Control_GetAtespace_FullMethodName = "/substrate.ateapi.v1.Control/GetAtespace" Control_ListAtespaces_FullMethodName = "/substrate.ateapi.v1.Control/ListAtespaces" Control_DeleteAtespace_FullMethodName = "/substrate.ateapi.v1.Control/DeleteAtespace" + Control_CreateExternalVolumeClass_FullMethodName = "/substrate.ateapi.v1.Control/CreateExternalVolumeClass" + Control_GetExternalVolumeClass_FullMethodName = "/substrate.ateapi.v1.Control/GetExternalVolumeClass" + Control_ListExternalVolumeClasses_FullMethodName = "/substrate.ateapi.v1.Control/ListExternalVolumeClasses" + Control_DeleteExternalVolumeClass_FullMethodName = "/substrate.ateapi.v1.Control/DeleteExternalVolumeClass" + Control_CreateCsiDriverConfig_FullMethodName = "/substrate.ateapi.v1.Control/CreateCsiDriverConfig" + Control_GetCsiDriverConfig_FullMethodName = "/substrate.ateapi.v1.Control/GetCsiDriverConfig" + Control_ListCsiDriverConfigs_FullMethodName = "/substrate.ateapi.v1.Control/ListCsiDriverConfigs" + Control_UpdateCsiDriverConfig_FullMethodName = "/substrate.ateapi.v1.Control/UpdateCsiDriverConfig" + Control_DeleteCsiDriverConfig_FullMethodName = "/substrate.ateapi.v1.Control/DeleteCsiDriverConfig" Control_CreateActorTemplate_FullMethodName = "/substrate.ateapi.v1.Control/CreateActorTemplate" Control_GetActorTemplate_FullMethodName = "/substrate.ateapi.v1.Control/GetActorTemplate" Control_ListActorTemplates_FullMethodName = "/substrate.ateapi.v1.Control/ListActorTemplates" @@ -170,6 +179,27 @@ type ControlClient interface { // Delete an empty Atespace. Rejects (FailedPrecondition) if any Actors or // Tags remain. DeleteAtespace(ctx context.Context, in *DeleteAtespaceRequest, opts ...grpc.CallOption) (*Atespace, error) + // Create an ExternalVolumeClass. + CreateExternalVolumeClass(ctx context.Context, in *CreateExternalVolumeClassRequest, opts ...grpc.CallOption) (*ExternalVolumeClass, error) + // Get an ExternalVolumeClass by name. + GetExternalVolumeClass(ctx context.Context, in *GetExternalVolumeClassRequest, opts ...grpc.CallOption) (*ExternalVolumeClass, error) + // List ExternalVolumeClasses. + ListExternalVolumeClasses(ctx context.Context, in *ListExternalVolumeClassesRequest, opts ...grpc.CallOption) (*ListExternalVolumeClassesResponse, error) + // Delete an ExternalVolumeClass. Delete does not check for ActorTemplates + // that still reference the class. Volumes from those templates then fail to + // provision. + DeleteExternalVolumeClass(ctx context.Context, in *DeleteExternalVolumeClassRequest, opts ...grpc.CallOption) (*ExternalVolumeClass, error) + // Create a CsiDriverConfig. + CreateCsiDriverConfig(ctx context.Context, in *CreateCsiDriverConfigRequest, opts ...grpc.CallOption) (*CsiDriverConfig, error) + // Get a CsiDriverConfig by name. + GetCsiDriverConfig(ctx context.Context, in *GetCsiDriverConfigRequest, opts ...grpc.CallOption) (*CsiDriverConfig, error) + // List CsiDriverConfigs. + ListCsiDriverConfigs(ctx context.Context, in *ListCsiDriverConfigsRequest, opts ...grpc.CallOption) (*ListCsiDriverConfigsResponse, error) + // Update a CsiDriverConfig. + UpdateCsiDriverConfig(ctx context.Context, in *UpdateCsiDriverConfigRequest, opts ...grpc.CallOption) (*CsiDriverConfig, error) + // Delete a CsiDriverConfig. Rejects (FailedPrecondition) if an + // ExternalVolumeClass still references its driver_name. + DeleteCsiDriverConfig(ctx context.Context, in *DeleteCsiDriverConfigRequest, opts ...grpc.CallOption) (*CsiDriverConfig, error) CreateActorTemplate(ctx context.Context, in *CreateActorTemplateRequest, opts ...grpc.CallOption) (*ActorTemplate, error) GetActorTemplate(ctx context.Context, in *GetActorTemplateRequest, opts ...grpc.CallOption) (*ActorTemplate, error) ListActorTemplates(ctx context.Context, in *ListActorTemplatesRequest, opts ...grpc.CallOption) (*ListActorTemplatesResponse, error) @@ -515,6 +545,96 @@ func (c *controlClient) DeleteAtespace(ctx context.Context, in *DeleteAtespaceRe return out, nil } +func (c *controlClient) CreateExternalVolumeClass(ctx context.Context, in *CreateExternalVolumeClassRequest, opts ...grpc.CallOption) (*ExternalVolumeClass, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ExternalVolumeClass) + err := c.cc.Invoke(ctx, Control_CreateExternalVolumeClass_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controlClient) GetExternalVolumeClass(ctx context.Context, in *GetExternalVolumeClassRequest, opts ...grpc.CallOption) (*ExternalVolumeClass, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ExternalVolumeClass) + err := c.cc.Invoke(ctx, Control_GetExternalVolumeClass_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controlClient) ListExternalVolumeClasses(ctx context.Context, in *ListExternalVolumeClassesRequest, opts ...grpc.CallOption) (*ListExternalVolumeClassesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListExternalVolumeClassesResponse) + err := c.cc.Invoke(ctx, Control_ListExternalVolumeClasses_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controlClient) DeleteExternalVolumeClass(ctx context.Context, in *DeleteExternalVolumeClassRequest, opts ...grpc.CallOption) (*ExternalVolumeClass, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ExternalVolumeClass) + err := c.cc.Invoke(ctx, Control_DeleteExternalVolumeClass_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controlClient) CreateCsiDriverConfig(ctx context.Context, in *CreateCsiDriverConfigRequest, opts ...grpc.CallOption) (*CsiDriverConfig, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CsiDriverConfig) + err := c.cc.Invoke(ctx, Control_CreateCsiDriverConfig_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controlClient) GetCsiDriverConfig(ctx context.Context, in *GetCsiDriverConfigRequest, opts ...grpc.CallOption) (*CsiDriverConfig, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CsiDriverConfig) + err := c.cc.Invoke(ctx, Control_GetCsiDriverConfig_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controlClient) ListCsiDriverConfigs(ctx context.Context, in *ListCsiDriverConfigsRequest, opts ...grpc.CallOption) (*ListCsiDriverConfigsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListCsiDriverConfigsResponse) + err := c.cc.Invoke(ctx, Control_ListCsiDriverConfigs_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controlClient) UpdateCsiDriverConfig(ctx context.Context, in *UpdateCsiDriverConfigRequest, opts ...grpc.CallOption) (*CsiDriverConfig, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CsiDriverConfig) + err := c.cc.Invoke(ctx, Control_UpdateCsiDriverConfig_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controlClient) DeleteCsiDriverConfig(ctx context.Context, in *DeleteCsiDriverConfigRequest, opts ...grpc.CallOption) (*CsiDriverConfig, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CsiDriverConfig) + err := c.cc.Invoke(ctx, Control_DeleteCsiDriverConfig_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *controlClient) CreateActorTemplate(ctx context.Context, in *CreateActorTemplateRequest, opts ...grpc.CallOption) (*ActorTemplate, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ActorTemplate) @@ -718,6 +838,27 @@ type ControlServer interface { // Delete an empty Atespace. Rejects (FailedPrecondition) if any Actors or // Tags remain. DeleteAtespace(context.Context, *DeleteAtespaceRequest) (*Atespace, error) + // Create an ExternalVolumeClass. + CreateExternalVolumeClass(context.Context, *CreateExternalVolumeClassRequest) (*ExternalVolumeClass, error) + // Get an ExternalVolumeClass by name. + GetExternalVolumeClass(context.Context, *GetExternalVolumeClassRequest) (*ExternalVolumeClass, error) + // List ExternalVolumeClasses. + ListExternalVolumeClasses(context.Context, *ListExternalVolumeClassesRequest) (*ListExternalVolumeClassesResponse, error) + // Delete an ExternalVolumeClass. Delete does not check for ActorTemplates + // that still reference the class. Volumes from those templates then fail to + // provision. + DeleteExternalVolumeClass(context.Context, *DeleteExternalVolumeClassRequest) (*ExternalVolumeClass, error) + // Create a CsiDriverConfig. + CreateCsiDriverConfig(context.Context, *CreateCsiDriverConfigRequest) (*CsiDriverConfig, error) + // Get a CsiDriverConfig by name. + GetCsiDriverConfig(context.Context, *GetCsiDriverConfigRequest) (*CsiDriverConfig, error) + // List CsiDriverConfigs. + ListCsiDriverConfigs(context.Context, *ListCsiDriverConfigsRequest) (*ListCsiDriverConfigsResponse, error) + // Update a CsiDriverConfig. + UpdateCsiDriverConfig(context.Context, *UpdateCsiDriverConfigRequest) (*CsiDriverConfig, error) + // Delete a CsiDriverConfig. Rejects (FailedPrecondition) if an + // ExternalVolumeClass still references its driver_name. + DeleteCsiDriverConfig(context.Context, *DeleteCsiDriverConfigRequest) (*CsiDriverConfig, error) CreateActorTemplate(context.Context, *CreateActorTemplateRequest) (*ActorTemplate, error) GetActorTemplate(context.Context, *GetActorTemplateRequest) (*ActorTemplate, error) ListActorTemplates(context.Context, *ListActorTemplatesRequest) (*ListActorTemplatesResponse, error) @@ -846,6 +987,33 @@ func (UnimplementedControlServer) ListAtespaces(context.Context, *ListAtespacesR func (UnimplementedControlServer) DeleteAtespace(context.Context, *DeleteAtespaceRequest) (*Atespace, error) { return nil, status.Error(codes.Unimplemented, "method DeleteAtespace not implemented") } +func (UnimplementedControlServer) CreateExternalVolumeClass(context.Context, *CreateExternalVolumeClassRequest) (*ExternalVolumeClass, error) { + return nil, status.Error(codes.Unimplemented, "method CreateExternalVolumeClass not implemented") +} +func (UnimplementedControlServer) GetExternalVolumeClass(context.Context, *GetExternalVolumeClassRequest) (*ExternalVolumeClass, error) { + return nil, status.Error(codes.Unimplemented, "method GetExternalVolumeClass not implemented") +} +func (UnimplementedControlServer) ListExternalVolumeClasses(context.Context, *ListExternalVolumeClassesRequest) (*ListExternalVolumeClassesResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListExternalVolumeClasses not implemented") +} +func (UnimplementedControlServer) DeleteExternalVolumeClass(context.Context, *DeleteExternalVolumeClassRequest) (*ExternalVolumeClass, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteExternalVolumeClass not implemented") +} +func (UnimplementedControlServer) CreateCsiDriverConfig(context.Context, *CreateCsiDriverConfigRequest) (*CsiDriverConfig, error) { + return nil, status.Error(codes.Unimplemented, "method CreateCsiDriverConfig not implemented") +} +func (UnimplementedControlServer) GetCsiDriverConfig(context.Context, *GetCsiDriverConfigRequest) (*CsiDriverConfig, error) { + return nil, status.Error(codes.Unimplemented, "method GetCsiDriverConfig not implemented") +} +func (UnimplementedControlServer) ListCsiDriverConfigs(context.Context, *ListCsiDriverConfigsRequest) (*ListCsiDriverConfigsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListCsiDriverConfigs not implemented") +} +func (UnimplementedControlServer) UpdateCsiDriverConfig(context.Context, *UpdateCsiDriverConfigRequest) (*CsiDriverConfig, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateCsiDriverConfig not implemented") +} +func (UnimplementedControlServer) DeleteCsiDriverConfig(context.Context, *DeleteCsiDriverConfigRequest) (*CsiDriverConfig, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteCsiDriverConfig not implemented") +} func (UnimplementedControlServer) CreateActorTemplate(context.Context, *CreateActorTemplateRequest) (*ActorTemplate, error) { return nil, status.Error(codes.Unimplemented, "method CreateActorTemplate not implemented") } @@ -1458,6 +1626,168 @@ func _Control_DeleteAtespace_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _Control_CreateExternalVolumeClass_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateExternalVolumeClassRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControlServer).CreateExternalVolumeClass(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Control_CreateExternalVolumeClass_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControlServer).CreateExternalVolumeClass(ctx, req.(*CreateExternalVolumeClassRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Control_GetExternalVolumeClass_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetExternalVolumeClassRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControlServer).GetExternalVolumeClass(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Control_GetExternalVolumeClass_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControlServer).GetExternalVolumeClass(ctx, req.(*GetExternalVolumeClassRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Control_ListExternalVolumeClasses_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListExternalVolumeClassesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControlServer).ListExternalVolumeClasses(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Control_ListExternalVolumeClasses_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControlServer).ListExternalVolumeClasses(ctx, req.(*ListExternalVolumeClassesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Control_DeleteExternalVolumeClass_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteExternalVolumeClassRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControlServer).DeleteExternalVolumeClass(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Control_DeleteExternalVolumeClass_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControlServer).DeleteExternalVolumeClass(ctx, req.(*DeleteExternalVolumeClassRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Control_CreateCsiDriverConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateCsiDriverConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControlServer).CreateCsiDriverConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Control_CreateCsiDriverConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControlServer).CreateCsiDriverConfig(ctx, req.(*CreateCsiDriverConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Control_GetCsiDriverConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCsiDriverConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControlServer).GetCsiDriverConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Control_GetCsiDriverConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControlServer).GetCsiDriverConfig(ctx, req.(*GetCsiDriverConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Control_ListCsiDriverConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListCsiDriverConfigsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControlServer).ListCsiDriverConfigs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Control_ListCsiDriverConfigs_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControlServer).ListCsiDriverConfigs(ctx, req.(*ListCsiDriverConfigsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Control_UpdateCsiDriverConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateCsiDriverConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControlServer).UpdateCsiDriverConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Control_UpdateCsiDriverConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControlServer).UpdateCsiDriverConfig(ctx, req.(*UpdateCsiDriverConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Control_DeleteCsiDriverConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteCsiDriverConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControlServer).DeleteCsiDriverConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Control_DeleteCsiDriverConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControlServer).DeleteCsiDriverConfig(ctx, req.(*DeleteCsiDriverConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Control_CreateActorTemplate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateActorTemplateRequest) if err := dec(in); err != nil { @@ -1787,6 +2117,42 @@ var Control_ServiceDesc = grpc.ServiceDesc{ MethodName: "DeleteAtespace", Handler: _Control_DeleteAtespace_Handler, }, + { + MethodName: "CreateExternalVolumeClass", + Handler: _Control_CreateExternalVolumeClass_Handler, + }, + { + MethodName: "GetExternalVolumeClass", + Handler: _Control_GetExternalVolumeClass_Handler, + }, + { + MethodName: "ListExternalVolumeClasses", + Handler: _Control_ListExternalVolumeClasses_Handler, + }, + { + MethodName: "DeleteExternalVolumeClass", + Handler: _Control_DeleteExternalVolumeClass_Handler, + }, + { + MethodName: "CreateCsiDriverConfig", + Handler: _Control_CreateCsiDriverConfig_Handler, + }, + { + MethodName: "GetCsiDriverConfig", + Handler: _Control_GetCsiDriverConfig_Handler, + }, + { + MethodName: "ListCsiDriverConfigs", + Handler: _Control_ListCsiDriverConfigs_Handler, + }, + { + MethodName: "UpdateCsiDriverConfig", + Handler: _Control_UpdateCsiDriverConfig_Handler, + }, + { + MethodName: "DeleteCsiDriverConfig", + Handler: _Control_DeleteCsiDriverConfig_Handler, + }, { MethodName: "CreateActorTemplate", Handler: _Control_CreateActorTemplate_Handler, diff --git a/cmd/ateapi/internal/apivalidation/actor_template_test.go b/cmd/ateapi/internal/apivalidation/actor_template_test.go index 0c32ef3440..7dc0f80efe 100644 --- a/cmd/ateapi/internal/apivalidation/actor_template_test.go +++ b/cmd/ateapi/internal/apivalidation/actor_template_test.go @@ -932,12 +932,45 @@ func TestValidateActorTemplate(t *testing.T) { want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")}, wantWithPreview: map[string]field.ErrorList{"ALL": {field.Invalid(field.NewPath("volumes").Index(0).Child("external", "template", "capacity_bytes"), nil, "").WithOrigin("minimum")}}, }, { - name: "external volume template missing storage_class_name", + name: "external volume template with no class", mutate: func(tmpl *ateapi.ActorTemplate) { tmpl.Volumes = []*ateapi.Volume{{Name: "data", External: &ateapi.ExternalVolumeSource{Template: &ateapi.ExternalVolumeTemplate{CapacityBytes: 10 << 30}}}} + tmpl.Containers[0].VolumeMounts = []*ateapi.VolumeMount{{Name: "data", MountPath: "/var/data"}} + }, + want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")}, + wantWithPreview: map[string]field.ErrorList{"ALL": {field.Invalid(field.NewPath("volumes").Index(0).Child("external", "template"), nil, "one of").WithOrigin("union")}}, + }, { + name: "valid external volume template with external_volume_class", + mutate: func(tmpl *ateapi.ActorTemplate) { + tmpl.Volumes = []*ateapi.Volume{{Name: "data", External: &ateapi.ExternalVolumeSource{Template: &ateapi.ExternalVolumeTemplate{CapacityBytes: 10 << 30, ExternalVolumeClass: &ateapi.ObjectRef{Name: "fast-ssd"}}}}} + tmpl.Containers[0].VolumeMounts = []*ateapi.VolumeMount{{Name: "data", MountPath: "/var/data"}} + }, + want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")}, + wantWithPreview: map[string]field.ErrorList{"ALL": nil}, + }, { + name: "external volume template with both storage_class_name and external_volume_class", + mutate: func(tmpl *ateapi.ActorTemplate) { + tmpl.Volumes = []*ateapi.Volume{{Name: "data", External: &ateapi.ExternalVolumeSource{Template: &ateapi.ExternalVolumeTemplate{CapacityBytes: 10 << 30, StorageClassName: "fast-ssd", ExternalVolumeClass: &ateapi.ObjectRef{Name: "fast-ssd"}}}}} + tmpl.Containers[0].VolumeMounts = []*ateapi.VolumeMount{{Name: "data", MountPath: "/var/data"}} + }, + want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")}, + wantWithPreview: map[string]field.ErrorList{"ALL": {field.Invalid(field.NewPath("volumes").Index(0).Child("external", "template"), nil, "one of").WithOrigin("union")}}, + }, { + name: "external_volume_class with an atespace", + mutate: func(tmpl *ateapi.ActorTemplate) { + tmpl.Volumes = []*ateapi.Volume{{Name: "data", External: &ateapi.ExternalVolumeSource{Template: &ateapi.ExternalVolumeTemplate{CapacityBytes: 10 << 30, ExternalVolumeClass: &ateapi.ObjectRef{Atespace: "ns1", Name: "fast-ssd"}}}}} + tmpl.Containers[0].VolumeMounts = []*ateapi.VolumeMount{{Name: "data", MountPath: "/var/data"}} + }, + want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")}, + wantWithPreview: map[string]field.ErrorList{"ALL": {field.Forbidden(field.NewPath("volumes").Index(0).Child("external", "template", "external_volume_class", "atespace"), "")}}, + }, { + name: "external_volume_class missing name", + mutate: func(tmpl *ateapi.ActorTemplate) { + tmpl.Volumes = []*ateapi.Volume{{Name: "data", External: &ateapi.ExternalVolumeSource{Template: &ateapi.ExternalVolumeTemplate{CapacityBytes: 10 << 30, ExternalVolumeClass: &ateapi.ObjectRef{}}}}} + tmpl.Containers[0].VolumeMounts = []*ateapi.VolumeMount{{Name: "data", MountPath: "/var/data"}} }, want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")}, - wantWithPreview: map[string]field.ErrorList{"ALL": {field.Required(field.NewPath("volumes").Index(0).Child("external", "template", "storage_class_name"), "")}}, + wantWithPreview: map[string]field.ErrorList{"ALL": {field.Required(field.NewPath("volumes").Index(0).Child("external", "template", "external_volume_class", "name"), "")}}, }, { name: "external volume template invalid storage_class_name", mutate: func(tmpl *ateapi.ActorTemplate) { diff --git a/cmd/ateapi/internal/apivalidation/csi_driver_config.go b/cmd/ateapi/internal/apivalidation/csi_driver_config.go new file mode 100644 index 0000000000..23dfd3282e --- /dev/null +++ b/cmd/ateapi/internal/apivalidation/csi_driver_config.go @@ -0,0 +1,168 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package apivalidation + +import ( + "context" + "net" + "net/netip" + "net/url" + "path/filepath" + "strconv" + "strings" + + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/internal/resources" + "k8s.io/apimachinery/pkg/api/operation" + "k8s.io/apimachinery/pkg/api/validate" + "k8s.io/apimachinery/pkg/util/validation" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +func ValidateCreateCsiDriverConfigRequest(ctx context.Context, req *ateapi.CreateCsiDriverConfigRequest) field.ErrorList { + return Validate_CreateCsiDriverConfigRequest(ctx, MakeCreateOp(ctx), nil, req, nil) +} + +func ValidateGetCsiDriverConfigRequest(ctx context.Context, req *ateapi.GetCsiDriverConfigRequest) field.ErrorList { + return Validate_GetCsiDriverConfigRequest(ctx, MakeCreateOp(ctx), nil, req, nil) +} + +func ValidateListCsiDriverConfigsRequest(ctx context.Context, req *ateapi.ListCsiDriverConfigsRequest) field.ErrorList { + return Validate_ListCsiDriverConfigsRequest(ctx, MakeCreateOp(ctx), nil, req, nil) +} + +func ValidateUpdateCsiDriverConfigRequest(ctx context.Context, req *ateapi.UpdateCsiDriverConfigRequest) field.ErrorList { + return Validate_UpdateCsiDriverConfigRequest(ctx, MakeCreateOp(ctx), nil, req, nil) +} + +func ValidateDeleteCsiDriverConfigRequest(ctx context.Context, req *ateapi.DeleteCsiDriverConfigRequest) field.ErrorList { + return Validate_DeleteCsiDriverConfigRequest(ctx, MakeCreateOp(ctx), nil, req, nil) +} + +func ValidateCsiDriverConfigUpdate(ctx context.Context, fldPath *field.Path, newVal, oldVal *ateapi.CsiDriverConfig) field.ErrorList { + return Validate_CsiDriverConfig(ctx, MakeUpdateOp(ctx), fldPath, newVal, oldVal) +} + +func ValidateCustom_UpdateCsiDriverConfigRequest_CsiDriverConfig(ctx context.Context, op operation.Operation, fldPath *field.Path, cfg, _ *ateapi.CsiDriverConfig) field.ErrorList { + if cfg == nil || cfg.Metadata == nil { + return nil // handled by DV + } + errs := Validate_ResourceMetadata(ctx, op, fldPath.Child("metadata"), cfg.Metadata, nil) + errs = append(errs, validate.ForbiddenValue(ctx, op, fldPath.Child("metadata", "atespace"), &cfg.Metadata.Atespace, nil)...) + return errs +} + +func ValidateCustom_CsiDriverConfig_DriverName(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList { + return resources.ValidateVolumeType(fldPath, *value) +} + +func ValidateCustom_CsiDriverConfig_ControllerEndpoint(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList { + raw := *value + if strings.ContainsAny(raw, "%?# \t\r\n") { + return field.ErrorList{field.Invalid(fldPath, raw, "must not contain percent-escapes, query parameters, fragments, or whitespace")} + } + u, err := url.Parse(raw) + if err != nil || u.User != nil { + return field.ErrorList{field.Invalid(fldPath, raw, "must be a valid tcp:// or dns:// endpoint URI")} + } + switch { + case strings.HasPrefix(raw, "tcp://"): + if u.Path != "" || !isValidEndpointHostPort(u.Host) { + return field.ErrorList{field.Invalid(fldPath, raw, "tcp endpoint must be tcp://:")} + } + return nil + case strings.HasPrefix(raw, "dns://"): + target, ok := strings.CutPrefix(u.Path, "/") + if (u.Host != "" && !isValidDNSAuthority(u.Host)) || !ok || !isValidEndpointHostPort(target) { + return field.ErrorList{field.Invalid(fldPath, raw, "dns endpoint must be dns://[]/:")} + } + return nil + default: + return field.ErrorList{field.Invalid(fldPath, raw, "scheme must be tcp or dns")} + } +} + +func isValidEndpointHostPort(target string) bool { + host, portStr, err := net.SplitHostPort(target) + if err != nil { + return false + } + port, err := strconv.Atoi(portStr) + if err != nil || strconv.Itoa(port) != portStr || len(validation.IsValidPortNum(port)) > 0 { + return false + } + if strings.HasPrefix(target, "[") { + ip, err := netip.ParseAddr(host) + return err == nil && ip.Is6() && ip.Zone() == "" + } + return isValidEndpointHost(host) +} + +func isValidDNSAuthority(authority string) bool { + if isValidEndpointHostPort(authority) { + return true + } + if strings.HasPrefix(authority, "[") && strings.HasSuffix(authority, "]") { + ip, err := netip.ParseAddr(authority[1 : len(authority)-1]) + return err == nil && ip.Is6() && ip.Zone() == "" + } + return !strings.Contains(authority, ":") && isValidEndpointHost(authority) +} + +func isValidEndpointHost(host string) bool { + if host == "" { + return false + } + if ip, err := netip.ParseAddr(host); err == nil { + return ip.Zone() == "" + } + return len(validation.IsDNS1123Subdomain(strings.TrimSuffix(host, "."))) == 0 +} + +func ValidateCustom_CsiDriverConfig_NodeSocketOverride(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList { + raw := *value + p, ok := strings.CutPrefix(raw, "unix://") + if !ok || strings.ContainsAny(raw, "?# \t\r\n\x00") { + return field.ErrorList{field.Invalid(fldPath, raw, "must be unix://")} + } + u, err := url.Parse(raw) + if err != nil || u.Host != "" || u.User != nil || u.Path != p { + return field.ErrorList{field.Invalid(fldPath, raw, "must be unix://")} + } + if p == "/" || !filepath.IsAbs(p) || filepath.Clean(p) != p { + return field.ErrorList{field.Invalid(fldPath, raw, "socket path must be a non-root clean absolute path")} + } + return nil +} + +func ValidateCustom_CsiDriverTlsConfig(_ context.Context, _ operation.Operation, fldPath *field.Path, obj, _ *ateapi.CsiDriverTlsConfig) field.ErrorList { + var errs field.ErrorList + if !obj.GetEnabled() { + if obj.GetUsePodIdentity() { + errs = append(errs, field.Forbidden(fldPath.Child("use_pod_identity"), "may not be set when enabled is false")) + } + if obj.GetServerName() != "" { + errs = append(errs, field.Forbidden(fldPath.Child("server_name"), "may not be set when enabled is false")) + } + return errs + } + if !obj.GetUsePodIdentity() { + errs = append(errs, field.Invalid(fldPath.Child("use_pod_identity"), false, "must be true when enabled is true; manual certificates are not yet supported")) + } + if obj.GetServerName() == "" { + errs = append(errs, field.Required(fldPath.Child("server_name"), "is required when enabled is true")) + } + return errs +} diff --git a/cmd/ateapi/internal/apivalidation/csi_driver_config_test.go b/cmd/ateapi/internal/apivalidation/csi_driver_config_test.go new file mode 100644 index 0000000000..566f561302 --- /dev/null +++ b/cmd/ateapi/internal/apivalidation/csi_driver_config_test.go @@ -0,0 +1,237 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package apivalidation + +import ( + "context" + "strings" + "testing" + + "go.ate.dev/substrate/api/ateapi/v1" + "google.golang.org/protobuf/types/known/timestamppb" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +func validCsiDriverConfig(mutate ...func(*ateapi.CsiDriverConfig)) *ateapi.CsiDriverConfig { + cfg := &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, + DriverName: "nfs.csi.k8s.io", + ControllerEndpoint: "dns:///csi-nfs.ate-system.svc:9000", + } + for _, fn := range mutate { + if fn != nil { + fn(cfg) + } + } + return cfg +} + +func TestValidateCreateCsiDriverConfigRequest(t *testing.T) { + cdc := field.NewPath("csi_driver_config") + ep, sock, tlsPath := cdc.Child("controller_endpoint"), cdc.Child("node_socket_override"), cdc.Child("tls") + forbiddenWithoutPreview := field.ErrorList{field.Forbidden(cdc, "")} + tests := []struct { + name string + req *ateapi.CreateCsiDriverConfigRequest + want field.ErrorList + wantWithPreview field.ErrorList + }{ + {"missing csi_driver_config", &ateapi.CreateCsiDriverConfigRequest{}, field.ErrorList{field.Required(cdc, "")}, field.ErrorList{field.Required(cdc, "")}}, + {"valid default", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig()}, forbiddenWithoutPreview, nil}, + {"valid substrate.io driver + ipv6 tcp + socket + tls", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { + c.DriverName = "substrate.io/mock" + c.ControllerEndpoint = "tcp://[::1]:9000" + c.NodeSocketOverride = "unix:///var/lib/kubelet/plugins/mock/csi.sock" + c.Tls = &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "csi.ate-system.svc"} + })}, forbiddenWithoutPreview, nil}, + {"valid dns authority with port", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "dns://8.8.8.8:53/csi-nfs:9000" })}, forbiddenWithoutPreview, nil}, + {"valid dns ipv4 authority without port", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "dns://8.8.8.8/csi-nfs:9000" })}, forbiddenWithoutPreview, nil}, + {"valid dns ipv6 authority without port", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "dns://[::1]/csi-nfs:9000" })}, forbiddenWithoutPreview, nil}, + {"valid dns ipv6 authority and target with port", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "dns://[::1]:53/[::1]:9000" })}, forbiddenWithoutPreview, nil}, + {"valid explicit disabled tls", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.Tls = &ateapi.CsiDriverTlsConfig{} })}, forbiddenWithoutPreview, nil}, + {"atespace forbidden", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.Metadata.Atespace = "as" })}, forbiddenWithoutPreview, field.ErrorList{field.Forbidden(cdc.Child("metadata", "atespace"), "")}}, + {"missing driver_name", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.DriverName = "" })}, forbiddenWithoutPreview, field.ErrorList{field.Required(cdc.Child("driver_name"), "")}}, + {"invalid driver_name", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.DriverName = "Bad_Driver" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(cdc.Child("driver_name"), nil, "")}}, + {"too-long driver_name", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.DriverName = "nfs.csi." + strings.Repeat("a", 56) })}, forbiddenWithoutPreview, field.ErrorList{field.TooLong(cdc.Child("driver_name"), "", 63).WithOrigin("maxLength")}}, + {"missing controller_endpoint", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "" })}, forbiddenWithoutPreview, field.ErrorList{field.Required(ep, "")}}, + {"tcp missing port", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "tcp://127.0.0.1" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"tcp missing host", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "tcp://:9000" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"tcp malformed ipv6", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "tcp://[::1:9000" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"tcp bracketed ipv4", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "tcp://[127.0.0.1]:9000" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"dns bracketed hostname", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "dns:///[csi-nfs]:9000" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"dns bracketed ipv4 authority", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "dns://[8.8.8.8]:53/csi-nfs:9000" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"dns missing port on target", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "dns:///csi-nfs" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"dns missing target path", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "dns://csi-nfs:9000" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"dns invalid authority", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "dns://bad_auth/csi-nfs:9000" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"non-canonical +port", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "dns:///csi-nfs:+80" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"non-canonical 00port", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "tcp://127.0.0.1:0080" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"percent-encoded endpoint", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "dns:///%63si-nfs:9000" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"tcp with path", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "tcp://127.0.0.1:9000/p" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"tcp with query", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "tcp://127.0.0.1:9000?a=1" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"tcp with userinfo", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "tcp://u@127.0.0.1:9000" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"unsupported endpoint scheme", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.ControllerEndpoint = "http://127.0.0.1:9000" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(ep, nil, "")}}, + {"socket wrong scheme", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.NodeSocketOverride = "tcp://127.0.0.1:9000" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(sock, nil, "")}}, + {"socket non-empty authority", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.NodeSocketOverride = "unix://host/var/csi.sock" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(sock, nil, "")}}, + {"socket root path", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.NodeSocketOverride = "unix:///" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(sock, nil, "")}}, + {"socket double slash", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.NodeSocketOverride = "unix:///var//csi.sock" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(sock, nil, "")}}, + {"socket dotdot", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.NodeSocketOverride = "unix:///var/../csi.sock" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(sock, nil, "")}}, + {"socket trailing slash", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.NodeSocketOverride = "unix:///var/csi.sock/" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(sock, nil, "")}}, + {"socket percent escape", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.NodeSocketOverride = "unix:///var%2fcsi.sock" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(sock, nil, "")}}, + {"socket space", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { c.NodeSocketOverride = "unix:///var/run/csi sock" })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(sock, nil, "")}}, + {"tls enabled missing pod identity and server_name", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { + c.Tls = &ateapi.CsiDriverTlsConfig{Enabled: true} + })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(tlsPath.Child("use_pod_identity"), nil, ""), field.Required(tlsPath.Child("server_name"), "")}}, + {"tls disabled rejects use_pod_identity and server_name", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { + c.Tls = &ateapi.CsiDriverTlsConfig{Enabled: false, UsePodIdentity: true, ServerName: "csi.ate-system.svc"} + })}, forbiddenWithoutPreview, field.ErrorList{field.Forbidden(tlsPath.Child("use_pod_identity"), ""), field.Forbidden(tlsPath.Child("server_name"), "")}}, + {"tls invalid server_name format", &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { + c.Tls = &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "Bad_Host"} + })}, forbiddenWithoutPreview, field.ErrorList{field.Invalid(tlsPath.Child("server_name"), nil, "").WithOrigin("format=k8s-long-name")}}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assertValidate(t, func() field.ErrorList { return ValidateCreateCsiDriverConfigRequest(context.Background(), tt.req) }, + tt.want, map[string]field.ErrorList{"ExternalVolumes": tt.wantWithPreview}) + }) + } +} + +func TestValidateGetCsiDriverConfigRequest(t *testing.T) { + tests := []struct { + name string + ref *ateapi.ObjectRef + want field.ErrorList + }{ + {"valid", &ateapi.ObjectRef{Name: "csi-nfs"}, nil}, + {"missing ref", nil, field.ErrorList{field.Required(field.NewPath("csi_driver_config"), "")}}, + {"atespace must be empty", &ateapi.ObjectRef{Atespace: "as", Name: "csi-nfs"}, field.ErrorList{field.Forbidden(field.NewPath("csi_driver_config", "atespace"), "")}}, + {"missing name", &ateapi.ObjectRef{}, field.ErrorList{field.Required(field.NewPath("csi_driver_config", "name"), "")}}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assertValidateErr(t, ValidateGetCsiDriverConfigRequest(context.Background(), &ateapi.GetCsiDriverConfigRequest{CsiDriverConfig: tt.ref}), tt.want) + }) + } +} + +func TestValidateDeleteCsiDriverConfigRequest(t *testing.T) { + tests := []struct { + name string + req *ateapi.DeleteCsiDriverConfigRequest + want field.ErrorList + }{ + {"valid", &ateapi.DeleteCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Name: "csi-nfs"}}, nil}, + {"missing ref", &ateapi.DeleteCsiDriverConfigRequest{}, field.ErrorList{field.Required(field.NewPath("csi_driver_config"), "")}}, + {"atespace must be empty", &ateapi.DeleteCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Atespace: "as", Name: "csi-nfs"}}, field.ErrorList{field.Forbidden(field.NewPath("csi_driver_config", "atespace"), "")}}, + {"missing name", &ateapi.DeleteCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{}}, field.ErrorList{field.Required(field.NewPath("csi_driver_config", "name"), "")}}, + {"invalid delete options uid", &ateapi.DeleteCsiDriverConfigRequest{ + CsiDriverConfig: &ateapi.ObjectRef{Name: "csi-nfs"}, + Options: &ateapi.DeleteOptions{Uid: "not-a-uuid"}, + }, field.ErrorList{field.Invalid(field.NewPath("options", "uid"), nil, "").WithOrigin("format=k8s-uuid")}}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assertValidateErr(t, ValidateDeleteCsiDriverConfigRequest(context.Background(), tt.req), tt.want) + }) + } +} + +func TestValidateListCsiDriverConfigsRequest(t *testing.T) { + tests := []struct { + name string + req *ateapi.ListCsiDriverConfigsRequest + want field.ErrorList + }{ + {"valid", &ateapi.ListCsiDriverConfigsRequest{}, nil}, + {"negative page_size", &ateapi.ListCsiDriverConfigsRequest{Options: &ateapi.ListOptions{PageSize: -1}}, field.ErrorList{field.Invalid(field.NewPath("options", "page_size"), int32(-1), "").WithOrigin("minimum")}}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assertValidateErr(t, ValidateListCsiDriverConfigsRequest(context.Background(), tt.req), tt.want) + }) + } +} + +func TestValidateUpdateCsiDriverConfigRequest(t *testing.T) { + cdc := field.NewPath("csi_driver_config") + forbiddenWithoutPreview := field.ErrorList{field.Forbidden(cdc, "")} + validReq := func(mutate ...func(*ateapi.CsiDriverConfig)) *ateapi.UpdateCsiDriverConfigRequest { + cfg := validCsiDriverConfig(func(c *ateapi.CsiDriverConfig) { + c.Metadata.Uid = someActorUID + c.Metadata.Version = 3 + }) + for _, fn := range mutate { + fn(cfg) + } + return &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: cfg} + } + tests := []struct { + name string + req *ateapi.UpdateCsiDriverConfigRequest + want field.ErrorList + wantWithPreview field.ErrorList + }{ + {"missing csi_driver_config", &ateapi.UpdateCsiDriverConfigRequest{}, field.ErrorList{field.Required(cdc, "")}, field.ErrorList{field.Required(cdc, "")}}, + {"valid", validReq(), forbiddenWithoutPreview, nil}, + {"missing uid and version pass request validation", validReq(func(c *ateapi.CsiDriverConfig) { c.Metadata.Uid = ""; c.Metadata.Version = 0 }), forbiddenWithoutPreview, nil}, + {"missing metadata", validReq(func(c *ateapi.CsiDriverConfig) { c.Metadata = nil }), forbiddenWithoutPreview, field.ErrorList{field.Required(cdc.Child("metadata"), "")}}, + {"missing metadata.name", validReq(func(c *ateapi.CsiDriverConfig) { c.Metadata.Name = "" }), forbiddenWithoutPreview, field.ErrorList{field.Required(cdc.Child("metadata", "name"), "")}}, + {"invalid metadata.name", validReq(func(c *ateapi.CsiDriverConfig) { c.Metadata.Name = "Bad_Name" }), forbiddenWithoutPreview, field.ErrorList{field.Invalid(cdc.Child("metadata", "name"), nil, "").WithOrigin("format=k8s-short-name")}}, + {"invalid metadata.uid", validReq(func(c *ateapi.CsiDriverConfig) { c.Metadata.Uid = "not-a-uuid" }), forbiddenWithoutPreview, field.ErrorList{field.Invalid(cdc.Child("metadata", "uid"), nil, "").WithOrigin("format=k8s-uuid")}}, + {"metadata.atespace forbidden", validReq(func(c *ateapi.CsiDriverConfig) { c.Metadata.Atespace = "as" }), forbiddenWithoutPreview, field.ErrorList{field.Forbidden(cdc.Child("metadata", "atespace"), "")}}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assertValidate(t, func() field.ErrorList { return ValidateUpdateCsiDriverConfigRequest(context.Background(), tt.req) }, + tt.want, map[string]field.ErrorList{"ExternalVolumes": tt.wantWithPreview}) + }) + } +} + +func TestValidateCsiDriverConfigUpdate(t *testing.T) { + stored := func(mutate ...func(*ateapi.CsiDriverConfig)) *ateapi.CsiDriverConfig { + return validCsiDriverConfig(append([]func(*ateapi.CsiDriverConfig){func(c *ateapi.CsiDriverConfig) { + c.Metadata.Uid = someActorUID + c.Metadata.Version = 2 + c.Metadata.CreateTime = ×tamppb.Timestamp{Seconds: 100} + c.Metadata.UpdateTime = ×tamppb.Timestamp{Seconds: 200} + }}, mutate...)...) + } + cdc := field.NewPath("csi_driver_config") + tests := []struct { + name string + mutate func(*ateapi.CsiDriverConfig) + want field.ErrorList + }{ + {"valid mutable fields changed", func(c *ateapi.CsiDriverConfig) { + c.ControllerEndpoint = "tcp://10.0.0.2:9000" + c.NodeSocketOverride = "unix:///run/csi/nfs.sock" + c.Tls = &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "csi.ate-system.svc"} + }, nil}, + {"driver_name immutable", func(c *ateapi.CsiDriverConfig) { c.DriverName = "other.csi.k8s.io" }, field.ErrorList{field.Invalid(cdc.Child("driver_name"), nil, "").WithOrigin("immutable")}}, + {"metadata.name immutable", func(c *ateapi.CsiDriverConfig) { c.Metadata.Name = "other" }, field.ErrorList{field.Invalid(cdc.Child("metadata", "name"), nil, "").WithOrigin("immutable")}}, + {"metadata.uid immutable", func(c *ateapi.CsiDriverConfig) { c.Metadata.Uid = "11111111-2222-3333-4444-555555555555" }, field.ErrorList{field.Invalid(cdc.Child("metadata", "uid"), nil, "").WithOrigin("immutable")}}, + {"metadata.create_time immutable", func(c *ateapi.CsiDriverConfig) { c.Metadata.CreateTime = ×tamppb.Timestamp{Seconds: 101} }, field.ErrorList{field.Invalid(cdc.Child("metadata", "create_time"), nil, "").WithOrigin("immutable")}}, + {"metadata.atespace forbidden and immutable", func(c *ateapi.CsiDriverConfig) { c.Metadata.Atespace = "as" }, field.ErrorList{ + field.Forbidden(cdc.Child("metadata", "atespace"), ""), + field.Invalid(cdc.Child("metadata", "atespace"), nil, "").WithOrigin("immutable"), + }}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assertValidateErr(t, ValidateCsiDriverConfigUpdate(context.Background(), cdc, stored(tt.mutate), stored()), tt.want) + }) + } +} diff --git a/cmd/ateapi/internal/apivalidation/external_volume_class.go b/cmd/ateapi/internal/apivalidation/external_volume_class.go new file mode 100644 index 0000000000..43f6d8c562 --- /dev/null +++ b/cmd/ateapi/internal/apivalidation/external_volume_class.go @@ -0,0 +1,44 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package apivalidation + +import ( + "context" + + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/internal/resources" + "k8s.io/apimachinery/pkg/api/operation" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +func ValidateCreateExternalVolumeClassRequest(ctx context.Context, req *ateapi.CreateExternalVolumeClassRequest) field.ErrorList { + return Validate_CreateExternalVolumeClassRequest(ctx, MakeCreateOp(ctx), nil, req, nil) +} + +func ValidateGetExternalVolumeClassRequest(ctx context.Context, req *ateapi.GetExternalVolumeClassRequest) field.ErrorList { + return Validate_GetExternalVolumeClassRequest(ctx, MakeCreateOp(ctx), nil, req, nil) +} + +func ValidateListExternalVolumeClassesRequest(ctx context.Context, req *ateapi.ListExternalVolumeClassesRequest) field.ErrorList { + return Validate_ListExternalVolumeClassesRequest(ctx, MakeCreateOp(ctx), nil, req, nil) +} + +func ValidateDeleteExternalVolumeClassRequest(ctx context.Context, req *ateapi.DeleteExternalVolumeClassRequest) field.ErrorList { + return Validate_DeleteExternalVolumeClassRequest(ctx, MakeCreateOp(ctx), nil, req, nil) +} + +func ValidateCustom_ExternalVolumeClass_DriverName(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList { + return resources.ValidateVolumeType(fldPath, *value) +} diff --git a/cmd/ateapi/internal/apivalidation/external_volume_class_test.go b/cmd/ateapi/internal/apivalidation/external_volume_class_test.go new file mode 100644 index 0000000000..9c023c015a --- /dev/null +++ b/cmd/ateapi/internal/apivalidation/external_volume_class_test.go @@ -0,0 +1,135 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package apivalidation + +import ( + "context" + "strings" + "testing" + + "go.ate.dev/substrate/api/ateapi/v1" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +func TestValidateCreateExternalVolumeClassRequest(t *testing.T) { + evc := field.NewPath("external_volume_class") + tests := []struct { + name string + mutate func(*ateapi.ExternalVolumeClass) + want field.ErrorList + wantWithPreview field.ErrorList + }{{ + name: "valid", + want: field.ErrorList{field.Forbidden(evc, "")}, + }, { + name: "driver_name with substrate.io/ prefix", + mutate: func(c *ateapi.ExternalVolumeClass) { c.DriverName = "substrate.io/mock" }, + want: field.ErrorList{field.Forbidden(evc, "")}, + wantWithPreview: nil, + }, { + name: "metadata.atespace must be empty", + mutate: func(c *ateapi.ExternalVolumeClass) { c.Metadata.Atespace = "as" }, + want: field.ErrorList{field.Forbidden(evc, "")}, + wantWithPreview: field.ErrorList{field.Forbidden(evc.Child("metadata", "atespace"), "")}, + }, { + name: "missing driver_name", + mutate: func(c *ateapi.ExternalVolumeClass) { c.DriverName = "" }, + want: field.ErrorList{field.Forbidden(evc, "")}, + wantWithPreview: field.ErrorList{field.Required(evc.Child("driver_name"), "")}, + }, { + name: "invalid driver_name", + mutate: func(c *ateapi.ExternalVolumeClass) { c.DriverName = "Bad_Driver" }, + want: field.ErrorList{field.Forbidden(evc, "")}, + wantWithPreview: field.ErrorList{field.Invalid(evc.Child("driver_name"), nil, "")}, + }, { + name: "too-long driver_name", + mutate: func(c *ateapi.ExternalVolumeClass) { c.DriverName = "nfs.csi." + strings.Repeat("a", 56) }, + want: field.ErrorList{field.Forbidden(evc, "")}, + wantWithPreview: field.ErrorList{field.TooLong(evc.Child("driver_name"), "", 63).WithOrigin("maxLength")}, + }, { + name: "too many parameters", + mutate: func(c *ateapi.ExternalVolumeClass) { c.Parameters = selectorLabelsOfSize(33) }, + want: field.ErrorList{field.Forbidden(evc, "")}, + wantWithPreview: field.ErrorList{field.TooMany(evc.Child("parameters"), 33, 32).WithOrigin("maxProperties")}, + }, { + name: "too-long parameter value", + mutate: func(c *ateapi.ExternalVolumeClass) { c.Parameters = map[string]string{"k": strings.Repeat("v", 257)} }, + want: field.ErrorList{field.Forbidden(evc, "")}, + wantWithPreview: field.ErrorList{field.TooLong(evc.Child("parameters").Key("k"), "", 256).WithOrigin("maxLength")}, + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + c := &ateapi.ExternalVolumeClass{ + Metadata: &ateapi.ResourceMetadata{Name: "nfs"}, + DriverName: "nfs.csi.k8s.io", + } + if tt.mutate != nil { + tt.mutate(c) + } + req := &ateapi.CreateExternalVolumeClassRequest{ExternalVolumeClass: c} + assertValidate(t, func() field.ErrorList { return ValidateCreateExternalVolumeClassRequest(context.Background(), req) }, + tt.want, map[string]field.ErrorList{"ExternalVolumes": tt.wantWithPreview}) + }) + } + t.Run("missing external_volume_class", func(t *testing.T) { + assertValidateErr(t, ValidateCreateExternalVolumeClassRequest(context.Background(), &ateapi.CreateExternalVolumeClassRequest{}), + field.ErrorList{field.Required(evc, "")}) + }) +} + +var externalVolumeClassRefCases = []struct { + name string + ref *ateapi.ObjectRef + want field.ErrorList +}{ + {"valid", &ateapi.ObjectRef{Name: "nfs"}, nil}, + {"missing ref", nil, field.ErrorList{field.Required(field.NewPath("external_volume_class"), "")}}, + {"atespace must be empty", &ateapi.ObjectRef{Atespace: "as", Name: "nfs"}, field.ErrorList{field.Forbidden(field.NewPath("external_volume_class", "atespace"), "")}}, + {"missing name", &ateapi.ObjectRef{}, field.ErrorList{field.Required(field.NewPath("external_volume_class", "name"), "")}}, +} + +func TestValidateGetExternalVolumeClassRequest(t *testing.T) { + for _, tt := range externalVolumeClassRefCases { + t.Run(tt.name, func(t *testing.T) { + req := &ateapi.GetExternalVolumeClassRequest{ExternalVolumeClass: tt.ref} + assertValidateErr(t, ValidateGetExternalVolumeClassRequest(context.Background(), req), tt.want) + }) + } +} + +func TestValidateDeleteExternalVolumeClassRequest(t *testing.T) { + for _, tt := range externalVolumeClassRefCases { + t.Run(tt.name, func(t *testing.T) { + req := &ateapi.DeleteExternalVolumeClassRequest{ExternalVolumeClass: tt.ref} + assertValidateErr(t, ValidateDeleteExternalVolumeClassRequest(context.Background(), req), tt.want) + }) + } +} + +func TestValidateListExternalVolumeClassesRequest(t *testing.T) { + tests := []struct { + name string + req *ateapi.ListExternalVolumeClassesRequest + want field.ErrorList + }{ + {"valid", &ateapi.ListExternalVolumeClassesRequest{}, nil}, + {"negative page_size", &ateapi.ListExternalVolumeClassesRequest{Options: &ateapi.ListOptions{PageSize: -1}}, field.ErrorList{field.Invalid(field.NewPath("options", "page_size"), int32(-1), "").WithOrigin("minimum")}}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assertValidateErr(t, ValidateListExternalVolumeClassesRequest(context.Background(), tt.req), tt.want) + }) + } +} diff --git a/cmd/ateapi/internal/apivalidation/zz_generated.validation.go b/cmd/ateapi/internal/apivalidation/zz_generated.validation.go index 4719d8d4f4..230e6cb9a1 100644 --- a/cmd/ateapi/internal/apivalidation/zz_generated.validation.go +++ b/cmd/ateapi/internal/apivalidation/zz_generated.validation.go @@ -2449,6 +2449,100 @@ func Validate_CreateAtespaceRequest( return errs } +// Validate_CreateCsiDriverConfigRequest validates an instance of CreateCsiDriverConfigRequest according +// to declarative validation rules in the API schema. +func Validate_CreateCsiDriverConfigRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.CreateCsiDriverConfigRequest) (errs field.ErrorList) { + + { // field v1.CreateCsiDriverConfigRequest.CsiDriverConfig + fn := func( + fldPath *field.Path, + obj, oldObj *v1.CsiDriverConfig, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "ExternalVolumes", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "ExternalVolumes", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_CsiDriverConfig(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.CreateCsiDriverConfigRequest) *v1.CsiDriverConfig { + return oldObj.CsiDriverConfig + }) + errs = append(errs, fn(fldPath.Child("csi_driver_config"), obj.CsiDriverConfig, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_CreateExternalVolumeClassRequest validates an instance of CreateExternalVolumeClassRequest according +// to declarative validation rules in the API schema. +func Validate_CreateExternalVolumeClassRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.CreateExternalVolumeClassRequest) (errs field.ErrorList) { + + { // field v1.CreateExternalVolumeClassRequest.ExternalVolumeClass + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ExternalVolumeClass, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "ExternalVolumes", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "ExternalVolumes", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_ExternalVolumeClass(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.CreateExternalVolumeClassRequest) *v1.ExternalVolumeClass { + return oldObj.ExternalVolumeClass + }) + errs = append(errs, fn(fldPath.Child("external_volume_class"), obj.ExternalVolumeClass, oldVal, oldObj != nil)...) + } + + return errs +} + // Validate_CreateGlobalAccessPolicyRequest validates an instance of CreateGlobalAccessPolicyRequest according // to declarative validation rules in the API schema. func Validate_CreateGlobalAccessPolicyRequest( @@ -2729,16 +2823,16 @@ func Validate_CredentialHeader( return errs } -// Validate_DeleteActorEgressPolicyRequest validates an instance of DeleteActorEgressPolicyRequest according +// Validate_CsiDriverConfig validates an instance of CsiDriverConfig according // to declarative validation rules in the API schema. -func Validate_DeleteActorEgressPolicyRequest( +func Validate_CsiDriverConfig( ctx context.Context, op operation.Operation, fldPath *field.Path, - obj, oldObj *v1.DeleteActorEgressPolicyRequest) (errs field.ErrorList) { + obj, oldObj *v1.CsiDriverConfig) (errs field.ErrorList) { - { // field v1.DeleteActorEgressPolicyRequest.Actor + { // field v1.CsiDriverConfig.Metadata fn := func( fldPath *field.Path, - obj, oldObj *v1.ObjectRef, + obj, oldObj *v1.ResourceMetadata, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update { @@ -2758,12 +2852,20 @@ func Validate_DeleteActorEgressPolicyRequest( func() { // cohort = "atespace" earlyReturn := false if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", - func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.RequiredValue).MarkShortCircuit(); len(e) != 0 { + func(o *v1.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.ForbiddenValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", - func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkShortCircuit(); len(e) != 0 { + func(o *v1.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.Immutable).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { earlyReturn = true } if earlyReturn { @@ -2771,17 +2873,17 @@ func Validate_DeleteActorEgressPolicyRequest( } }() // call the type's validation function - errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...) + errs = append(errs, Validate_ResourceMetadata(ctx, op, fldPath, obj, oldObj)...) return } oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteActorEgressPolicyRequest) *v1.ObjectRef { - return oldObj.Actor + func(oldObj *v1.CsiDriverConfig) *v1.ResourceMetadata { + return oldObj.Metadata }) - errs = append(errs, fn(fldPath.Child("actor"), obj.Actor, oldVal, oldObj != nil)...) + errs = append(errs, fn(fldPath.Child("metadata"), obj.Metadata, oldVal, oldObj != nil)...) } - { // field v1.DeleteActorEgressPolicyRequest.Name + { // field v1.CsiDriverConfig.DriverName fn := func( fldPath *field.Path, obj, oldObj *string, @@ -2794,6 +2896,10 @@ func Validate_DeleteActorEgressPolicyRequest( } // call field-attached validations earlyReturn := false + if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { errs = append(errs, e...) earlyReturn = true @@ -2802,25 +2908,96 @@ func Validate_DeleteActorEgressPolicyRequest( return // do not proceed } // custom validation - if e := ValidateCustom_DeleteActorEgressPolicyRequest_Name(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + if e := ValidateCustom_CsiDriverConfig_DriverName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) } - if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + if e := validate.MaxLength(ctx, op, fldPath, obj, oldObj, 63); len(e) != 0 { errs = append(errs, e...) } return } oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteActorEgressPolicyRequest) *string { - return &oldObj.Name + func(oldObj *v1.CsiDriverConfig) *string { + return &oldObj.DriverName }) - errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) + errs = append(errs, fn(fldPath.Child("driver_name"), &obj.DriverName, oldVal, oldObj != nil)...) } - { // field v1.DeleteActorEgressPolicyRequest.Options + { // field v1.CsiDriverConfig.ControllerEndpoint fn := func( fldPath *field.Path, - obj, oldObj *v1.DeleteOptions, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // custom validation + if e := ValidateCustom_CsiDriverConfig_ControllerEndpoint(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + if e := validate.MaxLength(ctx, op, fldPath, obj, oldObj, 1024); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.CsiDriverConfig) *string { + return &oldObj.ControllerEndpoint + }) + errs = append(errs, fn(fldPath.Child("controller_endpoint"), &obj.ControllerEndpoint, oldVal, oldObj != nil)...) + } + + { // field v1.CsiDriverConfig.NodeSocketOverride + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // custom validation + if e := ValidateCustom_CsiDriverConfig_NodeSocketOverride(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + if e := validate.MaxLength(ctx, op, fldPath, obj, oldObj, 1024); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.CsiDriverConfig) *string { + return &oldObj.NodeSocketOverride + }) + errs = append(errs, fn(fldPath.Child("node_socket_override"), &obj.NodeSocketOverride, oldVal, oldObj != nil)...) + } + + { // field v1.CsiDriverConfig.Tls + fn := func( + fldPath *field.Path, + obj, oldObj *v1.CsiDriverTlsConfig, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update { @@ -2837,72 +3014,507 @@ func Validate_DeleteActorEgressPolicyRequest( return // do not proceed } // call the type's validation function - errs = append(errs, Validate_DeleteOptions(ctx, op, fldPath, obj, oldObj)...) + errs = append(errs, Validate_CsiDriverTlsConfig(ctx, op, fldPath, obj, oldObj)...) return } oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteActorEgressPolicyRequest) *v1.DeleteOptions { - return oldObj.Options + func(oldObj *v1.CsiDriverConfig) *v1.CsiDriverTlsConfig { + return oldObj.Tls }) - errs = append(errs, fn(fldPath.Child("options"), obj.Options, oldVal, oldObj != nil)...) + errs = append(errs, fn(fldPath.Child("tls"), obj.Tls, oldVal, oldObj != nil)...) } return errs } -// Validate_DeleteActorRequest validates an instance of DeleteActorRequest according +// Validate_CsiDriverTlsConfig validates an instance of CsiDriverTlsConfig according // to declarative validation rules in the API schema. -func Validate_DeleteActorRequest( +func Validate_CsiDriverTlsConfig( ctx context.Context, op operation.Operation, fldPath *field.Path, - obj, oldObj *v1.DeleteActorRequest) (errs field.ErrorList) { + obj, oldObj *v1.CsiDriverTlsConfig) (errs field.ErrorList) { - { // field v1.DeleteActorRequest.Actor + // custom validation + if e := ValidateCustom_CsiDriverTlsConfig(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + + { // field v1.CsiDriverTlsConfig.Enabled fn := func( fldPath *field.Path, - obj, oldObj *v1.ObjectRef, + obj, oldObj *bool, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update { - if ateDeepEqual(obj, oldObj) { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { return nil } } // call field-attached validations earlyReturn := false - if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { - errs = append(errs, e...) + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } - func() { // cohort = "atespace" - earlyReturn := false - if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", - func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.RequiredValue).MarkShortCircuit(); len(e) != 0 { - errs = append(errs, e...) - earlyReturn = true - } - if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", - func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkShortCircuit(); len(e) != 0 { - earlyReturn = true - } - if earlyReturn { - return // do not proceed + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.CsiDriverTlsConfig) *bool { + return &oldObj.Enabled + }) + errs = append(errs, fn(fldPath.Child("enabled"), &obj.Enabled, oldVal, oldObj != nil)...) + } + + { // field v1.CsiDriverTlsConfig.UsePodIdentity + fn := func( + fldPath *field.Path, + obj, oldObj *bool, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil } - }() - // call the type's validation function - errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...) + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } return } oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteActorRequest) *v1.ObjectRef { - return oldObj.Actor + func(oldObj *v1.CsiDriverTlsConfig) *bool { + return &oldObj.UsePodIdentity + }) + errs = append(errs, fn(fldPath.Child("use_pod_identity"), &obj.UsePodIdentity, oldVal, oldObj != nil)...) + } + + { // field v1.CsiDriverTlsConfig.ServerName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + if e := validate.MaxLength(ctx, op, fldPath, obj, oldObj, 253); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.CsiDriverTlsConfig) *string { + return &oldObj.ServerName + }) + errs = append(errs, fn(fldPath.Child("server_name"), &obj.ServerName, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeleteActorEgressPolicyRequest validates an instance of DeleteActorEgressPolicyRequest according +// to declarative validation rules in the API schema. +func Validate_DeleteActorEgressPolicyRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.DeleteActorEgressPolicyRequest) (errs field.ErrorList) { + + { // field v1.DeleteActorEgressPolicyRequest.Actor + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ObjectRef, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + func() { // cohort = "atespace" + earlyReturn := false + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.RequiredValue).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + }() + // call the type's validation function + errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.DeleteActorEgressPolicyRequest) *v1.ObjectRef { + return oldObj.Actor + }) + errs = append(errs, fn(fldPath.Child("actor"), obj.Actor, oldVal, oldObj != nil)...) + } + + { // field v1.DeleteActorEgressPolicyRequest.Name + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // custom validation + if e := ValidateCustom_DeleteActorEgressPolicyRequest_Name(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.DeleteActorEgressPolicyRequest) *string { + return &oldObj.Name + }) + errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) + } + + { // field v1.DeleteActorEgressPolicyRequest.Options + fn := func( + fldPath *field.Path, + obj, oldObj *v1.DeleteOptions, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_DeleteOptions(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.DeleteActorEgressPolicyRequest) *v1.DeleteOptions { + return oldObj.Options + }) + errs = append(errs, fn(fldPath.Child("options"), obj.Options, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeleteActorRequest validates an instance of DeleteActorRequest according +// to declarative validation rules in the API schema. +func Validate_DeleteActorRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.DeleteActorRequest) (errs field.ErrorList) { + + { // field v1.DeleteActorRequest.Actor + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ObjectRef, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + func() { // cohort = "atespace" + earlyReturn := false + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.RequiredValue).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + }() + // call the type's validation function + errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.DeleteActorRequest) *v1.ObjectRef { + return oldObj.Actor + }) + errs = append(errs, fn(fldPath.Child("actor"), obj.Actor, oldVal, oldObj != nil)...) + } + + { // field v1.DeleteActorRequest.Options + fn := func( + fldPath *field.Path, + obj, oldObj *v1.DeleteOptions, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_DeleteOptions(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.DeleteActorRequest) *v1.DeleteOptions { + return oldObj.Options + }) + errs = append(errs, fn(fldPath.Child("options"), obj.Options, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeleteActorTemplateRequest validates an instance of DeleteActorTemplateRequest according +// to declarative validation rules in the API schema. +func Validate_DeleteActorTemplateRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.DeleteActorTemplateRequest) (errs field.ErrorList) { + + { // field v1.DeleteActorTemplateRequest.ActorTemplate + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ObjectRef, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + func() { // cohort = "atespace" + earlyReturn := false + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.RequiredValue).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + }() + // call the type's validation function + errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.DeleteActorTemplateRequest) *v1.ObjectRef { + return oldObj.ActorTemplate + }) + errs = append(errs, fn(fldPath.Child("actor_template"), obj.ActorTemplate, oldVal, oldObj != nil)...) + } + + { // field v1.DeleteActorTemplateRequest.Options + fn := func( + fldPath *field.Path, + obj, oldObj *v1.DeleteOptions, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_DeleteOptions(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.DeleteActorTemplateRequest) *v1.DeleteOptions { + return oldObj.Options + }) + errs = append(errs, fn(fldPath.Child("options"), obj.Options, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_DeleteAtespaceAccessPolicyRequest validates an instance of DeleteAtespaceAccessPolicyRequest according +// to declarative validation rules in the API schema. +func Validate_DeleteAtespaceAccessPolicyRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.DeleteAtespaceAccessPolicyRequest) (errs field.ErrorList) { + + { // field v1.DeleteAtespaceAccessPolicyRequest.Atespace + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ObjectRef, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + func() { // cohort = "atespace" + earlyReturn := false + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.ForbiddenValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + }() + // call the type's validation function + errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.DeleteAtespaceAccessPolicyRequest) *v1.ObjectRef { + return oldObj.Atespace + }) + errs = append(errs, fn(fldPath.Child("atespace"), obj.Atespace, oldVal, oldObj != nil)...) + } + + { // field v1.DeleteAtespaceAccessPolicyRequest.Name + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // custom validation + if e := ValidateCustom_DeleteAtespaceAccessPolicyRequest_Name(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.DeleteAtespaceAccessPolicyRequest) *string { + return &oldObj.Name }) - errs = append(errs, fn(fldPath.Child("actor"), obj.Actor, oldVal, oldObj != nil)...) + errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) } - { // field v1.DeleteActorRequest.Options + { // field v1.DeleteAtespaceAccessPolicyRequest.Options fn := func( fldPath *field.Path, obj, oldObj *v1.DeleteOptions, @@ -2926,7 +3538,7 @@ func Validate_DeleteActorRequest( return } oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteActorRequest) *v1.DeleteOptions { + func(oldObj *v1.DeleteAtespaceAccessPolicyRequest) *v1.DeleteOptions { return oldObj.Options }) errs = append(errs, fn(fldPath.Child("options"), obj.Options, oldVal, oldObj != nil)...) @@ -2935,13 +3547,13 @@ func Validate_DeleteActorRequest( return errs } -// Validate_DeleteActorTemplateRequest validates an instance of DeleteActorTemplateRequest according +// Validate_DeleteAtespaceRequest validates an instance of DeleteAtespaceRequest according // to declarative validation rules in the API schema. -func Validate_DeleteActorTemplateRequest( +func Validate_DeleteAtespaceRequest( ctx context.Context, op operation.Operation, fldPath *field.Path, - obj, oldObj *v1.DeleteActorTemplateRequest) (errs field.ErrorList) { + obj, oldObj *v1.DeleteAtespaceRequest) (errs field.ErrorList) { - { // field v1.DeleteActorTemplateRequest.ActorTemplate + { // field v1.DeleteAtespaceRequest.Atespace fn := func( fldPath *field.Path, obj, oldObj *v1.ObjectRef, @@ -2964,12 +3576,16 @@ func Validate_DeleteActorTemplateRequest( func() { // cohort = "atespace" earlyReturn := false if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", - func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.RequiredValue).MarkShortCircuit(); len(e) != 0 { + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.ForbiddenValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", - func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkShortCircuit(); len(e) != 0 { + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { earlyReturn = true } if earlyReturn { @@ -2981,13 +3597,13 @@ func Validate_DeleteActorTemplateRequest( return } oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteActorTemplateRequest) *v1.ObjectRef { - return oldObj.ActorTemplate + func(oldObj *v1.DeleteAtespaceRequest) *v1.ObjectRef { + return oldObj.Atespace }) - errs = append(errs, fn(fldPath.Child("actor_template"), obj.ActorTemplate, oldVal, oldObj != nil)...) + errs = append(errs, fn(fldPath.Child("atespace"), obj.Atespace, oldVal, oldObj != nil)...) } - { // field v1.DeleteActorTemplateRequest.Options + { // field v1.DeleteAtespaceRequest.Options fn := func( fldPath *field.Path, obj, oldObj *v1.DeleteOptions, @@ -3011,7 +3627,7 @@ func Validate_DeleteActorTemplateRequest( return } oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteActorTemplateRequest) *v1.DeleteOptions { + func(oldObj *v1.DeleteAtespaceRequest) *v1.DeleteOptions { return oldObj.Options }) errs = append(errs, fn(fldPath.Child("options"), obj.Options, oldVal, oldObj != nil)...) @@ -3020,13 +3636,13 @@ func Validate_DeleteActorTemplateRequest( return errs } -// Validate_DeleteAtespaceAccessPolicyRequest validates an instance of DeleteAtespaceAccessPolicyRequest according +// Validate_DeleteCsiDriverConfigRequest validates an instance of DeleteCsiDriverConfigRequest according // to declarative validation rules in the API schema. -func Validate_DeleteAtespaceAccessPolicyRequest( +func Validate_DeleteCsiDriverConfigRequest( ctx context.Context, op operation.Operation, fldPath *field.Path, - obj, oldObj *v1.DeleteAtespaceAccessPolicyRequest) (errs field.ErrorList) { + obj, oldObj *v1.DeleteCsiDriverConfigRequest) (errs field.ErrorList) { - { // field v1.DeleteAtespaceAccessPolicyRequest.Atespace + { // field v1.DeleteCsiDriverConfigRequest.CsiDriverConfig fn := func( fldPath *field.Path, obj, oldObj *v1.ObjectRef, @@ -3070,49 +3686,13 @@ func Validate_DeleteAtespaceAccessPolicyRequest( return } oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteAtespaceAccessPolicyRequest) *v1.ObjectRef { - return oldObj.Atespace - }) - errs = append(errs, fn(fldPath.Child("atespace"), obj.Atespace, oldVal, oldObj != nil)...) - } - - { // field v1.DeleteAtespaceAccessPolicyRequest.Name - fn := func( - fldPath *field.Path, - obj, oldObj *string, - oldValueCorrelated bool) (errs field.ErrorList) { - // don't revalidate unchanged data - if oldValueCorrelated && op.Type == operation.Update { - if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { - return nil - } - } - // call field-attached validations - earlyReturn := false - if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { - errs = append(errs, e...) - earlyReturn = true - } - if earlyReturn { - return // do not proceed - } - // custom validation - if e := ValidateCustom_DeleteAtespaceAccessPolicyRequest_Name(ctx, op, fldPath, obj, oldObj); len(e) != 0 { - errs = append(errs, e...) - } - if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { - errs = append(errs, e...) - } - return - } - oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteAtespaceAccessPolicyRequest) *string { - return &oldObj.Name + func(oldObj *v1.DeleteCsiDriverConfigRequest) *v1.ObjectRef { + return oldObj.CsiDriverConfig }) - errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...) + errs = append(errs, fn(fldPath.Child("csi_driver_config"), obj.CsiDriverConfig, oldVal, oldObj != nil)...) } - { // field v1.DeleteAtespaceAccessPolicyRequest.Options + { // field v1.DeleteCsiDriverConfigRequest.Options fn := func( fldPath *field.Path, obj, oldObj *v1.DeleteOptions, @@ -3136,7 +3716,7 @@ func Validate_DeleteAtespaceAccessPolicyRequest( return } oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteAtespaceAccessPolicyRequest) *v1.DeleteOptions { + func(oldObj *v1.DeleteCsiDriverConfigRequest) *v1.DeleteOptions { return oldObj.Options }) errs = append(errs, fn(fldPath.Child("options"), obj.Options, oldVal, oldObj != nil)...) @@ -3145,13 +3725,13 @@ func Validate_DeleteAtespaceAccessPolicyRequest( return errs } -// Validate_DeleteAtespaceRequest validates an instance of DeleteAtespaceRequest according +// Validate_DeleteExternalVolumeClassRequest validates an instance of DeleteExternalVolumeClassRequest according // to declarative validation rules in the API schema. -func Validate_DeleteAtespaceRequest( +func Validate_DeleteExternalVolumeClassRequest( ctx context.Context, op operation.Operation, fldPath *field.Path, - obj, oldObj *v1.DeleteAtespaceRequest) (errs field.ErrorList) { + obj, oldObj *v1.DeleteExternalVolumeClassRequest) (errs field.ErrorList) { - { // field v1.DeleteAtespaceRequest.Atespace + { // field v1.DeleteExternalVolumeClassRequest.ExternalVolumeClass fn := func( fldPath *field.Path, obj, oldObj *v1.ObjectRef, @@ -3195,13 +3775,13 @@ func Validate_DeleteAtespaceRequest( return } oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteAtespaceRequest) *v1.ObjectRef { - return oldObj.Atespace + func(oldObj *v1.DeleteExternalVolumeClassRequest) *v1.ObjectRef { + return oldObj.ExternalVolumeClass }) - errs = append(errs, fn(fldPath.Child("atespace"), obj.Atespace, oldVal, oldObj != nil)...) + errs = append(errs, fn(fldPath.Child("external_volume_class"), obj.ExternalVolumeClass, oldVal, oldObj != nil)...) } - { // field v1.DeleteAtespaceRequest.Options + { // field v1.DeleteExternalVolumeClassRequest.Options fn := func( fldPath *field.Path, obj, oldObj *v1.DeleteOptions, @@ -3225,7 +3805,7 @@ func Validate_DeleteAtespaceRequest( return } oldVal := safe.Field(oldObj, - func(oldObj *v1.DeleteAtespaceRequest) *v1.DeleteOptions { + func(oldObj *v1.DeleteExternalVolumeClassRequest) *v1.DeleteOptions { return oldObj.Options }) errs = append(errs, fn(fldPath.Child("options"), obj.Options, oldVal, oldObj != nil)...) @@ -3898,6 +4478,149 @@ func Validate_EnvVar( return errs } +// Validate_ExternalVolumeClass validates an instance of ExternalVolumeClass according +// to declarative validation rules in the API schema. +func Validate_ExternalVolumeClass( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.ExternalVolumeClass) (errs field.ErrorList) { + + { // field v1.ExternalVolumeClass.Metadata + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ResourceMetadata, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + func() { // cohort = "atespace" + earlyReturn := false + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.ForbiddenValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.Immutable).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + }() + // call the type's validation function + errs = append(errs, Validate_ResourceMetadata(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ExternalVolumeClass) *v1.ResourceMetadata { + return oldObj.Metadata + }) + errs = append(errs, fn(fldPath.Child("metadata"), obj.Metadata, oldVal, oldObj != nil)...) + } + + { // field v1.ExternalVolumeClass.DriverName + fn := func( + fldPath *field.Path, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // custom validation + if e := ValidateCustom_ExternalVolumeClass_DriverName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + if e := validate.MaxLength(ctx, op, fldPath, obj, oldObj, 63); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ExternalVolumeClass) *string { + return &oldObj.DriverName + }) + errs = append(errs, fn(fldPath.Child("driver_name"), &obj.DriverName, oldVal, oldObj != nil)...) + } + + { // field v1.ExternalVolumeClass.Parameters + fn := func( + fldPath *field.Path, + obj, oldObj map[string]string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.MaxProperties(ctx, op, fldPath, obj, oldObj, 32).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.OptionalMap(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.EachMapKey(ctx, op, fldPath, obj, oldObj, + func(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *string) field.ErrorList { + return validate.MaxLength(ctx, op, fldPath, obj, oldObj, 128) + }); len(e) != 0 { + errs = append(errs, e...) + } + if e := validate.EachMapVal(ctx, op, fldPath, obj, oldObj, validate.DirectEqual, + func(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *string) field.ErrorList { + return validate.MaxLength(ctx, op, fldPath, obj, oldObj, 256) + }); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ExternalVolumeClass) map[string]string { + return oldObj.Parameters + }) + errs = append(errs, fn(fldPath.Child("parameters"), obj.Parameters, oldVal, oldObj != nil)...) + } + + return errs +} + var unionMembershipFor_go_ate_dev_substrate_api_ateapi_v1_ExternalVolumeSource_ = validate.NewUnionMembership(validate.NewUnionMember("template")) // Validate_ExternalVolumeSource validates an instance of ExternalVolumeSource according @@ -4108,12 +4831,31 @@ func Validate_ExternalVolumeStatus( return errs } +var unionMembershipFor_go_ate_dev_substrate_api_ateapi_v1_ExternalVolumeTemplate_ = validate.NewUnionMembership(validate.NewUnionMember("storage_class_name"), validate.NewUnionMember("external_volume_class")) + // Validate_ExternalVolumeTemplate validates an instance of ExternalVolumeTemplate according // to declarative validation rules in the API schema. func Validate_ExternalVolumeTemplate( ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *v1.ExternalVolumeTemplate) (errs field.ErrorList) { + if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_go_ate_dev_substrate_api_ateapi_v1_ExternalVolumeTemplate_, + func(obj *v1.ExternalVolumeTemplate) bool { + if obj == nil { + return false + } + var z string + return obj.StorageClassName != z + }, + func(obj *v1.ExternalVolumeTemplate) bool { + if obj == nil { + return false + } + return obj.ExternalVolumeClass != nil + }); len(e) != 0 { + errs = append(errs, e...) + } + { // field v1.ExternalVolumeTemplate.CapacityBytes fn := func( fldPath *field.Path, @@ -4149,33 +4891,81 @@ func Validate_ExternalVolumeTemplate( { // field v1.ExternalVolumeTemplate.StorageClassName fn := func( fldPath *field.Path, - obj, oldObj *string, + obj, oldObj *string, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ExternalVolumeTemplate) *string { + return &oldObj.StorageClassName + }) + errs = append(errs, fn(fldPath.Child("storage_class_name"), &obj.StorageClassName, oldVal, oldObj != nil)...) + } + + { // field v1.ExternalVolumeTemplate.ExternalVolumeClass + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ObjectRef, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update { - if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) { + if ateDeepEqual(obj, oldObj) { return nil } } // call field-attached validations earlyReturn := false - if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { - errs = append(errs, e...) + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } - if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 { - errs = append(errs, e...) - } + func() { // cohort = "atespace" + earlyReturn := false + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.ForbiddenValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + }() + // call the type's validation function + errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...) return } oldVal := safe.Field(oldObj, - func(oldObj *v1.ExternalVolumeTemplate) *string { - return &oldObj.StorageClassName + func(oldObj *v1.ExternalVolumeTemplate) *v1.ObjectRef { + return oldObj.ExternalVolumeClass }) - errs = append(errs, fn(fldPath.Child("storage_class_name"), &obj.StorageClassName, oldVal, oldObj != nil)...) + errs = append(errs, fn(fldPath.Child("external_volume_class"), obj.ExternalVolumeClass, oldVal, oldObj != nil)...) } return errs @@ -4591,6 +5381,124 @@ func Validate_GetAtespaceRequest( return errs } +// Validate_GetCsiDriverConfigRequest validates an instance of GetCsiDriverConfigRequest according +// to declarative validation rules in the API schema. +func Validate_GetCsiDriverConfigRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.GetCsiDriverConfigRequest) (errs field.ErrorList) { + + { // field v1.GetCsiDriverConfigRequest.CsiDriverConfig + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ObjectRef, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + func() { // cohort = "atespace" + earlyReturn := false + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.ForbiddenValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + }() + // call the type's validation function + errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.GetCsiDriverConfigRequest) *v1.ObjectRef { + return oldObj.CsiDriverConfig + }) + errs = append(errs, fn(fldPath.Child("csi_driver_config"), obj.CsiDriverConfig, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_GetExternalVolumeClassRequest validates an instance of GetExternalVolumeClassRequest according +// to declarative validation rules in the API schema. +func Validate_GetExternalVolumeClassRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.GetExternalVolumeClassRequest) (errs field.ErrorList) { + + { // field v1.GetExternalVolumeClassRequest.ExternalVolumeClass + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ObjectRef, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + func() { // cohort = "atespace" + earlyReturn := false + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.ForbiddenValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace", + func(o *v1.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + }() + // call the type's validation function + errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.GetExternalVolumeClassRequest) *v1.ObjectRef { + return oldObj.ExternalVolumeClass + }) + errs = append(errs, fn(fldPath.Child("external_volume_class"), obj.ExternalVolumeClass, oldVal, oldObj != nil)...) + } + + return errs +} + // Validate_GetGlobalAccessPolicyRequest validates an instance of GetGlobalAccessPolicyRequest according // to declarative validation rules in the API schema. func Validate_GetGlobalAccessPolicyRequest( @@ -5491,6 +6399,84 @@ func Validate_ListAtespacesRequest( return errs } +// Validate_ListCsiDriverConfigsRequest validates an instance of ListCsiDriverConfigsRequest according +// to declarative validation rules in the API schema. +func Validate_ListCsiDriverConfigsRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.ListCsiDriverConfigsRequest) (errs field.ErrorList) { + + { // field v1.ListCsiDriverConfigsRequest.Options + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ListOptions, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_ListOptions(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ListCsiDriverConfigsRequest) *v1.ListOptions { + return oldObj.Options + }) + errs = append(errs, fn(fldPath.Child("options"), obj.Options, oldVal, oldObj != nil)...) + } + + return errs +} + +// Validate_ListExternalVolumeClassesRequest validates an instance of ListExternalVolumeClassesRequest according +// to declarative validation rules in the API schema. +func Validate_ListExternalVolumeClassesRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.ListExternalVolumeClassesRequest) (errs field.ErrorList) { + + { // field v1.ListExternalVolumeClassesRequest.Options + fn := func( + fldPath *field.Path, + obj, oldObj *v1.ListOptions, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_ListOptions(ctx, op, fldPath, obj, oldObj)...) + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.ListExternalVolumeClassesRequest) *v1.ListOptions { + return oldObj.Options + }) + errs = append(errs, fn(fldPath.Child("options"), obj.Options, oldVal, oldObj != nil)...) + } + + return errs +} + // Validate_ListOptions validates an instance of ListOptions according // to declarative validation rules in the API schema. func Validate_ListOptions( @@ -9491,6 +10477,66 @@ func Validate_UpdateAtespaceAccessPolicyRequest( return errs } +// Validate_UpdateCsiDriverConfigRequest validates an instance of UpdateCsiDriverConfigRequest according +// to declarative validation rules in the API schema. +func Validate_UpdateCsiDriverConfigRequest( + ctx context.Context, op operation.Operation, fldPath *field.Path, + obj, oldObj *v1.UpdateCsiDriverConfigRequest) (errs field.ErrorList) { + + { // field v1.UpdateCsiDriverConfigRequest.CsiDriverConfig + fn := func( + fldPath *field.Path, + obj, oldObj *v1.CsiDriverConfig, + oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update { + if ateDeepEqual(obj, oldObj) { + return nil + } + } + // call field-attached validations + earlyReturn := false + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "ExternalVolumes", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "ExternalVolumes", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 { + earlyReturn = true + } + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // custom validation + if e := ValidateCustom_UpdateCsiDriverConfigRequest_CsiDriverConfig(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + errs = append(errs, e...) + } + func() { // cohort = "metadata" + earlyReturn := false + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "metadata", + func(o *v1.CsiDriverConfig) *v1.ResourceMetadata { return o.Metadata }, ateDeepEqual, validate.RequiredPointer).MarkShortCircuit(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + }() + return + } + oldVal := safe.Field(oldObj, + func(oldObj *v1.UpdateCsiDriverConfigRequest) *v1.CsiDriverConfig { + return oldObj.CsiDriverConfig + }) + errs = append(errs, fn(fldPath.Child("csi_driver_config"), obj.CsiDriverConfig, oldVal, oldObj != nil)...) + } + + return errs +} + // Validate_UpdateGlobalAccessPolicyRequest validates an instance of UpdateGlobalAccessPolicyRequest according // to declarative validation rules in the API schema. func Validate_UpdateGlobalAccessPolicyRequest( diff --git a/cmd/ateapi/internal/authz/authorizer.go b/cmd/ateapi/internal/authz/authorizer.go index dac3a324f0..59a005cc74 100644 --- a/cmd/ateapi/internal/authz/authorizer.go +++ b/cmd/ateapi/internal/authz/authorizer.go @@ -52,9 +52,9 @@ type Authorizer struct { } // Check verifies that the principal in ctx has relation on object. -// Structural hierarchy links (global:root as parent_global of every atespace -// and worker, and each atespace as parent_atespace of its actors, actor -// templates and tags) and +// Structural hierarchy links (global:root as parent_global of every atespace, +// worker, external volume class and CSI driver config, and each atespace as +// parent_atespace of its actors, actor templates and tags) and // the caller's bootstrap owner and system role grants, if any, are injected as OpenFGA // ContextualTuples at evaluation time rather than persisted in the tuple table. func (a *Authorizer) Check(ctx context.Context, relation, object string) error { @@ -129,20 +129,23 @@ func (a *Authorizer) checkRaw(ctx context.Context, user, relation, object string // tuples in PostgreSQL. // // Why contextual tuples are used instead of storing parent links in the database: -// 1. Deterministic structure: Every `atespace:` and `worker:` +// 1. Deterministic structure: Every `atespace:`, `worker:`, +// `external_volume_class:` and `csi_driver_config:` // unconditionally has `global:root` as its `parent_global`, and every // `actor:/`, `actor_template:/` and // `tag:/` has `atespace:` as its -// `parent_atespace`. Because these -// relationships are derived purely from the object type/ID, storing a row -// per resource in the OpenFGA `tuple` table would be redundant. +// `parent_atespace`. Because these relationships are derived purely from +// the object type/ID, storing a row per resource in the OpenFGA `tuple` +// table would be redundant. // 2. No write amplification on create: `CreateAtespace`, `CreateWorker`, -// `CreateActorTemplate`, `CreateActor` and `CreateTag` can insert their rows without -// opening an OpenFGA write transaction just to link the parent. +// `CreateExternalVolumeClass`, `CreateCsiDriverConfig`, +// `CreateActorTemplate`, `CreateActor` and `CreateTag` can insert their +// rows without opening an OpenFGA write transaction just to link the +// parent. func contextualTuples(object string) []*openfgav1.TupleKey { objectType, id, _ := strings.Cut(object, ":") switch objectType { - case "atespace", "worker": + case "atespace", "worker", "external_volume_class", "csi_driver_config": return []*openfgav1.TupleKey{parentGlobalTuple(object)} case "actor", "actor_template", "tag": atespace, _, ok := strings.Cut(id, "/") @@ -159,8 +162,8 @@ func contextualTuples(object string) []*openfgav1.TupleKey { return nil } -// parentGlobalTuple links a global-scoped object (an atespace or a worker) to -// global:root. +// parentGlobalTuple links a global-scoped object (an atespace, worker, +// external volume class or CSI driver config) to global:root. func parentGlobalTuple(object string) *openfgav1.TupleKey { return &openfgav1.TupleKey{ User: GlobalRootObject, diff --git a/cmd/ateapi/internal/authz/authorizer_test.go b/cmd/ateapi/internal/authz/authorizer_test.go index c35b7179e0..9278b6b93b 100644 --- a/cmd/ateapi/internal/authz/authorizer_test.go +++ b/cmd/ateapi/internal/authz/authorizer_test.go @@ -50,6 +50,16 @@ func TestContextualTuples(t *testing.T) { object: WorkerObject("w-1"), want: []*openfgav1.TupleKey{parentGlobal("worker:w-1")}, }, + { + name: "external volume class", + object: ExternalVolumeClassObject("nfs-gold"), + want: []*openfgav1.TupleKey{parentGlobal("external_volume_class:nfs-gold")}, + }, + { + name: "csi driver config", + object: CsiDriverConfigObject("csi-nfs"), + want: []*openfgav1.TupleKey{parentGlobal("csi_driver_config:csi-nfs")}, + }, { name: "actor", object: ActorObject("team-a", "runner"), diff --git a/cmd/ateapi/internal/authz/authz_util.go b/cmd/ateapi/internal/authz/authz_util.go index 092beb80fd..237ece25a0 100644 --- a/cmd/ateapi/internal/authz/authz_util.go +++ b/cmd/ateapi/internal/authz/authz_util.go @@ -80,6 +80,11 @@ const ( RelationCanUseTag = "can_use_tag" RelationCanMintActorJWT = "can_mint_actor_jwt" + RelationCanCreateExternalVolumeClass = "can_create_external_volume_class" + RelationCanListExternalVolumeClasses = "can_list_external_volume_classes" + RelationCanCreateCsiDriverConfig = "can_create_csi_driver_config" + RelationCanListCsiDriverConfigs = "can_list_csi_driver_configs" + // maxTuplesPerWrite is OpenFGA's default maximum number of tuples allowed in a single Write request. maxTuplesPerWrite = 100 ) @@ -128,6 +133,18 @@ func WorkerObject(name string) string { return "worker:" + objectIDReplacer.Replace(name) } +// ExternalVolumeClassObject formats an external volume class name as an +// OpenFGA object string. External volume classes are global-scoped. +func ExternalVolumeClassObject(name string) string { + return "external_volume_class:" + objectIDReplacer.Replace(name) +} + +// CsiDriverConfigObject formats a CSI driver config name as an OpenFGA object +// string. CSI driver configs are global-scoped. +func CsiDriverConfigObject(name string) string { + return "csi_driver_config:" + objectIDReplacer.Replace(name) +} + // ActorObject formats an actor as an OpenFGA object string. func ActorObject(atespace, name string) string { return "actor:" + atespacedID(atespace, name) diff --git a/cmd/ateapi/internal/authz/model.fga b/cmd/ateapi/internal/authz/model.fga index bf689b48e0..99cd4fcaf3 100644 --- a/cmd/ateapi/internal/authz/model.fga +++ b/cmd/ateapi/internal/authz/model.fga @@ -65,11 +65,34 @@ type global define can_list_actor_templates: viewer define can_list_tags: viewer + # --- Volume Infrastructure --- + define can_create_external_volume_class: owner + define can_list_external_volume_classes: viewer + define can_create_csi_driver_config: owner + define can_list_csi_driver_configs: viewer or atelet + # --- Policy Governance --- define can_create_access_policy: owner define can_get_access_policy: viewer define can_update_access_policy: owner +# Global-scoped; inherits its roles from global. +type external_volume_class + relations + define parent_global: [global] + + define can_get: viewer from parent_global + define can_delete: owner from parent_global + +# Global-scoped; inherits its roles from global. +type csi_driver_config + relations + define parent_global: [global] + + define can_get: viewer from parent_global or atelet from parent_global + define can_update: owner from parent_global + define can_delete: owner from parent_global + type atespace relations define parent_global: [global] diff --git a/cmd/ateapi/internal/authz/model_test.fga.yaml b/cmd/ateapi/internal/authz/model_test.fga.yaml index c9cb9916ce..2c125afa14 100644 --- a/cmd/ateapi/internal/authz/model_test.fga.yaml +++ b/cmd/ateapi/internal/authz/model_test.fga.yaml @@ -94,6 +94,16 @@ tuples: relation: api_server_sidecar object: global:root + # External volume class (nfs-gold linked to global:root) + - user: global:root + relation: parent_global + object: external_volume_class:nfs-gold + + # CSI driver config (csi-nfs linked to global:root) + - user: global:root + relation: parent_global + object: csi_driver_config:csi-nfs + tests: - name: 1. Global Superadmin & Viewer Propagation check: @@ -572,3 +582,83 @@ tests: object: actor:runner-1 assertions: can_mint_actor_jwt: false + + - name: 10. External Volume Classes (Inherited from Global) + check: + - user: user:carol # Global owner + object: global:root + assertions: + can_create_external_volume_class: true + can_list_external_volume_classes: true + - user: user:frank # Global viewer + object: global:root + assertions: + can_create_external_volume_class: false + can_list_external_volume_classes: true + - user: user:bob # Atespace editor + object: global:root + assertions: + can_create_external_volume_class: false + can_list_external_volume_classes: false + - user: user:carol + object: external_volume_class:nfs-gold + assertions: + can_get: true + can_delete: true + - user: user:frank + object: external_volume_class:nfs-gold + assertions: + can_get: true + can_delete: false + - user: user:bob + object: external_volume_class:nfs-gold + assertions: + can_get: false + can_delete: false + + - name: 11. CSI Driver Configs (Inherited from Global) + check: + - user: user:carol # Global owner + object: global:root + assertions: + can_create_csi_driver_config: true + can_list_csi_driver_configs: true + - user: user:frank # Global viewer + object: global:root + assertions: + can_create_csi_driver_config: false + can_list_csi_driver_configs: true + - user: user:sys-atelet # atelet system role + object: global:root + assertions: + can_create_csi_driver_config: false + can_list_csi_driver_configs: true + - user: user:bob # Atespace editor + object: global:root + assertions: + can_create_csi_driver_config: false + can_list_csi_driver_configs: false + - user: user:carol + object: csi_driver_config:csi-nfs + assertions: + can_get: true + can_update: true + can_delete: true + - user: user:frank + object: csi_driver_config:csi-nfs + assertions: + can_get: true + can_update: false + can_delete: false + - user: user:sys-atelet + object: csi_driver_config:csi-nfs + assertions: + can_get: true + can_update: false + can_delete: false + - user: user:bob + object: csi_driver_config:csi-nfs + assertions: + can_get: false + can_update: false + can_delete: false diff --git a/cmd/ateapi/internal/authz/registry.go b/cmd/ateapi/internal/authz/registry.go index b4bf601a0e..7512700bed 100644 --- a/cmd/ateapi/internal/authz/registry.go +++ b/cmd/ateapi/internal/authz/registry.go @@ -88,6 +88,20 @@ func onWorker(relation, name string, fldPath *field.Path) ([]check, field.ErrorL return []check{{relation: relation, object: WorkerObject(name)}}, nil } +func onExternalVolumeClass(relation, name string, fldPath *field.Path) ([]check, field.ErrorList) { + if errs := validateName(name, fldPath); len(errs) > 0 { + return nil, errs + } + return []check{{relation: relation, object: ExternalVolumeClassObject(name)}}, nil +} + +func onCsiDriverConfig(relation, name string, fldPath *field.Path) ([]check, field.ErrorList) { + if errs := validateName(name, fldPath); len(errs) > 0 { + return nil, errs + } + return []check{{relation: relation, object: CsiDriverConfigObject(name)}}, nil +} + // resourceRef identifies an atespaced resource. Both *ateapi.ObjectRef and // *ateapi.ResourceMetadata satisfy it, including as nil pointers. type resourceRef interface { @@ -294,6 +308,37 @@ var defaultRPCPermissions = map[string]rpcRule{ return onWorker(RelationCanListActorAssignments, r.GetWorker().GetName(), field.NewPath("worker", "name")) })), + // External volume classes. Global-scoped like workers. + ateapi.Control_CreateExternalVolumeClass_FullMethodName: rule(checksOf(func(*ateapi.CreateExternalVolumeClassRequest) ([]check, field.ErrorList) { + return onGlobal(RelationCanCreateExternalVolumeClass) + })), + ateapi.Control_ListExternalVolumeClasses_FullMethodName: rule(checksOf(func(*ateapi.ListExternalVolumeClassesRequest) ([]check, field.ErrorList) { + return onGlobal(RelationCanListExternalVolumeClasses) + })), + ateapi.Control_GetExternalVolumeClass_FullMethodName: rule(checksOf(func(r *ateapi.GetExternalVolumeClassRequest) ([]check, field.ErrorList) { + return onExternalVolumeClass(RelationCanGet, r.GetExternalVolumeClass().GetName(), field.NewPath("external_volume_class", "name")) + })), + ateapi.Control_DeleteExternalVolumeClass_FullMethodName: rule(checksOf(func(r *ateapi.DeleteExternalVolumeClassRequest) ([]check, field.ErrorList) { + return onExternalVolumeClass(RelationCanDelete, r.GetExternalVolumeClass().GetName(), field.NewPath("external_volume_class", "name")) + })), + + // CSI driver configs. Global-scoped like workers. + ateapi.Control_CreateCsiDriverConfig_FullMethodName: rule(checksOf(func(*ateapi.CreateCsiDriverConfigRequest) ([]check, field.ErrorList) { + return onGlobal(RelationCanCreateCsiDriverConfig) + })), + ateapi.Control_ListCsiDriverConfigs_FullMethodName: rule(checksOf(func(*ateapi.ListCsiDriverConfigsRequest) ([]check, field.ErrorList) { + return onGlobal(RelationCanListCsiDriverConfigs) + })), + ateapi.Control_GetCsiDriverConfig_FullMethodName: rule(checksOf(func(r *ateapi.GetCsiDriverConfigRequest) ([]check, field.ErrorList) { + return onCsiDriverConfig(RelationCanGet, r.GetCsiDriverConfig().GetName(), field.NewPath("csi_driver_config", "name")) + })), + ateapi.Control_UpdateCsiDriverConfig_FullMethodName: rule(checksOf(func(r *ateapi.UpdateCsiDriverConfigRequest) ([]check, field.ErrorList) { + return onCsiDriverConfig(RelationCanUpdate, r.GetCsiDriverConfig().GetMetadata().GetName(), field.NewPath("csi_driver_config", "metadata", "name")) + })), + ateapi.Control_DeleteCsiDriverConfig_FullMethodName: rule(checksOf(func(r *ateapi.DeleteCsiDriverConfigRequest) ([]check, field.ErrorList) { + return onCsiDriverConfig(RelationCanDelete, r.GetCsiDriverConfig().GetName(), field.NewPath("csi_driver_config", "name")) + })), + // Actor identity credentials. ateapi.Control_MintActorJwt_FullMethodName: rule(checksOf(func(r *ateapi.MintActorJwtRequest) ([]check, field.ErrorList) { return onActor(RelationCanMintActorJWT, r.GetActor(), field.NewPath("actor")) diff --git a/cmd/ateapi/internal/authz/registry_test.go b/cmd/ateapi/internal/authz/registry_test.go index d12e60e029..594afe1cce 100644 --- a/cmd/ateapi/internal/authz/registry_test.go +++ b/cmd/ateapi/internal/authz/registry_test.go @@ -274,6 +274,66 @@ func TestDefaultRPCPermissions(t *testing.T) { want: []check{{RelationCanListActorAssignments, "worker:w-1"}}, }, + // External volume classes. + { + name: "CreateExternalVolumeClass", + fullMethod: ateapi.Control_CreateExternalVolumeClass_FullMethodName, + req: &ateapi.CreateExternalVolumeClassRequest{}, + want: []check{{RelationCanCreateExternalVolumeClass, GlobalRootObject}}, + }, + { + name: "ListExternalVolumeClasses", + fullMethod: ateapi.Control_ListExternalVolumeClasses_FullMethodName, + req: &ateapi.ListExternalVolumeClassesRequest{}, + want: []check{{RelationCanListExternalVolumeClasses, GlobalRootObject}}, + }, + { + name: "GetExternalVolumeClass", + fullMethod: ateapi.Control_GetExternalVolumeClass_FullMethodName, + req: &ateapi.GetExternalVolumeClassRequest{ExternalVolumeClass: &ateapi.ObjectRef{Name: "nfs-gold"}}, + want: []check{{RelationCanGet, "external_volume_class:nfs-gold"}}, + }, + { + name: "DeleteExternalVolumeClass", + fullMethod: ateapi.Control_DeleteExternalVolumeClass_FullMethodName, + req: &ateapi.DeleteExternalVolumeClassRequest{ExternalVolumeClass: &ateapi.ObjectRef{Name: "nfs-gold"}}, + want: []check{{RelationCanDelete, "external_volume_class:nfs-gold"}}, + }, + + // CSI driver configs. + { + name: "CreateCsiDriverConfig", + fullMethod: ateapi.Control_CreateCsiDriverConfig_FullMethodName, + req: &ateapi.CreateCsiDriverConfigRequest{}, + want: []check{{RelationCanCreateCsiDriverConfig, GlobalRootObject}}, + }, + { + name: "ListCsiDriverConfigs", + fullMethod: ateapi.Control_ListCsiDriverConfigs_FullMethodName, + req: &ateapi.ListCsiDriverConfigsRequest{}, + want: []check{{RelationCanListCsiDriverConfigs, GlobalRootObject}}, + }, + { + name: "GetCsiDriverConfig", + fullMethod: ateapi.Control_GetCsiDriverConfig_FullMethodName, + req: &ateapi.GetCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Name: "csi-nfs"}}, + want: []check{{RelationCanGet, "csi_driver_config:csi-nfs"}}, + }, + { + name: "UpdateCsiDriverConfig", + fullMethod: ateapi.Control_UpdateCsiDriverConfig_FullMethodName, + req: &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, + }}, + want: []check{{RelationCanUpdate, "csi_driver_config:csi-nfs"}}, + }, + { + name: "DeleteCsiDriverConfig", + fullMethod: ateapi.Control_DeleteCsiDriverConfig_FullMethodName, + req: &ateapi.DeleteCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Name: "csi-nfs"}}, + want: []check{{RelationCanDelete, "csi_driver_config:csi-nfs"}}, + }, + // Actor identity credentials. { name: "MintActorJWT", @@ -591,6 +651,44 @@ func TestDefaultRPCPermissions_MalformedIdentifierFailsClosed(t *testing.T) { req: &ateapi.ListWorkerActorAssignmentsRequest{Worker: &ateapi.ObjectRef{}}, wantField: "worker.name", }, + { + name: "GetExternalVolumeClass without a class", + fullMethod: ateapi.Control_GetExternalVolumeClass_FullMethodName, + req: &ateapi.GetExternalVolumeClassRequest{}, + wantField: "external_volume_class.name", + }, + { + name: "DeleteExternalVolumeClass with an invalid name", + fullMethod: ateapi.Control_DeleteExternalVolumeClass_FullMethodName, + req: &ateapi.DeleteExternalVolumeClassRequest{ExternalVolumeClass: &ateapi.ObjectRef{Name: "nfs/gold"}}, + wantField: "external_volume_class.name", + }, + { + name: "GetCsiDriverConfig without a config", + fullMethod: ateapi.Control_GetCsiDriverConfig_FullMethodName, + req: &ateapi.GetCsiDriverConfigRequest{}, + wantField: "csi_driver_config.name", + }, + { + name: "UpdateCsiDriverConfig without metadata", + fullMethod: ateapi.Control_UpdateCsiDriverConfig_FullMethodName, + req: &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: &ateapi.CsiDriverConfig{}}, + wantField: "csi_driver_config.metadata.name", + }, + { + name: "UpdateCsiDriverConfig with an invalid name", + fullMethod: ateapi.Control_UpdateCsiDriverConfig_FullMethodName, + req: &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi/nfs"}, + }}, + wantField: "csi_driver_config.metadata.name", + }, + { + name: "DeleteCsiDriverConfig with an invalid name", + fullMethod: ateapi.Control_DeleteCsiDriverConfig_FullMethodName, + req: &ateapi.DeleteCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Name: "csi/nfs"}}, + wantField: "csi_driver_config.name", + }, { name: "MintActorJWT without an actor", fullMethod: ateapi.Control_MintActorJwt_FullMethodName, diff --git a/cmd/ateapi/internal/controlapi/actor.go b/cmd/ateapi/internal/controlapi/actor.go index 9b690a9f12..d9f6c557a1 100644 --- a/cmd/ateapi/internal/controlapi/actor.go +++ b/cmd/ateapi/internal/controlapi/actor.go @@ -109,7 +109,7 @@ func (s *ServiceImpl) CreateActor(ctx context.Context, inActor *ateapi.Actor) (* // Volume creation is completed asynchronously after the actor is recorded. var initVols []*ateapi.ExternalVolumeStatus - if iv, err := initialExternalVolumes(ctx, s.storageClassLister, template); err != nil { + if iv, err := initialExternalVolumes(ctx, s, s.storageClassLister, template); err != nil { return nil, err } else if preview.IsEnabledFor(ctx, preview.GateExternalVolumes) { initVols = iv diff --git a/cmd/ateapi/internal/controlapi/csi_driver_config.go b/cmd/ateapi/internal/controlapi/csi_driver_config.go new file mode 100644 index 0000000000..bbf20ad26c --- /dev/null +++ b/cmd/ateapi/internal/controlapi/csi_driver_config.go @@ -0,0 +1,171 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controlapi + +import ( + "context" + "errors" + "fmt" + "strings" + + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/cmd/ateapi/internal/apivalidation" + "go.ate.dev/substrate/cmd/ateapi/internal/defaults" + "go.ate.dev/substrate/cmd/ateapi/internal/store" + "go.ate.dev/substrate/internal/apierror" + "go.ate.dev/substrate/internal/resources" + "google.golang.org/protobuf/proto" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +func (s *RPCService) CreateCsiDriverConfig(ctx context.Context, req *ateapi.CreateCsiDriverConfigRequest) (*ateapi.CsiDriverConfig, error) { + in := proto.CloneOf(req.GetCsiDriverConfig()) + if in != nil { + scrubResourceMetadataForCreate(in.Metadata) + defaults.Apply(in) + } + if errs := apivalidation.ValidateCreateCsiDriverConfigRequest(ctx, &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: in}); len(errs) > 0 { + return nil, resources.ToAPIError(errs) + } + return s.impl.CreateCsiDriverConfig(ctx, in) +} + +func (s *ServiceImpl) CreateCsiDriverConfig(ctx context.Context, config *ateapi.CsiDriverConfig) (*ateapi.CsiDriverConfig, error) { + stored, err := s.store.CreateCsiDriverConfig(ctx, config) + if errors.Is(err, store.ErrAlreadyExists) { + if strings.Contains(err.Error(), "driver_name") { + return nil, apierror.AlreadyExists("CsiDriverConfig for driver_name %q already exists", config.GetDriverName()) + } + return nil, apierror.AlreadyExists("CsiDriverConfig %q already exists", config.GetMetadata().GetName()) + } + if err != nil { + return nil, fmt.Errorf("while recording csi driver config: %w", err) + } + return stored, nil +} + +func (s *RPCService) GetCsiDriverConfig(ctx context.Context, req *ateapi.GetCsiDriverConfigRequest) (*ateapi.CsiDriverConfig, error) { + if errs := apivalidation.ValidateGetCsiDriverConfigRequest(ctx, req); len(errs) > 0 { + return nil, resources.ToAPIError(errs) + } + return s.impl.GetCsiDriverConfig(ctx, req.GetCsiDriverConfig().GetName()) +} + +func (s *ServiceImpl) GetCsiDriverConfig(ctx context.Context, name string) (*ateapi.CsiDriverConfig, error) { + config, err := s.store.GetCsiDriverConfig(ctx, name) + if errors.Is(err, store.ErrNotFound) { + return nil, apierror.NotFound("CsiDriverConfig %s not found", name) + } + if err != nil { + return nil, fmt.Errorf("while getting csi driver config from DB: %w", err) + } + return config, nil +} + +func (s *ServiceImpl) GetCsiDriverConfigByDriverName(ctx context.Context, driverName string) (*ateapi.CsiDriverConfig, error) { + return s.store.GetCsiDriverConfigByDriverName(ctx, driverName) +} + +func (s *RPCService) ListCsiDriverConfigs(ctx context.Context, req *ateapi.ListCsiDriverConfigsRequest) (*ateapi.ListCsiDriverConfigsResponse, error) { + if errs := apivalidation.ValidateListCsiDriverConfigsRequest(ctx, req); len(errs) > 0 { + return nil, resources.ToAPIError(errs) + } + page, err := s.impl.ListCsiDriverConfigs(ctx, toStoreListOptions(req.GetOptions())) + if err != nil { + return nil, err + } + return &ateapi.ListCsiDriverConfigsResponse{ + CsiDriverConfigs: page.Items, + NextPageToken: page.NextPageToken, + }, nil +} + +func (s *ServiceImpl) ListCsiDriverConfigs(ctx context.Context, opts store.ListOptions) (store.ListResponse[*ateapi.CsiDriverConfig], error) { + page, err := s.store.ListCsiDriverConfigs(ctx, opts) + if err != nil { + return page, mapListError(fmt.Errorf("while listing csi driver configs in db: %w", err)) + } + return page, nil +} + +func (s *RPCService) UpdateCsiDriverConfig(ctx context.Context, req *ateapi.UpdateCsiDriverConfigRequest) (*ateapi.CsiDriverConfig, error) { + in := proto.CloneOf(req.GetCsiDriverConfig()) + if in != nil { + scrubResourceMetadataForUpdate(in.Metadata) + } + if errs := apivalidation.ValidateUpdateCsiDriverConfigRequest(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: in}); len(errs) > 0 { + return nil, resources.ToAPIError(errs) + } + return s.impl.UpdateCsiDriverConfig(ctx, in.GetMetadata().GetName(), store.PreconditionFrom(in), func(toUpdate *ateapi.CsiDriverConfig) error { + metadata := toUpdate.GetMetadata() + proto.Reset(toUpdate) + proto.Merge(toUpdate, in) + toUpdate.Metadata = metadata + defaults.Apply(toUpdate) + return nil + }) +} + +func (s *ServiceImpl) UpdateCsiDriverConfig(ctx context.Context, name string, precondition store.Precondition, mutate func(toUpdate *ateapi.CsiDriverConfig) error) (*ateapi.CsiDriverConfig, error) { + updated, err := s.store.UpdateCsiDriverConfig(ctx, name, precondition, func(toUpdate *ateapi.CsiDriverConfig) error { + oldVal := proto.CloneOf(toUpdate) + if err := mutate(toUpdate); err != nil { + return err + } + if errs := apivalidation.ValidateCsiDriverConfigUpdate(ctx, field.NewPath("csi_driver_config"), toUpdate, oldVal); len(errs) > 0 { + return resources.ToAPIError(errs) + } + return nil + }) + switch { + case err == nil: + return updated, nil + case errors.Is(err, store.ErrNotFound): + return nil, apierror.NotFound("CsiDriverConfig %s not found", name) + case errors.Is(err, store.ErrPreconditionRequired), errors.Is(err, store.ErrImmutableField): + return nil, apierror.InvalidArgument("while updating csi driver config %s: %v", name, err) + case errors.Is(err, store.ErrUIDConflict): + return nil, apierror.Aborted("CsiDriverConfig %s does not have uid %s", name, precondition.UID) + case errors.Is(err, store.ErrVersionConflict): + return nil, apierror.Aborted("concurrent update conflict, please retry") + default: + return nil, fmt.Errorf("while updating csi driver config: %w", err) + } +} + +func (s *RPCService) DeleteCsiDriverConfig(ctx context.Context, req *ateapi.DeleteCsiDriverConfigRequest) (*ateapi.CsiDriverConfig, error) { + if errs := apivalidation.ValidateDeleteCsiDriverConfigRequest(ctx, req); len(errs) > 0 { + return nil, resources.ToAPIError(errs) + } + return s.impl.DeleteCsiDriverConfig(ctx, req.GetCsiDriverConfig().GetName(), toDeletePreconditions(req.GetOptions())) +} + +func (s *ServiceImpl) DeleteCsiDriverConfig(ctx context.Context, name string, precondition store.DeletePreconditions) (*ateapi.CsiDriverConfig, error) { + deleted, err := s.store.DeleteCsiDriverConfig(ctx, name, precondition) + switch { + case err == nil: + return deleted, nil + case errors.Is(err, store.ErrNotFound): + return nil, apierror.NotFound("CsiDriverConfig %s not found", name) + case errors.Is(err, store.ErrUIDConflict): + return nil, apierror.Aborted("CsiDriverConfig %s does not have uid %s", name, precondition.UID) + case errors.Is(err, store.ErrVersionConflict): + return nil, apierror.Aborted("concurrent update conflict, please retry") + case errors.Is(err, store.ErrFailedPrecondition): + return nil, apierror.FailedPrecondition("CsiDriverConfig %s cannot be deleted while referenced by an ExternalVolumeClass", name) + default: + return nil, fmt.Errorf("while deleting csi driver config from DB: %w", err) + } +} diff --git a/cmd/ateapi/internal/controlapi/csi_driver_config_test.go b/cmd/ateapi/internal/controlapi/csi_driver_config_test.go new file mode 100644 index 0000000000..2f01569b14 --- /dev/null +++ b/cmd/ateapi/internal/controlapi/csi_driver_config_test.go @@ -0,0 +1,325 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controlapi + +import ( + "context" + "errors" + "maps" + "net" + "strings" + "sync" + "testing" + + csipb "github.com/container-storage-interface/spec/lib/go/csi" + "go.ate.dev/substrate/api/ateapi/v1" + atev1 "go.ate.dev/substrate/api/infra/k8s/ate/v1" + "go.ate.dev/substrate/cmd/ateapi/internal/store" + "go.ate.dev/substrate/cmd/ateapi/internal/store/storetest" + "go.ate.dev/substrate/internal/volume" + "go.ate.dev/substrate/internal/volume/csi" + atelisters "go.ate.dev/substrate/pkg/client/listers/ate/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/tools/cache" +) + +type testCSIServer struct { + csipb.UnimplementedIdentityServer + csipb.UnimplementedControllerServer + driverName string + volumeID string + onGetPlugin func() +} + +func (s *testCSIServer) GetPluginInfo(context.Context, *csipb.GetPluginInfoRequest) (*csipb.GetPluginInfoResponse, error) { + if s.onGetPlugin != nil { + s.onGetPlugin() + } + return &csipb.GetPluginInfoResponse{Name: s.driverName, VendorVersion: "v1.0.0"}, nil +} + +func (s *testCSIServer) CreateVolume(context.Context, *csipb.CreateVolumeRequest) (*csipb.CreateVolumeResponse, error) { + return &csipb.CreateVolumeResponse{Volume: &csipb.Volume{VolumeId: s.volumeID}}, nil +} + +func startTestCSIServer(t *testing.T, driverName, volumeID string, onGetPlugin func()) string { + t.Helper() + lis, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatalf("listen tcp: %v", err) + } + srv := grpc.NewServer() + impl := &testCSIServer{driverName: driverName, volumeID: volumeID, onGetPlugin: onGetPlugin} + csipb.RegisterIdentityServer(srv, impl) + csipb.RegisterControllerServer(srv, impl) + go func() { _ = srv.Serve(lis) }() + t.Cleanup(func() { srv.Stop(); _ = lis.Close() }) + return "tcp://" + lis.Addr().String() +} + +type faultyServiceStore struct { + serviceStore + err error +} + +func (f *faultyServiceStore) GetCsiDriverConfigByDriverName(ctx context.Context, driverName string) (*ateapi.CsiDriverConfig, error) { + if f.err != nil { + return nil, f.err + } + return f.serviceStore.GetCsiDriverConfigByDriverName(ctx, driverName) +} + +func cleanupCSIPlugins(t *testing.T, svc *RPCService) *RPCService { + t.Helper() + t.Cleanup(func() { + svc.mu.Lock() + slots := maps.Clone(svc.csiPlugins) + clear(svc.csiPlugins) + svc.mu.Unlock() + for _, slot := range slots { + _ = slot.plugin.Close() + } + }) + return svc +} + +func newCRDIndexer(driverName, ep string) (cache.Indexer, *atev1.CSIDriverConfig, atelisters.CSIDriverConfigLister) { + indexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{}) + crd := &atev1.CSIDriverConfig{ + ObjectMeta: metav1.ObjectMeta{Name: "crd-" + driverName, UID: types.UID("crd-uid"), ResourceVersion: "5"}, + Spec: atev1.CSIDriverConfigSpec{DriverName: driverName, ControllerEndpoint: ep}, + } + _ = indexer.Add(crd) + return indexer, crd, atelisters.NewCSIDriverConfigLister(indexer) +} + +func assertPluginClosed(t *testing.T, plugin volume.VolumePluginControlPlane) { + t.Helper() + _, err := plugin.CreateVolume(t.Context(), volume.CreateVolumeRequest{Name: "closed", CapacityBytes: 1 << 20}) + if status.Code(err) != codes.Canceled { + t.Fatalf("CreateVolume() on evicted plugin = %v (code %v), want %v", err, status.Code(err), codes.Canceled) + } +} + +func mustGetCSIPlugin(t *testing.T, svc *RPCService, driverName, wantVolID string) *csi.Plugin { + t.Helper() + got, err := svc.GetPlugin(t.Context(), driverName) + plugin, ok := got.(*csi.Plugin) + if err != nil || !ok { + t.Fatalf("GetPlugin(%q) = (%T, %v), want (*csi.Plugin, nil)", driverName, got, err) + } + if resp, err := plugin.CreateVolume(t.Context(), volume.CreateVolumeRequest{Name: "vol", CapacityBytes: 1 << 20}); err != nil || resp.VolumeID != wantVolID { + t.Fatalf("CreateVolume() = (%q, %v), want (%q, nil)", resp.VolumeID, err, wantVolID) + } + return plugin +} + +func mustGetSamePlugin(t *testing.T, svc *RPCService, driverName, wantVolID string, want *csi.Plugin) { + t.Helper() + if got := mustGetCSIPlugin(t, svc, driverName, wantVolID); got != want { + t.Fatalf("GetPlugin(%q) = %p, want preserved %p", driverName, got, want) + } +} +func mustGetSwappedPlugin(t *testing.T, svc *RPCService, driverName, wantVolID string, prev *csi.Plugin) *csi.Plugin { + t.Helper() + got := mustGetCSIPlugin(t, svc, driverName, wantVolID) + if got == prev { + t.Fatalf("GetPlugin(%q) returned stale %p", driverName, prev) + } + assertPluginClosed(t, prev) + return got +} +func mustFailGetPlugin(t *testing.T, svc *RPCService, driverName string, wantErr error, wantSubstr string) { + t.Helper() + _, err := svc.GetPlugin(t.Context(), driverName) + if err == nil || errors.Is(err, store.ErrNotFound) || (wantErr != nil && !errors.Is(err, wantErr)) || !strings.Contains(err.Error(), wantSubstr) { + t.Fatalf("GetPlugin(%q) error = %v, want non-store.ErrNotFound matching (%v, %q)", driverName, err, wantErr, wantSubstr) + } +} + +func mustCreateCfg(t *testing.T, st store.Interface, name, driverName, ep string) *ateapi.CsiDriverConfig { + t.Helper() + cfg := &ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: name}, DriverName: driverName, ControllerEndpoint: ep} + created, err := st.CreateCsiDriverConfig(t.Context(), cfg) + if err != nil { + t.Fatalf("CreateCsiDriverConfig(%q) error = %v", name, err) + } + t.Cleanup(func() { _, _ = st.DeleteCsiDriverConfig(context.Background(), name, store.DeletePreconditions{}) }) + return created +} +func mustUpdateCfg(t *testing.T, st store.Interface, prev *ateapi.CsiDriverConfig, ep, sock string, tls *ateapi.CsiDriverTlsConfig) *ateapi.CsiDriverConfig { + t.Helper() + updated, err := st.UpdateCsiDriverConfig(t.Context(), prev.GetMetadata().GetName(), store.PreconditionFrom(prev), func(cfg *ateapi.CsiDriverConfig) error { + cfg.ControllerEndpoint, cfg.NodeSocketOverride, cfg.Tls = ep, sock, tls + return nil + }) + if err != nil { + t.Fatalf("UpdateCsiDriverConfig(%q) error = %v", prev.GetMetadata().GetName(), err) + } + return updated +} +func mustDeleteCfg(t *testing.T, st store.Interface, name string) { + t.Helper() + if _, err := st.DeleteCsiDriverConfig(t.Context(), name, store.DeletePreconditions{}); err != nil { + t.Fatalf("DeleteCsiDriverConfig(%q) error = %v", name, err) + } +} + +func TestRPCServiceGetPlugin(t *testing.T) { + st := storetest.SetupPostgresPersistence(t) + ctx := t.Context() + + t.Run("static override and cache key fields", func(t *testing.T) { + base := &ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: "a", Uid: "u1", Version: 1}, ControllerEndpoint: "tcp://127.0.0.1:9000", NodeSocketOverride: "unix:///a.sock"} + same := &ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: "b", Uid: "u2", Version: 9}, ControllerEndpoint: "tcp://127.0.0.1:9000", NodeSocketOverride: "unix:///b.sock"} + if newCSIPluginCacheKey(base) != newCSIPluginCacheKey(same) { + t.Fatalf("newCSIPluginCacheKey() differed across metadata or node_socket_override") + } + for _, tls := range []*ateapi.CsiDriverTlsConfig{{Enabled: true}, {UsePodIdentity: true}, {ServerName: "s"}} { + if newCSIPluginCacheKey(base) == newCSIPluginCacheKey(&ateapi.CsiDriverConfig{ControllerEndpoint: base.ControllerEndpoint, Tls: tls}) { + t.Fatalf("newCSIPluginCacheKey() did not distinguish %v", tls) + } + } + if newCSIPluginCacheKey(base) == newCSIPluginCacheKey(&ateapi.CsiDriverConfig{ControllerEndpoint: "tcp://127.0.0.1:9001"}) { + t.Fatalf("newCSIPluginCacheKey() did not distinguish controller_endpoint") + } + staticPlugin := volume.NewMockVolumePlugin() + plugins := map[string]volume.VolumePluginControlPlane{"nfs.csi.k8s.io": staticPlugin} + svc := NewRPCService(nil, nil, nil, nil, nil, nil, "", plugins, nil, "", nil, "") + svc.impl = &faultyServiceStore{err: errors.New("unexpected store call")} + delete(plugins, "nfs.csi.k8s.io") + if got, err := svc.GetPlugin(ctx, "nfs.csi.k8s.io"); err != nil || got != staticPlugin { + t.Fatalf("GetPlugin() = (%v, %v), want static override", got, err) + } + }) + + t.Run("postgres lookup, node_socket_override reuse, endpoint/tls invalidation, recreate, and delete", func(t *testing.T) { + const cfgName, driverName = "csi-nfs", "nfs.csi.k8s.io" + ep1, ep2 := startTestCSIServer(t, driverName, "vol-ep1", nil), startTestCSIServer(t, driverName, "vol-ep2", nil) + svc := cleanupCSIPlugins(t, NewRPCService(st, nil, nil, nil, nil, nil, "", nil, nil, "", nil, "")) + v1 := mustCreateCfg(t, st, cfgName, driverName, ep1) + p1 := mustGetCSIPlugin(t, svc, driverName, "vol-ep1") + v2 := mustUpdateCfg(t, st, v1, ep1, "unix:///var/lib/kubelet/plugins/nfs/csi.sock", nil) + mustGetSamePlugin(t, svc, driverName, "vol-ep1", p1) + mustUpdateCfg(t, st, v2, ep2, "", nil) + p2 := mustGetSwappedPlugin(t, svc, driverName, "vol-ep2", p1) + mustDeleteCfg(t, st, cfgName) + recreated := mustCreateCfg(t, st, cfgName, driverName, ep1) + p3 := mustGetSwappedPlugin(t, svc, driverName, "vol-ep1", p2) + withTLS := mustUpdateCfg(t, st, recreated, ep1, "", &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "csi-nfs.kube-system.svc"}) + mustFailGetPlugin(t, svc, driverName, nil, "TLS") + assertPluginClosed(t, p3) + mustUpdateCfg(t, st, withTLS, ep2, "", nil) + p4 := mustGetCSIPlugin(t, svc, driverName, "vol-ep2") + mustDeleteCfg(t, st, cfgName) + mustFailGetPlugin(t, svc, driverName, nil, "not found") + assertPluginClosed(t, p4) + if len(svc.csiPlugins) != 0 { + t.Fatalf("len(csiPlugins) = %d, want 0", len(svc.csiPlugins)) + } + }) + + t.Run("crd fallback, identical promotion/demotion reuse, and differing endpoint swap", func(t *testing.T) { + const driverName = "pd.csi.storage.gke.io" + epCRD, epPG := startTestCSIServer(t, driverName, "vol-crd", nil), startTestCSIServer(t, driverName, "vol-pg", nil) + indexer, crdObj, lister := newCRDIndexer(driverName, epCRD) + svc := cleanupCSIPlugins(t, NewRPCService(st, nil, lister, nil, nil, nil, "", nil, nil, "", nil, "")) + nilImplSvc := cleanupCSIPlugins(t, &RPCService{csiDriverConfigLister: lister}) + nilImplPlugin := mustGetCSIPlugin(t, nilImplSvc, driverName, "vol-crd") + crdPlugin := mustGetCSIPlugin(t, svc, driverName, "vol-crd") + + crdObjBumped := crdObj.DeepCopy() + crdObjBumped.ResourceVersion, crdObjBumped.Spec.NodeSocketOverride = "6", "unix:///var/lib/kubelet/plugins/pd/csi.sock" + _ = indexer.Update(crdObjBumped) + mustGetSamePlugin(t, svc, driverName, "vol-crd", crdPlugin) + mustCreateCfg(t, st, "csi-pd-same", driverName, epCRD) + mustGetSamePlugin(t, svc, driverName, "vol-crd", crdPlugin) + mustDeleteCfg(t, st, "csi-pd-same") + mustGetSamePlugin(t, svc, driverName, "vol-crd", crdPlugin) + mustCreateCfg(t, st, "csi-pd", driverName, epPG) + pgPlugin := mustGetSwappedPlugin(t, svc, driverName, "vol-pg", crdPlugin) + mustDeleteCfg(t, st, "csi-pd") + crdPlugin2 := mustGetSwappedPlugin(t, svc, driverName, "vol-crd", pgPlugin) + _ = indexer.Delete(crdObjBumped) + mustFailGetPlugin(t, svc, driverName, nil, "not found") + assertPluginClosed(t, crdPlugin2) + mustFailGetPlugin(t, nilImplSvc, driverName, nil, "not found") + assertPluginClosed(t, nilImplPlugin) + }) + + t.Run("transient store error fails loudly without fallback or eviction", func(t *testing.T) { + const driverName = "lustre.csi.storage.gke.io" + epPG, epCRD := startTestCSIServer(t, driverName, "vol-lustre-pg", nil), startTestCSIServer(t, driverName, "vol-lustre-crd", nil) + _, _, lister := newCRDIndexer(driverName, epCRD) + faulty := &faultyServiceStore{serviceStore: newServiceImpl(st, nil)} + svc := cleanupCSIPlugins(t, &RPCService{impl: faulty, csiDriverConfigLister: lister}) + mustCreateCfg(t, st, "csi-lustre", driverName, epPG) + cachedPlugin := mustGetCSIPlugin(t, svc, driverName, "vol-lustre-pg") + + dbErr := errors.New("database connection lost") + faulty.err = dbErr + mustFailGetPlugin(t, svc, driverName, dbErr, "") + if resp, err := cachedPlugin.CreateVolume(ctx, volume.CreateVolumeRequest{Name: "v", CapacityBytes: 1 << 20}); err != nil || resp.VolumeID != "vol-lustre-pg" { + t.Fatalf("cachedPlugin.CreateVolume() during store error = (%q, %v)", resp.VolumeID, err) + } + faulty.err = nil + mustGetSamePlugin(t, svc, driverName, "vol-lustre-pg", cachedPlugin) + }) + + for _, mode := range []string{"update", "recreate", "delete"} { + t.Run("concurrent slow dial vs "+mode, func(t *testing.T) { + cfgName, driver := "csi-race-"+mode, "race-"+mode+".csi.k8s.io" + enteredEp1, releaseEp1 := make(chan struct{}), make(chan struct{}) + var once sync.Once + ep1 := startTestCSIServer(t, driver, "vol-v1", func() { once.Do(func() { close(enteredEp1); <-releaseEp1 }) }) + ep2 := startTestCSIServer(t, driver, "vol-v2", nil) + svc := cleanupCSIPlugins(t, NewRPCService(st, nil, nil, nil, nil, nil, "", nil, nil, "", nil, "")) + created := mustCreateCfg(t, st, cfgName, driver, ep1) + var gotPlugin volume.VolumePluginControlPlane + var gotErr error + var wg sync.WaitGroup + wg.Go(func() { gotPlugin, gotErr = svc.GetPlugin(ctx, driver) }) + <-enteredEp1 + var wantPlugin *csi.Plugin + switch mode { + case "update": + mustUpdateCfg(t, st, created, ep2, "", nil) + wantPlugin = mustGetCSIPlugin(t, svc, driver, "vol-v2") + case "recreate": + mustDeleteCfg(t, st, cfgName) + mustCreateCfg(t, st, cfgName, driver, ep2) + wantPlugin = mustGetCSIPlugin(t, svc, driver, "vol-v2") + case "delete": + mustDeleteCfg(t, st, cfgName) + mustFailGetPlugin(t, svc, driver, nil, "not found") + } + close(releaseEp1) + wg.Wait() + if mode == "delete" { + if gotErr == nil || errors.Is(gotErr, store.ErrNotFound) || !strings.Contains(gotErr.Error(), "not found") || len(svc.csiPlugins) != 0 { + t.Fatalf("concurrent GetPlugin() = (%v, %v), slots = %d; want non-store.ErrNotFound not-found error and 0 slots", gotPlugin, gotErr, len(svc.csiPlugins)) + } + return + } + if gotErr != nil || gotPlugin != wantPlugin || svc.csiPlugins[driver].inflight != 0 { + t.Fatalf("concurrent GetPlugin() = (%v, %v), inflight = %d; want (%v, nil) and inflight 0", gotPlugin, gotErr, svc.csiPlugins[driver].inflight, wantPlugin) + } + }) + } +} diff --git a/cmd/ateapi/internal/controlapi/external_volume_class.go b/cmd/ateapi/internal/controlapi/external_volume_class.go new file mode 100644 index 0000000000..d32a02a711 --- /dev/null +++ b/cmd/ateapi/internal/controlapi/external_volume_class.go @@ -0,0 +1,112 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controlapi + +import ( + "context" + "errors" + "fmt" + + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/cmd/ateapi/internal/apivalidation" + "go.ate.dev/substrate/cmd/ateapi/internal/defaults" + "go.ate.dev/substrate/cmd/ateapi/internal/store" + "go.ate.dev/substrate/internal/apierror" + "go.ate.dev/substrate/internal/resources" +) + +func (s *RPCService) CreateExternalVolumeClass(ctx context.Context, req *ateapi.CreateExternalVolumeClassRequest) (*ateapi.ExternalVolumeClass, error) { + class := req.GetExternalVolumeClass() + if class != nil { // otherwise validation will flag it + scrubResourceMetadataForCreate(class.Metadata) + defaults.Apply(class) + } + if errs := apivalidation.ValidateCreateExternalVolumeClassRequest(ctx, req); len(errs) > 0 { + return nil, resources.ToAPIError(errs) + } + return s.impl.CreateExternalVolumeClass(ctx, class) +} + +func (s *ServiceImpl) CreateExternalVolumeClass(ctx context.Context, class *ateapi.ExternalVolumeClass) (*ateapi.ExternalVolumeClass, error) { + stored, err := s.store.CreateExternalVolumeClass(ctx, class) + if errors.Is(err, store.ErrAlreadyExists) { + return nil, apierror.AlreadyExists("ExternalVolumeClass %s already exists", class.GetMetadata().GetName()) + } else if err != nil { + return nil, fmt.Errorf("while recording external volume class: %w", err) + } + return stored, nil +} + +func (s *RPCService) GetExternalVolumeClass(ctx context.Context, req *ateapi.GetExternalVolumeClassRequest) (*ateapi.ExternalVolumeClass, error) { + if errs := apivalidation.ValidateGetExternalVolumeClassRequest(ctx, req); len(errs) > 0 { + return nil, resources.ToAPIError(errs) + } + return s.impl.GetExternalVolumeClass(ctx, req.GetExternalVolumeClass().GetName()) +} + +func (s *ServiceImpl) GetExternalVolumeClass(ctx context.Context, name string) (*ateapi.ExternalVolumeClass, error) { + class, err := s.store.GetExternalVolumeClass(ctx, name) + if errors.Is(err, store.ErrNotFound) { + return nil, apierror.NotFound("ExternalVolumeClass %s not found", name) + } else if err != nil { + return nil, fmt.Errorf("while getting external volume class from DB: %w", err) + } + return class, nil +} + +func (s *RPCService) ListExternalVolumeClasses(ctx context.Context, req *ateapi.ListExternalVolumeClassesRequest) (*ateapi.ListExternalVolumeClassesResponse, error) { + if errs := apivalidation.ValidateListExternalVolumeClassesRequest(ctx, req); len(errs) > 0 { + return nil, resources.ToAPIError(errs) + } + page, err := s.impl.ListExternalVolumeClasses(ctx, toStoreListOptions(req.GetOptions())) + if err != nil { + return nil, err + } + return &ateapi.ListExternalVolumeClassesResponse{ + ExternalVolumeClasses: page.Items, + NextPageToken: page.NextPageToken, + }, nil +} + +func (s *ServiceImpl) ListExternalVolumeClasses(ctx context.Context, opts store.ListOptions) (store.ListResponse[*ateapi.ExternalVolumeClass], error) { + page, err := s.store.ListExternalVolumeClasses(ctx, opts) + if err != nil { + return page, mapListError(fmt.Errorf("while listing external volume classes in db: %w", err)) + } + return page, nil +} + +func (s *RPCService) DeleteExternalVolumeClass(ctx context.Context, req *ateapi.DeleteExternalVolumeClassRequest) (*ateapi.ExternalVolumeClass, error) { + if errs := apivalidation.ValidateDeleteExternalVolumeClassRequest(ctx, req); len(errs) > 0 { + return nil, resources.ToAPIError(errs) + } + return s.impl.DeleteExternalVolumeClass(ctx, req.GetExternalVolumeClass().GetName(), toDeletePreconditions(req.GetOptions())) +} + +func (s *ServiceImpl) DeleteExternalVolumeClass(ctx context.Context, name string, precondition store.DeletePreconditions) (*ateapi.ExternalVolumeClass, error) { + deleted, err := s.store.DeleteExternalVolumeClass(ctx, name, precondition) + switch { + case err == nil: + return deleted, nil + case errors.Is(err, store.ErrNotFound): + return nil, apierror.NotFound("ExternalVolumeClass %s not found", name) + case errors.Is(err, store.ErrUIDConflict): + return nil, apierror.Aborted("ExternalVolumeClass %s does not have uid %s", name, precondition.UID) + case errors.Is(err, store.ErrVersionConflict): + return nil, apierror.Aborted("concurrent update conflict, please retry") + default: + return nil, fmt.Errorf("while deleting external volume class from DB: %w", err) + } +} diff --git a/cmd/ateapi/internal/controlapi/functionaltest/actor_test.go b/cmd/ateapi/internal/controlapi/functionaltest/actor_test.go index 2d685e0e5e..678063aa9d 100644 --- a/cmd/ateapi/internal/controlapi/functionaltest/actor_test.go +++ b/cmd/ateapi/internal/controlapi/functionaltest/actor_test.go @@ -1992,6 +1992,149 @@ func TestActorLifecycle_WithExternalVolumes(t *testing.T) { } } +// TestActorLifecycle_WithExternalVolumeClass provisions a volume from an +// ExternalVolumeClass: the class's driver becomes the volume type, and its +// parameters reach the driver's CreateVolume call. +func TestActorLifecycle_WithExternalVolumeClass(t *testing.T) { + preview.InitForTest(t, "ExternalVolumes") + + ns := namespaceForTest("ns-lifecycle-evc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + ctx := context.Background() + + class, err := tc.client.CreateExternalVolumeClass(ctx, &ateapi.CreateExternalVolumeClassRequest{ + ExternalVolumeClass: &ateapi.ExternalVolumeClass{ + Metadata: &ateapi.ResourceMetadata{Name: "evc-gold"}, + DriverName: "substrate.io/mock", + Parameters: map[string]string{"tier": "gold"}, + }, + }) + if err != nil { + t.Fatalf("CreateExternalVolumeClass failed: %v", err) + } + if class.GetDriverName() != "substrate.io/mock" { + t.Fatalf("driver = %q, want substrate.io/mock", class.GetDriverName()) + } + volumes := []*ateapi.Volume{{ + Name: "data-vol", + External: &ateapi.ExternalVolumeSource{Template: &ateapi.ExternalVolumeTemplate{ + ExternalVolumeClass: &ateapi.ObjectRef{Name: "evc-gold"}, + CapacityBytes: 20 << 30, + }}, + }} + mounts := []*ateapi.VolumeMount{{Name: "data-vol", MountPath: "/mnt/data"}} + createTemplateWithVolumes(t, tc, ns, volumes, mounts) + createWorkerPod(t, tc, ns, "worker-1", "node1", "pool1") + + actorRef := &ateapi.ObjectRef{Atespace: testAtespace, Name: "actor-evc"} + createResp, err := tc.client.CreateActor(ctx, &ateapi.CreateActorRequest{ + Actor: &ateapi.Actor{ + Metadata: &ateapi.ResourceMetadata{Atespace: testAtespace, Name: "actor-evc"}, + ActorTemplate: &ateapi.ObjectRef{Atespace: testAtespace, Name: "tmpl1"}, + }, + }) + if err != nil { + t.Fatalf("CreateActor failed: %v", err) + } + created := createResp.GetStatus().GetExternalVolumes().GetVolumes() + if len(created) != 1 || created[0].GetVolumeType() != "substrate.io/mock" || created[0].GetStorageVolumeId() != "" { + t.Fatalf("CreateActor volumes = %v, want 1 unprovisioned volume of type substrate.io/mock", created) + } + + resumeResp, err := tc.client.ResumeActor(ctx, &ateapi.ResumeActorRequest{Actor: actorRef}) + if err != nil { + t.Fatalf("ResumeActor failed: %v", err) + } + resumed := resumeResp.GetActor().GetStatus().GetExternalVolumes().GetVolumes() + if len(resumed) != 1 || resumed[0].GetStorageVolumeId() == "" { + t.Fatalf("ResumeActor volumes = %v, want 1 provisioned volume", resumed) + } + if got := resumed[0].GetVolumeContext()["tier"]; got != "gold" { + t.Errorf("volume context tier = %q, want %q from the class parameters", got, "gold") + } + + if _, err := tc.client.DeleteActor(ctx, &ateapi.DeleteActorRequest{Actor: actorRef}); err != nil { + t.Fatalf("DeleteActor failed: %v", err) + } +} + +// TestCreateActor_MissingExternalVolumeClass checks that CreateActor fails when +// the template names an ExternalVolumeClass that does not exist. +func TestCreateActor_MissingExternalVolumeClass(t *testing.T) { + preview.InitForTest(t, "ExternalVolumes") + + ns := namespaceForTest("ns-missing-evc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + + volumes := []*ateapi.Volume{{ + Name: "data-vol", + External: &ateapi.ExternalVolumeSource{Template: &ateapi.ExternalVolumeTemplate{ + ExternalVolumeClass: &ateapi.ObjectRef{Name: "evc-missing"}, + CapacityBytes: 1 << 30, + }}, + }} + mounts := []*ateapi.VolumeMount{{Name: "data-vol", MountPath: "/mnt/data"}} + createTemplateWithVolumes(t, tc, ns, volumes, mounts) + + _, err := tc.client.CreateActor(context.Background(), &ateapi.CreateActorRequest{ + Actor: &ateapi.Actor{ + Metadata: &ateapi.ResourceMetadata{Atespace: testAtespace, Name: "actor-missing-evc"}, + ActorTemplate: &ateapi.ObjectRef{Atespace: testAtespace, Name: "tmpl1"}, + }, + }) + assertGrpcErrorRegex(t, err, codes.FailedPrecondition, `ExternalVolumeClass "evc-missing" not found`) +} + +// TestResumeActor_DeletedExternalVolumeClass checks that a resume fails with +// FailedPrecondition, before any volume is created, when the template's +// ExternalVolumeClass was deleted after the actor was created. +func TestResumeActor_DeletedExternalVolumeClass(t *testing.T) { + preview.InitForTest(t, "ExternalVolumes") + + ns := namespaceForTest("ns-deleted-evc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + ctx := context.Background() + + if _, err := tc.client.CreateExternalVolumeClass(ctx, &ateapi.CreateExternalVolumeClassRequest{ + ExternalVolumeClass: &ateapi.ExternalVolumeClass{ + Metadata: &ateapi.ResourceMetadata{Name: "evc-gone"}, + DriverName: "substrate.io/mock", + }, + }); err != nil { + t.Fatalf("CreateExternalVolumeClass failed: %v", err) + } + volumes := []*ateapi.Volume{{ + Name: "data-vol", + External: &ateapi.ExternalVolumeSource{Template: &ateapi.ExternalVolumeTemplate{ + ExternalVolumeClass: &ateapi.ObjectRef{Name: "evc-gone"}, + CapacityBytes: 1 << 30, + }}, + }} + mounts := []*ateapi.VolumeMount{{Name: "data-vol", MountPath: "/mnt/data"}} + createTemplateWithVolumes(t, tc, ns, volumes, mounts) + + actorRef := &ateapi.ObjectRef{Atespace: testAtespace, Name: "actor-deleted-evc"} + if _, err := tc.client.CreateActor(ctx, &ateapi.CreateActorRequest{ + Actor: &ateapi.Actor{ + Metadata: &ateapi.ResourceMetadata{Atespace: testAtespace, Name: "actor-deleted-evc"}, + ActorTemplate: &ateapi.ObjectRef{Atespace: testAtespace, Name: "tmpl1"}, + }, + }); err != nil { + t.Fatalf("CreateActor failed: %v", err) + } + if _, err := tc.client.DeleteExternalVolumeClass(ctx, &ateapi.DeleteExternalVolumeClassRequest{ + ExternalVolumeClass: &ateapi.ObjectRef{Name: "evc-gone"}, + }); err != nil { + t.Fatalf("DeleteExternalVolumeClass failed: %v", err) + } + + _, err := tc.client.ResumeActor(ctx, &ateapi.ResumeActorRequest{Actor: actorRef}) + assertGrpcErrorRegex(t, err, codes.FailedPrecondition, `ExternalVolumeClass "evc-gone" not found`) +} + type partialFailVolumePlugin struct { volume.VolumePluginControlPlane deleted []string diff --git a/cmd/ateapi/internal/controlapi/functionaltest/csi_driver_config_test.go b/cmd/ateapi/internal/controlapi/functionaltest/csi_driver_config_test.go new file mode 100644 index 0000000000..7d8fce1229 --- /dev/null +++ b/cmd/ateapi/internal/controlapi/functionaltest/csi_driver_config_test.go @@ -0,0 +1,341 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package functionaltest + +import ( + "context" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/internal/preview" + "google.golang.org/grpc/codes" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func newCsiDriverConfig(name, driverName string) *ateapi.CsiDriverConfig { + return &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: name}, + DriverName: driverName, + ControllerEndpoint: "dns:///csi-nfs-controller.csi-nfs.svc:12345", + NodeSocketOverride: "unix:///var/lib/kubelet/plugins/nfs.csi.k8s.io/csi.sock", + Tls: &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "csi-nfs-controller.csi-nfs.svc"}, + } +} + +func createCsiDriverConfig(t *testing.T, tc *testContext, name, driverName string) *ateapi.CsiDriverConfig { + t.Helper() + created, err := tc.client.CreateCsiDriverConfig(context.Background(), &ateapi.CreateCsiDriverConfigRequest{ + CsiDriverConfig: newCsiDriverConfig(name, driverName), + }) + if err != nil { + t.Fatalf("CreateCsiDriverConfig(%s) failed: %v", name, err) + } + return created +} + +func TestCreateCsiDriverConfig(t *testing.T) { + preview.InitForTest(t) + ns := namespaceForTest("ns-create-cdc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + ctx := context.Background() + + // Gate disabled rejects even an opt-in client. + _, err := tc.client.CreateCsiDriverConfig(ctx, &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: newCsiDriverConfig("csi-nfs", "nfs.csi.k8s.io")}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "csi_driver_config: Forbidden") + + preview.InitForTest(t, "ExternalVolumes") + + in := newCsiDriverConfig("csi-nfs", "nfs.csi.k8s.io") + in.Metadata = &ateapi.ResourceMetadata{ + Name: "csi-nfs", + Uid: "caller-supplied-uid", + Version: 999, + CreateTime: timestamppb.New(time.Unix(1, 0)), + UpdateTime: timestamppb.New(time.Unix(2, 0)), + DeleteTime: timestamppb.New(time.Unix(3, 0)), + } + created, err := tc.client.CreateCsiDriverConfig(ctx, &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: in}) + if err != nil { + t.Fatalf("CreateCsiDriverConfig failed: %v", err) + } + if diff := cmp.Diff(newCsiDriverConfig("csi-nfs", "nfs.csi.k8s.io"), created, protocmp.Transform(), ignoreServerMetadata, ignoreVersion); diff != "" { + t.Errorf("CreateCsiDriverConfig mismatch (-want +got):\n%s", diff) + } + md := created.GetMetadata() + if md.GetVersion() != 1 || md.GetUid() == "" || md.GetUid() == "caller-supplied-uid" || + md.GetCreateTime() == nil || md.GetCreateTime().AsTime().Unix() == 1 || + md.GetUpdateTime() == nil || md.GetUpdateTime().AsTime().Unix() == 2 || + md.GetDeleteTime() != nil { + t.Errorf("metadata = %v, want server-assigned uid/timestamps and version 1", md) + } + + got, err := tc.client.GetCsiDriverConfig(ctx, &ateapi.GetCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Name: "csi-nfs"}}) + if err != nil { + t.Fatalf("GetCsiDriverConfig failed: %v", err) + } + if diff := cmp.Diff(created, got, protocmp.Transform()); diff != "" { + t.Errorf("GetCsiDriverConfig mismatch (-created +got):\n%s", diff) + } + + _, err = tc.client.CreateCsiDriverConfig(ctx, &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: newCsiDriverConfig("csi-nfs", "other.csi.k8s.io")}) + assertGrpcErrorRegex(t, err, codes.AlreadyExists, "csi-nfs.*already exists") + + _, err = tc.client.CreateCsiDriverConfig(ctx, &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: newCsiDriverConfig("csi-nfs-2", "nfs.csi.k8s.io")}) + assertGrpcErrorRegex(t, err, codes.AlreadyExists, "driver_name.*nfs\\.csi\\.k8s\\.io") + + _, err = tc.noOptInClient.CreateCsiDriverConfig(ctx, &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: newCsiDriverConfig("csi-other", "other.csi.k8s.io")}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "csi_driver_config: Forbidden") +} + +func TestGetAndListCsiDriverConfigs(t *testing.T) { + preview.InitForTest(t, "ExternalVolumes") + ns := namespaceForTest("ns-list-cdc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + ctx := context.Background() + + _, err := tc.client.GetCsiDriverConfig(ctx, &ateapi.GetCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Name: "missing"}}) + assertGrpcErrorRegex(t, err, codes.NotFound, "missing.*not found") + + for _, item := range []struct{ name, driver string }{ + {"cfg-c", "c.csi.k8s.io"}, + {"cfg-a", "a.csi.k8s.io"}, + {"cfg-b", "b.csi.k8s.io"}, + } { + createCsiDriverConfig(t, tc, item.name, item.driver) + } + + var got []string + for token := ""; ; { + resp, err := tc.client.ListCsiDriverConfigs(ctx, &ateapi.ListCsiDriverConfigsRequest{Options: &ateapi.ListOptions{PageSize: 2, PageToken: token}}) + if err != nil { + t.Fatalf("ListCsiDriverConfigs failed: %v", err) + } + for _, cfg := range resp.GetCsiDriverConfigs() { + got = append(got, cfg.GetMetadata().GetName()) + } + if token = resp.GetNextPageToken(); token == "" { + break + } + } + if diff := cmp.Diff([]string{"cfg-a", "cfg-b", "cfg-c"}, got); diff != "" { + t.Errorf("listed configs mismatch (-want +got):\n%s", diff) + } + + _, err = tc.client.ListCsiDriverConfigs(ctx, &ateapi.ListCsiDriverConfigsRequest{Options: &ateapi.ListOptions{PageToken: "%%%"}}) + assertGrpcError(t, err, codes.InvalidArgument, "invalid page_token") +} + +func TestUpdateCsiDriverConfig(t *testing.T) { + preview.InitForTest(t, "ExternalVolumes") + ns := namespaceForTest("ns-update-cdc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + ctx := context.Background() + + created := createCsiDriverConfig(t, tc, "csi-nfs", "nfs.csi.k8s.io") + uid := created.GetMetadata().GetUid() + + // Replace mutable fields while attempting to smuggle caller timestamps. + reqCfg := proto.CloneOf(created) + reqCfg.ControllerEndpoint = "tcp://10.0.0.2:9000" + reqCfg.NodeSocketOverride = "unix:///run/csi/nfs.sock" + reqCfg.Tls = &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "alt-nfs.csi-nfs.svc"} + reqCfg.Metadata.CreateTime = timestamppb.New(time.Unix(1, 0)) + reqCfg.Metadata.UpdateTime = timestamppb.New(time.Unix(2, 0)) + reqCfg.Metadata.DeleteTime = timestamppb.New(time.Unix(3, 0)) + + updated, err := tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: reqCfg}) + if err != nil { + t.Fatalf("UpdateCsiDriverConfig failed: %v", err) + } + md := updated.GetMetadata() + if md.GetVersion() != 2 || md.GetUid() != uid || + !md.GetCreateTime().AsTime().Equal(created.GetMetadata().GetCreateTime().AsTime()) || + md.GetUpdateTime().AsTime().Before(created.GetMetadata().GetUpdateTime().AsTime()) || + md.GetDeleteTime() != nil { + t.Errorf("updated metadata = %v, created = %v", md, created.GetMetadata()) + } + + // Full replacement clears optional node_socket_override and tls when omitted. + clearedReq := proto.CloneOf(updated) + clearedReq.NodeSocketOverride = "" + clearedReq.Tls = nil + cleared, err := tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: clearedReq}) + if err != nil { + t.Fatalf("UpdateCsiDriverConfig(clear optional) failed: %v", err) + } + if cleared.GetMetadata().GetVersion() != 3 || cleared.GetNodeSocketOverride() != "" || cleared.GetTls() != nil { + t.Errorf("cleared config = %v, want version 3 with empty socket override and nil tls", cleared) + } + + // Missing uid or version precondition -> InvalidArgument. + noUID := proto.CloneOf(cleared) + noUID.Metadata.Uid = "" + _, err = tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: noUID}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "precondition required") + + noVer := proto.CloneOf(cleared) + noVer.Metadata.Version = 0 + _, err = tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: noVer}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "precondition required") + + // Stale version or wrong uid -> Aborted. + stale := proto.CloneOf(cleared) + stale.Metadata.Version = 1 + _, err = tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: stale}) + assertGrpcErrorRegex(t, err, codes.Aborted, "concurrent update conflict") + + wrongUID := proto.CloneOf(cleared) + wrongUID.Metadata.Uid = foreignUID + _, err = tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: wrongUID}) + assertGrpcErrorRegex(t, err, codes.Aborted, foreignUID) + + // Non-existent config -> NotFound. + missing := newCsiDriverConfig("does-not-exist", "other.csi.k8s.io") + missing.Metadata.Uid = foreignUID + missing.Metadata.Version = 1 + _, err = tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: missing}) + assertGrpcErrorRegex(t, err, codes.NotFound, "does-not-exist.*not found") + + // Immutable driver_name, invalid controller_endpoint, invalid tls, and missing preview opt-in -> InvalidArgument. + changedDriver := proto.CloneOf(cleared) + changedDriver.DriverName = "other.csi.k8s.io" + _, err = tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: changedDriver}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "driver_name") + + badEndpoint := proto.CloneOf(cleared) + badEndpoint.ControllerEndpoint = "http://10.0.0.2:9000" + _, err = tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: badEndpoint}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "controller_endpoint") + + badSocket := proto.CloneOf(cleared) + badSocket.NodeSocketOverride = "/relative/csi.sock" + _, err = tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: badSocket}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "node_socket_override") + + badTLS := proto.CloneOf(cleared) + badTLS.Tls = &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: false, ServerName: "x.svc"} + _, err = tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: badTLS}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "use_pod_identity") + + _, err = tc.noOptInClient.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: proto.CloneOf(cleared)}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "csi_driver_config: Forbidden") +} + +func TestDeleteCsiDriverConfig(t *testing.T) { + preview.InitForTest(t, "ExternalVolumes") + ns := namespaceForTest("ns-delete-cdc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + ctx := context.Background() + ref := &ateapi.ObjectRef{Name: "csi-nfs"} + del := func(opts *ateapi.DeleteOptions) (*ateapi.CsiDriverConfig, error) { + return tc.client.DeleteCsiDriverConfig(ctx, &ateapi.DeleteCsiDriverConfigRequest{CsiDriverConfig: ref, Options: opts}) + } + + created := createCsiDriverConfig(t, tc, "csi-nfs", "nfs.csi.k8s.io") + uid, version := created.GetMetadata().GetUid(), created.GetMetadata().GetVersion() + + _, err := del(&ateapi.DeleteOptions{Uid: uid, Version: version + 1}) + assertGrpcError(t, err, codes.Aborted, "concurrent update conflict, please retry") + _, err = del(&ateapi.DeleteOptions{Uid: foreignUID}) + assertGrpcErrorRegex(t, err, codes.Aborted, foreignUID) + + createExternalVolumeClass(t, tc, "nfs") + _, err = del(nil) + assertGrpcError(t, err, codes.FailedPrecondition, "CsiDriverConfig csi-nfs cannot be deleted while referenced by an ExternalVolumeClass") + if _, err := tc.client.GetCsiDriverConfig(ctx, &ateapi.GetCsiDriverConfigRequest{CsiDriverConfig: ref}); err != nil { + t.Fatalf("config removed despite in-use failure: %v", err) + } + + if _, err := tc.client.DeleteExternalVolumeClass(ctx, &ateapi.DeleteExternalVolumeClassRequest{ExternalVolumeClass: &ateapi.ObjectRef{Name: "nfs"}}); err != nil { + t.Fatalf("DeleteExternalVolumeClass failed: %v", err) + } + deleted, err := del(&ateapi.DeleteOptions{Uid: uid, Version: version}) + if err != nil { + t.Fatalf("DeleteCsiDriverConfig failed: %v", err) + } + if deleted.GetMetadata().GetDeleteTime() == nil { + t.Errorf("deleted config = %v, want delete_time populated", deleted.GetMetadata()) + } + if diff := cmp.Diff(created, deleted, protocmp.Transform(), ignoreTimestamps); diff != "" { + t.Errorf("DeleteCsiDriverConfig mismatch (-created +deleted):\n%s", diff) + } + _, err = tc.client.GetCsiDriverConfig(ctx, &ateapi.GetCsiDriverConfigRequest{CsiDriverConfig: ref}) + assertGrpcErrorRegex(t, err, codes.NotFound, "csi-nfs.*not found") + _, err = del(nil) + assertGrpcErrorRegex(t, err, codes.NotFound, "csi-nfs.*not found") +} + +func TestValidation_CsiDriverConfig(t *testing.T) { + preview.InitForTest(t, "ExternalVolumes") + ns := namespaceForTest("ns-validation-cdc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + ctx := context.Background() + + t.Run("CreateCsiDriverConfig", func(t *testing.T) { + for _, c := range []struct { + name string + mutate func(*ateapi.CsiDriverConfig) + want string + }{ + {"atespace forbidden", func(cfg *ateapi.CsiDriverConfig) { cfg.Metadata.Atespace = testAtespace }, "atespace: Forbidden"}, + {"invalid driver_name", func(cfg *ateapi.CsiDriverConfig) { cfg.DriverName = "Bad_Driver" }, "driver_name: Invalid value"}, + {"invalid controller_endpoint", func(cfg *ateapi.CsiDriverConfig) { cfg.ControllerEndpoint = "tcp://no-port" }, "controller_endpoint: Invalid value"}, + {"invalid node_socket_override", func(cfg *ateapi.CsiDriverConfig) { cfg.NodeSocketOverride = "/relative/csi.sock" }, "node_socket_override: Invalid value"}, + {"invalid tls", func(cfg *ateapi.CsiDriverConfig) { + cfg.Tls = &ateapi.CsiDriverTlsConfig{Enabled: false, ServerName: "csi.svc"} + }, "server_name: Forbidden"}, + } { + t.Run(c.name, func(t *testing.T) { + bad := newCsiDriverConfig("csi-nfs", "nfs.csi.k8s.io") + c.mutate(bad) + _, err := tc.client.CreateCsiDriverConfig(ctx, &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: bad}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, c.want) + }) + } + }) + t.Run("GetCsiDriverConfig", func(t *testing.T) { + _, err := tc.client.GetCsiDriverConfig(ctx, &ateapi.GetCsiDriverConfigRequest{}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "csi_driver_config: Required value") + _, err = tc.client.GetCsiDriverConfig(ctx, &ateapi.GetCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Atespace: testAtespace, Name: "csi-nfs"}}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "atespace: Forbidden") + }) + t.Run("ListCsiDriverConfigs", func(t *testing.T) { + _, err := tc.client.ListCsiDriverConfigs(ctx, &ateapi.ListCsiDriverConfigsRequest{Options: &ateapi.ListOptions{PageSize: -1}}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "page_size: Invalid value") + }) + t.Run("UpdateCsiDriverConfig", func(t *testing.T) { + _, err := tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "csi_driver_config: Required value") + withAtespace := newCsiDriverConfig("csi-nfs", "nfs.csi.k8s.io") + withAtespace.Metadata.Atespace = testAtespace + _, err = tc.client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: withAtespace}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "atespace: Forbidden") + }) + t.Run("DeleteCsiDriverConfig", func(t *testing.T) { + _, err := tc.client.DeleteCsiDriverConfig(ctx, &ateapi.DeleteCsiDriverConfigRequest{}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "csi_driver_config: Required value") + _, err = tc.client.DeleteCsiDriverConfig(ctx, &ateapi.DeleteCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Atespace: testAtespace, Name: "csi-nfs"}}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "atespace: Forbidden") + }) +} diff --git a/cmd/ateapi/internal/controlapi/functionaltest/external_volume_class_test.go b/cmd/ateapi/internal/controlapi/functionaltest/external_volume_class_test.go new file mode 100644 index 0000000000..db9e1cbec0 --- /dev/null +++ b/cmd/ateapi/internal/controlapi/functionaltest/external_volume_class_test.go @@ -0,0 +1,167 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package functionaltest + +import ( + "context" + "testing" + + "github.com/google/go-cmp/cmp" + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/internal/preview" + "google.golang.org/grpc/codes" + "google.golang.org/protobuf/testing/protocmp" +) + +func newExternalVolumeClass(name string) *ateapi.ExternalVolumeClass { + return &ateapi.ExternalVolumeClass{ + Metadata: &ateapi.ResourceMetadata{Name: name}, + DriverName: "nfs.csi.k8s.io", + Parameters: map[string]string{"server": "nfs.example.com"}, + } +} + +func createExternalVolumeClass(t *testing.T, tc *testContext, name string) *ateapi.ExternalVolumeClass { + t.Helper() + created, err := tc.client.CreateExternalVolumeClass(context.Background(), &ateapi.CreateExternalVolumeClassRequest{ExternalVolumeClass: newExternalVolumeClass(name)}) + if err != nil { + t.Fatalf("CreateExternalVolumeClass(%s) failed: %v", name, err) + } + return created +} + +func TestCreateExternalVolumeClass(t *testing.T) { + preview.InitForTest(t, "ExternalVolumes") + ns := namespaceForTest("ns-create-evc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + ctx := context.Background() + + in := newExternalVolumeClass("nfs") + in.Metadata.Uid = "caller-supplied-uid" + in.Metadata.Version = 999 + created, err := tc.client.CreateExternalVolumeClass(ctx, &ateapi.CreateExternalVolumeClassRequest{ExternalVolumeClass: in}) + if err != nil { + t.Fatalf("CreateExternalVolumeClass failed: %v", err) + } + if diff := cmp.Diff(newExternalVolumeClass("nfs"), created, protocmp.Transform(), ignoreServerMetadata, ignoreVersion); diff != "" { + t.Errorf("CreateExternalVolumeClass mismatch (-want +got):\n%s", diff) + } + if md := created.GetMetadata(); md.GetVersion() != 1 || md.GetUid() == "" || md.GetUid() == "caller-supplied-uid" { + t.Errorf("metadata = %v, want server-assigned uid and version 1", md) + } + + got, err := tc.client.GetExternalVolumeClass(ctx, &ateapi.GetExternalVolumeClassRequest{ExternalVolumeClass: &ateapi.ObjectRef{Name: "nfs"}}) + if err != nil { + t.Fatalf("GetExternalVolumeClass failed: %v", err) + } + if diff := cmp.Diff(created, got, protocmp.Transform()); diff != "" { + t.Errorf("GetExternalVolumeClass mismatch (-created +got):\n%s", diff) + } + + _, err = tc.client.CreateExternalVolumeClass(ctx, &ateapi.CreateExternalVolumeClassRequest{ExternalVolumeClass: newExternalVolumeClass("nfs")}) + assertGrpcError(t, err, codes.AlreadyExists, "ExternalVolumeClass nfs already exists") + + // A client that does not opt in to preview features cannot set the field. + _, err = tc.noOptInClient.CreateExternalVolumeClass(ctx, &ateapi.CreateExternalVolumeClassRequest{ExternalVolumeClass: newExternalVolumeClass("other")}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "external_volume_class: Forbidden") +} + +func TestListExternalVolumeClasses(t *testing.T) { + preview.InitForTest(t, "ExternalVolumes") + ns := namespaceForTest("ns-list-evc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + + want := []string{"class-a", "class-b", "class-c"} + for _, n := range want { + createExternalVolumeClass(t, tc, n) + } + var got []string + token := "" + for { + resp, err := tc.client.ListExternalVolumeClasses(context.Background(), &ateapi.ListExternalVolumeClassesRequest{Options: &ateapi.ListOptions{PageSize: 2, PageToken: token}}) + if err != nil { + t.Fatalf("ListExternalVolumeClasses failed: %v", err) + } + for _, c := range resp.GetExternalVolumeClasses() { + got = append(got, c.GetMetadata().GetName()) + } + if token = resp.GetNextPageToken(); token == "" { + break + } + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("listed classes mismatch (-want +got):\n%s", diff) + } +} + +func TestDeleteExternalVolumeClass(t *testing.T) { + preview.InitForTest(t, "ExternalVolumes") + ns := namespaceForTest("ns-delete-evc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + ctx := context.Background() + ref := &ateapi.ObjectRef{Name: "nfs"} + del := func(opts *ateapi.DeleteOptions) (*ateapi.ExternalVolumeClass, error) { + return tc.client.DeleteExternalVolumeClass(ctx, &ateapi.DeleteExternalVolumeClassRequest{ExternalVolumeClass: ref, Options: opts}) + } + + created := createExternalVolumeClass(t, tc, "nfs") + uid, version := created.GetMetadata().GetUid(), created.GetMetadata().GetVersion() + _, err := del(&ateapi.DeleteOptions{Uid: uid, Version: version + 1}) + assertGrpcError(t, err, codes.Aborted, "concurrent update conflict, please retry") + _, err = del(&ateapi.DeleteOptions{Uid: foreignUID}) + assertGrpcError(t, err, codes.Aborted, "ExternalVolumeClass nfs does not have uid "+foreignUID) + + deleted, err := del(&ateapi.DeleteOptions{Uid: uid, Version: version}) + if err != nil { + t.Fatalf("DeleteExternalVolumeClass failed: %v", err) + } + if deleted.GetMetadata().GetName() != "nfs" || deleted.GetMetadata().GetDeleteTime() == nil { + t.Errorf("deleted class = %v, want nfs with delete_time", deleted.GetMetadata()) + } + _, err = tc.client.GetExternalVolumeClass(ctx, &ateapi.GetExternalVolumeClassRequest{ExternalVolumeClass: ref}) + assertGrpcError(t, err, codes.NotFound, "ExternalVolumeClass nfs not found") + _, err = del(nil) + assertGrpcError(t, err, codes.NotFound, "ExternalVolumeClass nfs not found") +} + +func TestValidation_ExternalVolumeClass(t *testing.T) { + preview.InitForTest(t, "ExternalVolumes") + ns := namespaceForTest("ns-validation-evc") + tc := setupPreviewTest(t, ns) + defer tc.cleanup() + ctx := context.Background() + + t.Run("CreateExternalVolumeClass", func(t *testing.T) { + bad := newExternalVolumeClass("nfs") + bad.DriverName = "Bad_Driver" + _, err := tc.client.CreateExternalVolumeClass(ctx, &ateapi.CreateExternalVolumeClassRequest{ExternalVolumeClass: bad}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "driver_name: Invalid value") + }) + t.Run("GetExternalVolumeClass", func(t *testing.T) { + _, err := tc.client.GetExternalVolumeClass(ctx, &ateapi.GetExternalVolumeClassRequest{}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "external_volume_class: Required value") + }) + t.Run("ListExternalVolumeClasses", func(t *testing.T) { + _, err := tc.client.ListExternalVolumeClasses(ctx, &ateapi.ListExternalVolumeClassesRequest{Options: &ateapi.ListOptions{PageSize: -1}}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "page_size: Invalid value") + }) + t.Run("DeleteExternalVolumeClass", func(t *testing.T) { + _, err := tc.client.DeleteExternalVolumeClass(ctx, &ateapi.DeleteExternalVolumeClassRequest{}) + assertGrpcErrorRegex(t, err, codes.InvalidArgument, "external_volume_class: Required value") + }) +} diff --git a/cmd/ateapi/internal/controlapi/service.go b/cmd/ateapi/internal/controlapi/service.go index f67ebcd613..6612caa621 100644 --- a/cmd/ateapi/internal/controlapi/service.go +++ b/cmd/ateapi/internal/controlapi/service.go @@ -16,6 +16,9 @@ package controlapi import ( "context" + "errors" + "fmt" + "maps" "sync" "go.ate.dev/substrate/api/ateapi/v1" @@ -30,6 +33,29 @@ import ( storagev1listers "k8s.io/client-go/listers/storage/v1" ) +type csiPluginCacheKey struct { + controllerEndpoint string + tlsEnabled bool + tlsUsePodIdentity bool + tlsServerName string +} + +type csiPluginSlot struct { + gen uint64 + inflight int + key csiPluginCacheKey + plugin *csi.Plugin +} + +func newCSIPluginCacheKey(cfg *ateapi.CsiDriverConfig) csiPluginCacheKey { + return csiPluginCacheKey{ + controllerEndpoint: cfg.GetControllerEndpoint(), + tlsEnabled: cfg.GetTls().GetEnabled(), + tlsUsePodIdentity: cfg.GetTls().GetUsePodIdentity(), + tlsServerName: cfg.GetTls().GetServerName(), + } +} + // RPCService implements ateapi.ControlServer and provides the implementation of // the RPC service. // @@ -45,8 +71,9 @@ type RPCService struct { actorWorkflow *ActorWorkflow workerWorkflow *WorkerWorkflow instruments *Instruments + staticVolumePlugins map[string]volume.VolumePluginControlPlane mu sync.RWMutex - volumePlugins map[string]volume.VolumePluginControlPlane + csiPlugins map[string]csiPluginSlot objectStorePlugin objectstore.ControlProviderClient actorJWTIssuer string @@ -96,7 +123,8 @@ func NewRPCService( csiDriverConfigLister: csiDriverConfigLister, dialer: dialer, instruments: instruments, - volumePlugins: volumePlugins, + staticVolumePlugins: maps.Clone(volumePlugins), + csiPlugins: make(map[string]csiPluginSlot), objectStorePlugin: objectStorePlugin, actorJWTIssuer: actorJWTIssuer, actorIDJWTPool: actorIDJWTPool, @@ -126,6 +154,16 @@ type serviceStore interface { GetAtespace(ctx context.Context, name string) (*ateapi.Atespace, error) ListAtespaces(ctx context.Context, opts store.ListOptions) (store.ListResponse[*ateapi.Atespace], error) DeleteAtespace(ctx context.Context, name string, precondition store.DeletePreconditions) (*ateapi.Atespace, error) + CreateExternalVolumeClass(ctx context.Context, class *ateapi.ExternalVolumeClass) (*ateapi.ExternalVolumeClass, error) + GetExternalVolumeClass(ctx context.Context, name string) (*ateapi.ExternalVolumeClass, error) + ListExternalVolumeClasses(ctx context.Context, opts store.ListOptions) (store.ListResponse[*ateapi.ExternalVolumeClass], error) + DeleteExternalVolumeClass(ctx context.Context, name string, precondition store.DeletePreconditions) (*ateapi.ExternalVolumeClass, error) + CreateCsiDriverConfig(ctx context.Context, config *ateapi.CsiDriverConfig) (*ateapi.CsiDriverConfig, error) + GetCsiDriverConfig(ctx context.Context, name string) (*ateapi.CsiDriverConfig, error) + GetCsiDriverConfigByDriverName(ctx context.Context, driverName string) (*ateapi.CsiDriverConfig, error) + ListCsiDriverConfigs(ctx context.Context, opts store.ListOptions) (store.ListResponse[*ateapi.CsiDriverConfig], error) + UpdateCsiDriverConfig(ctx context.Context, name string, precondition store.Precondition, mutate func(toUpdate *ateapi.CsiDriverConfig) error) (*ateapi.CsiDriverConfig, error) + DeleteCsiDriverConfig(ctx context.Context, name string, precondition store.DeletePreconditions) (*ateapi.CsiDriverConfig, error) CreateGlobalAccessPolicy(ctx context.Context, policy *ateapi.AccessPolicy) (*ateapi.AccessPolicy, error) GetGlobalAccessPolicy(ctx context.Context) (*ateapi.AccessPolicy, error) UpdateGlobalAccessPolicy(ctx context.Context, precondition store.Precondition, mutate func(*ateapi.AccessPolicy) error) (*ateapi.AccessPolicy, error) @@ -145,24 +183,127 @@ type serviceStore interface { AcquireLease(ctx context.Context, key string) (*store.Lease, error) } -// GetPlugin retrieves a CSI volume plugin by driver name, dynamically discovering it if not present. -func (s *RPCService) GetPlugin(ctx context.Context, driverName string) (volume.VolumePluginControlPlane, error) { - s.mu.RLock() - plugin, ok := s.volumePlugins[driverName] - s.mu.RUnlock() - if ok { - return plugin, nil +func (s *RPCService) resolveCsiDriverConfig(ctx context.Context, driverName string) (*ateapi.CsiDriverConfig, bool, error) { + if s.impl != nil { + cfg, err := s.impl.GetCsiDriverConfigByDriverName(ctx, driverName) + if err == nil { + return cfg, false, nil + } + if !errors.Is(err, store.ErrNotFound) { + return nil, false, fmt.Errorf("failed to retrieve CsiDriverConfig for %q: %w", driverName, err) + } + if s.csiDriverConfigLister == nil { + return nil, true, fmt.Errorf("failed to retrieve CsiDriverConfig for %q: not found", driverName) + } + } + cfg, k8sErr := csi.NewK8sCSIDriverConfigGetter(s.csiDriverConfigLister).Get(ctx, driverName) + if k8sErr != nil { + return nil, true, fmt.Errorf("failed to retrieve CsiDriverConfig for %q: %w", driverName, k8sErr) + } + return cfg, false, nil +} + +func (s *RPCService) evictSlotLocked(driverName string, cur csiPluginSlot) (*csi.Plugin, uint64) { + evicted := cur.plugin + cur.plugin, cur.key = nil, csiPluginCacheKey{} + cur.gen++ + s.csiPlugins[driverName] = cur + return evicted, cur.gen +} + +func (s *RPCService) getPluginOnce(ctx context.Context, driverName string) (volume.VolumePluginControlPlane, bool, error) { + if err := ctx.Err(); err != nil { + return nil, false, err + } + s.mu.Lock() + if s.csiPlugins == nil { + s.csiPlugins = make(map[string]csiPluginSlot) } + slot := s.csiPlugins[driverName] + slot.inflight++ + startGen := slot.gen + s.csiPlugins[driverName] = slot + s.mu.Unlock() + defer func() { + s.mu.Lock() + cur := s.csiPlugins[driverName] + cur.inflight-- + if cur.plugin == nil && cur.inflight == 0 { + delete(s.csiPlugins, driverName) + } else { + s.csiPlugins[driverName] = cur + } + s.mu.Unlock() + }() - csiPlugin, err := csi.NewCSIPlugin(ctx, s.csiDriverConfigLister, driverName, true /*isController*/) + cfg, evictOnErr, err := s.resolveCsiDriverConfig(ctx, driverName) if err != nil { - return nil, err + if !evictOnErr { + return nil, false, err + } + s.mu.Lock() + cur := s.csiPlugins[driverName] + if cur.gen != startGen { + retry := cur.plugin != nil + s.mu.Unlock() + return nil, retry, err + } + evicted, _ := s.evictSlotLocked(driverName, cur) + s.mu.Unlock() + _ = evicted.Close() + return nil, false, err } + key := newCSIPluginCacheKey(cfg) s.mu.Lock() - s.volumePlugins[driverName] = csiPlugin + cur := s.csiPlugins[driverName] + if cur.plugin != nil && cur.key == key { + s.mu.Unlock() + return cur.plugin, false, nil + } + if cur.gen != startGen { + s.mu.Unlock() + return nil, true, nil + } + var preEvicted *csi.Plugin + if cur.plugin != nil { + preEvicted, startGen = s.evictSlotLocked(driverName, cur) + } s.mu.Unlock() - return csiPlugin, nil + _ = preEvicted.Close() + + csiPlugin, err := csi.NewCSIPluginFromConfig(ctx, cfg, driverName, true) + if err != nil { + return nil, false, err + } + + s.mu.Lock() + cur = s.csiPlugins[driverName] + if (cur.plugin != nil && cur.key == key) || cur.gen != startGen { + matched, retry := cur.plugin, cur.plugin == nil || cur.key != key + s.mu.Unlock() + _ = csiPlugin.Close() + return matched, retry, nil + } + cur.plugin, cur.key = csiPlugin, key + cur.gen++ + s.csiPlugins[driverName] = cur + s.mu.Unlock() + return csiPlugin, false, nil +} + +// GetPlugin retrieves a CSI volume plugin by driver name, reading CsiDriverConfig +// from Postgres first and falling back to the Kubernetes CSIDriverConfig CRD. +func (s *RPCService) GetPlugin(ctx context.Context, driverName string) (volume.VolumePluginControlPlane, error) { + if plugin, ok := s.staticVolumePlugins[driverName]; ok { + return plugin, nil + } + for { + plugin, retry, err := s.getPluginOnce(ctx, driverName) + if !retry { + return plugin, err + } + } } // ServiceImpl implements store.Interface and provides the "middleware" layer diff --git a/cmd/ateapi/internal/controlapi/volumes.go b/cmd/ateapi/internal/controlapi/volumes.go index d9de1a3ff7..d89424743c 100644 --- a/cmd/ateapi/internal/controlapi/volumes.go +++ b/cmd/ateapi/internal/controlapi/volumes.go @@ -38,27 +38,79 @@ func externalVolumesStatus(vols []*ateapi.ExternalVolumeStatus) *ateapi.External return &ateapi.ExternalVolumes{Volumes: vols} } +// externalVolumeClassGetter reads an ExternalVolumeClass by name. ServiceImpl +// implements it and reports a missing class as a NotFound API error. +type externalVolumeClassGetter interface { + GetExternalVolumeClass(ctx context.Context, name string) (*ateapi.ExternalVolumeClass, error) +} + +// volumeClass is what an external volume template resolves to: the CSI driver, +// the parameters for its CreateVolume call, and a label that names the class +// in errors. +type volumeClass struct { + driver string + params map[string]string + label string +} + +// resolveVolumeClass resolves the class of an external volume template from +// external_volume_class when it is set, otherwise from the Kubernetes +// StorageClass named by storage_class_name. +func resolveVolumeClass(ctx context.Context, classes externalVolumeClassGetter, scLister storagev1listers.StorageClassLister, tmpl *ateapi.ExternalVolumeTemplate) (volumeClass, error) { + if ref := tmpl.GetExternalVolumeClass(); ref != nil { + driver, params, err := resolveExternalVolumeClass(ctx, classes, ref) + if err != nil { + return volumeClass{}, err + } + return volumeClass{driver: driver, params: params, label: fmt.Sprintf("ExternalVolumeClass %q", ref.GetName())}, nil + } + + scName := tmpl.GetStorageClassName() + if scName == "" { + return volumeClass{}, apierror.FailedPrecondition("external volume template sets neither external_volume_class nor storage_class_name") + } + sc, err := scLister.Get(scName) + if err != nil { + if k8serrors.IsNotFound(err) { + return volumeClass{}, apierror.FailedPrecondition("StorageClass %q not found", scName) + } + return volumeClass{}, apierror.Internal("failed to get StorageClass %q: %v", scName, err) + } + return volumeClass{driver: sc.Provisioner, params: sc.Parameters, label: fmt.Sprintf("StorageClass %q", scName)}, nil +} + +// resolveExternalVolumeClass returns the driver and CreateVolume parameters of +// the ExternalVolumeClass that ref names. A missing class is a +// FailedPrecondition: the template is valid, but the class it names does not +// exist yet or was deleted. +func resolveExternalVolumeClass(ctx context.Context, classes externalVolumeClassGetter, ref *ateapi.ObjectRef) (driver string, params map[string]string, err error) { + class, err := classes.GetExternalVolumeClass(ctx, ref.GetName()) + if err != nil { + if apierror.Code(err) == codes.NotFound { + return "", nil, apierror.FailedPrecondition("ExternalVolumeClass %q not found", ref.GetName()) + } + return "", nil, apierror.Internal("failed to get ExternalVolumeClass %q: %v", ref.GetName(), err) + } + return class.GetDriverName(), class.GetParameters(), nil +} + // initialExternalVolumes constructs the actor's volume objects before volume // creation. A volume has no storage volume ID until it is provisioned. -func initialExternalVolumes(ctx context.Context, scLister storagev1listers.StorageClassLister, template *ateapi.ActorTemplate) ([]*ateapi.ExternalVolumeStatus, error) { +func initialExternalVolumes(ctx context.Context, classes externalVolumeClassGetter, scLister storagev1listers.StorageClassLister, template *ateapi.ActorTemplate) ([]*ateapi.ExternalVolumeStatus, error) { if template == nil { return nil, apierror.InvalidArgument("template is required") } var volumes []*ateapi.ExternalVolumeStatus for _, vol := range template.GetVolumes() { - if vol.GetExternal().GetTemplate() != nil { - scName := vol.GetExternal().GetTemplate().GetStorageClassName() - sc, err := scLister.Get(scName) + if ext := vol.GetExternal().GetTemplate(); ext != nil { + class, err := resolveVolumeClass(ctx, classes, scLister, ext) if err != nil { - if k8serrors.IsNotFound(err) { - return nil, apierror.FailedPrecondition("StorageClass %q not found", scName) - } - return nil, apierror.Internal("failed to get StorageClass %q: %v", scName, err) + return nil, err } volumes = append(volumes, &ateapi.ExternalVolumeStatus{ Name: vol.GetName(), - VolumeType: sc.Provisioner, + VolumeType: class.driver, }) } } @@ -68,7 +120,7 @@ func initialExternalVolumes(ctx context.Context, scLister storagev1listers.Stora // createActorVolumes provisions the external volumes in volumesToCreate that have no storage volume ID, using the provided volume plugin. // It returns the list of external volumes (with storage IDs), or an error if any creation fails. // Any volumes processed before or during a failure are returned alongside the error so they can be persisted on the actor. -func createActorVolumes(ctx context.Context, registry VolumePluginRegistry, scLister storagev1listers.StorageClassLister, actorUID string, template *ateapi.ActorTemplate, volumesToCreate []*ateapi.ExternalVolumeStatus) (resultVolumes []*ateapi.ExternalVolumeStatus, err error) { +func createActorVolumes(ctx context.Context, registry VolumePluginRegistry, classes externalVolumeClassGetter, scLister storagev1listers.StorageClassLister, actorUID string, template *ateapi.ActorTemplate, volumesToCreate []*ateapi.ExternalVolumeStatus) (resultVolumes []*ateapi.ExternalVolumeStatus, err error) { resultVolumes = make([]*ateapi.ExternalVolumeStatus, 0, len(volumesToCreate)) var currentIdx int @@ -102,28 +154,24 @@ func createActorVolumes(ctx context.Context, registry VolumePluginRegistry, scLi actVolID := actorVolumeID(actorUID, volName) - scName := specVol.GetExternal().GetTemplate().GetStorageClassName() - sc, err := scLister.Get(scName) + class, err := resolveVolumeClass(ctx, classes, scLister, specVol.GetExternal().GetTemplate()) if err != nil { - if k8serrors.IsNotFound(err) { - return resultVolumes, apierror.FailedPrecondition("StorageClass %q not found", scName) - } - return resultVolumes, apierror.Internal("failed to get StorageClass %q: %v", scName, err) + return resultVolumes, err } - if sc.Provisioner != vol.GetVolumeType() { - return resultVolumes, apierror.FailedPrecondition("volume %q has mismatched type %q (expected %q from StorageClass %q)", volName, vol.GetVolumeType(), sc.Provisioner, scName) + if class.driver != vol.GetVolumeType() { + return resultVolumes, apierror.FailedPrecondition("volume %q has mismatched type %q (expected %q from %s)", volName, vol.GetVolumeType(), class.driver, class.label) } plugin, err := registry.GetPlugin(ctx, vol.GetVolumeType()) if err != nil { - return resultVolumes, apierror.FailedPrecondition("failed to get volume plugin for driver %q (StorageClass %q): %v", sc.Provisioner, scName, err) + return resultVolumes, apierror.FailedPrecondition("failed to get volume plugin for driver %q (%s): %v", class.driver, class.label, err) } resp, volErr := plugin.CreateVolume(ctx, volume.CreateVolumeRequest{ Name: actVolID, CapacityBytes: specVol.GetExternal().GetTemplate().GetCapacityBytes(), - Parameters: sc.Parameters, + Parameters: class.params, }) if volErr != nil { return resultVolumes, apierror.Internal("failed to create volume %q: %v", specVol.GetName(), volErr) @@ -137,7 +185,7 @@ func createActorVolumes(ctx context.Context, registry VolumePluginRegistry, scLi resultVolumes = append(resultVolumes, &ateapi.ExternalVolumeStatus{ Name: volName, StorageVolumeId: resp.VolumeID, - VolumeType: sc.Provisioner, + VolumeType: class.driver, VolumeContext: resp.VolumeContext, }) } diff --git a/cmd/ateapi/internal/controlapi/volumes_test.go b/cmd/ateapi/internal/controlapi/volumes_test.go index a7366a0c9f..5603357dcf 100644 --- a/cmd/ateapi/internal/controlapi/volumes_test.go +++ b/cmd/ateapi/internal/controlapi/volumes_test.go @@ -58,6 +58,24 @@ func (f *fakeStorageClassLister) Get(name string) (*storagev1.StorageClass, erro var _ storagev1listers.StorageClassLister = (*fakeStorageClassLister)(nil) +// fakeExternalVolumeClassGetter serves classes from a map and reports a +// missing name the way ServiceImpl does. +type fakeExternalVolumeClassGetter struct { + classes map[string]*ateapi.ExternalVolumeClass + getErr error +} + +func (f *fakeExternalVolumeClassGetter) GetExternalVolumeClass(_ context.Context, name string) (*ateapi.ExternalVolumeClass, error) { + if f.getErr != nil { + return nil, f.getErr + } + class, ok := f.classes[name] + if !ok { + return nil, apierror.NotFound("ExternalVolumeClass %s not found", name) + } + return class, nil +} + func TestActorVolumesStorageClassErrors(t *testing.T) { ctx := context.Background() tmpl := &ateapi.ActorTemplate{ @@ -91,7 +109,7 @@ func TestActorVolumesStorageClassErrors(t *testing.T) { t.Run(tt.name, func(t *testing.T) { lister := &fakeStorageClassLister{getErr: tt.getErr} t.Run("initial", func(t *testing.T) { - _, err := initialExternalVolumes(ctx, lister, tmpl) + _, err := initialExternalVolumes(ctx, nil, lister, tmpl) if got := apierror.Code(err); got != tt.wantCode { t.Fatalf("initialExternalVolumes() code = %v, want %v; error = %v", got, tt.wantCode, err) } @@ -100,7 +118,7 @@ func TestActorVolumesStorageClassErrors(t *testing.T) { } }) t.Run("create", func(t *testing.T) { - res, err := createActorVolumes(ctx, &mockPluginRegistry{}, lister, "actor-uid-123", tmpl, volumes) + res, err := createActorVolumes(ctx, &mockPluginRegistry{}, nil, lister, "actor-uid-123", tmpl, volumes) if got := apierror.Code(err); got != tt.wantCode { t.Fatalf("createActorVolumes() code = %v, want %v; error = %v", got, tt.wantCode, err) } @@ -163,7 +181,7 @@ func TestInitialActorVolumes(t *testing.T) { }, }, } - initVols, err := initialExternalVolumes(context.Background(), scLister, tmpl) + initVols, err := initialExternalVolumes(context.Background(), nil, scLister, tmpl) if err != nil { t.Fatalf("initialExternalVolumes failed: %v", err) } @@ -322,7 +340,7 @@ func TestCreateActorVolumes(t *testing.T) { } } scLister := &fakeStorageClassLister{storageClasses: scs} - res, err := createActorVolumes(ctx, registry, scLister, "actor-uid-123", tt.tmpl, tt.inputVolumes) + res, err := createActorVolumes(ctx, registry, nil, scLister, "actor-uid-123", tt.tmpl, tt.inputVolumes) if (err != nil) != tt.wantErr { t.Errorf("createActorVolumes() error = %v, wantErr %v", err, tt.wantErr) } @@ -333,6 +351,138 @@ func TestCreateActorVolumes(t *testing.T) { } } +func TestResolveExternalVolumeClass(t *testing.T) { + ref := &ateapi.ObjectRef{Name: "gold"} + for _, tt := range []struct { + name string + getter *fakeExternalVolumeClassGetter + wantCode codes.Code + wantDriver string + wantParams map[string]string + }{{ + name: "found", + getter: &fakeExternalVolumeClassGetter{classes: map[string]*ateapi.ExternalVolumeClass{ + "gold": {DriverName: "mock-standard", Parameters: map[string]string{"tier": "gold"}}, + }}, + wantCode: codes.OK, + wantDriver: "mock-standard", + wantParams: map[string]string{"tier": "gold"}, + }, { + name: "missing", + getter: &fakeExternalVolumeClassGetter{}, + wantCode: codes.FailedPrecondition, + }, { + name: "lookup fails", + getter: &fakeExternalVolumeClassGetter{getErr: errors.New("database unavailable")}, + wantCode: codes.Internal, + }} { + t.Run(tt.name, func(t *testing.T) { + driver, params, err := resolveExternalVolumeClass(context.Background(), tt.getter, ref) + if got := apierror.Code(err); got != tt.wantCode { + t.Fatalf("resolveExternalVolumeClass() code = %v, want %v; error = %v", got, tt.wantCode, err) + } + if err != nil { + if !strings.Contains(err.Error(), `ExternalVolumeClass "gold"`) { + t.Errorf("resolveExternalVolumeClass() error does not name the class: %v", err) + } + return + } + if driver != tt.wantDriver { + t.Errorf("resolveExternalVolumeClass() driver = %q, want %q", driver, tt.wantDriver) + } + if diff := cmp.Diff(tt.wantParams, params); diff != "" { + t.Errorf("resolveExternalVolumeClass() params mismatch (-want +got):\n%s", diff) + } + }) + } +} + +func TestActorVolumesFromExternalVolumeClass(t *testing.T) { + ctx := context.Background() + tmpl := &ateapi.ActorTemplate{ + Volumes: []*ateapi.Volume{{ + Name: "data-vol", + External: &ateapi.ExternalVolumeSource{Template: &ateapi.ExternalVolumeTemplate{ + ExternalVolumeClass: &ateapi.ObjectRef{Name: "gold"}, + CapacityBytes: 1 << 30, + }}, + }}, + } + classes := &fakeExternalVolumeClassGetter{classes: map[string]*ateapi.ExternalVolumeClass{ + "gold": {DriverName: "mock-standard", Parameters: map[string]string{"tier": "gold"}}, + }} + registry := &mockPluginRegistry{plugins: map[string]volume.VolumePluginControlPlane{ + "mock-standard": volume.NewMockVolumePlugin(), + }} + + t.Run("initial volume takes the class driver as its type", func(t *testing.T) { + got, err := initialExternalVolumes(ctx, classes, nil, tmpl) + if err != nil { + t.Fatalf("initialExternalVolumes() failed: %v", err) + } + want := []*ateapi.ExternalVolumeStatus{{Name: "data-vol", VolumeType: "mock-standard"}} + if diff := cmp.Diff(want, got, protocmp.Transform()); diff != "" { + t.Errorf("initialExternalVolumes() mismatch (-want +got):\n%s", diff) + } + }) + + t.Run("create passes the class parameters to the driver", func(t *testing.T) { + input := []*ateapi.ExternalVolumeStatus{{Name: "data-vol", VolumeType: "mock-standard"}} + got, err := createActorVolumes(ctx, registry, classes, nil, "actor-uid-123", tmpl, input) + if err != nil { + t.Fatalf("createActorVolumes() failed: %v", err) + } + want := []*ateapi.ExternalVolumeStatus{{ + Name: "data-vol", + StorageVolumeId: "mock-vol-substrate-actor-uid-123-data-vol", + VolumeType: "mock-standard", + VolumeContext: map[string]string{"tier": "gold"}, + }} + if diff := cmp.Diff(want, got, protocmp.Transform()); diff != "" { + t.Errorf("createActorVolumes() mismatch (-want +got):\n%s", diff) + } + }) + + t.Run("create rejects a volume whose type differs from the class driver", func(t *testing.T) { + input := []*ateapi.ExternalVolumeStatus{{Name: "data-vol", VolumeType: "mock-fast"}} + got, err := createActorVolumes(ctx, registry, classes, nil, "actor-uid-123", tmpl, input) + if code := apierror.Code(err); code != codes.FailedPrecondition { + t.Fatalf("createActorVolumes() code = %v, want %v; error = %v", code, codes.FailedPrecondition, err) + } + if !strings.Contains(err.Error(), `from ExternalVolumeClass "gold"`) { + t.Errorf("createActorVolumes() error does not name the class: %v", err) + } + if diff := cmp.Diff(input, got, protocmp.Transform()); diff != "" { + t.Errorf("createActorVolumes() did not preserve pending volumes (-want +got):\n%s", diff) + } + }) + + t.Run("missing class is a failed precondition", func(t *testing.T) { + missing := &fakeExternalVolumeClassGetter{} + if _, err := initialExternalVolumes(ctx, missing, nil, tmpl); apierror.Code(err) != codes.FailedPrecondition { + t.Errorf("initialExternalVolumes() error = %v, want FailedPrecondition", err) + } + input := []*ateapi.ExternalVolumeStatus{{Name: "data-vol", VolumeType: "mock-standard"}} + got, err := createActorVolumes(ctx, registry, missing, nil, "actor-uid-123", tmpl, input) + if code := apierror.Code(err); code != codes.FailedPrecondition { + t.Fatalf("createActorVolumes() code = %v, want %v; error = %v", code, codes.FailedPrecondition, err) + } + if diff := cmp.Diff(input, got, protocmp.Transform()); diff != "" { + t.Errorf("createActorVolumes() did not preserve pending volumes (-want +got):\n%s", diff) + } + }) + + t.Run("template with no class is a failed precondition", func(t *testing.T) { + noClass := &ateapi.ActorTemplate{Volumes: []*ateapi.Volume{{ + Name: "data-vol", + External: &ateapi.ExternalVolumeSource{Template: &ateapi.ExternalVolumeTemplate{CapacityBytes: 1 << 30}}, + }}} + if _, err := initialExternalVolumes(ctx, classes, nil, noClass); apierror.Code(err) != codes.FailedPrecondition { + t.Errorf("initialExternalVolumes() error = %v, want FailedPrecondition", err) + } + }) +} + // emptyIDVolumePlugin provisions volumes without returning an ID. type emptyIDVolumePlugin struct { volume.VolumePluginControlPlane @@ -357,7 +507,7 @@ func TestCreateActorVolumesRejectsEmptyPluginID(t *testing.T) { }} input := []*ateapi.ExternalVolumeStatus{{Name: "data-vol", VolumeType: "mock-standard"}} - res, err := createActorVolumes(context.Background(), registry, scLister, "actor-uid-123", tmpl, input) + res, err := createActorVolumes(context.Background(), registry, nil, scLister, "actor-uid-123", tmpl, input) if got := apierror.Code(err); got != codes.Internal { t.Fatalf("createActorVolumes() code = %v, want %v; error = %v", got, codes.Internal, err) } diff --git a/cmd/ateapi/internal/controlapi/workflow.go b/cmd/ateapi/internal/controlapi/workflow.go index c8579c64e5..834c481e27 100644 --- a/cmd/ateapi/internal/controlapi/workflow.go +++ b/cmd/ateapi/internal/controlapi/workflow.go @@ -187,6 +187,7 @@ type actorWorkflowStore interface { MarkTagForDeletion(ctx context.Context, tagRef resources.TagRef, precondition store.DeletePreconditions, mutate func(toUpdate *ateapi.Tag) error) (*ateapi.Tag, error) DeleteTag(ctx context.Context, tagRef resources.TagRef, precondition store.DeletePreconditions) (*ateapi.Tag, error) GetActorTemplate(ctx context.Context, templateRef resources.ActorTemplateRef) (*ateapi.ActorTemplate, error) + GetExternalVolumeClass(ctx context.Context, name string) (*ateapi.ExternalVolumeClass, error) MarkActorTemplateForDeletion(ctx context.Context, templateRef resources.ActorTemplateRef, precondition store.DeletePreconditions, mutate func(toUpdate *ateapi.ActorTemplate) error) (*ateapi.ActorTemplate, error) DeleteActorTemplate(ctx context.Context, templateRef resources.ActorTemplateRef, precondition store.DeletePreconditions) (*ateapi.ActorTemplate, error) AcquireLease(ctx context.Context, key string) (*store.Lease, error) diff --git a/cmd/ateapi/internal/controlapi/workflow_resume.go b/cmd/ateapi/internal/controlapi/workflow_resume.go index 324a16eda6..ccd34726bc 100644 --- a/cmd/ateapi/internal/controlapi/workflow_resume.go +++ b/cmd/ateapi/internal/controlapi/workflow_resume.go @@ -206,7 +206,7 @@ func (w *ActorWorkflow) ensureVolumesCreated(ctx context.Context, actorRef resou return nil, apierror.FailedPrecondition("cannot create volumes for Actor %s in state %s", actorRef, st) } - volumes, createErr := createActorVolumes(ctx, w.pluginRegistry, w.storageClassLister, actor.GetMetadata().GetUid(), actorTemplate, actor.GetStatus().GetExternalVolumes().GetVolumes()) + volumes, createErr := createActorVolumes(ctx, w.pluginRegistry, w.store, w.storageClassLister, actor.GetMetadata().GetUid(), actorTemplate, actor.GetStatus().GetExternalVolumes().GetVolumes()) // createActorVolumes reports the state it got to even when it fails, so both // paths persist the same field. updatePrecondition := store.PreconditionFrom(actor) diff --git a/cmd/ateapi/internal/defaults/defaults.go b/cmd/ateapi/internal/defaults/defaults.go index 0bffefb536..52698ce849 100644 --- a/cmd/ateapi/internal/defaults/defaults.go +++ b/cmd/ateapi/internal/defaults/defaults.go @@ -36,8 +36,12 @@ func Apply(m proto.Message) { applyActorTemplateDefaults(v) case *ateapi.Atespace: applyAtespaceDefaults(v) + case *ateapi.CsiDriverConfig: + applyCsiDriverConfigDefaults(v) case *ateapi.EgressPolicy: applyEgressPolicyDefaults(v) + case *ateapi.ExternalVolumeClass: + applyExternalVolumeClassDefaults(v) case *ateapi.Tag: applyTagDefaults(v) case *ateapi.Worker: @@ -99,6 +103,8 @@ func applyActorDefaults(*ateapi.Actor) {} func applyAtespaceDefaults(*ateapi.Atespace) {} +func applyCsiDriverConfigDefaults(*ateapi.CsiDriverConfig) {} + func applyEgressPolicyDefaults(p *ateapi.EgressPolicy) { applyEgressRuleDefaults(p.GetRules()) } @@ -117,6 +123,8 @@ func applyEgressRuleDefaults(rules []*ateapi.EgressRule) { } } +func applyExternalVolumeClassDefaults(*ateapi.ExternalVolumeClass) {} + func applyTagDefaults(*ateapi.Tag) {} func applyWorkerDefaults(*ateapi.Worker) {} diff --git a/cmd/ateapi/internal/defaults/defaults_test.go b/cmd/ateapi/internal/defaults/defaults_test.go index 5a1e2e441d..6dab2cc32b 100644 --- a/cmd/ateapi/internal/defaults/defaults_test.go +++ b/cmd/ateapi/internal/defaults/defaults_test.go @@ -151,6 +151,14 @@ func TestApply(t *testing.T) { {Https: &ateapi.HttpsRule{Hostnames: []string{"custom.example.com"}, Ports: &ateapi.Ports{Numbers: []int32{8443}}}}, {TlsPassthrough: &ateapi.TlsPassthroughRule{Hostnames: []string{"tcp.example.com"}}}, }}}, + }, { + name: "csi driver config has no defaults", + in: &ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, DriverName: "nfs.csi.k8s.io", ControllerEndpoint: "dns:///csi-nfs:9000"}, + want: &ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, DriverName: "nfs.csi.k8s.io", ControllerEndpoint: "dns:///csi-nfs:9000"}, + }, { + name: "external volume class has no defaults", + in: &ateapi.ExternalVolumeClass{Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, DriverName: "nfs.csi.k8s.io"}, + want: &ateapi.ExternalVolumeClass{Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, DriverName: "nfs.csi.k8s.io"}, }, { name: "tag has no defaults", in: &ateapi.Tag{Scope: ateapi.TagScope_TAG_SCOPE_PUBLISHED}, diff --git a/cmd/ateapi/internal/store/atepg/common_test.go b/cmd/ateapi/internal/store/atepg/common_test.go index 718317ee30..6d05adf2ab 100644 --- a/cmd/ateapi/internal/store/atepg/common_test.go +++ b/cmd/ateapi/internal/store/atepg/common_test.go @@ -28,7 +28,7 @@ import ( // state, so the statement lives here rather than on Persistence. func clearAll(t *testing.T, p *Persistence) { t.Helper() - if _, err := p.pool.Exec(context.Background(), `TRUNCATE atespaces, global_access_policy, atespace_access_policies, actors, actor_egress_policies, actor_templates, tags, workers, worker_assignments, leases, worker_outbox, worker_outbox_trim, tuple, changelog`); err != nil { + if _, err := p.pool.Exec(context.Background(), `TRUNCATE atespaces, global_access_policy, atespace_access_policies, actors, actor_egress_policies, actor_templates, tags, workers, worker_assignments, leases, worker_outbox, worker_outbox_trim, external_volume_classes, csi_driver_configs, tuple, changelog`); err != nil { t.Fatalf("truncating tables: %v", err) } } diff --git a/cmd/ateapi/internal/store/atepg/csi_driver_config.go b/cmd/ateapi/internal/store/atepg/csi_driver_config.go new file mode 100644 index 0000000000..10255c1cb4 --- /dev/null +++ b/cmd/ateapi/internal/store/atepg/csi_driver_config.go @@ -0,0 +1,299 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package atepg + +import ( + "context" + "errors" + "fmt" + + "github.com/jackc/pgx/v5" + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/cmd/ateapi/internal/store" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func validateCsiDriverConfigColumns(name string, cfg *ateapi.CsiDriverConfig, uid string, version int64, driverName string) error { + resource := fmt.Sprintf("csi driver config %q", name) + if err := validateProtoMetadataMatchesColumns(resource, cfg.GetMetadata(), uid, version); err != nil { + return err + } + if cfg.GetMetadata().GetName() != name { + return fmt.Errorf("%s name projection %q does not match proto metadata name %q", resource, name, cfg.GetMetadata().GetName()) + } + if cfg.GetDriverName() != driverName { + return fmt.Errorf("%s driver_name projection %q does not match proto driver_name %q", resource, driverName, cfg.GetDriverName()) + } + return nil +} + +func (p *Persistence) CreateCsiDriverConfig(ctx context.Context, config *ateapi.CsiDriverConfig) (*ateapi.CsiDriverConfig, error) { + dbConfig := proto.CloneOf(config) + if dbConfig.Metadata == nil { + dbConfig.Metadata = &ateapi.ResourceMetadata{} + } + name := dbConfig.GetMetadata().GetName() + setCreateMetadata(dbConfig.Metadata) + protoBytes, err := proto.Marshal(dbConfig) + if err != nil { + return nil, fmt.Errorf("marshaling csi driver config: %w", err) + } + _, err = p.pool.Exec(ctx, ` + INSERT INTO csi_driver_configs (name, uid, version, driver_name, proto) + VALUES ($1, $2, $3, $4, $5)`, + name, dbConfig.GetMetadata().GetUid(), dbConfig.GetMetadata().GetVersion(), dbConfig.GetDriverName(), protoBytes) + if err != nil { + if isUniqueViolation(err) { + if pgErrConstraint(err) == "csi_driver_configs_driver_name_key" { + return nil, fmt.Errorf("%w: driver_name %q is already registered", store.ErrAlreadyExists, dbConfig.GetDriverName()) + } + return nil, fmt.Errorf("%w: csi driver config %q already exists", store.ErrAlreadyExists, name) + } + return nil, fmt.Errorf("inserting csi driver config %q: %w", name, err) + } + return dbConfig, nil +} + +func (p *Persistence) getCsiDriverConfig(ctx context.Context, query, arg string) (*ateapi.CsiDriverConfig, error) { + var name, uid, driverName string + var version int64 + var protoBytes []byte + if err := p.pool.QueryRow(ctx, query, arg).Scan(&name, &uid, &version, &driverName, &protoBytes); err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return nil, store.ErrNotFound + } + return nil, fmt.Errorf("getting csi driver config %q: %w", arg, err) + } + out := &ateapi.CsiDriverConfig{} + if err := unmarshalStored(protoBytes, out); err != nil { + return nil, fmt.Errorf("unmarshaling csi driver config: %w", err) + } + if err := validateCsiDriverConfigColumns(name, out, uid, version, driverName); err != nil { + return nil, err + } + return out, nil +} + +func (p *Persistence) GetCsiDriverConfig(ctx context.Context, name string) (*ateapi.CsiDriverConfig, error) { + return p.getCsiDriverConfig(ctx, `SELECT name, uid, version, driver_name, proto FROM csi_driver_configs WHERE name = $1`, name) +} + +func (p *Persistence) GetCsiDriverConfigByDriverName(ctx context.Context, driverName string) (*ateapi.CsiDriverConfig, error) { + return p.getCsiDriverConfig(ctx, `SELECT name, uid, version, driver_name, proto FROM csi_driver_configs WHERE driver_name = $1`, driverName) +} + +func (p *Persistence) ListCsiDriverConfigs(ctx context.Context, opts store.ListOptions) (store.ListResponse[*ateapi.CsiDriverConfig], error) { + opts, err := store.NormalizeListOptions(opts) + if err != nil { + return store.ListResponse[*ateapi.CsiDriverConfig]{}, err + } + pageSize := opts.PageSize + token, err := decodePageToken(opts.PageToken, kindCsiDriverConfig, "", 1) + if err != nil { + return store.ListResponse[*ateapi.CsiDriverConfig]{}, err + } + var last *string + if len(token.Last) > 0 { + last = &token.Last[0] + } + rows, err := p.pool.Query(ctx, ` + SELECT name, uid, version, driver_name, proto FROM csi_driver_configs + WHERE $1::text IS NULL OR name > $1 + ORDER BY name + LIMIT $2`, last, int64(pageSize)+1) + if err != nil { + return store.ListResponse[*ateapi.CsiDriverConfig]{}, fmt.Errorf("listing csi driver configs: %w", err) + } + defer rows.Close() + + var names []string + var result []*ateapi.CsiDriverConfig + for rows.Next() { + var name, uid, driverName string + var version int64 + var protoBytes []byte + if err := rows.Scan(&name, &uid, &version, &driverName, &protoBytes); err != nil { + return store.ListResponse[*ateapi.CsiDriverConfig]{}, fmt.Errorf("scanning csi driver config row: %w", err) + } + cfg := &ateapi.CsiDriverConfig{} + if err := unmarshalRow(protoBytes, cfg, "csi driver config", name); err != nil { + return store.ListResponse[*ateapi.CsiDriverConfig]{}, err + } + if err := validateCsiDriverConfigColumns(name, cfg, uid, version, driverName); err != nil { + return store.ListResponse[*ateapi.CsiDriverConfig]{}, err + } + result = append(result, cfg) + names = append(names, name) + } + if err := rows.Err(); err != nil { + return store.ListResponse[*ateapi.CsiDriverConfig]{}, fmt.Errorf("listing csi driver configs: %w", err) + } + var nextToken string + if len(result) > int(pageSize) { + result = result[:pageSize] + nextToken = encodePageToken(kindCsiDriverConfig, "", []string{names[pageSize-1]}) + } + return store.ListResponse[*ateapi.CsiDriverConfig]{Items: result, NextPageToken: nextToken}, nil +} + +func (p *Persistence) UpdateCsiDriverConfig(ctx context.Context, name string, precondition store.Precondition, mutate func(toUpdate *ateapi.CsiDriverConfig) error) (*ateapi.CsiDriverConfig, error) { + if err := precondition.Validate(); err != nil { + return nil, err + } + var currentUID, currentDriverName string + var currentVersion int64 + var currentBytes []byte + err := p.pool.QueryRow(ctx, `SELECT uid, version, driver_name, proto FROM csi_driver_configs WHERE name = $1`, name).Scan( + ¤tUID, ¤tVersion, ¤tDriverName, ¤tBytes) + if err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return nil, store.ErrNotFound + } + return nil, fmt.Errorf("getting csi driver config %q for update: %w", name, err) + } + dbConfig := &ateapi.CsiDriverConfig{} + if err := unmarshalStored(currentBytes, dbConfig); err != nil { + return nil, fmt.Errorf("unmarshaling csi driver config %q: %w", name, err) + } + if err := validateCsiDriverConfigColumns(name, dbConfig, currentUID, currentVersion, currentDriverName); err != nil { + return nil, err + } + if err := precondition.Check(dbConfig.GetMetadata()); err != nil { + return nil, err + } + + oldMeta := proto.CloneOf(dbConfig.GetMetadata()) + oldDriverName := dbConfig.GetDriverName() + if mutate != nil { + if err := mutate(dbConfig); err != nil { + return nil, err + } + } + if got := dbConfig.GetMetadata().GetAtespace(); got != "" { + return nil, fmt.Errorf("%w: metadata.atespace must be empty, got %q", store.ErrImmutableField, got) + } + if got := dbConfig.GetMetadata().GetName(); got != name { + return nil, fmt.Errorf("%w: metadata.name changed from %q to %q", store.ErrImmutableField, name, got) + } + if got := dbConfig.GetDriverName(); got != oldDriverName { + return nil, fmt.Errorf("%w: driver_name changed from %q to %q", store.ErrImmutableField, oldDriverName, got) + } + setUpdateMetadata(dbConfig.Metadata, oldMeta) + + updatedBytes, err := proto.Marshal(dbConfig) + if err != nil { + return nil, fmt.Errorf("marshaling csi driver config: %w", err) + } + commandTag, err := p.pool.Exec(ctx, ` + UPDATE csi_driver_configs SET version = $1, proto = $2 + WHERE name = $3 AND uid = $4 AND version = $5`, + dbConfig.GetMetadata().GetVersion(), updatedBytes, name, currentUID, currentVersion) + if err != nil { + return nil, fmt.Errorf("updating csi driver config %q: %w", name, err) + } + if commandTag.RowsAffected() == 0 { + return nil, store.ErrVersionConflict + } + if commandTag.RowsAffected() != 1 { + return nil, fmt.Errorf("updating csi driver config %q affected %d rows, want 1", name, commandTag.RowsAffected()) + } + return dbConfig, nil +} + +func isDriverInUseByExternalVolumeClass(ctx context.Context, tx pgx.Tx, driverName string) (bool, error) { + var inUse bool + if err := tx.QueryRow(ctx, `SELECT EXISTS (SELECT 1 FROM external_volume_classes WHERE driver_name = $1)`, driverName).Scan(&inUse); err != nil { + return false, fmt.Errorf("checking external volume classes for driver %q: %w", driverName, err) + } + if inUse { + return true, nil + } + // Rows written before migration 000003 or by an older replica during a + // rolling update carry an empty driver_name projection. + rows, err := tx.Query(ctx, `SELECT name, proto FROM external_volume_classes WHERE driver_name = ''`) + if err != nil { + return false, fmt.Errorf("checking legacy external volume classes for driver %q: %w", driverName, err) + } + defer rows.Close() + for rows.Next() { + var clsName string + var protoBytes []byte + if err := rows.Scan(&clsName, &protoBytes); err != nil { + return false, fmt.Errorf("scanning external volume class row: %w", err) + } + cls := &ateapi.ExternalVolumeClass{} + if err := unmarshalRow(protoBytes, cls, "external volume class", clsName); err != nil { + return false, err + } + if cls.GetDriverName() == driverName { + return true, nil + } + } + if err := rows.Err(); err != nil { + return false, fmt.Errorf("checking legacy external volume classes for driver %q: %w", driverName, err) + } + return false, nil +} + +func (p *Persistence) DeleteCsiDriverConfig(ctx context.Context, name string, precondition store.DeletePreconditions) (*ateapi.CsiDriverConfig, error) { + tx, err := p.pool.Begin(ctx) + if err != nil { + return nil, fmt.Errorf("beginning csi driver config delete: %w", err) + } + defer tx.Rollback(ctx) //nolint:errcheck // no-op once committed + + var uid, driverName string + var version int64 + var protoBytes []byte + err = tx.QueryRow(ctx, `SELECT uid, version, driver_name, proto FROM csi_driver_configs WHERE name = $1 FOR UPDATE`, name).Scan( + &uid, &version, &driverName, &protoBytes) + if err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return nil, store.ErrNotFound + } + return nil, fmt.Errorf("locking csi driver config %q for delete: %w", name, err) + } + deleted := &ateapi.CsiDriverConfig{} + if err := unmarshalStored(protoBytes, deleted); err != nil { + return nil, fmt.Errorf("unmarshaling csi driver config %q: %w", name, err) + } + if err := validateCsiDriverConfigColumns(name, deleted, uid, version, driverName); err != nil { + return nil, err + } + if err := precondition.Check(deleted.GetMetadata()); err != nil { + return nil, err + } + + inUse, err := isDriverInUseByExternalVolumeClass(ctx, tx, deleted.GetDriverName()) + if err != nil { + return nil, err + } + if inUse { + return nil, fmt.Errorf("%w: csi driver config %q (driver %q) is in use by an external volume class", store.ErrFailedPrecondition, name, deleted.GetDriverName()) + } + commandTag, err := tx.Exec(ctx, `DELETE FROM csi_driver_configs WHERE name = $1`, name) + if err != nil { + return nil, fmt.Errorf("deleting csi driver config %q: %w", name, err) + } + if commandTag.RowsAffected() != 1 { + return nil, fmt.Errorf("deleting csi driver config %q affected %d rows, want 1", name, commandTag.RowsAffected()) + } + if err := tx.Commit(ctx); err != nil { + return nil, fmt.Errorf("committing csi driver config delete %q: %w", name, err) + } + deleted.Metadata.DeleteTime = timestamppb.Now() + return deleted, nil +} diff --git a/cmd/ateapi/internal/store/atepg/csi_driver_config_test.go b/cmd/ateapi/internal/store/atepg/csi_driver_config_test.go new file mode 100644 index 0000000000..6f407cc93e --- /dev/null +++ b/cmd/ateapi/internal/store/atepg/csi_driver_config_test.go @@ -0,0 +1,174 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package atepg + +import ( + "context" + "errors" + "fmt" + "strings" + "testing" + + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/cmd/ateapi/internal/store" +) + +func TestCreateCsiDriverConfig_UniqueConstraintMessages(t *testing.T) { + s := setupPostgresPersistence(t) + ctx := context.Background() + if _, err := s.CreateCsiDriverConfig(ctx, &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, DriverName: "nfs.csi.k8s.io", ControllerEndpoint: "tcp://10.0.0.1:12345", + }); err != nil { + t.Fatalf("CreateCsiDriverConfig failed: %v", err) + } + + _, err := s.CreateCsiDriverConfig(ctx, &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, DriverName: "other.csi.k8s.io", ControllerEndpoint: "tcp://10.0.0.1:12345", + }) + if !errors.Is(err, store.ErrAlreadyExists) || !strings.Contains(err.Error(), "already exists") || strings.Contains(err.Error(), "is already registered") { + t.Errorf("duplicate name error = %v, want ErrAlreadyExists with 'already exists'", err) + } + + _, err = s.CreateCsiDriverConfig(ctx, &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs-2"}, DriverName: "nfs.csi.k8s.io", ControllerEndpoint: "tcp://10.0.0.1:12345", + }) + if !errors.Is(err, store.ErrAlreadyExists) || !strings.Contains(err.Error(), `driver_name "nfs.csi.k8s.io" is already registered`) { + t.Errorf("duplicate driver_name error = %v, want ErrAlreadyExists naming registered driver_name", err) + } +} + +func TestUpdateCsiDriverConfig_ConcurrentWriteReturnsConflict(t *testing.T) { + s := setupPostgresPersistence(t) + ctx := context.Background() + created, err := s.CreateCsiDriverConfig(ctx, &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, DriverName: "nfs.csi.k8s.io", ControllerEndpoint: "tcp://10.0.0.1:12345", + }) + if err != nil { + t.Fatalf("CreateCsiDriverConfig failed: %v", err) + } + _, err = s.UpdateCsiDriverConfig(ctx, "csi-nfs", store.PreconditionFrom(created), func(toUpdate *ateapi.CsiDriverConfig) error { + if _, err := s.UpdateCsiDriverConfig(ctx, "csi-nfs", store.PreconditionFrom(created), func(c *ateapi.CsiDriverConfig) error { + c.ControllerEndpoint = "tcp://10.0.0.2:12345" + return nil + }); err != nil { + return fmt.Errorf("concurrent update: %w", err) + } + toUpdate.ControllerEndpoint = "tcp://10.0.0.3:12345" + return nil + }) + if !errors.Is(err, store.ErrVersionConflict) { + t.Fatalf("UpdateCsiDriverConfig error = %v, want ErrVersionConflict", err) + } + if stored, err := s.GetCsiDriverConfig(ctx, "csi-nfs"); err != nil || stored.GetControllerEndpoint() != "tcp://10.0.0.2:12345" { + t.Errorf("GetCsiDriverConfig = (%v, %v), want winning endpoint", stored, err) + } +} + +func TestCsiDriverConfig_CorruptAndColumnTamper(t *testing.T) { + cases := []struct { + name, tamperSQL, lookupDriver string + tamperArg any + }{ + {"corrupt proto", `UPDATE csi_driver_configs SET proto = $1 WHERE name = 'csi-nfs'`, "nfs.csi.k8s.io", []byte{0xff}}, + {"uid mismatch", `UPDATE csi_driver_configs SET uid = $1 WHERE name = 'csi-nfs'`, "nfs.csi.k8s.io", "tampered-uid"}, + {"version mismatch", `UPDATE csi_driver_configs SET version = $1 WHERE name = 'csi-nfs'`, "nfs.csi.k8s.io", int64(99)}, + {"driver_name mismatch", `UPDATE csi_driver_configs SET driver_name = $1 WHERE name = 'csi-nfs'`, "tampered.csi.k8s.io", "tampered.csi.k8s.io"}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + s := setupPostgresPersistence(t) + ctx := context.Background() + created, err := s.CreateCsiDriverConfig(ctx, &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, DriverName: "nfs.csi.k8s.io", ControllerEndpoint: "tcp://10.0.0.1:12345", + }) + if err != nil { + t.Fatalf("CreateCsiDriverConfig failed: %v", err) + } + if _, err := s.pool.Exec(ctx, tc.tamperSQL, tc.tamperArg); err != nil { + t.Fatalf("tampering csi_driver_configs row: %v", err) + } + for op, fn := range map[string]func() error{ + "GetCsiDriverConfig": func() error { _, err := s.GetCsiDriverConfig(ctx, "csi-nfs"); return err }, + "GetCsiDriverConfigByDriverName": func() error { _, err := s.GetCsiDriverConfigByDriverName(ctx, tc.lookupDriver); return err }, + "ListCsiDriverConfigs": func() error { _, err := s.ListCsiDriverConfigs(ctx, store.ListOptions{PageSize: 10}); return err }, + "UpdateCsiDriverConfig": func() error { + _, err := s.UpdateCsiDriverConfig(ctx, "csi-nfs", store.PreconditionFrom(created), func(*ateapi.CsiDriverConfig) error { return nil }) + return err + }, + "DeleteCsiDriverConfig": func() error { + _, err := s.DeleteCsiDriverConfig(ctx, "csi-nfs", store.DeletePreconditions{}) + return err + }, + } { + if err := fn(); err == nil { + t.Errorf("%s succeeded on tampered row, want error", op) + } + } + }) + } +} + +func TestExternalVolumeClass_DriverNameColumnAndLegacyEmpty(t *testing.T) { + s := setupPostgresPersistence(t) + ctx := context.Background() + if _, err := s.CreateCsiDriverConfig(ctx, &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, DriverName: "nfs.csi.k8s.io", ControllerEndpoint: "tcp://10.0.0.1:12345", + }); err != nil { + t.Fatalf("CreateCsiDriverConfig failed: %v", err) + } + if _, err := s.CreateExternalVolumeClass(ctx, &ateapi.ExternalVolumeClass{Metadata: &ateapi.ResourceMetadata{Name: "other"}, DriverName: "other.csi.k8s.io"}); err != nil { + t.Fatalf("CreateExternalVolumeClass(other) failed: %v", err) + } + if _, err := s.CreateExternalVolumeClass(ctx, &ateapi.ExternalVolumeClass{Metadata: &ateapi.ResourceMetadata{Name: "nfs"}, DriverName: "nfs.csi.k8s.io"}); err != nil { + t.Fatalf("CreateExternalVolumeClass(nfs) failed: %v", err) + } + var driverName string + if err := s.pool.QueryRow(ctx, `SELECT driver_name FROM external_volume_classes WHERE name = $1`, "nfs").Scan(&driverName); err != nil || driverName != "nfs.csi.k8s.io" { + t.Fatalf("driver_name column = (%q, %v), want nfs.csi.k8s.io", driverName, err) + } + + // Simulate pre-000003 / older-replica rows whose driver_name column is still ''. + if _, err := s.pool.Exec(ctx, `UPDATE external_volume_classes SET driver_name = '' WHERE name = $1`, "other"); err != nil { + t.Fatalf("clearing other driver_name: %v", err) + } + if _, err := s.pool.Exec(ctx, `UPDATE external_volume_classes SET driver_name = '' WHERE name = $1`, "nfs"); err != nil { + t.Fatalf("clearing nfs driver_name: %v", err) + } + if got, err := s.GetExternalVolumeClass(ctx, "nfs"); err != nil || got.GetDriverName() != "nfs.csi.k8s.io" { + t.Fatalf("GetExternalVolumeClass on legacy row = (%v, %v), want nfs.csi.k8s.io", got, err) + } + if page, err := s.ListExternalVolumeClasses(ctx, store.ListOptions{PageSize: 10}); err != nil || len(page.Items) != 2 { + t.Fatalf("ListExternalVolumeClasses on legacy rows = (%d items, %v), want 2", len(page.Items), err) + } + if _, err := s.DeleteCsiDriverConfig(ctx, "csi-nfs", store.DeletePreconditions{}); !errors.Is(err, store.ErrFailedPrecondition) { + t.Fatalf("DeleteCsiDriverConfig while referenced by legacy row = %v, want ErrFailedPrecondition", err) + } + if _, err := s.DeleteExternalVolumeClass(ctx, "nfs", store.DeletePreconditions{}); err != nil { + t.Fatalf("DeleteExternalVolumeClass(nfs) failed: %v", err) + } + if _, err := s.DeleteCsiDriverConfig(ctx, "csi-nfs", store.DeletePreconditions{}); err != nil { + t.Fatalf("DeleteCsiDriverConfig after legacy row deleted = %v, want nil", err) + } + + if _, err := s.pool.Exec(ctx, `UPDATE external_volume_classes SET driver_name = $1 WHERE name = 'other'`, "tampered.csi.k8s.io"); err != nil { + t.Fatalf("tampering external_volume_classes row: %v", err) + } + if _, err := s.GetExternalVolumeClass(ctx, "other"); err == nil { + t.Error("GetExternalVolumeClass succeeded on tampered driver_name, want error") + } + if _, err := s.ListExternalVolumeClasses(ctx, store.ListOptions{PageSize: 10}); err == nil { + t.Error("ListExternalVolumeClasses succeeded on tampered driver_name, want error") + } +} diff --git a/cmd/ateapi/internal/store/atepg/external_volume_class.go b/cmd/ateapi/internal/store/atepg/external_volume_class.go new file mode 100644 index 0000000000..d96ec62d4c --- /dev/null +++ b/cmd/ateapi/internal/store/atepg/external_volume_class.go @@ -0,0 +1,151 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package atepg + +import ( + "context" + "errors" + "fmt" + + "github.com/jackc/pgx/v5" + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/cmd/ateapi/internal/store" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func (p *Persistence) CreateExternalVolumeClass(ctx context.Context, class *ateapi.ExternalVolumeClass) (*ateapi.ExternalVolumeClass, error) { + name := class.GetMetadata().GetName() + + dbClass := proto.Clone(class).(*ateapi.ExternalVolumeClass) + setCreateMetadata(dbClass.Metadata) + + protoBytes, err := proto.Marshal(dbClass) + if err != nil { + return nil, fmt.Errorf("marshaling external volume class: %w", err) + } + + _, err = p.pool.Exec(ctx, ` + INSERT INTO external_volume_classes (name, uid, version, driver_name, proto) + VALUES ($1, $2, $3, $4, $5)`, + name, dbClass.GetMetadata().GetUid(), dbClass.GetMetadata().GetVersion(), dbClass.GetDriverName(), protoBytes) + if err != nil { + if isUniqueViolation(err) { + return nil, store.ErrAlreadyExists + } + return nil, fmt.Errorf("inserting external volume class %q: %w", name, err) + } + return dbClass, nil +} + +func (p *Persistence) GetExternalVolumeClass(ctx context.Context, name string) (*ateapi.ExternalVolumeClass, error) { + var driverName string + var protoBytes []byte + err := p.pool.QueryRow(ctx, `SELECT driver_name, proto FROM external_volume_classes WHERE name = $1`, name).Scan(&driverName, &protoBytes) + if err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return nil, store.ErrNotFound + } + return nil, fmt.Errorf("getting external volume class %q: %w", name, err) + } + out := &ateapi.ExternalVolumeClass{} + if err := unmarshalStored(protoBytes, out); err != nil { + return nil, fmt.Errorf("unmarshaling external volume class: %w", err) + } + if driverName != "" && out.GetDriverName() != driverName { + return nil, fmt.Errorf("external volume class %q driver_name projection %q does not match proto driver_name %q", name, driverName, out.GetDriverName()) + } + return out, nil +} + +func (p *Persistence) ListExternalVolumeClasses(ctx context.Context, opts store.ListOptions) (store.ListResponse[*ateapi.ExternalVolumeClass], error) { + opts, err := store.NormalizeListOptions(opts) + if err != nil { + return store.ListResponse[*ateapi.ExternalVolumeClass]{}, err + } + pageSize, pageTokenStr := opts.PageSize, opts.PageToken + token, err := decodePageToken(pageTokenStr, kindExternalVolumeClass, "", 1) + if err != nil { + return store.ListResponse[*ateapi.ExternalVolumeClass]{}, err + } + var last *string + if len(token.Last) > 0 { + last = &token.Last[0] + } + + rows, err := p.pool.Query(ctx, ` + SELECT name, driver_name, proto FROM external_volume_classes + WHERE $1::text IS NULL OR name > $1 + ORDER BY name + LIMIT $2`, last, int64(pageSize)+1) + if err != nil { + return store.ListResponse[*ateapi.ExternalVolumeClass]{}, fmt.Errorf("listing external volume classes: %w", err) + } + defer rows.Close() + + var names []string + var result []*ateapi.ExternalVolumeClass + for rows.Next() { + var name, driverName string + var protoBytes []byte + if err := rows.Scan(&name, &driverName, &protoBytes); err != nil { + return store.ListResponse[*ateapi.ExternalVolumeClass]{}, fmt.Errorf("scanning external volume class row: %w", err) + } + c := &ateapi.ExternalVolumeClass{} + if err := unmarshalRow(protoBytes, c, "external volume class", name); err != nil { + return store.ListResponse[*ateapi.ExternalVolumeClass]{}, err + } + if driverName != "" && c.GetDriverName() != driverName { + return store.ListResponse[*ateapi.ExternalVolumeClass]{}, fmt.Errorf("external volume class %q driver_name projection %q does not match proto driver_name %q", name, driverName, c.GetDriverName()) + } + result = append(result, c) + names = append(names, name) + } + if err := rows.Err(); err != nil { + return store.ListResponse[*ateapi.ExternalVolumeClass]{}, fmt.Errorf("listing external volume classes: %w", err) + } + + var nextToken string + if len(result) > int(pageSize) { + result = result[:pageSize] + nextToken = encodePageToken(kindExternalVolumeClass, "", []string{names[pageSize-1]}) + } + return store.ListResponse[*ateapi.ExternalVolumeClass]{Items: result, NextPageToken: nextToken}, nil +} + +func (p *Persistence) DeleteExternalVolumeClass(ctx context.Context, name string, precondition store.DeletePreconditions) (*ateapi.ExternalVolumeClass, error) { + var protoBytes []byte + err := p.pool.QueryRow(ctx, ` + DELETE FROM external_volume_classes + WHERE name = $1 + AND ($2::text = '' OR uid = $2::text) + AND ($3::bigint = 0 OR version = $3::bigint) + RETURNING proto`, name, precondition.UID, precondition.Version).Scan(&protoBytes) + if errors.Is(err, pgx.ErrNoRows) { + var uid string + var version int64 + err := p.pool.QueryRow(ctx, `SELECT uid, version FROM external_volume_classes WHERE name = $1`, name).Scan(&uid, &version) + return nil, mapDeleteError(err, uid, version, precondition) + } + if err != nil { + return nil, fmt.Errorf("deleting external volume class %q: %w", name, err) + } + out := &ateapi.ExternalVolumeClass{} + if err := unmarshalStored(protoBytes, out); err != nil { + return nil, fmt.Errorf("unmarshaling deleted external volume class: %w", err) + } + out.Metadata.DeleteTime = timestamppb.Now() + return out, nil +} diff --git a/cmd/ateapi/internal/store/atepg/migrations/000002_external_volume_classes.sql b/cmd/ateapi/internal/store/atepg/migrations/000002_external_volume_classes.sql new file mode 100644 index 0000000000..cfceb9c182 --- /dev/null +++ b/cmd/ateapi/internal/store/atepg/migrations/000002_external_volume_classes.sql @@ -0,0 +1,23 @@ +-- Copyright 2026 The Agent Substrate Authors +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. + +-- +goose Up + +-- ExternalVolumeClasses are global-scoped, so name alone is the primary key. +CREATE TABLE external_volume_classes ( + name text PRIMARY KEY, + uid text NOT NULL, + version bigint NOT NULL, + proto bytea NOT NULL +); diff --git a/cmd/ateapi/internal/store/atepg/migrations/000003_csi_driver_configs.sql b/cmd/ateapi/internal/store/atepg/migrations/000003_csi_driver_configs.sql new file mode 100644 index 0000000000..065a780ad3 --- /dev/null +++ b/cmd/ateapi/internal/store/atepg/migrations/000003_csi_driver_configs.sql @@ -0,0 +1,31 @@ +-- Copyright 2026 The Agent Substrate Authors +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. + +-- +goose Up + +ALTER TABLE external_volume_classes + ADD COLUMN driver_name text NOT NULL DEFAULT ''; + +CREATE INDEX external_volume_classes_driver_name_idx + ON external_volume_classes (driver_name); + +-- CsiDriverConfigs are global-scoped, so name alone is the primary key. +-- driver_name is unique so at most one config addresses each CSI driver. +CREATE TABLE csi_driver_configs ( + name text PRIMARY KEY, + uid text NOT NULL, + version bigint NOT NULL, + driver_name text NOT NULL CONSTRAINT csi_driver_configs_driver_name_key UNIQUE, + proto bytea NOT NULL +); diff --git a/cmd/ateapi/internal/store/atepg/pagetoken.go b/cmd/ateapi/internal/store/atepg/pagetoken.go index 5c8354c229..a929abfcc0 100644 --- a/cmd/ateapi/internal/store/atepg/pagetoken.go +++ b/cmd/ateapi/internal/store/atepg/pagetoken.go @@ -37,6 +37,9 @@ const ( kindTag resourceKind = "tag" kindWorker resourceKind = "worker" kindWorkerAssign resourceKind = "worker-assignment" + + kindExternalVolumeClass resourceKind = "external-volume-class" + kindCsiDriverConfig resourceKind = "csi-driver-config" ) // pageToken is PostgreSQL's opaque keyset page token. It carries no database diff --git a/cmd/ateapi/internal/store/store.go b/cmd/ateapi/internal/store/store.go index 7545b309e8..c520e5cade 100644 --- a/cmd/ateapi/internal/store/store.go +++ b/cmd/ateapi/internal/store/store.go @@ -217,6 +217,44 @@ type Interface interface { // precondition does not describe the policy the caller observed. DeleteAtespaceAccessPolicy(ctx context.Context, name string, precondition DeletePreconditions) (*ateapi.AccessPolicy, error) + // Stores a new ExternalVolumeClass and returns the stored resource with + // server-assigned metadata (uid, version, timestamps). The input is not + // mutated. Returns ErrAlreadyExists if the name is taken. + CreateExternalVolumeClass(ctx context.Context, class *ateapi.ExternalVolumeClass) (*ateapi.ExternalVolumeClass, error) + + // Fetches an ExternalVolumeClass by name. Returns ErrNotFound if missing. + GetExternalVolumeClass(ctx context.Context, name string) (*ateapi.ExternalVolumeClass, error) + + // Lists ExternalVolumeClasses. + ListExternalVolumeClasses(ctx context.Context, opts ListOptions) (ListResponse[*ateapi.ExternalVolumeClass], error) + + // Removes an ExternalVolumeClass and returns the deleted resource. Returns + // ErrNotFound if missing, or ErrUIDConflict/ErrVersionConflict if + // precondition does not describe the class the caller observed. + DeleteExternalVolumeClass(ctx context.Context, name string, precondition DeletePreconditions) (*ateapi.ExternalVolumeClass, error) + + // Stores a new CsiDriverConfig and returns the stored resource with + // server-assigned metadata. Returns ErrAlreadyExists if metadata.name or + // driver_name is taken. + CreateCsiDriverConfig(ctx context.Context, config *ateapi.CsiDriverConfig) (*ateapi.CsiDriverConfig, error) + + // Fetches a CsiDriverConfig by metadata.name. Returns ErrNotFound if missing. + GetCsiDriverConfig(ctx context.Context, name string) (*ateapi.CsiDriverConfig, error) + + // Fetches a CsiDriverConfig by driver_name. Returns ErrNotFound if missing. + GetCsiDriverConfigByDriverName(ctx context.Context, driverName string) (*ateapi.CsiDriverConfig, error) + + // Lists CsiDriverConfigs ordered by metadata.name. + ListCsiDriverConfigs(ctx context.Context, opts ListOptions) (ListResponse[*ateapi.CsiDriverConfig], error) + + // UpdateCsiDriverConfig updates a CsiDriverConfig via guarded + // read-modify-write and returns the stored config with advanced metadata. + UpdateCsiDriverConfig(ctx context.Context, name string, precondition Precondition, mutate func(toUpdate *ateapi.CsiDriverConfig) error) (*ateapi.CsiDriverConfig, error) + + // Removes a CsiDriverConfig and returns the deleted resource. Returns + // ErrFailedPrecondition if an ExternalVolumeClass references its driver_name. + DeleteCsiDriverConfig(ctx context.Context, name string, precondition DeletePreconditions) (*ateapi.CsiDriverConfig, error) + // Stores a new ActorTemplate and returns the stored resource with // server-assigned metadata (uid, version, timestamps). The input is not // mutated. Returns ErrAlreadyExists if the (atespace, name) is taken. diff --git a/cmd/ateapi/internal/store/storecontract/contract.go b/cmd/ateapi/internal/store/storecontract/contract.go index dc760895fc..015d49592d 100644 --- a/cmd/ateapi/internal/store/storecontract/contract.go +++ b/cmd/ateapi/internal/store/storecontract/contract.go @@ -336,6 +336,8 @@ func RunContractTests(t *testing.T, setup func(t *testing.T) store.Interface) { runWorkerContractTests(t, setup) runWorkerAssignmentContractTests(t, setup) runAtespaceContractTests(t, setup) + runExternalVolumeClassContractTests(t, setup) + runCsiDriverConfigContractTests(t, setup) runActorTemplateContractTests(t, setup) runTagContractTests(t, setup) runLeaseContractTests(t, setup) @@ -530,6 +532,7 @@ func runListOptionsContractTests(t *testing.T, setup func(t *testing.T) store.In {"actor templates", func(opts store.ListOptions) error { _, err := s.ListActorTemplates(ctx, "", opts); return err }}, {"tags", func(opts store.ListOptions) error { _, err := s.ListTags(ctx, "", opts); return err }}, {"workers", func(opts store.ListOptions) error { _, err := s.ListWorkers(ctx, opts); return err }}, + {"csi driver configs", func(opts store.ListOptions) error { _, err := s.ListCsiDriverConfigs(ctx, opts); return err }}, } for _, call := range calls { t.Run(call.name, func(t *testing.T) { @@ -555,6 +558,7 @@ func runListOptionsContractTests(t *testing.T, setup func(t *testing.T) store.In {"actor templates", func(opts store.ListOptions) error { _, err := s.ListActorTemplates(ctx, "", opts); return err }}, {"tags", func(opts store.ListOptions) error { _, err := s.ListTags(ctx, "", opts); return err }}, {"workers", func(opts store.ListOptions) error { _, err := s.ListWorkers(ctx, opts); return err }}, + {"csi driver configs", func(opts store.ListOptions) error { _, err := s.ListCsiDriverConfigs(ctx, opts); return err }}, } for _, call := range calls { t.Run(call.name, func(t *testing.T) { @@ -3513,6 +3517,396 @@ func runAtespaceContractTests(t *testing.T, setup func(t *testing.T) store.Inter }) } +func newTestExternalVolumeClass(name string) *ateapi.ExternalVolumeClass { + return &ateapi.ExternalVolumeClass{ + Metadata: &ateapi.ResourceMetadata{Name: name}, + DriverName: "nfs.csi.k8s.io", + Parameters: map[string]string{"server": "nfs.example.com", "share": "/exports"}, + } +} + +func runExternalVolumeClassContractTests(t *testing.T, setup func(t *testing.T) store.Interface) { + t.Helper() + + t.Run("CreateExternalVolumeClass_Success", func(t *testing.T) { + s := setup(t) + ctx := context.Background() + + want := newTestExternalVolumeClass("nfs") + created, err := s.CreateExternalVolumeClass(ctx, want) + if err != nil { + t.Fatalf("CreateExternalVolumeClass failed: %v", err) + } + if created.GetMetadata().GetUid() == "" { + t.Errorf("CreateExternalVolumeClass returned empty uid; want server-assigned uid") + } + if created.GetMetadata().GetVersion() != 1 { + t.Errorf("CreateExternalVolumeClass returned version %d, want 1", created.GetMetadata().GetVersion()) + } + if diff := cmp.Diff(want, created, protocmp.Transform(), ignoreUID, ignoreTimestamps, ignoreVersion); diff != "" { + t.Errorf("CreateExternalVolumeClass returned unexpected class (-want +got):\n%s", diff) + } + + got, err := s.GetExternalVolumeClass(ctx, "nfs") + if err != nil { + t.Fatalf("GetExternalVolumeClass failed: %v", err) + } + if diff := cmp.Diff(created, got, protocmp.Transform()); diff != "" { + t.Errorf("CreateExternalVolumeClass return does not match stored state (-created +got):\n%s", diff) + } + }) + + t.Run("CreateExternalVolumeClass_AlreadyExists", func(t *testing.T) { + s := setup(t) + ctx := context.Background() + + if _, err := s.CreateExternalVolumeClass(ctx, newTestExternalVolumeClass("nfs")); err != nil { + t.Fatalf("first CreateExternalVolumeClass failed: %v", err) + } + if _, err := s.CreateExternalVolumeClass(ctx, newTestExternalVolumeClass("nfs")); !errors.Is(err, store.ErrAlreadyExists) { + t.Errorf("second CreateExternalVolumeClass = %v, want ErrAlreadyExists", err) + } + }) + + t.Run("GetExternalVolumeClass_NotFound", func(t *testing.T) { + s := setup(t) + + if _, err := s.GetExternalVolumeClass(context.Background(), "nope"); !errors.Is(err, store.ErrNotFound) { + t.Errorf("GetExternalVolumeClass = %v, want ErrNotFound", err) + } + }) + + t.Run("ListExternalVolumeClasses_Pagination", func(t *testing.T) { + s := setup(t) + ctx := context.Background() + + empty, err := s.ListExternalVolumeClasses(ctx, store.ListOptions{PageSize: 1000}) + if err != nil || len(empty.Items) != 0 || empty.NextPageToken != "" { + t.Fatalf("empty ListExternalVolumeClasses = (%v, %q, %v); want empty", empty.Items, empty.NextPageToken, err) + } + + var want []string + for i := range 5 { + name := fmt.Sprintf("class-%d", i) + if _, err := s.CreateExternalVolumeClass(ctx, newTestExternalVolumeClass(name)); err != nil { + t.Fatalf("CreateExternalVolumeClass(%s) failed: %v", name, err) + } + want = append(want, name) + } + + var got []string + pageToken := "" + for { + page, err := s.ListExternalVolumeClasses(ctx, store.ListOptions{PageSize: 2, PageToken: pageToken}) + if err != nil { + t.Fatalf("ListExternalVolumeClasses failed: %v", err) + } + for _, c := range page.Items { + got = append(got, c.GetMetadata().GetName()) + } + pageToken = page.NextPageToken + if pageToken == "" { + break + } + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("paged class names mismatch (-want +got):\n%s", diff) + } + }) + + t.Run("DeleteExternalVolumeClass", func(t *testing.T) { + s := setup(t) + ctx := context.Background() + + created, err := s.CreateExternalVolumeClass(ctx, newTestExternalVolumeClass("nfs")) + if err != nil { + t.Fatalf("CreateExternalVolumeClass failed: %v", err) + } + deleted, err := s.DeleteExternalVolumeClass(ctx, "nfs", store.DeletePreconditions{}) + if err != nil { + t.Fatalf("DeleteExternalVolumeClass failed: %v", err) + } + if deleted.GetMetadata().GetDeleteTime() == nil { + t.Error("the deleted class carries no delete_time") + } + if diff := cmp.Diff(created, deleted, protocmp.Transform(), ignoreTimestamps); diff != "" { + t.Errorf("DeleteExternalVolumeClass returned unexpected class (-created +deleted):\n%s", diff) + } + if _, err := s.GetExternalVolumeClass(ctx, "nfs"); !errors.Is(err, store.ErrNotFound) { + t.Errorf("after delete, GetExternalVolumeClass = %v, want ErrNotFound", err) + } + }) + + t.Run("DeleteExternalVolumeClass_Preconditions", func(t *testing.T) { + s := setup(t) + ctx := context.Background() + del := func(precondition store.DeletePreconditions) error { + _, err := s.DeleteExternalVolumeClass(ctx, "nfs", precondition) + return err + } + + if err := del(store.DeletePreconditions{UID: foreignUID, Version: 1}); !errors.Is(err, store.ErrNotFound) { + t.Errorf("guarded delete of a missing class = %v, want ErrNotFound", err) + } + + created, err := s.CreateExternalVolumeClass(ctx, newTestExternalVolumeClass("nfs")) + if err != nil { + t.Fatalf("CreateExternalVolumeClass failed: %v", err) + } + uid, version := created.GetMetadata().GetUid(), created.GetMetadata().GetVersion() + if err := del(store.DeletePreconditions{UID: uid, Version: version + 1}); !errors.Is(err, store.ErrVersionConflict) { + t.Errorf("matching uid, stale version = %v, want ErrVersionConflict", err) + } + if err := del(store.DeletePreconditions{UID: foreignUID, Version: version}); !errors.Is(err, store.ErrUIDConflict) { + t.Errorf("foreign uid, matching version = %v, want ErrUIDConflict", err) + } + if _, err := s.GetExternalVolumeClass(ctx, "nfs"); err != nil { + t.Fatalf("a refused delete removed the class: %v", err) + } + if err := del(store.DeletePreconditions{UID: uid, Version: version}); err != nil { + t.Errorf("matching uid and version = %v, want nil", err) + } + }) +} + +func newTestCsiDriverConfig(name, driverName string) *ateapi.CsiDriverConfig { + return &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: name}, + DriverName: driverName, + ControllerEndpoint: "dns:///csi-nfs-controller.csi-nfs.svc:12345", + NodeSocketOverride: "unix:///var/lib/kubelet/plugins/nfs.csi.k8s.io/csi.sock", + Tls: &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "csi-nfs-controller.csi-nfs.svc"}, + } +} + +func runCsiDriverConfigContractTests(t *testing.T, setup func(t *testing.T) store.Interface) { + t.Helper() + + t.Run("CreateAndGetCsiDriverConfig", func(t *testing.T) { + s := setup(t) + ctx := context.Background() + + input := newTestCsiDriverConfig("csi-nfs", "nfs.csi.k8s.io") + input.Metadata = &ateapi.ResourceMetadata{ + Name: "csi-nfs", Uid: "caller-uid", Version: 99, + CreateTime: timestamppb.New(time.Unix(1, 0)), UpdateTime: timestamppb.New(time.Unix(2, 0)), DeleteTime: timestamppb.New(time.Unix(3, 0)), + } + before := proto.CloneOf(input) + created, err := s.CreateCsiDriverConfig(ctx, input) + if err != nil { + t.Fatalf("CreateCsiDriverConfig failed: %v", err) + } + if diff := cmp.Diff(before, input, protocmp.Transform()); diff != "" { + t.Errorf("CreateCsiDriverConfig mutated caller input (-before +after):\n%s", diff) + } + if md := created.GetMetadata(); md.GetUid() == "" || md.GetUid() == "caller-uid" || md.GetVersion() != 1 || + md.GetCreateTime() == nil || md.GetCreateTime().AsTime().Unix() == 1 || + md.GetUpdateTime() == nil || md.GetUpdateTime().AsTime().Unix() == 2 || md.GetDeleteTime() != nil { + t.Errorf("created metadata = %v; want fresh server-assigned metadata at version 1", md) + } + if diff := cmp.Diff(newTestCsiDriverConfig("csi-nfs", "nfs.csi.k8s.io"), created, protocmp.Transform(), ignoreUID, ignoreTimestamps, ignoreVersion); diff != "" { + t.Errorf("CreateCsiDriverConfig mismatch (-want +got):\n%s", diff) + } + + got, err := s.GetCsiDriverConfig(ctx, "csi-nfs") + if err != nil || !proto.Equal(created, got) { + t.Fatalf("GetCsiDriverConfig = (%v, %v), want %v", got, err, created) + } + byDriver, err := s.GetCsiDriverConfigByDriverName(ctx, "nfs.csi.k8s.io") + if err != nil || !proto.Equal(created, byDriver) { + t.Fatalf("GetCsiDriverConfigByDriverName = (%v, %v), want %v", byDriver, err, created) + } + if _, err := s.GetCsiDriverConfig(ctx, "nope"); !errors.Is(err, store.ErrNotFound) { + t.Errorf("GetCsiDriverConfig(missing) = %v, want ErrNotFound", err) + } + if _, err := s.GetCsiDriverConfigByDriverName(ctx, "nope.csi.k8s.io"); !errors.Is(err, store.ErrNotFound) { + t.Errorf("GetCsiDriverConfigByDriverName(missing) = %v, want ErrNotFound", err) + } + if _, err := s.CreateCsiDriverConfig(ctx, newTestCsiDriverConfig("csi-nfs", "other.csi.k8s.io")); !errors.Is(err, store.ErrAlreadyExists) { + t.Errorf("duplicate name = %v, want ErrAlreadyExists", err) + } + if _, err := s.CreateCsiDriverConfig(ctx, newTestCsiDriverConfig("csi-nfs-2", "nfs.csi.k8s.io")); !errors.Is(err, store.ErrAlreadyExists) { + t.Errorf("duplicate driver_name = %v, want ErrAlreadyExists", err) + } + }) + + t.Run("ListCsiDriverConfigs_PaginationAndTokens", func(t *testing.T) { + s := setup(t) + ctx := context.Background() + + if empty, err := s.ListCsiDriverConfigs(ctx, store.ListOptions{PageSize: 1000}); err != nil || len(empty.Items) != 0 || empty.NextPageToken != "" { + t.Fatalf("empty ListCsiDriverConfigs = (%v, %q, %v); want empty", empty.Items, empty.NextPageToken, err) + } + for _, idx := range []int{3, 1, 4, 0, 2} { + if _, err := s.CreateCsiDriverConfig(ctx, newTestCsiDriverConfig(fmt.Sprintf("cfg-%d", idx), fmt.Sprintf("d%d.csi.k8s.io", idx))); err != nil { + t.Fatalf("CreateCsiDriverConfig(cfg-%d) failed: %v", idx, err) + } + } + + var got []string + for pageToken := ""; ; { + page, err := s.ListCsiDriverConfigs(ctx, store.ListOptions{PageSize: 2, PageToken: pageToken}) + if err != nil { + t.Fatalf("ListCsiDriverConfigs failed: %v", err) + } + for _, cfg := range page.Items { + got = append(got, cfg.GetMetadata().GetName()) + } + if page.NextPageToken == "" { + break + } + pageToken = page.NextPageToken + } + if diff := cmp.Diff([]string{"cfg-0", "cfg-1", "cfg-2", "cfg-3", "cfg-4"}, got); diff != "" { + t.Errorf("paged config names mismatch (-want +got):\n%s", diff) + } + + mustCreateAtespace(t, s, "team-a") + mustCreateAtespace(t, s, "team-b") + atespacePage, err := s.ListAtespaces(ctx, store.ListOptions{PageSize: 1}) + if err != nil || atespacePage.NextPageToken == "" { + t.Fatalf("ListAtespaces page 1 = (%q, %v); want next page token", atespacePage.NextPageToken, err) + } + if _, err := s.ListCsiDriverConfigs(ctx, store.ListOptions{PageSize: 1, PageToken: atespacePage.NextPageToken}); !errors.Is(err, store.ErrInvalidPageToken) { + t.Errorf("cross-resource page token = %v, want ErrInvalidPageToken", err) + } + }) + + t.Run("UpdateCsiDriverConfig", func(t *testing.T) { + s := setup(t) + ctx := context.Background() + noop := func(*ateapi.CsiDriverConfig) error { return nil } + + if _, err := s.UpdateCsiDriverConfig(ctx, "nope", store.Precondition{UID: foreignUID, Version: 1}, noop); !errors.Is(err, store.ErrNotFound) { + t.Errorf("UpdateCsiDriverConfig(missing) = %v, want ErrNotFound", err) + } + created, err := s.CreateCsiDriverConfig(ctx, newTestCsiDriverConfig("csi-nfs", "nfs.csi.k8s.io")) + if err != nil { + t.Fatalf("CreateCsiDriverConfig failed: %v", err) + } + + for _, pre := range []store.Precondition{{}, {UID: created.GetMetadata().GetUid()}, {Version: created.GetMetadata().GetVersion()}} { + if _, err := s.UpdateCsiDriverConfig(ctx, "csi-nfs", pre, noop); !errors.Is(err, store.ErrPreconditionRequired) { + t.Errorf("UpdateCsiDriverConfig(%+v) = %v, want ErrPreconditionRequired", pre, err) + } + } + if _, err := s.UpdateCsiDriverConfig(ctx, "csi-nfs", store.Precondition{UID: foreignUID, Version: 1}, noop); !errors.Is(err, store.ErrUIDConflict) { + t.Errorf("wrong uid = %v, want ErrUIDConflict", err) + } + if _, err := s.UpdateCsiDriverConfig(ctx, "csi-nfs", store.Precondition{UID: created.GetMetadata().GetUid(), Version: 99}, noop); !errors.Is(err, store.ErrVersionConflict) { + t.Errorf("wrong version = %v, want ErrVersionConflict", err) + } + + abortErr := errors.New("abort") + if _, err := s.UpdateCsiDriverConfig(ctx, "csi-nfs", store.PreconditionFrom(created), func(cfg *ateapi.CsiDriverConfig) error { + cfg.ControllerEndpoint = "tcp://10.0.0.9:9999" + return abortErr + }); !errors.Is(err, abortErr) { + t.Errorf("mutate error = %v, want %v", err, abortErr) + } + + for _, fn := range []func(*ateapi.CsiDriverConfig){ + func(cfg *ateapi.CsiDriverConfig) { cfg.DriverName = "other.csi.k8s.io" }, + func(cfg *ateapi.CsiDriverConfig) { cfg.Metadata.Name = "other" }, + func(cfg *ateapi.CsiDriverConfig) { cfg.Metadata.Atespace = "team-a" }, + } { + if _, err := s.UpdateCsiDriverConfig(ctx, "csi-nfs", store.PreconditionFrom(created), func(cfg *ateapi.CsiDriverConfig) error { + fn(cfg) + return nil + }); !errors.Is(err, store.ErrImmutableField) { + t.Errorf("immutable field mutation = %v, want ErrImmutableField", err) + } + } + + updated, err := s.UpdateCsiDriverConfig(ctx, "csi-nfs", store.PreconditionFrom(created), func(cfg *ateapi.CsiDriverConfig) error { + cfg.ControllerEndpoint = "tcp://10.0.0.2:9000" + cfg.NodeSocketOverride = "unix:///run/csi/nfs.sock" + cfg.Tls = &ateapi.CsiDriverTlsConfig{Enabled: false} + cfg.Metadata.UpdateTime = timestamppb.New(time.Unix(1, 0)) + return nil + }) + if err != nil { + t.Fatalf("UpdateCsiDriverConfig failed: %v", err) + } + if updated.GetMetadata().GetVersion() != 2 || updated.GetMetadata().GetUid() != created.GetMetadata().GetUid() || + !updated.GetMetadata().GetCreateTime().AsTime().Equal(created.GetMetadata().GetCreateTime().AsTime()) || + updated.GetMetadata().GetUpdateTime().AsTime().Before(created.GetMetadata().GetUpdateTime().AsTime()) { + t.Errorf("updated metadata = %v, created = %v", updated.GetMetadata(), created.GetMetadata()) + } + got, err := s.GetCsiDriverConfig(ctx, "csi-nfs") + if err != nil { + t.Fatalf("GetCsiDriverConfig after update failed: %v", err) + } + if diff := cmp.Diff(updated, got, protocmp.Transform()); diff != "" { + t.Errorf("stored config after update mismatch (-updated +got):\n%s", diff) + } + if got.GetControllerEndpoint() != "tcp://10.0.0.2:9000" || got.GetNodeSocketOverride() != "unix:///run/csi/nfs.sock" || got.GetTls().GetEnabled() { + t.Errorf("updated fields did not persist: %v", got) + } + }) + + t.Run("DeleteCsiDriverConfig_PreconditionsAndInUse", func(t *testing.T) { + s := setup(t) + ctx := context.Background() + + for _, pre := range []store.DeletePreconditions{{}, {UID: foreignUID, Version: 1}} { + if _, err := s.DeleteCsiDriverConfig(ctx, "csi-nfs", pre); !errors.Is(err, store.ErrNotFound) { + t.Errorf("DeleteCsiDriverConfig(missing, %+v) = %v, want ErrNotFound", pre, err) + } + } + + created, err := s.CreateCsiDriverConfig(ctx, newTestCsiDriverConfig("csi-nfs", "nfs.csi.k8s.io")) + if err != nil { + t.Fatalf("CreateCsiDriverConfig failed: %v", err) + } + uid, version := created.GetMetadata().GetUid(), created.GetMetadata().GetVersion() + if _, err := s.DeleteCsiDriverConfig(ctx, "csi-nfs", store.DeletePreconditions{UID: uid, Version: version + 1}); !errors.Is(err, store.ErrVersionConflict) { + t.Errorf("stale version = %v, want ErrVersionConflict", err) + } + if _, err := s.DeleteCsiDriverConfig(ctx, "csi-nfs", store.DeletePreconditions{UID: foreignUID, Version: version}); !errors.Is(err, store.ErrUIDConflict) { + t.Errorf("foreign uid = %v, want ErrUIDConflict", err) + } + + otherClass := newTestExternalVolumeClass("other") + otherClass.DriverName = "other.csi.k8s.io" + if _, err := s.CreateExternalVolumeClass(ctx, otherClass); err != nil { + t.Fatalf("CreateExternalVolumeClass(other) failed: %v", err) + } + if _, err := s.CreateExternalVolumeClass(ctx, newTestExternalVolumeClass("nfs")); err != nil { + t.Fatalf("CreateExternalVolumeClass(nfs) failed: %v", err) + } + if _, err := s.DeleteCsiDriverConfig(ctx, "csi-nfs", store.DeletePreconditions{}); !errors.Is(err, store.ErrFailedPrecondition) { + t.Fatalf("DeleteCsiDriverConfig while in use = %v, want ErrFailedPrecondition", err) + } + if _, err := s.GetCsiDriverConfig(ctx, "csi-nfs"); err != nil { + t.Fatalf("refused delete removed config: %v", err) + } + + if _, err := s.DeleteExternalVolumeClass(ctx, "nfs", store.DeletePreconditions{}); err != nil { + t.Fatalf("DeleteExternalVolumeClass failed: %v", err) + } + deleted, err := s.DeleteCsiDriverConfig(ctx, "csi-nfs", store.DeletePreconditions{UID: uid, Version: version}) + if err != nil { + t.Fatalf("DeleteCsiDriverConfig after class removal failed: %v", err) + } + if deleted.GetMetadata().GetDeleteTime() == nil { + t.Error("deleted config carries no delete_time") + } + if diff := cmp.Diff(created, deleted, protocmp.Transform(), ignoreTimestamps); diff != "" { + t.Errorf("DeleteCsiDriverConfig mismatch (-created +deleted):\n%s", diff) + } + if _, err := s.GetCsiDriverConfig(ctx, "csi-nfs"); !errors.Is(err, store.ErrNotFound) { + t.Errorf("GetCsiDriverConfig after delete = %v, want ErrNotFound", err) + } + if _, err := s.GetCsiDriverConfigByDriverName(ctx, "nfs.csi.k8s.io"); !errors.Is(err, store.ErrNotFound) { + t.Errorf("GetCsiDriverConfigByDriverName after delete = %v, want ErrNotFound", err) + } + if _, err := s.CreateCsiDriverConfig(ctx, newTestCsiDriverConfig("csi-nfs-2", "nfs.csi.k8s.io")); err != nil { + t.Errorf("reusing driver_name after delete failed: %v", err) + } + }) +} + func runLeaseContractTests(t *testing.T, setup func(t *testing.T) store.Interface) { t.Helper() @@ -3760,6 +4154,75 @@ func runUnknownFieldContractTests(t *testing.T, setup func(t *testing.T) store.I assertPruned(t, "DeleteAtespace", created, deleted) }) + t.Run("UnknownFields_ExternalVolumeClass", func(t *testing.T) { + s := setup(t) + ctx := context.Background() + class := withUnknownField(newTestExternalVolumeClass("nfs")) + withUnknownField(class.Metadata) + created, err := s.CreateExternalVolumeClass(ctx, class) + if err != nil { + t.Fatalf("CreateExternalVolumeClass failed: %v", err) + } + + got, err := s.GetExternalVolumeClass(ctx, "nfs") + if err != nil { + t.Fatalf("GetExternalVolumeClass failed: %v", err) + } + assertPruned(t, "GetExternalVolumeClass", created, got) + + list, err := s.ListExternalVolumeClasses(ctx, store.ListOptions{}) + if err != nil || len(list.Items) != 1 { + t.Fatalf("ListExternalVolumeClasses = %d items, %v; want 1", len(list.Items), err) + } + assertPruned(t, "ListExternalVolumeClasses", created, list.Items[0]) + + deleted, err := s.DeleteExternalVolumeClass(ctx, "nfs", store.DeletePreconditions{}) + if err != nil { + t.Fatalf("DeleteExternalVolumeClass failed: %v", err) + } + assertPruned(t, "DeleteExternalVolumeClass", created, deleted) + }) + + t.Run("UnknownFields_CsiDriverConfig", func(t *testing.T) { + s := setup(t) + ctx := context.Background() + cfg := withUnknownField(newTestCsiDriverConfig("csi-nfs", "nfs.csi.k8s.io")) + withUnknownField(cfg.Metadata) + withUnknownField(cfg.Tls) + created, err := s.CreateCsiDriverConfig(ctx, cfg) + if err != nil { + t.Fatalf("CreateCsiDriverConfig failed: %v", err) + } + got, err := s.GetCsiDriverConfig(ctx, "csi-nfs") + if err != nil { + t.Fatalf("GetCsiDriverConfig failed: %v", err) + } + assertPruned(t, "GetCsiDriverConfig", created, got) + byDriver, err := s.GetCsiDriverConfigByDriverName(ctx, "nfs.csi.k8s.io") + if err != nil { + t.Fatalf("GetCsiDriverConfigByDriverName failed: %v", err) + } + assertPruned(t, "GetCsiDriverConfigByDriverName", created, byDriver) + list, err := s.ListCsiDriverConfigs(ctx, store.ListOptions{}) + if err != nil || len(list.Items) != 1 { + t.Fatalf("ListCsiDriverConfigs = %d items, %v; want 1", len(list.Items), err) + } + assertPruned(t, "ListCsiDriverConfigs", created, list.Items[0]) + updated, err := s.UpdateCsiDriverConfig(ctx, "csi-nfs", store.PreconditionFrom(got), func(toUpdate *ateapi.CsiDriverConfig) error { + requireNoUnknownFields(t, "UpdateCsiDriverConfig mutation input", toUpdate) + return nil + }) + if err != nil { + t.Fatalf("UpdateCsiDriverConfig failed: %v", err) + } + assertPruned(t, "UpdateCsiDriverConfig", created, updated) + deleted, err := s.DeleteCsiDriverConfig(ctx, "csi-nfs", store.DeletePreconditions{}) + if err != nil { + t.Fatalf("DeleteCsiDriverConfig failed: %v", err) + } + assertPruned(t, "DeleteCsiDriverConfig", created, deleted) + }) + t.Run("UnknownFields_ActorTemplate", func(t *testing.T) { s := setup(t) ctx := context.Background() diff --git a/cmd/atelet/main.go b/cmd/atelet/main.go index 42d1e4d75b..104dd30f3c 100644 --- a/cmd/atelet/main.go +++ b/cmd/atelet/main.go @@ -21,11 +21,14 @@ import ( "errors" "fmt" "log/slog" + "maps" "net" "os" "os/signal" "path/filepath" + "slices" "strconv" + "strings" "sync" "syscall" "time" @@ -85,6 +88,7 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/reflection" "google.golang.org/grpc/status" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" k8sruntime "k8s.io/apimachinery/pkg/runtime" @@ -343,8 +347,6 @@ func main() { } } - csiDriverConfigGetter := &directCSIDriverConfigGetter{client: ateClient} - trustBundles, err := clustertrustbundle.NewClient(k8sClient, func(o *metav1.ListOptions) { o.FieldSelector = fields.OneTermEqualSelector("metadata.name", trustbundle.EgressCTB).String() }) @@ -400,6 +402,11 @@ func main() { } defer ateapiConn.Close() workerService := ateapi.NewWorkerServiceClient(ateapiConn) + controlService := ateapi.NewControlClient(ateapiConn) + csiDriverConfigGetter := &ateapiCSIDriverConfigGetter{ + control: controlService, + fallback: &directCSIDriverConfigGetter{client: ateClient}, + } // The snapshot tracker's workers get a context of their own, cancelled only // once the gRPC server has drained, so background snapshot work keeps @@ -541,7 +548,7 @@ func main() { ateletpb.RegisterWorkerSupportServer(workerFacingSrv, &workerSupportServer{ workers: workerService, - control: ateapi.NewControlClient(ateapiConn), + control: controlService, }) go func() { if err := workerFacingSrv.Serve(workerFacingLis); err != nil { @@ -706,13 +713,97 @@ func drainOnShutdown(ctx context.Context, srv *grpc.Server, readiness *serverboo return done } +type csiDriverConfigListClient interface { + ListCsiDriverConfigs(ctx context.Context, in *ateapi.ListCsiDriverConfigsRequest, opts ...grpc.CallOption) (*ateapi.ListCsiDriverConfigsResponse, error) +} + +// ateapiCSIDriverConfigGetter resolves CsiDriverConfig from ate-api-server first +// and falls back to the Kubernetes CSIDriverConfig CRD. +type ateapiCSIDriverConfigGetter struct { + control csiDriverConfigListClient + fallback csi.CSIDriverConfigGetter +} + +func (g *ateapiCSIDriverConfigGetter) Get(ctx context.Context, driverName string) (*ateapi.CsiDriverConfig, error) { + if g.control == nil { + if g.fallback != nil { + return g.fallback.Get(ctx, driverName) + } + return nil, errors.New("missing csiDriverConfigGetter") + } + for pageToken := ""; ; { + resp, err := g.control.ListCsiDriverConfigs(ctx, &ateapi.ListCsiDriverConfigsRequest{ + Options: &ateapi.ListOptions{PageSize: 1000, PageToken: pageToken}, + }) + if err != nil { + switch status.Code(err) { + case codes.Unimplemented: + if g.fallback != nil { + return g.fallback.Get(ctx, driverName) + } + case codes.Unavailable: + return nil, apierror.Unavailable("while listing CsiDriverConfigs from ate-api-server: %w", err) + case codes.Canceled, codes.DeadlineExceeded: + if ctxErr := ctx.Err(); ctxErr != nil { + return nil, fmt.Errorf("while listing CsiDriverConfigs from ate-api-server: %w", ctxErr) + } + return nil, apierror.Unavailable("while listing CsiDriverConfigs from ate-api-server: %w", err) + } + return nil, fmt.Errorf("while listing CsiDriverConfigs from ate-api-server: %w", err) + } + for _, cfg := range resp.GetCsiDriverConfigs() { + if cfg.GetDriverName() == driverName { + return cfg, nil + } + } + if pageToken = resp.GetNextPageToken(); pageToken == "" { + break + } + } + if g.fallback != nil { + return g.fallback.Get(ctx, driverName) + } + return nil, status.Errorf(codes.NotFound, "CsiDriverConfig for driver %q not found", driverName) +} + // directCSIDriverConfigGetter retrieves CSIDriverConfig via direct API call rather than a cluster-wide watch informer. type directCSIDriverConfigGetter struct { client versioned.Interface } -func (g *directCSIDriverConfigGetter) Get(name string) (*atev1.CSIDriverConfig, error) { - return g.client.AteV1().CSIDriverConfigs().Get(context.Background(), name, metav1.GetOptions{}) +func (g *directCSIDriverConfigGetter) Get(ctx context.Context, name string) (*ateapi.CsiDriverConfig, error) { + crd, err := g.client.AteV1().CSIDriverConfigs().Get(ctx, name, metav1.GetOptions{}) + if err != nil && !apierrors.IsNotFound(err) { + return nil, err + } + if err == nil && crd != nil && (crd.Spec.DriverName == "" || crd.Spec.DriverName == name) { + return csi.FromK8sCSIDriverConfig(crd), nil + } + if apierrors.IsNotFound(err) || (err == nil && crd != nil && crd.Spec.DriverName != "" && crd.Spec.DriverName != name) { + list, listErr := g.client.AteV1().CSIDriverConfigs().List(ctx, metav1.ListOptions{}) + if listErr != nil { + return nil, listErr + } + var matched *atev1.CSIDriverConfig + var matchedNames []string + for i := range list.Items { + if list.Items[i].Spec.DriverName == name { + matched = &list.Items[i] + matchedNames = append(matchedNames, list.Items[i].Name) + } + } + if len(matchedNames) > 1 { + slices.Sort(matchedNames) + return nil, fmt.Errorf("multiple CSIDriverConfigs match driver %q: %s", name, strings.Join(matchedNames, ", ")) + } + if matched != nil { + return csi.FromK8sCSIDriverConfig(matched), nil + } + } + if err != nil { + return nil, err + } + return nil, apierrors.NewNotFound(atev1.Resource("csidriverconfigs"), name) } // Atelet is a service that allows controlling workloads on individual @@ -751,7 +842,9 @@ type Atelet struct { instruments *Instruments mu sync.RWMutex volumePlugins map[string]volume.VolumePluginWorkerPlane + csiPlugins map[string]csiNodePluginSlot csiDriverConfigGetter csi.CSIDriverConfigGetter + clock clock.PassiveClock systemInfoVolumes *systemInfoVolumeRefresher // snapshots tracks each actor's snapshots on this node. @@ -821,8 +914,9 @@ func NewService( pluginSocket: pluginSocket, snapshotScratchDir: ateletpath.SnapshotScratchDir, instruments: instruments, - volumePlugins: volumePlugins, + volumePlugins: maps.Clone(volumePlugins), csiDriverConfigGetter: csiDriverConfigGetter, + clock: clock.RealClock{}, systemInfoVolumes: systemInfoVolumes, snapshots: snapshots, workerActorJWTs: newWorkerActorJWTs(workers), diff --git a/cmd/atelet/volumes.go b/cmd/atelet/volumes.go index eb34d769e8..7912d04d82 100644 --- a/cmd/atelet/volumes.go +++ b/cmd/atelet/volumes.go @@ -20,16 +20,44 @@ import ( "fmt" "log/slog" "os" + "time" "go.ate.dev/substrate/cmd/atelet/internal/ateletpath" + "go.ate.dev/substrate/internal/apierror" "go.ate.dev/substrate/internal/proto/ateletpb" "go.ate.dev/substrate/internal/volume" "go.ate.dev/substrate/internal/volume/csi" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + apierrors "k8s.io/apimachinery/pkg/api/errors" ) +const defaultCSIPluginConfigTTL = 30 * time.Second + +func wrapPluginError(err error, format string, args ...any) error { + if apierror.Code(err) == codes.Unavailable { + return apierror.Unavailable(format, args...) + } + return fmt.Errorf(format, args...) +} + func (s *Atelet) mountExternalVolumes(ctx context.Context, actorUID string, volumes []*ateletpb.Volume) error { + plugins := make(map[string]volume.VolumePluginWorkerPlane, len(volumes)) + for _, vol := range volumes { + ext := vol.GetExternal() + if ext == nil { + continue + } + driverName := ext.GetVolumeType() + if _, ok := plugins[driverName]; ok { + continue + } + plugin, err := s.getPlugin(ctx, driverName) + if err != nil { + return wrapPluginError(err, "failed to get volume plugin for %q: %w", driverName, err) + } + plugins[driverName] = plugin + } for _, vol := range volumes { // Given that external volumes has been in the codebase for a while and // its preview-ness is solely around the API, and that the impact of @@ -45,11 +73,7 @@ func (s *Atelet) mountExternalVolumes(ctx context.Context, actorUID string, volu return fmt.Errorf("failed to create mount point %q: %w", hostPath, err) } slog.InfoContext(ctx, "Mounting volume", slog.String("volume_id", ext.GetStorageVolumeId()), slog.String("host_path", hostPath), slog.String("volume_type", ext.GetVolumeType())) - plugin, err := s.getPlugin(ctx, ext.GetVolumeType()) - if err != nil { - return fmt.Errorf("failed to get volume plugin for %q: %w", ext.GetVolumeType(), err) - } - if err := plugin.MountVolume(ctx, volume.MountVolumeRequest{ + if err := plugins[ext.GetVolumeType()].MountVolume(ctx, volume.MountVolumeRequest{ VolumeID: ext.GetStorageVolumeId(), TargetPath: hostPath, VolumeContext: ext.GetVolumeContext(), @@ -79,7 +103,7 @@ func (s *Atelet) unmountExternalVolumes(ctx context.Context, actorUID string, vo // and worker plane (e.g. via a shared helper). plugin, err := s.getPlugin(ctx, ext.GetVolumeType()) if err != nil { - errs = append(errs, fmt.Errorf("failed to get volume plugin for %q (volume %q): %w", ext.GetVolumeType(), ext.GetStorageVolumeId(), err)) + errs = append(errs, wrapPluginError(err, "failed to get volume plugin for %q (volume %q): %w", ext.GetVolumeType(), ext.GetStorageVolumeId(), err)) continue } if err := plugin.UnmountVolume(ctx, ext.GetStorageVolumeId(), hostPath); err != nil { @@ -90,24 +114,166 @@ func (s *Atelet) unmountExternalVolumes(ctx context.Context, actorUID string, vo } } } - return errors.Join(errs...) + if len(errs) == 0 { + return nil + } + var hasUnavailable, hasFatal bool + for _, err := range errs { + switch apierror.Code(err) { + case codes.Unavailable: + hasUnavailable = true + case codes.Canceled, codes.DeadlineExceeded: + default: + hasFatal = true + } + } + if hasFatal { + return apierror.Internal("%w", errors.Join(errs...)) + } + if ctxErr := ctx.Err(); ctxErr != nil { + return fmt.Errorf("%v: %w", errors.Join(errs...), ctxErr) + } + if !hasUnavailable { + return errors.Join(errs...) + } + return apierror.Unavailable("%w", errors.Join(errs...)) } -func (s *Atelet) getPlugin(ctx context.Context, driverName string) (volume.VolumePluginWorkerPlane, error) { - s.mu.RLock() - plugin, ok := s.volumePlugins[driverName] - s.mu.RUnlock() - if ok { - return plugin, nil +type csiNodePluginSlot struct { + gen uint64 + inflight int + checkedAt time.Time + nodeSocketOverride string + plugin *csi.Plugin +} + +func (s *Atelet) now() time.Time { + if s.clock != nil { + return s.clock.Now() + } + return time.Now() +} + +func (s *Atelet) evictNodeSlotLocked(driverName string, cur csiNodePluginSlot) (*csi.Plugin, uint64) { + evicted := cur.plugin + cur.plugin, cur.nodeSocketOverride, cur.checkedAt = nil, "", time.Time{} + cur.gen++ + s.csiPlugins[driverName] = cur + return evicted, cur.gen +} + +func (s *Atelet) getPluginOnce(ctx context.Context, driverName string) (volume.VolumePluginWorkerPlane, bool, error) { + if err := ctx.Err(); err != nil { + return nil, false, err + } + s.mu.Lock() + if s.csiPlugins == nil { + s.csiPlugins = make(map[string]csiNodePluginSlot) + } + slot := s.csiPlugins[driverName] + slot.inflight++ + startGen := slot.gen + s.csiPlugins[driverName] = slot + s.mu.Unlock() + defer func() { + s.mu.Lock() + cur := s.csiPlugins[driverName] + cur.inflight-- + if cur.plugin == nil && cur.inflight == 0 { + delete(s.csiPlugins, driverName) + } else { + s.csiPlugins[driverName] = cur + } + s.mu.Unlock() + }() + + cfg, err := s.csiDriverConfigGetter.Get(ctx, driverName) + if err != nil { + evictOnErr := apierrors.IsNotFound(err) || status.Code(err) == codes.NotFound + retErr := wrapPluginError(err, "failed to retrieve CsiDriverConfig for %q: %w", driverName, err) + if !evictOnErr { + return nil, false, retErr + } + s.mu.Lock() + cur := s.csiPlugins[driverName] + if cur.gen != startGen { + retry := cur.plugin != nil + s.mu.Unlock() + return nil, retry, retErr + } + evicted, _ := s.evictNodeSlotLocked(driverName, cur) + s.mu.Unlock() + _ = evicted.Close() + return nil, false, retErr + } + if cfg == nil { + return nil, false, fmt.Errorf("missing CsiDriverConfig for %q", driverName) + } + + socketOverride := cfg.GetNodeSocketOverride() + s.mu.Lock() + cur := s.csiPlugins[driverName] + if cur.plugin != nil && cur.nodeSocketOverride == socketOverride { + cur.checkedAt = s.now() + s.csiPlugins[driverName] = cur + s.mu.Unlock() + return cur.plugin, false, nil + } + if cur.gen != startGen { + s.mu.Unlock() + return nil, true, nil } + var preEvicted *csi.Plugin + if cur.plugin != nil { + preEvicted, startGen = s.evictNodeSlotLocked(driverName, cur) + } + s.mu.Unlock() + _ = preEvicted.Close() - csiPlugin, err := csi.NewCSIPlugin(ctx, s.csiDriverConfigGetter, driverName, false /*isController*/) + csiPlugin, err := csi.NewCSIPluginFromConfig(ctx, cfg, driverName, false /*isController*/) if err != nil { - return nil, err + return nil, false, err } s.mu.Lock() - s.volumePlugins[driverName] = csiPlugin + cur = s.csiPlugins[driverName] + if cur.plugin != nil && cur.nodeSocketOverride == socketOverride { + matched := cur.plugin + s.mu.Unlock() + _ = csiPlugin.Close() + return matched, false, nil + } + if cur.gen != startGen { + s.mu.Unlock() + _ = csiPlugin.Close() + return nil, true, nil + } + cur.plugin, cur.nodeSocketOverride, cur.checkedAt = csiPlugin, socketOverride, s.now() + cur.gen++ + s.csiPlugins[driverName] = cur s.mu.Unlock() - return csiPlugin, nil + return csiPlugin, false, nil +} + +func (s *Atelet) getPlugin(ctx context.Context, driverName string) (volume.VolumePluginWorkerPlane, error) { + s.mu.RLock() + if plugin, ok := s.volumePlugins[driverName]; ok { + s.mu.RUnlock() + return plugin, nil + } + if slot, ok := s.csiPlugins[driverName]; ok && slot.plugin != nil && !slot.checkedAt.IsZero() && s.now().Sub(slot.checkedAt) < defaultCSIPluginConfigTTL { + plugin := slot.plugin + s.mu.RUnlock() + return plugin, nil + } + s.mu.RUnlock() + if s.csiDriverConfigGetter == nil { + return nil, errors.New("missing csiDriverConfigGetter") + } + for { + plugin, retry, err := s.getPluginOnce(ctx, driverName) + if !retry { + return plugin, err + } + } } diff --git a/cmd/atelet/volumes_test.go b/cmd/atelet/volumes_test.go index 060be7e3ad..919f2d7d47 100644 --- a/cmd/atelet/volumes_test.go +++ b/cmd/atelet/volumes_test.go @@ -18,19 +18,35 @@ import ( "context" "errors" "fmt" + "maps" + "net" "os" "path/filepath" "strings" + "sync" + "sync/atomic" "testing" + "time" + csipb "github.com/container-storage-interface/spec/lib/go/csi" "github.com/google/go-cmp/cmp" + "go.ate.dev/substrate/api/ateapi/v1" atev1 "go.ate.dev/substrate/api/infra/k8s/ate/v1" "go.ate.dev/substrate/cmd/atelet/internal/actordirs" "go.ate.dev/substrate/cmd/atelet/internal/ateletpath" + "go.ate.dev/substrate/internal/apierror" "go.ate.dev/substrate/internal/proto/ateletpb" "go.ate.dev/substrate/internal/volume" + "go.ate.dev/substrate/internal/volume/csi" "go.ate.dev/substrate/pkg/client/clientset/versioned/fake" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + k8stesting "k8s.io/client-go/testing" + clocktesting "k8s.io/utils/clock/testing" ) type mountCall struct { @@ -514,30 +530,495 @@ func TestVolumeHostDirectoryCleanup(t *testing.T) { } func TestDirectCSIDriverConfigGetter(t *testing.T) { - fakeClient := fake.NewSimpleClientset(&atev1.CSIDriverConfig{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test.csi.k8s.io", + fakeClient := fake.NewSimpleClientset( + &atev1.CSIDriverConfig{ + ObjectMeta: metav1.ObjectMeta{Name: "test.csi.k8s.io"}, + Spec: atev1.CSIDriverConfigSpec{DriverName: "test.csi.k8s.io", ControllerEndpoint: "tcp://127.0.0.1:9000"}, }, - Spec: atev1.CSIDriverConfigSpec{ - DriverName: "test.csi.k8s.io", - ControllerEndpoint: "tcp://127.0.0.1:9000", + &atev1.CSIDriverConfig{ + ObjectMeta: metav1.ObjectMeta{Name: "custom-nfs-config"}, + Spec: atev1.CSIDriverConfigSpec{DriverName: "nfs.csi.k8s.io", ControllerEndpoint: "tcp://127.0.0.1:9001", NodeSocketOverride: "unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock"}, }, + &atev1.CSIDriverConfig{ + ObjectMeta: metav1.ObjectMeta{Name: "dup-b"}, + Spec: atev1.CSIDriverConfigSpec{DriverName: "dup.csi.k8s.io", ControllerEndpoint: "tcp://127.0.0.1:9002"}, + }, + &atev1.CSIDriverConfig{ + ObjectMeta: metav1.ObjectMeta{Name: "dup-a"}, + Spec: atev1.CSIDriverConfigSpec{DriverName: "dup.csi.k8s.io", ControllerEndpoint: "tcp://127.0.0.1:9003"}, + }, + ) + getter := &directCSIDriverConfigGetter{client: fakeClient} + ctx := t.Context() + + cfg, err := getter.Get(ctx, "test.csi.k8s.io") + if err != nil || cfg.GetDriverName() != "test.csi.k8s.io" { + t.Fatalf("Get(test.csi.k8s.io) = (%v, %v)", cfg, err) + } + + nfsCfg, err := getter.Get(ctx, "nfs.csi.k8s.io") + if err != nil || nfsCfg.GetMetadata().GetName() != "custom-nfs-config" || nfsCfg.GetDriverName() != "nfs.csi.k8s.io" { + t.Fatalf("Get(nfs.csi.k8s.io) = (%v, %v)", nfsCfg, err) + } + if nfsCfg.GetNodeSocketOverride() != "unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock" { + t.Errorf("got NodeSocketOverride %q", nfsCfg.GetNodeSocketOverride()) + } + + if _, err := getter.Get(ctx, "dup.csi.k8s.io"); err == nil || !strings.Contains(err.Error(), `multiple CSIDriverConfigs match driver "dup.csi.k8s.io": dup-a, dup-b`) { + t.Fatalf("Get(dup.csi.k8s.io) error = %v, want deterministic duplicate error", err) + } + + if _, err := getter.Get(ctx, "missing.csi.k8s.io"); err == nil { + t.Fatal("expected error for missing driver, got nil") + } + + listBoom := errors.New("apiserver list unavailable") + fakeClient.PrependReactor("list", "csidriverconfigs", func(k8stesting.Action) (bool, runtime.Object, error) { + return true, nil, listBoom }) + if _, err := getter.Get(ctx, "nfs.csi.k8s.io"); !errors.Is(err, listBoom) { + t.Fatalf("Get with failing List = %v, want %v", err, listBoom) + } - getter := &directCSIDriverConfigGetter{client: fakeClient} + getBoom := errors.New("apiserver get forbidden") + listCalled := false + fakeClient.PrependReactor("list", "csidriverconfigs", func(k8stesting.Action) (bool, runtime.Object, error) { + listCalled = true + return true, nil, listBoom + }) + fakeClient.PrependReactor("get", "csidriverconfigs", func(k8stesting.Action) (bool, runtime.Object, error) { + return true, nil, getBoom + }) + if _, err := getter.Get(ctx, "nfs.csi.k8s.io"); !errors.Is(err, getBoom) || listCalled { + t.Fatalf("Get with non-NotFound error = %v (listCalled=%t), want %v without List", err, listCalled, getBoom) + } +} + +type fakeCsiDriverConfigListClient struct { + mu sync.Mutex + pages map[string]*ateapi.ListCsiDriverConfigsResponse + err error +} + +func (f *fakeCsiDriverConfigListClient) ListCsiDriverConfigs(_ context.Context, req *ateapi.ListCsiDriverConfigsRequest, _ ...grpc.CallOption) (*ateapi.ListCsiDriverConfigsResponse, error) { + f.mu.Lock() + defer f.mu.Unlock() + if f.err != nil { + return nil, f.err + } + if resp, ok := f.pages[req.GetOptions().GetPageToken()]; ok { + return resp, nil + } + return &ateapi.ListCsiDriverConfigsResponse{}, nil +} + +func (f *fakeCsiDriverConfigListClient) setSingle(cfg *ateapi.CsiDriverConfig, err error) { + f.mu.Lock() + defer f.mu.Unlock() + f.err, f.pages = err, nil + if cfg != nil { + f.pages = map[string]*ateapi.ListCsiDriverConfigsResponse{"": {CsiDriverConfigs: []*ateapi.CsiDriverConfig{cfg}}} + } +} + +type spyCSIGetter struct { + inner csi.CSIDriverConfigGetter + calls atomic.Int32 +} + +func (s *spyCSIGetter) Get(ctx context.Context, driverName string) (*ateapi.CsiDriverConfig, error) { + s.calls.Add(1) + return s.inner.Get(ctx, driverName) +} + +func TestAteapiCSIDriverConfigGetter(t *testing.T) { + t.Parallel() + ctx := t.Context() + crdClient := fake.NewSimpleClientset( + &atev1.CSIDriverConfig{ObjectMeta: metav1.ObjectMeta{Name: "crd-nfs"}, Spec: atev1.CSIDriverConfigSpec{DriverName: "nfs.csi.k8s.io", NodeSocketOverride: "unix:///crd-nfs.sock"}}, + &atev1.CSIDriverConfig{ObjectMeta: metav1.ObjectMeta{Name: "crd-pd"}, Spec: atev1.CSIDriverConfigSpec{DriverName: "pd.csi.storage.gke.io", NodeSocketOverride: "unix:///crd-pd.sock"}}, + ) + crdFallback := &directCSIDriverConfigGetter{client: crdClient} + control := &fakeCsiDriverConfigListClient{pages: map[string]*ateapi.ListCsiDriverConfigsResponse{ + "": {CsiDriverConfigs: []*ateapi.CsiDriverConfig{{Metadata: &ateapi.ResourceMetadata{Name: "other"}, DriverName: "other.csi.io"}}, NextPageToken: "p2"}, + "p2": {CsiDriverConfigs: []*ateapi.CsiDriverConfig{{Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, DriverName: "nfs.csi.k8s.io", NodeSocketOverride: "unix:///ateapi-nfs.sock"}}}, + }} + spy := &spyCSIGetter{inner: crdFallback} + getter := &ateapiCSIDriverConfigGetter{control: control, fallback: spy} + + if nfs, err := getter.Get(ctx, "nfs.csi.k8s.io"); err != nil || nfs.GetNodeSocketOverride() != "unix:///ateapi-nfs.sock" || spy.calls.Load() != 0 { + t.Fatalf("Get(nfs) = (%v, %v), fallbackCalls = %d", nfs, err, spy.calls.Load()) + } + if pd, err := getter.Get(ctx, "pd.csi.storage.gke.io"); err != nil || pd.GetNodeSocketOverride() != "unix:///crd-pd.sock" || spy.calls.Load() != 1 { + t.Fatalf("Get(pd) = (%v, %v), fallbackCalls = %d", pd, err, spy.calls.Load()) + } + if _, err := getter.Get(ctx, "missing.csi.io"); !apierrors.IsNotFound(err) { + t.Fatalf("Get(missing) error = %v, want apierrors.IsNotFound", err) + } + if _, err := (&ateapiCSIDriverConfigGetter{control: control}).Get(ctx, "missing.csi.io"); status.Code(err) != codes.NotFound { + t.Fatalf("Get(missing, nil fallback) code = %v, want NotFound", status.Code(err)) + } + + spy.calls.Store(0) + control.err = status.Error(codes.Unimplemented, "unknown method ListCsiDriverConfigs") + if got, err := getter.Get(ctx, "nfs.csi.k8s.io"); err != nil || got.GetNodeSocketOverride() != "unix:///crd-nfs.sock" || spy.calls.Load() != 1 { + t.Fatalf("Get(Unimplemented) = (%v, %v), fallbackCalls = %d", got, err, spy.calls.Load()) + } + if _, err := (&ateapiCSIDriverConfigGetter{control: control}).Get(ctx, "nfs.csi.k8s.io"); status.Code(err) != codes.Unimplemented { + t.Fatalf("Get(Unimplemented, nil fallback) = %v, want Unimplemented", err) + } + for _, tc := range []struct { + code codes.Code + wantCode codes.Code + }{ + {codes.Unavailable, codes.Unavailable}, + {codes.DeadlineExceeded, codes.Unavailable}, + {codes.Canceled, codes.Unavailable}, + {codes.PermissionDenied, codes.Internal}, + } { + spy.calls.Store(0) + control.err = status.Error(tc.code, "rpc failed") + if _, err := getter.Get(ctx, "nfs.csi.k8s.io"); apierror.Code(err) != tc.wantCode || spy.calls.Load() != 0 { + t.Fatalf("Get(%v) apierror.Code = %v (err=%v, fallbackCalls=%d), want %v without fallback", tc.code, apierror.Code(err), err, spy.calls.Load(), tc.wantCode) + } + } + canceledCtx, cancel := context.WithCancel(ctx) + cancel() + control.err = status.Error(codes.Canceled, "canceled") + if _, err := getter.Get(canceledCtx, "nfs.csi.k8s.io"); apierror.Code(err) != codes.Canceled { + t.Fatalf("Get(canceled ctx) apierror.Code = %v, want Canceled", apierror.Code(err)) + } + if got, err := (&ateapiCSIDriverConfigGetter{fallback: crdFallback}).Get(ctx, "pd.csi.storage.gke.io"); err != nil || got.GetDriverName() != "pd.csi.storage.gke.io" { + t.Fatalf("Get(nil control) = (%v, %v)", got, err) + } + if _, err := (&ateapiCSIDriverConfigGetter{}).Get(ctx, "pd.csi.storage.gke.io"); err == nil { + t.Fatal("Get(nil control, nil fallback) = nil, want error") + } +} - // Existing config - cfg, err := getter.Get("test.csi.k8s.io") +type testCSINodeServer struct { + csipb.UnimplementedIdentityServer + csipb.UnimplementedNodeServer + driverName string + publishes atomic.Int32 + onGetPlugin func() +} + +func (s *testCSINodeServer) GetPluginInfo(context.Context, *csipb.GetPluginInfoRequest) (*csipb.GetPluginInfoResponse, error) { + if s.onGetPlugin != nil { + s.onGetPlugin() + } + return &csipb.GetPluginInfoResponse{Name: s.driverName, VendorVersion: "v1.0.0"}, nil +} + +func (s *testCSINodeServer) NodeGetCapabilities(context.Context, *csipb.NodeGetCapabilitiesRequest) (*csipb.NodeGetCapabilitiesResponse, error) { + rpc := &csipb.NodeServiceCapability_Rpc{Rpc: &csipb.NodeServiceCapability_RPC{Type: csipb.NodeServiceCapability_RPC_GET_VOLUME_STATS}} + return &csipb.NodeGetCapabilitiesResponse{Capabilities: []*csipb.NodeServiceCapability{{Type: rpc}}}, nil +} + +func (s *testCSINodeServer) NodePublishVolume(context.Context, *csipb.NodePublishVolumeRequest) (*csipb.NodePublishVolumeResponse, error) { + s.publishes.Add(1) + return &csipb.NodePublishVolumeResponse{}, nil +} + +func startTestCSINodeSocket(t *testing.T, sockDir, file, driver string, onGetPlugin func()) (string, *testCSINodeServer) { + t.Helper() + sockPath := filepath.Join(sockDir, file) + lis, err := net.Listen("unix", sockPath) if err != nil { - t.Fatalf("getter.Get failed: %v", err) + t.Fatalf("listen unix %q: %v", sockPath, err) } - if cfg.Spec.DriverName != "test.csi.k8s.io" { - t.Errorf("expected driver name %q, got %q", "test.csi.k8s.io", cfg.Spec.DriverName) + srv, impl := grpc.NewServer(), &testCSINodeServer{driverName: driver, onGetPlugin: onGetPlugin} + csipb.RegisterIdentityServer(srv, impl) + csipb.RegisterNodeServer(srv, impl) + go func() { _ = srv.Serve(lis) }() + t.Cleanup(func() { srv.Stop(); _ = lis.Close() }) + return "unix://" + sockPath, impl +} + +func cleanupAteletCSIPlugins(t *testing.T, s *Atelet) *Atelet { + t.Helper() + t.Cleanup(func() { + s.mu.Lock() + slots := maps.Clone(s.csiPlugins) + clear(s.csiPlugins) + s.mu.Unlock() + for _, slot := range slots { + _ = slot.plugin.Close() + } + }) + return s +} + +func assertNodePluginClosed(t *testing.T, p volume.VolumePluginWorkerPlane) { + t.Helper() + if err := p.MountVolume(t.Context(), volume.MountVolumeRequest{VolumeID: "v", TargetPath: "/tmp/unused"}); status.Code(err) != codes.Canceled { + t.Fatalf("MountVolume() on closed plugin = %v, want Canceled", err) } +} - // Missing config - _, err = getter.Get("missing.csi.k8s.io") - if err == nil { - t.Fatalf("expected error for missing driver, got nil") +func TestAteletGetPlugin(t *testing.T) { + t.Parallel() + ctx := t.Context() + sockDir, err := os.MkdirTemp("", "atelet-csi-*") + if err != nil { + t.Fatalf("MkdirTemp: %v", err) } + t.Cleanup(func() { _ = os.RemoveAll(sockDir) }) + + t.Run("static override and nil getter", func(t *testing.T) { + t.Parallel() + static, spy := &fakeWorkerPlugin{}, &spyCSIGetter{inner: &ateapiCSIDriverConfigGetter{}} + s := &Atelet{volumePlugins: map[string]volume.VolumePluginWorkerPlane{"nfs.csi.k8s.io": static}, csiDriverConfigGetter: spy} + if got, err := s.getPlugin(ctx, "nfs.csi.k8s.io"); err != nil || got != static || spy.calls.Load() != 0 { + t.Fatalf("getPlugin(static) = (%v, %v), getterCalls = %d", got, err, spy.calls.Load()) + } + if _, err := (&Atelet{}).getPlugin(ctx, "nfs.csi.k8s.io"); err == nil { + t.Fatal("getPlugin(nil getter) = nil, want error") + } + }) + + t.Run("TTL reuse, socket swap, bad redial, apierror.Unavailable, and delete", func(t *testing.T) { + t.Parallel() + const driver = "nfs.csi.k8s.io" + sock1, srv1 := startTestCSINodeSocket(t, sockDir, "s1.sock", driver, nil) + sock2, srv2 := startTestCSINodeSocket(t, sockDir, "s2.sock", driver, nil) + crdClient := fake.NewSimpleClientset(&atev1.CSIDriverConfig{ + ObjectMeta: metav1.ObjectMeta{Name: "crd-nfs"}, + Spec: atev1.CSIDriverConfigSpec{DriverName: driver, ControllerEndpoint: "tcp://127.0.0.1:9000", NodeSocketOverride: sock1}, + }) + control := &fakeCsiDriverConfigListClient{} + getterSpy := &spyCSIGetter{inner: &ateapiCSIDriverConfigGetter{control: control, fallback: &directCSIDriverConfigGetter{client: crdClient}}} + fakeClock := clocktesting.NewFakeClock(time.Date(2026, 1, 1, 12, 0, 0, 0, time.UTC)) + s := cleanupAteletCSIPlugins(t, &Atelet{csiDriverConfigGetter: getterSpy, clock: fakeClock}) + + mustMount := func(wantSrv *testCSINodeServer, wantCount int32) *csi.Plugin { + t.Helper() + got, err := s.getPlugin(ctx, driver) + p, ok := got.(*csi.Plugin) + if err != nil || !ok { + t.Fatalf("getPlugin() = (%T, %v), want *csi.Plugin", got, err) + } + if err := p.MountVolume(ctx, volume.MountVolumeRequest{VolumeID: "v1", TargetPath: filepath.Join(sockDir, "mnt")}); err != nil || wantSrv.publishes.Load() != wantCount { + t.Fatalf("MountVolume() err = %v, publishes = %d (want %d)", err, wantSrv.publishes.Load(), wantCount) + } + return p + } + + // Cold call queries getter once; warm calls within defaultCSIPluginConfigTTL make 0 extra getter calls. + p1 := mustMount(srv1, 1) + if got := getterSpy.calls.Load(); got != 1 { + t.Fatalf("cold getter calls = %d, want 1", got) + } + fakeClock.Step(defaultCSIPluginConfigTTL - time.Nanosecond) + if p := mustMount(srv1, 2); p != p1 || getterSpy.calls.Load() != 1 { + t.Fatalf("warm TTL call = (%p, calls=%d), want (%p, calls=1)", p, getterSpy.calls.Load(), p1) + } + + // Stepping to TTL boundary revalidates, preserves p1 across promotion/controller/demotion, and refreshes TTL. + control.setSingle(&ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs", Uid: "u1", Version: 1}, DriverName: driver, ControllerEndpoint: "tcp://127.0.0.1:9001", NodeSocketOverride: sock1}, nil) + fakeClock.Step(time.Nanosecond) + if p := mustMount(srv1, 3); p != p1 || getterSpy.calls.Load() != 2 { + t.Fatalf("post-TTL promotion = (%p, calls=%d), want (%p, calls=2)", p, getterSpy.calls.Load(), p1) + } + if p := mustMount(srv1, 4); p != p1 || getterSpy.calls.Load() != 2 { + t.Fatalf("refreshed TTL call = (%p, calls=%d), want (%p, calls=2)", p, getterSpy.calls.Load(), p1) + } + control.setSingle(&ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs", Uid: "u1", Version: 2}, DriverName: driver, ControllerEndpoint: "tcp://127.0.0.1:9999", NodeSocketOverride: sock1, Tls: &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "x"}}, nil) + fakeClock.Step(defaultCSIPluginConfigTTL) + if p := mustMount(srv1, 5); p != p1 { + t.Fatalf("controller/tls edit changed node plugin pointer %p -> %p", p1, p) + } + control.setSingle(nil, nil) + fakeClock.Step(defaultCSIPluginConfigTTL) + if p := mustMount(srv1, 6); p != p1 { + t.Fatalf("demotion to identical CRD changed plugin pointer %p -> %p", p1, p) + } + + control.setSingle(&ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs", Uid: "u1", Version: 3}, DriverName: driver, NodeSocketOverride: sock2}, nil) + fakeClock.Step(defaultCSIPluginConfigTTL) + p2 := mustMount(srv2, 1) + if p2 == p1 { + t.Fatal("socket update returned stale plugin") + } + assertNodePluginClosed(t, p1) + + for _, code := range []codes.Code{codes.Unavailable, codes.DeadlineExceeded} { + control.setSingle(nil, status.Error(code, "api-server restarting")) + fakeClock.Step(defaultCSIPluginConfigTTL) + _, err := s.getPlugin(ctx, driver) + if st, _ := apierror.FromError(err); st.Code() != codes.Unavailable || !strings.Contains(st.Message(), driver) { + t.Fatalf("getPlugin(%v) status = (%v, %q), want (Unavailable, containing %q)", code, st.Code(), st.Message(), driver) + } + if err := p2.MountVolume(ctx, volume.MountVolumeRequest{VolumeID: "v1", TargetPath: filepath.Join(sockDir, "mnt")}); err != nil { + t.Fatalf("p2 closed on transient %v: %v", code, err) + } + } + + control.setSingle(&ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs", Uid: "u1", Version: 4}, DriverName: driver, NodeSocketOverride: "unix://" + filepath.Join(sockDir, "missing.sock")}, nil) + fakeClock.Step(defaultCSIPluginConfigTTL) + if _, err := s.getPlugin(ctx, driver); err == nil { + t.Fatal("getPlugin(missing.sock) = nil, want dial error") + } + assertNodePluginClosed(t, p2) + + control.setSingle(&ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs", Uid: "u1", Version: 5}, DriverName: driver, NodeSocketOverride: sock2}, nil) + p3 := mustMount(srv2, 4) + control.setSingle(nil, nil) + if err := crdClient.AteV1().CSIDriverConfigs().Delete(ctx, "crd-nfs", metav1.DeleteOptions{}); err != nil { + t.Fatal(err) + } + fakeClock.Step(defaultCSIPluginConfigTTL) + if _, err := s.getPlugin(ctx, driver); !apierrors.IsNotFound(err) { + t.Fatalf("getPlugin(deleted) = %v, want IsNotFound", err) + } + assertNodePluginClosed(t, p3) + if len(s.csiPlugins) != 0 { + t.Fatalf("len(csiPlugins) = %d, want 0", len(s.csiPlugins)) + } + }) + + for _, mode := range []string{"update", "delete"} { + t.Run("concurrent slow dial vs "+mode, func(t *testing.T) { + t.Parallel() + driver := "race-" + mode + ".csi.k8s.io" + entered, release := make(chan struct{}), make(chan struct{}) + var once sync.Once + slowSock, _ := startTestCSINodeSocket(t, sockDir, mode+"-1.sock", driver, func() { once.Do(func() { close(entered); <-release }) }) + fastSock, fastSrv := startTestCSINodeSocket(t, sockDir, mode+"-2.sock", driver, nil) + control := &fakeCsiDriverConfigListClient{} + control.setSingle(&ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: "cfg"}, DriverName: driver, NodeSocketOverride: slowSock}, nil) + s := cleanupAteletCSIPlugins(t, &Atelet{csiDriverConfigGetter: &ateapiCSIDriverConfigGetter{control: control}}) + + var gotPlugin, wantPlugin volume.VolumePluginWorkerPlane + var gotErr, err error + var wg sync.WaitGroup + wg.Go(func() { gotPlugin, gotErr = s.getPlugin(ctx, driver) }) + <-entered + if mode == "update" { + control.setSingle(&ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: "cfg"}, DriverName: driver, NodeSocketOverride: fastSock}, nil) + if wantPlugin, err = s.getPlugin(ctx, driver); err != nil { + t.Fatalf("fast getPlugin() error = %v", err) + } + } else { + control.setSingle(nil, nil) + if _, err := s.getPlugin(ctx, driver); status.Code(err) != codes.NotFound { + t.Fatalf("delete getPlugin() = %v, want NotFound", err) + } + } + close(release) + wg.Wait() + if mode == "delete" { + if status.Code(gotErr) != codes.NotFound || len(s.csiPlugins) != 0 { + t.Fatalf("slow getPlugin() = (%v, %v), slots = %d; want NotFound and 0 slots", gotPlugin, gotErr, len(s.csiPlugins)) + } + return + } + if gotErr != nil || gotPlugin != wantPlugin || s.csiPlugins[driver].inflight != 0 { + t.Fatalf("slow getPlugin() = (%v, %v), inflight = %d; want (%v, nil)", gotPlugin, gotErr, s.csiPlugins[driver].inflight, wantPlugin) + } + if err := gotPlugin.MountVolume(ctx, volume.MountVolumeRequest{VolumeID: "v", TargetPath: filepath.Join(sockDir, "m")}); err != nil || fastSrv.publishes.Load() != 1 { + t.Fatalf("MountVolume on winner = %v, fastSrv.publishes = %d", err, fastSrv.publishes.Load()) + } + }) + } +} + +func TestVolumeMountUnmountUnavailableCodes(t *testing.T) { + useTempNodeDirs(t) + ctx := t.Context() + const actorUID = "actor-unavail" + cachedVol := &ateletpb.Volume{Name: "vol-1", External: &ateletpb.ExternalVolumeSource{StorageVolumeId: "vid-1", VolumeType: "cached.csi.io"}} + unavailVol := &ateletpb.Volume{Name: "vol-2", External: &ateletpb.ExternalVolumeSource{StorageVolumeId: "vid-2", VolumeType: "unavail.csi.io"}} + + busyErr := errors.New("device or resource busy") + cachedPlugin := &fakeWorkerPlugin{unmountErr: busyErr} + control := &fakeCsiDriverConfigListClient{err: status.Error(codes.Unavailable, "api-server restarting")} + s := &Atelet{ + volumePlugins: map[string]volume.VolumePluginWorkerPlane{"cached.csi.io": cachedPlugin}, + csiDriverConfigGetter: &ateapiCSIDriverConfigGetter{control: control}, + } + + // Pre-pass fails with Unavailable before creating host directories or mounting earlier volumes. + err := s.mountExternalVolumes(ctx, actorUID, []*ateletpb.Volume{cachedVol, unavailVol}) + if apierror.Code(err) != codes.Unavailable || len(cachedPlugin.mountCalls) != 0 { + t.Fatalf("mountExternalVolumes() code = %v (err=%v), mountCalls = %d; want Unavailable and 0 mounts", apierror.Code(err), err, len(cachedPlugin.mountCalls)) + } + if _, statErr := os.Stat(ateletpath.ExternalVolumeHostPath(actorUID, "vol-1")); !os.IsNotExist(statErr) { + t.Fatalf("vol-1 mount dir created despite pre-pass failure: statErr = %v", statErr) + } + + // Unmount returns Unavailable only when every failed volume failed with Unavailable. + if err := s.unmountExternalVolumes(ctx, actorUID, []*ateletpb.Volume{unavailVol}); apierror.Code(err) != codes.Unavailable { + t.Fatalf("unmountExternalVolumes(all Unavailable) code = %v (err=%v), want Unavailable", apierror.Code(err), err) + } + mixedErr := s.unmountExternalVolumes(ctx, actorUID, []*ateletpb.Volume{unavailVol, cachedVol}) + if apierror.Code(mixedErr) != codes.Internal || !errors.Is(mixedErr, busyErr) { + t.Fatalf("unmountExternalVolumes(mixed) code = %v, errors.Is(busy) = %t (err=%v); want Internal wrapping busyErr", apierror.Code(mixedErr), errors.Is(mixedErr, busyErr), mixedErr) + } + + // Context errors ([DeadlineExceeded] and [Unavailable, Canceled]) preserve context status codes. + expiredCtx, cancelExpired := context.WithDeadline(ctx, time.Now().Add(-time.Second)) + defer cancelExpired() + control.err = status.Error(codes.DeadlineExceeded, "deadline exceeded") + if err := s.unmountExternalVolumes(expiredCtx, actorUID, []*ateletpb.Volume{unavailVol}); apierror.Code(err) != codes.DeadlineExceeded { + t.Fatalf("unmountExternalVolumes([DeadlineExceeded]) code = %v (err=%v), want DeadlineExceeded", apierror.Code(err), err) + } + + cancelMidCtx, cancelMid := context.WithCancel(ctx) + defer cancelMid() + secondUnavailVol := &ateletpb.Volume{Name: "vol-3", External: &ateletpb.ExternalVolumeSource{StorageVolumeId: "vid-3", VolumeType: "unavail-2.csi.io"}} + var unmountCalls int + s.csiDriverConfigGetter = getterFunc(func(c context.Context, driver string) (*ateapi.CsiDriverConfig, error) { + unmountCalls++ + if unmountCalls == 1 { + cancelMid() + return nil, apierror.Unavailable("ateapi restarting") + } + return nil, c.Err() + }) + if err := s.unmountExternalVolumes(cancelMidCtx, actorUID, []*ateletpb.Volume{unavailVol, secondUnavailVol}); apierror.Code(err) != codes.Canceled { + t.Fatalf("unmountExternalVolumes([Unavailable, Canceled]) code = %v (err=%v), want Canceled", apierror.Code(err), err) + } + + // Pre-pass deduplicates s.getPlugin per unique VolumeType so a mid-call TTL expiry cannot evict vol-1's plugin. + sockDir, err := os.MkdirTemp("", "atelet-dedup-*") + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = os.RemoveAll(sockDir) }) + sock1, srv1 := startTestCSINodeSocket(t, sockDir, "s1.sock", "dedup.csi.io", nil) + sock2, _ := startTestCSINodeSocket(t, sockDir, "s2.sock", "dedup.csi.io", nil) + stepSock, _ := startTestCSINodeSocket(t, sockDir, "step.sock", "step.csi.io", nil) + fc := clocktesting.NewFakeClock(time.Date(2026, 1, 1, 12, 0, 0, 0, time.UTC)) + var dedupCalls int + dedupAtelet := cleanupAteletCSIPlugins(t, &Atelet{ + clock: fc, + csiDriverConfigGetter: getterFunc(func(_ context.Context, driver string) (*ateapi.CsiDriverConfig, error) { + if driver == "step.csi.io" { + fc.Step(defaultCSIPluginConfigTTL) + return &ateapi.CsiDriverConfig{DriverName: driver, NodeSocketOverride: stepSock}, nil + } + dedupCalls++ + if dedupCalls == 1 { + return &ateapi.CsiDriverConfig{DriverName: driver, NodeSocketOverride: sock1}, nil + } + return &ateapi.CsiDriverConfig{DriverName: driver, NodeSocketOverride: sock2}, nil + }), + }) + if _, err := dedupAtelet.getPlugin(ctx, "dedup.csi.io"); err != nil { + t.Fatal(err) + } + v1 := &ateletpb.Volume{Name: "d1", External: &ateletpb.ExternalVolumeSource{StorageVolumeId: "vid-1", VolumeType: "dedup.csi.io"}} + vStep := &ateletpb.Volume{Name: "step", External: &ateletpb.ExternalVolumeSource{StorageVolumeId: "vid-s", VolumeType: "step.csi.io"}} + v2 := &ateletpb.Volume{Name: "d2", External: &ateletpb.ExternalVolumeSource{StorageVolumeId: "vid-2", VolumeType: "dedup.csi.io"}} + if err := dedupAtelet.mountExternalVolumes(ctx, actorUID, []*ateletpb.Volume{v1, vStep, v2}); err != nil || dedupCalls != 1 || srv1.publishes.Load() != 2 { + t.Fatalf("mountExternalVolumes(dedup) err = %v, dedupCalls = %d, publishes = %d; want (nil, 1, 2)", err, dedupCalls, srv1.publishes.Load()) + } +} + +type getterFunc func(context.Context, string) (*ateapi.CsiDriverConfig, error) + +func (f getterFunc) Get(ctx context.Context, driverName string) (*ateapi.CsiDriverConfig, error) { + return f(ctx, driverName) } diff --git a/cmd/kubectl-ate/internal/cmd/csi_driver_config.go b/cmd/kubectl-ate/internal/cmd/csi_driver_config.go new file mode 100644 index 0000000000..7fa929573a --- /dev/null +++ b/cmd/kubectl-ate/internal/cmd/csi_driver_config.go @@ -0,0 +1,223 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "context" + "fmt" + "io" + + "github.com/spf13/cobra" + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/cmd/kubectl-ate/internal/printer" + "google.golang.org/grpc" + "google.golang.org/protobuf/encoding/protojson" +) + +var ( + createCsiDriverConfigFilenameFlag string + updateCsiDriverConfigFilenameFlag string + deleteCsiDriverConfigGuard deleteGuardFlags +) + +type csiDriverConfigClient interface { + GetCsiDriverConfig(ctx context.Context, in *ateapi.GetCsiDriverConfigRequest, opts ...grpc.CallOption) (*ateapi.CsiDriverConfig, error) + ListCsiDriverConfigs(ctx context.Context, in *ateapi.ListCsiDriverConfigsRequest, opts ...grpc.CallOption) (*ateapi.ListCsiDriverConfigsResponse, error) + CreateCsiDriverConfig(ctx context.Context, in *ateapi.CreateCsiDriverConfigRequest, opts ...grpc.CallOption) (*ateapi.CsiDriverConfig, error) + UpdateCsiDriverConfig(ctx context.Context, in *ateapi.UpdateCsiDriverConfigRequest, opts ...grpc.CallOption) (*ateapi.CsiDriverConfig, error) + DeleteCsiDriverConfig(ctx context.Context, in *ateapi.DeleteCsiDriverConfigRequest, opts ...grpc.CallOption) (*ateapi.CsiDriverConfig, error) +} + +var getCsiDriverConfigsCmd = &cobra.Command{ + Use: "csi-driver-config [name ...]", + Aliases: []string{"csi-driver-configs"}, + Short: "List all CSI driver configs or get one or more CSI driver configs", + Long: "List or get CSI driver configs.", + Args: cobra.ArbitraryArgs, + RunE: func(cmd *cobra.Command, args []string) error { + apiClient, err := newAPIClient(cmd) + if err != nil { + return fmt.Errorf("failed to connect to ate-api-server: %w", err) + } + defer apiClient.Close() + return runGetCsiDriverConfigs(cmd.Context(), apiClient, cmd.OutOrStdout(), outputFmt, args) + }, +} + +var createCsiDriverConfigCmd = &cobra.Command{ + Use: "csi-driver-config -f ", + Aliases: []string{"csi-driver-configs"}, + Short: "Create a CSI driver config from a manifest", + Long: `Create a CSI driver config from a single YAML or JSON manifest holding one ateapi.CsiDriverConfig message in protojson form (as printed by "kubectl ate get csi-driver-config -o yaml"). CSI driver configs are global-scoped.`, + Args: noArgs("the CSI driver config name comes from the manifest passed to -f/--filename", "filename"), + RunE: func(cmd *cobra.Command, args []string) error { + config, err := loadCsiDriverConfigManifest(cmd.InOrStdin(), createCsiDriverConfigFilenameFlag) + if err != nil { + return err + } + apiClient, err := newAPIClient(cmd) + if err != nil { + return fmt.Errorf("failed to connect to ate-api-server: %w", err) + } + defer apiClient.Close() + return runCreateCsiDriverConfig(cmd.Context(), apiClient, cmd.OutOrStdout(), outputFmt, config) + }, +} + +var updateCsiDriverConfigCmd = &cobra.Command{ + Use: "csi-driver-config -f ", + Aliases: []string{"csi-driver-configs"}, + Short: "Replace a CSI driver config from a manifest", + Long: `Replace a CSI driver config from a single YAML or JSON manifest holding one ateapi.CsiDriverConfig message in protojson form (as printed by "kubectl ate get csi-driver-config -o yaml"). Its metadata.uid and metadata.version are required preconditions.`, + Args: noArgs("the CSI driver config name comes from the manifest passed to -f/--filename", "filename"), + RunE: func(cmd *cobra.Command, args []string) error { + config, err := loadCsiDriverConfigForUpdate(cmd.InOrStdin(), updateCsiDriverConfigFilenameFlag) + if err != nil { + return err + } + apiClient, err := newAPIClient(cmd) + if err != nil { + return fmt.Errorf("failed to connect to ate-api-server: %w", err) + } + defer apiClient.Close() + return runUpdateCsiDriverConfig(cmd.Context(), apiClient, cmd.OutOrStdout(), outputFmt, config) + }, +} + +var deleteCsiDriverConfigCmd = &cobra.Command{ + Use: "csi-driver-config ", + Aliases: []string{"csi-driver-configs"}, + Short: "Delete a CSI driver config", + Long: "Delete a CSI driver config. Pass --uid and/or --version to guard the delete against a concurrent replacement.", + Args: exactlyOneArg(""), + RunE: func(cmd *cobra.Command, args []string) error { + opts, err := deleteOptionsFromFlags(deleteGuardFlags{ + uidSet: cmd.Flags().Changed("uid"), + uid: deleteCsiDriverConfigGuard.uid, + versionSet: cmd.Flags().Changed("version"), + version: deleteCsiDriverConfigGuard.version, + }) + if err != nil { + return wrapUsageError(err) + } + apiClient, err := newAPIClient(cmd) + if err != nil { + return fmt.Errorf("failed to connect to ate-api-server: %w", err) + } + defer apiClient.Close() + return runDeleteCsiDriverConfig(cmd.Context(), apiClient, cmd.OutOrStdout(), args[0], opts) + }, +} + +func runGetCsiDriverConfigs(ctx context.Context, client csiDriverConfigClient, out io.Writer, format string, names []string) error { + if len(names) > 0 { + configs := make([]*ateapi.CsiDriverConfig, 0, len(names)) + for _, name := range names { + resp, err := client.GetCsiDriverConfig(ctx, &ateapi.GetCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Name: name}}) + if err != nil { + return fmt.Errorf("failed to get csi driver config %q: %w", name, err) + } + configs = append(configs, resp) + } + if len(configs) == 1 { + return printer.PrintCsiDriverConfigTo(out, configs[0], format) + } + return printer.PrintCsiDriverConfigsTo(out, configs, format) + } + var allConfigs []*ateapi.CsiDriverConfig + for pageToken := ""; ; { + resp, err := client.ListCsiDriverConfigs(ctx, &ateapi.ListCsiDriverConfigsRequest{Options: &ateapi.ListOptions{PageSize: 1000, PageToken: pageToken}}) + if err != nil { + return fmt.Errorf("failed to list csi driver configs: %w", err) + } + allConfigs = append(allConfigs, resp.GetCsiDriverConfigs()...) + if pageToken = resp.GetNextPageToken(); pageToken == "" { + break + } + } + return printer.PrintCsiDriverConfigsTo(out, allConfigs, format) +} + +func runCreateCsiDriverConfig(ctx context.Context, client csiDriverConfigClient, out io.Writer, format string, config *ateapi.CsiDriverConfig) error { + resp, err := client.CreateCsiDriverConfig(ctx, &ateapi.CreateCsiDriverConfigRequest{CsiDriverConfig: config}) + if err != nil { + return fmt.Errorf("failed to create csi driver config: %w", err) + } + return printer.PrintCsiDriverConfigTo(out, resp, format) +} + +func runUpdateCsiDriverConfig(ctx context.Context, client csiDriverConfigClient, out io.Writer, format string, config *ateapi.CsiDriverConfig) error { + resp, err := client.UpdateCsiDriverConfig(ctx, &ateapi.UpdateCsiDriverConfigRequest{CsiDriverConfig: config}) + if err != nil { + return fmt.Errorf("failed to update csi driver config: %w", err) + } + return printer.PrintCsiDriverConfigTo(out, resp, format) +} + +func runDeleteCsiDriverConfig(ctx context.Context, client csiDriverConfigClient, out io.Writer, name string, opts *ateapi.DeleteOptions) error { + if _, err := client.DeleteCsiDriverConfig(ctx, &ateapi.DeleteCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Name: name}, Options: opts}); err != nil { + return fmt.Errorf("failed to delete csi driver config: %w", err) + } + fmt.Fprintf(out, "csi driver config %q deleted\n", name) + return nil +} + +func loadCsiDriverConfigManifest(in io.Reader, path string) (*ateapi.CsiDriverConfig, error) { + data, err := readFileOrStdin(in, path) + if err != nil { + return nil, err + } + jsonData, err := manifestToJSON(data) + if err != nil { + return nil, fmt.Errorf("failed to parse csi driver config manifest %q: %w", path, err) + } + config := &ateapi.CsiDriverConfig{} + if err := protojson.Unmarshal(jsonData, config); err != nil { + return nil, fmt.Errorf("failed to parse csi driver config manifest %q: invalid CsiDriverConfig: %w", path, err) + } + if got := config.GetMetadata().GetAtespace(); got != "" { + return nil, fmt.Errorf("csi driver config is global-scoped: metadata.atespace must be empty (got %q)", got) + } + if config.GetMetadata().GetName() == "" { + return nil, fmt.Errorf("failed to parse csi driver config manifest %q: metadata.name is required", path) + } + return config, nil +} + +func loadCsiDriverConfigForUpdate(in io.Reader, path string) (*ateapi.CsiDriverConfig, error) { + config, err := loadCsiDriverConfigManifest(in, path) + if err != nil { + return nil, err + } + if config.GetMetadata().GetUid() == "" || config.GetMetadata().GetVersion() < 1 { + name := config.GetMetadata().GetName() + return nil, fmt.Errorf(`manifest for csi driver config %q lacks the metadata.uid and metadata.version preconditions that "kubectl ate get csi-driver-config %s -o yaml" prints`, name, name) + } + return config, nil +} + +func init() { + getCmd.AddCommand(getCsiDriverConfigsCmd) + + createCsiDriverConfigCmd.Flags().StringVarP(&createCsiDriverConfigFilenameFlag, "filename", "f", "", "manifest file holding a single JSON or YAML csi-driver-config document, or - for stdin") + createCmd.AddCommand(createCsiDriverConfigCmd) + + updateCsiDriverConfigCmd.Flags().StringVarP(&updateCsiDriverConfigFilenameFlag, "filename", "f", "", "manifest file holding a single JSON or YAML csi-driver-config document, or - for stdin") + updateCmd.AddCommand(updateCsiDriverConfigCmd) + + deleteCsiDriverConfigCmd.Flags().StringVar(&deleteCsiDriverConfigGuard.uid, "uid", "", "require the CSI driver config to have this UID before deleting") + deleteCsiDriverConfigCmd.Flags().Int64Var(&deleteCsiDriverConfigGuard.version, "version", 0, "require the CSI driver config to be at this version before deleting") + deleteCmd.AddCommand(deleteCsiDriverConfigCmd) +} diff --git a/cmd/kubectl-ate/internal/cmd/csi_driver_config_test.go b/cmd/kubectl-ate/internal/cmd/csi_driver_config_test.go new file mode 100644 index 0000000000..ced4ea9c57 --- /dev/null +++ b/cmd/kubectl-ate/internal/cmd/csi_driver_config_test.go @@ -0,0 +1,406 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "bytes" + "context" + "errors" + "os" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "go.ate.dev/substrate/api/ateapi/v1" + "google.golang.org/grpc" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func TestCsiDriverConfigCommandArgs(t *testing.T) { + runCommandArgsTests(t, []commandArgsTest{ + {name: "list", command: getCsiDriverConfigsCmd}, + {name: "get", command: getCsiDriverConfigsCmd, args: []string{"csi-nfs"}}, + {name: "get multiple", command: getCsiDriverConfigsCmd, args: []string{"csi-nfs", "pd-csi"}}, + {name: "create missing -f", command: createCsiDriverConfigCmd, wantErr: true}, + {name: "create extra arg", command: createCsiDriverConfigCmd, args: []string{"csi-nfs"}, wantErr: true}, + {name: "update missing -f", command: updateCsiDriverConfigCmd, wantErr: true}, + {name: "update extra arg", command: updateCsiDriverConfigCmd, args: []string{"csi-nfs"}, wantErr: true}, + {name: "delete", command: deleteCsiDriverConfigCmd, args: []string{"csi-nfs"}}, + {name: "delete missing name", command: deleteCsiDriverConfigCmd, wantErr: true}, + {name: "delete extra name", command: deleteCsiDriverConfigCmd, args: []string{"a", "b"}, wantErr: true}, + }) +} + +func TestLoadCsiDriverConfigManifest(t *testing.T) { + t.Parallel() + wantNFS := &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs"}, + DriverName: "nfs.csi.k8s.io", + ControllerEndpoint: "tcp://csi-nfs-controller.kube-system.svc:50052", + NodeSocketOverride: "unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock", + Tls: &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "csi-nfs-controller.kube-system.svc"}, + } + for _, tc := range []struct { + name, manifest, wantErr string + want *ateapi.CsiDriverConfig + }{ + { + name: "camelCase yaml from stdin", + manifest: "metadata: {name: csi-nfs}\ndriverName: nfs.csi.k8s.io\ncontrollerEndpoint: tcp://csi-nfs-controller.kube-system.svc:50052\nnodeSocketOverride: unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock\ntls: {enabled: true, usePodIdentity: true, serverName: csi-nfs-controller.kube-system.svc}\n", + want: wantNFS, + }, + { + name: "snake_case yaml from stdin", + manifest: "metadata: {name: csi-nfs}\ndriver_name: nfs.csi.k8s.io\ncontroller_endpoint: tcp://csi-nfs-controller.kube-system.svc:50052\nnode_socket_override: unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock\ntls: {enabled: true, use_pod_identity: true, server_name: csi-nfs-controller.kube-system.svc}\n", + want: wantNFS, + }, + { + name: "json input", + manifest: `{"metadata":{"name":"csi-nfs"},"driverName":"nfs.csi.k8s.io","controllerEndpoint":"tcp://csi-nfs-controller.kube-system.svc:50052","nodeSocketOverride":"unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock","tls":{"enabled":true,"usePodIdentity":true,"serverName":"csi-nfs-controller.kube-system.svc"}}`, + want: wantNFS, + }, + {name: "missing metadata.name", manifest: "driverName: nfs.csi.k8s.io\ncontrollerEndpoint: tcp://127.0.0.1:9000", wantErr: "metadata.name is required"}, + {name: "atespace set", manifest: "metadata: {atespace: team-a, name: csi-nfs}", wantErr: "metadata.atespace must be empty"}, + {name: "unknown field", manifest: "metadata: {name: csi-nfs}\nendpoint: tcp://127.0.0.1:9000", wantErr: "invalid CsiDriverConfig"}, + {name: "empty", manifest: "", wantErr: "manifest is empty"}, + {name: "multi-document yaml", manifest: "metadata: {name: a}\n---\nmetadata: {name: b}\n", wantErr: "manifest holds more than one document"}, + } { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + got, err := loadCsiDriverConfigManifest(strings.NewReader(tc.manifest), "-") + if tc.wantErr != "" { + if err == nil || !strings.Contains(err.Error(), tc.wantErr) { + t.Fatalf("loadCsiDriverConfigManifest() error = %v, want %q", err, tc.wantErr) + } + return + } + if err != nil || cmp.Diff(tc.want, got, protocmp.Transform()) != "" { + t.Fatalf("loadCsiDriverConfigManifest() = (%v, %v), want %v", got, err, tc.want) + } + }) + } + + t.Run("from file", func(t *testing.T) { + t.Parallel() + path := filepath.Join(t.TempDir(), "csi-nfs.yaml") + content := "metadata: {name: csi-nfs}\ndriverName: nfs.csi.k8s.io\ncontrollerEndpoint: tcp://csi-nfs-controller.kube-system.svc:50052\nnodeSocketOverride: unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock\ntls: {enabled: true, usePodIdentity: true, serverName: csi-nfs-controller.kube-system.svc}\n" + if err := os.WriteFile(path, []byte(content), 0o600); err != nil { + t.Fatal(err) + } + got, err := loadCsiDriverConfigManifest(strings.NewReader("ignored"), path) + if err != nil || cmp.Diff(wantNFS, got, protocmp.Transform()) != "" { + t.Fatalf("loadCsiDriverConfigManifest(file) = (%v, %v), want %v", got, err, wantNFS) + } + }) + + t.Run("missing file", func(t *testing.T) { + t.Parallel() + if _, err := loadCsiDriverConfigManifest(strings.NewReader(""), filepath.Join(t.TempDir(), "missing.yaml")); err == nil { + t.Fatal("loadCsiDriverConfigManifest(missing) = nil, want error") + } + }) +} + +func TestLoadCsiDriverConfigForUpdate(t *testing.T) { + t.Parallel() + for _, tc := range []struct { + name string + manifest string + want *ateapi.CsiDriverConfig + wantErr string + }{ + { + name: "manifest carries uid and version", + manifest: "metadata: {name: csi-nfs, uid: u-1, version: \"3\"}\ndriverName: nfs.csi.k8s.io\ncontrollerEndpoint: tcp://127.0.0.1:9000\n", + want: &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs", Uid: "u-1", Version: 3}, + DriverName: "nfs.csi.k8s.io", + ControllerEndpoint: "tcp://127.0.0.1:9000", + }, + }, + { + name: "missing uid in manifest", + manifest: "metadata: {name: csi-nfs, version: \"3\"}\ndriverName: nfs.csi.k8s.io\ncontrollerEndpoint: tcp://127.0.0.1:9000\n", + wantErr: "lacks the metadata.uid and metadata.version preconditions", + }, + { + name: "missing version in manifest", + manifest: "metadata: {name: csi-nfs, uid: u-1}\ndriverName: nfs.csi.k8s.io\ncontrollerEndpoint: tcp://127.0.0.1:9000\n", + wantErr: "lacks the metadata.uid and metadata.version preconditions", + }, + { + name: "negative version in manifest", + manifest: "metadata: {name: csi-nfs, uid: u-1, version: \"-2\"}\ndriverName: nfs.csi.k8s.io\ncontrollerEndpoint: tcp://127.0.0.1:9000\n", + wantErr: "lacks the metadata.uid and metadata.version preconditions", + }, + { + name: "atespace set", + manifest: "metadata: {atespace: team-a, name: csi-nfs, uid: u-1, version: \"1\"}\n", + wantErr: "metadata.atespace must be empty", + }, + } { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + got, err := loadCsiDriverConfigForUpdate(strings.NewReader(tc.manifest), "-") + if tc.wantErr != "" { + if err == nil || !strings.Contains(err.Error(), tc.wantErr) { + t.Fatalf("loadCsiDriverConfigForUpdate() error = %v, want %q", err, tc.wantErr) + } + return + } + if err != nil || cmp.Diff(tc.want, got, protocmp.Transform()) != "" { + t.Fatalf("loadCsiDriverConfigForUpdate() = (%v, %v), want %v", got, err, tc.want) + } + }) + } +} + +type fakeCsiDriverConfigClient struct { + byName map[string]*ateapi.CsiDriverConfig + listPages []*ateapi.ListCsiDriverConfigsResponse + listReqs []*ateapi.ListCsiDriverConfigsRequest + createReq *ateapi.CreateCsiDriverConfigRequest + updateReq *ateapi.UpdateCsiDriverConfigRequest + deleteReq *ateapi.DeleteCsiDriverConfigRequest + err error +} + +func (f *fakeCsiDriverConfigClient) GetCsiDriverConfig(_ context.Context, req *ateapi.GetCsiDriverConfigRequest, _ ...grpc.CallOption) (*ateapi.CsiDriverConfig, error) { + if f.err != nil { + return nil, f.err + } + return f.byName[req.GetCsiDriverConfig().GetName()], nil +} + +func (f *fakeCsiDriverConfigClient) ListCsiDriverConfigs(_ context.Context, req *ateapi.ListCsiDriverConfigsRequest, _ ...grpc.CallOption) (*ateapi.ListCsiDriverConfigsResponse, error) { + f.listReqs = append(f.listReqs, req) + if f.err != nil { + return nil, f.err + } + if len(f.listPages) == 0 { + return &ateapi.ListCsiDriverConfigsResponse{}, nil + } + page := f.listPages[0] + f.listPages = f.listPages[1:] + return page, nil +} + +func (f *fakeCsiDriverConfigClient) CreateCsiDriverConfig(_ context.Context, req *ateapi.CreateCsiDriverConfigRequest, _ ...grpc.CallOption) (*ateapi.CsiDriverConfig, error) { + f.createReq = req + if f.err != nil { + return nil, f.err + } + created := proto.Clone(req.GetCsiDriverConfig()).(*ateapi.CsiDriverConfig) + created.Metadata.Uid, created.Metadata.Version = "srv-uid-1", 1 + return created, nil +} + +func (f *fakeCsiDriverConfigClient) UpdateCsiDriverConfig(_ context.Context, req *ateapi.UpdateCsiDriverConfigRequest, _ ...grpc.CallOption) (*ateapi.CsiDriverConfig, error) { + f.updateReq = req + if f.err != nil { + return nil, f.err + } + updated := proto.Clone(req.GetCsiDriverConfig()).(*ateapi.CsiDriverConfig) + updated.Metadata.Version++ + return updated, nil +} + +func (f *fakeCsiDriverConfigClient) DeleteCsiDriverConfig(_ context.Context, req *ateapi.DeleteCsiDriverConfigRequest, _ ...grpc.CallOption) (*ateapi.CsiDriverConfig, error) { + f.deleteReq = req + if f.err != nil { + return nil, f.err + } + return &ateapi.CsiDriverConfig{Metadata: &ateapi.ResourceMetadata{Name: req.GetCsiDriverConfig().GetName()}}, nil +} + +func TestCsiDriverConfigRunners(t *testing.T) { + ctx := context.Background() + t0 := timestamppb.New(time.Date(2026, 1, 1, 11, 55, 0, 0, time.UTC)) + csiNFS := &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs", Uid: "u-nfs", Version: 2, CreateTime: t0}, + DriverName: "nfs.csi.k8s.io", + ControllerEndpoint: "tcp://csi-nfs.kube-system.svc:50052", + NodeSocketOverride: "unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock", + Tls: &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "csi-nfs.kube-system.svc"}, + } + pdCSI := &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "pd-csi", Uid: "u-pd", Version: 1, CreateTime: t0}, + DriverName: "pd.csi.storage.gke.io", + ControllerEndpoint: "dns:///pd-csi.kube-system.svc:9000", + } + + client := &fakeCsiDriverConfigClient{ + byName: map[string]*ateapi.CsiDriverConfig{"csi-nfs": csiNFS, "pd-csi": pdCSI}, + listPages: []*ateapi.ListCsiDriverConfigsResponse{ + {CsiDriverConfigs: []*ateapi.CsiDriverConfig{pdCSI}, NextPageToken: "page-2"}, + {CsiDriverConfigs: []*ateapi.CsiDriverConfig{csiNFS}}, + }, + } + + // Single get -o yaml, plus round-trip into both create -f - and update -f -. + var getOut bytes.Buffer + if err := runGetCsiDriverConfigs(ctx, client, &getOut, "yaml", []string{"csi-nfs"}); err != nil || strings.Contains(getOut.String(), "csiDriverConfigs:") { + t.Fatalf("single get err = %v, out = %s", err, getOut.String()) + } + + createdInput, err := loadCsiDriverConfigManifest(strings.NewReader(getOut.String()), "-") + if err != nil || cmp.Diff(csiNFS, createdInput, protocmp.Transform()) != "" { + t.Fatalf("get -o yaml | create -f - parse = (%v, %v), want %v", createdInput, err, csiNFS) + } + var out bytes.Buffer + if err := runCreateCsiDriverConfig(ctx, client, &out, "yaml", createdInput); err != nil || cmp.Diff(csiNFS, client.createReq.GetCsiDriverConfig(), protocmp.Transform()) != "" { + t.Fatalf("create err = %v, req = %v", err, client.createReq) + } + for _, w := range []string{"uid: srv-uid-1", `version: "1"`, "driverName: nfs.csi.k8s.io"} { + if !strings.Contains(out.String(), w) { + t.Errorf("create out = %q, want server response field %q", out.String(), w) + } + } + + updatedInput, err := loadCsiDriverConfigForUpdate(strings.NewReader(getOut.String()), "-") + if err != nil { + t.Fatalf("get -o yaml | update -f - load error = %v", err) + } + updatedInput.ControllerEndpoint = "tcp://csi-nfs-v2.kube-system.svc:50052" + out.Reset() + if err := runUpdateCsiDriverConfig(ctx, client, &out, "yaml", updatedInput); err != nil || cmp.Diff(updatedInput, client.updateReq.GetCsiDriverConfig(), protocmp.Transform()) != "" { + t.Fatalf("update err = %v, req = %v", err, client.updateReq) + } + for _, w := range []string{"uid: u-nfs", `version: "3"`, "controllerEndpoint: tcp://csi-nfs-v2.kube-system.svc:50052"} { + if !strings.Contains(out.String(), w) { + t.Errorf("update out = %q, want server response field %q", out.String(), w) + } + } + + // Multi-name get and paged list. + out.Reset() + if err := runGetCsiDriverConfigs(ctx, client, &out, "yaml", []string{"pd-csi", "csi-nfs"}); err != nil || !strings.Contains(out.String(), "csiDriverConfigs:") { + t.Fatalf("multi get err = %v, out = %s", err, out.String()) + } + out.Reset() + if err := runGetCsiDriverConfigs(ctx, client, &out, "yaml", nil); err != nil || len(client.listReqs) != 2 || client.listReqs[1].GetOptions().GetPageToken() != "page-2" { + t.Fatalf("paged list err = %v, reqs = %+v", err, client.listReqs) + } + + // Delete without guards and with guards. + out.Reset() + if err := runDeleteCsiDriverConfig(ctx, client, &out, "csi-nfs", nil); err != nil || out.String() != "csi driver config \"csi-nfs\" deleted\n" { + t.Fatalf("unguarded delete err = %v, out = %q", err, out.String()) + } + if diff := cmp.Diff(&ateapi.DeleteCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Name: "csi-nfs"}}, client.deleteReq, protocmp.Transform()); diff != "" { + t.Errorf("unguarded deleteReq mismatch (-want +got):\n%s", diff) + } + out.Reset() + opts := &ateapi.DeleteOptions{Uid: "u-nfs", Version: 2} + if err := runDeleteCsiDriverConfig(ctx, client, &out, "csi-nfs", opts); err != nil || out.String() != "csi driver config \"csi-nfs\" deleted\n" { + t.Fatalf("guarded delete err = %v, out = %q", err, out.String()) + } + if diff := cmp.Diff(&ateapi.DeleteCsiDriverConfigRequest{CsiDriverConfig: &ateapi.ObjectRef{Name: "csi-nfs"}, Options: opts}, client.deleteReq, protocmp.Transform()); diff != "" { + t.Errorf("guarded deleteReq mismatch (-want +got):\n%s", diff) + } + + // Cobra flag wiring and pre-dial checks not covered by unit helpers. + dir := t.TempDir() + missingKubeconfig := filepath.Join(dir, "missing-kubeconfig") + atespaceFile := filepath.Join(dir, "atespace.yaml") + if err := os.WriteFile(atespaceFile, []byte("metadata: {atespace: a, name: csi-nfs}\n"), 0o600); err != nil { + t.Fatal(err) + } + missingPrecondFile := filepath.Join(dir, "no-precond.yaml") + if err := os.WriteFile(missingPrecondFile, []byte("metadata: {name: csi-nfs}\ndriverName: nfs.csi.k8s.io\ncontrollerEndpoint: tcp://127.0.0.1:9000\n"), 0o600); err != nil { + t.Fatal(err) + } + for _, tc := range []struct { + name string + args []string + wantErr string + wantUsage bool + }{ + { + name: "create -f rejected before connect", + args: []string{"--kubeconfig", missingKubeconfig, "create", "csi-driver-config", "-f", atespaceFile}, + wantErr: "metadata.atespace must be empty", + }, + { + name: "update -f missing preconditions rejected before connect", + args: []string{"--kubeconfig", missingKubeconfig, "update", "csi-driver-config", "-f", missingPrecondFile}, + wantErr: "lacks the metadata.uid and metadata.version preconditions", + }, + { + name: "delete --version 0 is usage error", + args: []string{"--kubeconfig", missingKubeconfig, "delete", "csi-driver-config", "csi-nfs", "--version", "0"}, + wantErr: "--version must be at least 1, got 0", + wantUsage: true, + }, + { + name: "delete negative --version is usage error", + args: []string{"--kubeconfig", missingKubeconfig, "delete", "csi-driver-config", "csi-nfs", "--version=-5"}, + wantErr: "--version must be at least 1, got -5", + wantUsage: true, + }, + { + name: "delete empty --uid is usage error", + args: []string{"--kubeconfig", missingKubeconfig, "delete", "csi-driver-config", "csi-nfs", "--uid", ""}, + wantErr: "--uid must not be empty", + wantUsage: true, + }, + } { + if _, stderr, err := runRootCLI(t, tc.args...); err == nil || !strings.Contains(err.Error(), tc.wantErr) { + t.Fatalf("%s: runRootCLI(%v) error = %v (stderr = %q), want %q", tc.name, tc.args, err, stderr, tc.wantErr) + } else { + var uerr *usageError + if errors.As(err, &uerr) != tc.wantUsage { + t.Fatalf("%s: errors.As(usageError) = %v, want %v (err = %v)", tc.name, errors.As(err, &uerr), tc.wantUsage, err) + } + } + } +} + +func TestCsiDriverConfigRunnersPropagateErrors(t *testing.T) { + ctx := context.Background() + boom := errors.New("boom") + client := &fakeCsiDriverConfigClient{err: boom} + config := &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "x", Uid: "u-1", Version: 1}, + DriverName: "d.csi.example.io", + ControllerEndpoint: "tcp://127.0.0.1:9000", + } + var out bytes.Buffer + for _, tc := range []struct { + name, want string + run func() error + }{ + {"get", `failed to get csi driver config "x"`, func() error { return runGetCsiDriverConfigs(ctx, client, &out, "table", []string{"x"}) }}, + {"list", "failed to list csi driver configs", func() error { return runGetCsiDriverConfigs(ctx, client, &out, "table", nil) }}, + {"create", "failed to create csi driver config", func() error { return runCreateCsiDriverConfig(ctx, client, &out, "yaml", config) }}, + {"update", "failed to update csi driver config", func() error { return runUpdateCsiDriverConfig(ctx, client, &out, "yaml", config) }}, + {"delete", "failed to delete csi driver config", func() error { return runDeleteCsiDriverConfig(ctx, client, &out, "x", nil) }}, + } { + t.Run(tc.name, func(t *testing.T) { + out.Reset() + err := tc.run() + if !errors.Is(err, boom) || !strings.Contains(err.Error(), tc.want) { + t.Fatalf("err = %v, want %q wrapping boom", err, tc.want) + } + if out.Len() != 0 { + t.Errorf("out = %q, want nothing printed on error", out.String()) + } + }) + } +} diff --git a/cmd/kubectl-ate/internal/cmd/external_volume_class.go b/cmd/kubectl-ate/internal/cmd/external_volume_class.go new file mode 100644 index 0000000000..8580515b2e --- /dev/null +++ b/cmd/kubectl-ate/internal/cmd/external_volume_class.go @@ -0,0 +1,176 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "context" + "fmt" + "io" + + "github.com/spf13/cobra" + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/cmd/kubectl-ate/internal/printer" + "google.golang.org/grpc" + "google.golang.org/protobuf/encoding/protojson" +) + +var ( + createExternalVolumeClassFilenameFlag string + deleteExternalVolumeClassGuard deleteGuardFlags +) + +type externalVolumeClassClient interface { + GetExternalVolumeClass(ctx context.Context, in *ateapi.GetExternalVolumeClassRequest, opts ...grpc.CallOption) (*ateapi.ExternalVolumeClass, error) + ListExternalVolumeClasses(ctx context.Context, in *ateapi.ListExternalVolumeClassesRequest, opts ...grpc.CallOption) (*ateapi.ListExternalVolumeClassesResponse, error) + CreateExternalVolumeClass(ctx context.Context, in *ateapi.CreateExternalVolumeClassRequest, opts ...grpc.CallOption) (*ateapi.ExternalVolumeClass, error) + DeleteExternalVolumeClass(ctx context.Context, in *ateapi.DeleteExternalVolumeClassRequest, opts ...grpc.CallOption) (*ateapi.ExternalVolumeClass, error) +} + +var getExternalVolumeClassesCmd = &cobra.Command{ + Use: "external-volume-class [name ...]", + Aliases: []string{"external-volume-classes"}, + Short: "List all external volume classes or get one or more external volume classes", + Long: "List or get external volume classes.", + Args: cobra.ArbitraryArgs, + RunE: func(cmd *cobra.Command, args []string) error { + apiClient, err := newAPIClient(cmd) + if err != nil { + return fmt.Errorf("failed to connect to ate-api-server: %w", err) + } + defer apiClient.Close() + return runGetExternalVolumeClasses(cmd.Context(), apiClient, cmd.OutOrStdout(), outputFmt, args) + }, +} + +var createExternalVolumeClassCmd = &cobra.Command{ + Use: "external-volume-class -f ", + Aliases: []string{"external-volume-classes"}, + Short: "Create an external volume class from a manifest", + Long: `Create an external volume class from a single YAML or JSON manifest holding one ateapi.ExternalVolumeClass message in protojson form (as printed by "kubectl ate get external-volume-class -o yaml"). External volume classes are global-scoped and immutable.`, + Args: noArgs("the external volume class name comes from the manifest passed to -f/--filename", "filename"), + RunE: func(cmd *cobra.Command, args []string) error { + class, err := loadExternalVolumeClassManifest(cmd.InOrStdin(), createExternalVolumeClassFilenameFlag) + if err != nil { + return err + } + apiClient, err := newAPIClient(cmd) + if err != nil { + return fmt.Errorf("failed to connect to ate-api-server: %w", err) + } + defer apiClient.Close() + return runCreateExternalVolumeClass(cmd.Context(), apiClient, cmd.OutOrStdout(), outputFmt, class) + }, +} + +var deleteExternalVolumeClassCmd = &cobra.Command{ + Use: "external-volume-class ", + Aliases: []string{"external-volume-classes"}, + Short: "Delete an external volume class", + Long: "Delete an external volume class. Pass --uid and/or --version to guard the delete against a concurrent replacement.", + Args: exactlyOneArg(""), + RunE: func(cmd *cobra.Command, args []string) error { + opts, err := deleteOptionsFromFlags(deleteGuardFlags{ + uidSet: cmd.Flags().Changed("uid"), + uid: deleteExternalVolumeClassGuard.uid, + versionSet: cmd.Flags().Changed("version"), + version: deleteExternalVolumeClassGuard.version, + }) + if err != nil { + return wrapUsageError(err) + } + apiClient, err := newAPIClient(cmd) + if err != nil { + return fmt.Errorf("failed to connect to ate-api-server: %w", err) + } + defer apiClient.Close() + return runDeleteExternalVolumeClass(cmd.Context(), apiClient, cmd.OutOrStdout(), args[0], opts) + }, +} + +func runGetExternalVolumeClasses(ctx context.Context, client externalVolumeClassClient, out io.Writer, format string, names []string) error { + if len(names) > 0 { + classes := make([]*ateapi.ExternalVolumeClass, 0, len(names)) + for _, name := range names { + resp, err := client.GetExternalVolumeClass(ctx, &ateapi.GetExternalVolumeClassRequest{ExternalVolumeClass: &ateapi.ObjectRef{Name: name}}) + if err != nil { + return fmt.Errorf("failed to get external volume class %q: %w", name, err) + } + classes = append(classes, resp) + } + if len(classes) == 1 { + return printer.PrintExternalVolumeClassTo(out, classes[0], format) + } + return printer.PrintExternalVolumeClassesTo(out, classes, format) + } + var allClasses []*ateapi.ExternalVolumeClass + for pageToken := ""; ; { + resp, err := client.ListExternalVolumeClasses(ctx, &ateapi.ListExternalVolumeClassesRequest{Options: &ateapi.ListOptions{PageSize: 1000, PageToken: pageToken}}) + if err != nil { + return fmt.Errorf("failed to list external volume classes: %w", err) + } + allClasses = append(allClasses, resp.GetExternalVolumeClasses()...) + if pageToken = resp.GetNextPageToken(); pageToken == "" { + break + } + } + return printer.PrintExternalVolumeClassesTo(out, allClasses, format) +} + +func runCreateExternalVolumeClass(ctx context.Context, client externalVolumeClassClient, out io.Writer, format string, class *ateapi.ExternalVolumeClass) error { + resp, err := client.CreateExternalVolumeClass(ctx, &ateapi.CreateExternalVolumeClassRequest{ExternalVolumeClass: class}) + if err != nil { + return fmt.Errorf("failed to create external volume class: %w", err) + } + return printer.PrintExternalVolumeClassTo(out, resp, format) +} + +func runDeleteExternalVolumeClass(ctx context.Context, client externalVolumeClassClient, out io.Writer, name string, opts *ateapi.DeleteOptions) error { + if _, err := client.DeleteExternalVolumeClass(ctx, &ateapi.DeleteExternalVolumeClassRequest{ExternalVolumeClass: &ateapi.ObjectRef{Name: name}, Options: opts}); err != nil { + return fmt.Errorf("failed to delete external volume class: %w", err) + } + fmt.Fprintf(out, "external volume class %q deleted\n", name) + return nil +} + +func loadExternalVolumeClassManifest(in io.Reader, path string) (*ateapi.ExternalVolumeClass, error) { + data, err := readFileOrStdin(in, path) + if err != nil { + return nil, err + } + jsonData, err := manifestToJSON(data) + if err != nil { + return nil, fmt.Errorf("failed to parse external volume class manifest %q: %w", path, err) + } + class := &ateapi.ExternalVolumeClass{} + if err := protojson.Unmarshal(jsonData, class); err != nil { + return nil, fmt.Errorf("failed to parse external volume class manifest %q: invalid ExternalVolumeClass: %w", path, err) + } + if got := class.GetMetadata().GetAtespace(); got != "" { + return nil, fmt.Errorf("external volume class is global-scoped: metadata.atespace must be empty (got %q)", got) + } + if class.GetMetadata().GetName() == "" { + return nil, fmt.Errorf("failed to parse external volume class manifest %q: metadata.name is required", path) + } + return class, nil +} + +func init() { + getCmd.AddCommand(getExternalVolumeClassesCmd) + createExternalVolumeClassCmd.Flags().StringVarP(&createExternalVolumeClassFilenameFlag, "filename", "f", "", "manifest file holding a single JSON or YAML external-volume-class document, or - for stdin") + createCmd.AddCommand(createExternalVolumeClassCmd) + deleteExternalVolumeClassCmd.Flags().StringVar(&deleteExternalVolumeClassGuard.uid, "uid", "", "require the external volume class to have this UID before deleting") + deleteExternalVolumeClassCmd.Flags().Int64Var(&deleteExternalVolumeClassGuard.version, "version", 0, "require the external volume class to be at this version before deleting") + deleteCmd.AddCommand(deleteExternalVolumeClassCmd) +} diff --git a/cmd/kubectl-ate/internal/cmd/external_volume_class_test.go b/cmd/kubectl-ate/internal/cmd/external_volume_class_test.go new file mode 100644 index 0000000000..46c544c33b --- /dev/null +++ b/cmd/kubectl-ate/internal/cmd/external_volume_class_test.go @@ -0,0 +1,224 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "bytes" + "context" + "errors" + "os" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "go.ate.dev/substrate/api/ateapi/v1" + "go.ate.dev/substrate/cmd/kubectl-ate/internal/printer" + "google.golang.org/grpc" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func TestExternalVolumeClassCommandArgs(t *testing.T) { + runCommandArgsTests(t, []commandArgsTest{ + {name: "list", command: getExternalVolumeClassesCmd}, + {name: "get", command: getExternalVolumeClassesCmd, args: []string{"fast-ssd"}}, + {name: "get multiple", command: getExternalVolumeClassesCmd, args: []string{"fast-ssd", "standard-rwo"}}, + {name: "create missing -f", command: createExternalVolumeClassCmd, wantErr: true}, + {name: "create extra arg", command: createExternalVolumeClassCmd, args: []string{"fast-ssd"}, wantErr: true}, + {name: "delete", command: deleteExternalVolumeClassCmd, args: []string{"fast-ssd"}}, + {name: "delete missing name", command: deleteExternalVolumeClassCmd, wantErr: true}, + {name: "delete extra name", command: deleteExternalVolumeClassCmd, args: []string{"a", "b"}, wantErr: true}, + }) +} + +func TestLoadExternalVolumeClassManifest(t *testing.T) { + t.Parallel() + wantFastSSD := &ateapi.ExternalVolumeClass{Metadata: &ateapi.ResourceMetadata{Name: "fast-ssd"}, DriverName: "pd.csi.storage.gke.io", Parameters: map[string]string{"type": "pd-ssd"}} + for _, tc := range []struct { + name, manifest, wantErr string + want *ateapi.ExternalVolumeClass + }{ + {name: "camelCase yaml", manifest: "metadata: {name: fast-ssd}\ndriverName: pd.csi.storage.gke.io\nparameters: {type: pd-ssd}\n", want: wantFastSSD}, + {name: "snake_case yaml", manifest: "metadata: {name: fast-ssd}\ndriver_name: pd.csi.storage.gke.io\nparameters: {type: pd-ssd}\n", want: wantFastSSD}, + {name: "json input", manifest: `{"metadata": {"name": "fast-ssd"}, "driverName": "pd.csi.storage.gke.io", "parameters": {"type": "pd-ssd"}}`, want: wantFastSSD}, + {name: "missing metadata.name", manifest: "driverName: pd.csi.storage.gke.io", wantErr: "metadata.name is required"}, + {name: "atespace set", manifest: "metadata: {atespace: team-a, name: fast-ssd}", wantErr: "metadata.atespace must be empty"}, + {name: "unknown field", manifest: "metadata: {name: fast-ssd}\nprovisioner: pd.csi.storage.gke.io", wantErr: "invalid ExternalVolumeClass"}, + {name: "empty", manifest: "", wantErr: "manifest is empty"}, + {name: "multi-document yaml", manifest: "metadata: {name: a}\n---\nmetadata: {name: b}\n", wantErr: "manifest holds more than one document"}, + } { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + got, err := loadExternalVolumeClassManifest(strings.NewReader(tc.manifest), "-") + if tc.wantErr != "" { + if err == nil || !strings.Contains(err.Error(), tc.wantErr) { + t.Fatalf("loadExternalVolumeClassManifest() error = %v, want %q", err, tc.wantErr) + } + return + } + if err != nil || cmp.Diff(tc.want, got, protocmp.Transform()) != "" { + t.Fatalf("loadExternalVolumeClassManifest() = (%v, %v), want %v", got, err, tc.want) + } + }) + } + + t.Run("yaml round-trip", func(t *testing.T) { + t.Parallel() + serverObj := &ateapi.ExternalVolumeClass{ + Metadata: &ateapi.ResourceMetadata{Name: "fast-ssd", Uid: "u-1", Version: 1, CreateTime: timestamppb.New(time.Date(2026, 1, 1, 11, 55, 0, 0, time.UTC))}, + DriverName: "pd.csi.storage.gke.io", + Parameters: map[string]string{"type": "pd-ssd"}, + } + var yamlOut bytes.Buffer + if err := printer.PrintExternalVolumeClassTo(&yamlOut, serverObj, "yaml"); err != nil { + t.Fatalf("PrintExternalVolumeClassTo(yaml) error = %v", err) + } + parsed, err := loadExternalVolumeClassManifest(&yamlOut, "-") + if err != nil || cmp.Diff(serverObj, parsed, protocmp.Transform()) != "" { + t.Fatalf("round-trip = (%v, %v), want %v", parsed, err, serverObj) + } + }) +} + +type fakeExternalVolumeClassClient struct { + byName map[string]*ateapi.ExternalVolumeClass + listPages []*ateapi.ListExternalVolumeClassesResponse + listReqs []*ateapi.ListExternalVolumeClassesRequest + createReq *ateapi.CreateExternalVolumeClassRequest + deleteReq *ateapi.DeleteExternalVolumeClassRequest + err error +} + +func (f *fakeExternalVolumeClassClient) GetExternalVolumeClass(_ context.Context, req *ateapi.GetExternalVolumeClassRequest, _ ...grpc.CallOption) (*ateapi.ExternalVolumeClass, error) { + if f.err != nil { + return nil, f.err + } + return f.byName[req.GetExternalVolumeClass().GetName()], nil +} +func (f *fakeExternalVolumeClassClient) ListExternalVolumeClasses(_ context.Context, req *ateapi.ListExternalVolumeClassesRequest, _ ...grpc.CallOption) (*ateapi.ListExternalVolumeClassesResponse, error) { + f.listReqs = append(f.listReqs, req) + if f.err != nil { + return nil, f.err + } + if len(f.listPages) == 0 { + return &ateapi.ListExternalVolumeClassesResponse{}, nil + } + page := f.listPages[0] + f.listPages = f.listPages[1:] + return page, nil +} +func (f *fakeExternalVolumeClassClient) CreateExternalVolumeClass(_ context.Context, req *ateapi.CreateExternalVolumeClassRequest, _ ...grpc.CallOption) (*ateapi.ExternalVolumeClass, error) { + f.createReq = req + if f.err != nil { + return nil, f.err + } + created := proto.Clone(req.GetExternalVolumeClass()).(*ateapi.ExternalVolumeClass) + created.Metadata.Uid, created.Metadata.Version = "srv-uid-1", 7 + return created, nil +} +func (f *fakeExternalVolumeClassClient) DeleteExternalVolumeClass(_ context.Context, req *ateapi.DeleteExternalVolumeClassRequest, _ ...grpc.CallOption) (*ateapi.ExternalVolumeClass, error) { + f.deleteReq = req + if f.err != nil { + return nil, f.err + } + return &ateapi.ExternalVolumeClass{Metadata: &ateapi.ResourceMetadata{Name: req.GetExternalVolumeClass().GetName()}}, nil +} + +func TestExternalVolumeClassRunners(t *testing.T) { + ctx := context.Background() + fastSSD := &ateapi.ExternalVolumeClass{Metadata: &ateapi.ResourceMetadata{Name: "fast-ssd", Version: 1}, DriverName: "pd.csi.storage.gke.io", Parameters: map[string]string{"type": "pd-ssd"}} + standardRWO := &ateapi.ExternalVolumeClass{Metadata: &ateapi.ResourceMetadata{Name: "standard-rwo", Version: 1}, DriverName: "pd.csi.storage.gke.io"} + + client := &fakeExternalVolumeClassClient{ + byName: map[string]*ateapi.ExternalVolumeClass{"fast-ssd": fastSSD, "standard-rwo": standardRWO}, + listPages: []*ateapi.ListExternalVolumeClassesResponse{ + {ExternalVolumeClasses: []*ateapi.ExternalVolumeClass{standardRWO}, NextPageToken: "page-2"}, + {ExternalVolumeClasses: []*ateapi.ExternalVolumeClass{fastSSD}}, + }, + } + var out bytes.Buffer + if err := runGetExternalVolumeClasses(ctx, client, &out, "yaml", []string{"fast-ssd"}); err != nil || strings.Contains(out.String(), "externalVolumeClasses:") { + t.Fatalf("single get err = %v, out = %s", err, out.String()) + } + out.Reset() + if err := runGetExternalVolumeClasses(ctx, client, &out, "yaml", []string{"standard-rwo", "fast-ssd"}); err != nil || !strings.Contains(out.String(), "externalVolumeClasses:") { + t.Fatalf("multi get err = %v, out = %s", err, out.String()) + } + out.Reset() + if err := runGetExternalVolumeClasses(ctx, client, &out, "yaml", nil); err != nil || len(client.listReqs) != 2 || client.listReqs[1].GetOptions().GetPageToken() != "page-2" { + t.Fatalf("paged list err = %v, reqs = %+v", err, client.listReqs) + } + out.Reset() + if err := runCreateExternalVolumeClass(ctx, client, &out, "yaml", fastSSD); err != nil || cmp.Diff(fastSSD, client.createReq.GetExternalVolumeClass(), protocmp.Transform()) != "" { + t.Fatalf("create err = %v, req = %v", err, client.createReq) + } + for _, w := range []string{"uid: srv-uid-1", `version: "7"`, "driverName: pd.csi.storage.gke.io"} { + if !strings.Contains(out.String(), w) { + t.Errorf("create out = %q, want server response field %q", out.String(), w) + } + } + out.Reset() + opts := &ateapi.DeleteOptions{Uid: "u-1", Version: 3} + if err := runDeleteExternalVolumeClass(ctx, client, &out, "fast-ssd", opts); err != nil || out.String() != "external volume class \"fast-ssd\" deleted\n" { + t.Fatalf("delete err = %v, out = %q", err, out.String()) + } + if diff := cmp.Diff(&ateapi.DeleteExternalVolumeClassRequest{ExternalVolumeClass: &ateapi.ObjectRef{Name: "fast-ssd"}, Options: opts}, client.deleteReq, protocmp.Transform()); diff != "" { + t.Errorf("deleteReq mismatch (-want +got):\n%s", diff) + } + bad := filepath.Join(t.TempDir(), "evc.yaml") + if err := os.WriteFile(bad, []byte("metadata: {atespace: a, name: b}\n"), 0o600); err != nil { + t.Fatal(err) + } + if _, _, err := runRootCLI(t, "create", "external-volume-class", "-f", bad); err == nil || !strings.Contains(err.Error(), "metadata.atespace must be empty") { + t.Fatalf("create -f bad error = %v, want metadata.atespace must be empty", err) + } + if _, _, err := runRootCLI(t, "delete", "external-volume-class", "fast-ssd", "--version", "0"); err == nil || !strings.Contains(err.Error(), "--version must be at least 1") { + t.Fatalf("delete --version 0 error = %v, want --version must be at least 1", err) + } + if _, _, err := runRootCLI(t, "delete", "external-volume-class", "fast-ssd", "--uid", ""); err == nil || !strings.Contains(err.Error(), "--uid must not be empty") { + t.Fatalf("delete --uid '' error = %v, want --uid must not be empty", err) + } +} + +func TestExternalVolumeClassRunnersPropagateErrors(t *testing.T) { + ctx := context.Background() + boom := errors.New("boom") + client := &fakeExternalVolumeClassClient{err: boom} + class := &ateapi.ExternalVolumeClass{Metadata: &ateapi.ResourceMetadata{Name: "x"}, DriverName: "d"} + var out bytes.Buffer + for _, tc := range []struct { + name, want string + run func() error + }{ + {"get", `failed to get external volume class "x"`, func() error { return runGetExternalVolumeClasses(ctx, client, &out, "table", []string{"x"}) }}, + {"list", "failed to list external volume classes", func() error { return runGetExternalVolumeClasses(ctx, client, &out, "table", nil) }}, + {"create", "failed to create external volume class", func() error { return runCreateExternalVolumeClass(ctx, client, &out, "yaml", class) }}, + {"delete", "failed to delete external volume class", func() error { return runDeleteExternalVolumeClass(ctx, client, &out, "x", nil) }}, + } { + t.Run(tc.name, func(t *testing.T) { + out.Reset() + err := tc.run() + if !errors.Is(err, boom) || !strings.Contains(err.Error(), tc.want) { + t.Fatalf("err = %v, want %q wrapping boom", err, tc.want) + } + if out.Len() != 0 { + t.Errorf("out = %q, want nothing printed on error", out.String()) + } + }) + } +} diff --git a/cmd/kubectl-ate/internal/printer/csi_driver_config.go b/cmd/kubectl-ate/internal/printer/csi_driver_config.go new file mode 100644 index 0000000000..5b874200b3 --- /dev/null +++ b/cmd/kubectl-ate/internal/printer/csi_driver_config.go @@ -0,0 +1,79 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package printer + +import ( + "cmp" + "fmt" + "io" + "slices" + "text/tabwriter" + + "go.ate.dev/substrate/api/ateapi/v1" +) + +func formatNodeSocketOverride(socket string) string { + if socket == "" { + return "-" + } + return socket +} + +func formatCsiDriverTLS(tls *ateapi.CsiDriverTlsConfig) string { + if !tls.GetEnabled() { + return "disabled" + } + if tls.GetUsePodIdentity() { + return "mtls (pod-identity)" + } + return "enabled" +} + +// PrintCsiDriverConfigsTo prints a slice of CSI driver configs to the provided writer. +func PrintCsiDriverConfigsTo(out io.Writer, configs []*ateapi.CsiDriverConfig, format string) error { + slices.SortFunc(configs, func(a, b *ateapi.CsiDriverConfig) int { + return cmp.Compare(a.GetMetadata().GetName(), b.GetMetadata().GetName()) + }) + switch format { + case "json", "yaml": + return printProto(out, &ateapi.ListCsiDriverConfigsResponse{CsiDriverConfigs: configs}, format) + case "table": + w := tabwriter.NewWriter(out, 0, 0, 3, ' ', 0) + fmt.Fprintln(w, "NAME\tDRIVER\tCONTROLLER-ENDPOINT\tNODE-SOCKET-OVERRIDE\tTLS\tAGE") + for _, c := range configs { + fmt.Fprintf( + w, + "%s\t%s\t%s\t%s\t%s\t%s\n", + c.GetMetadata().GetName(), + c.GetDriverName(), + c.GetControllerEndpoint(), + formatNodeSocketOverride(c.GetNodeSocketOverride()), + formatCsiDriverTLS(c.GetTls()), + formatAge(c.GetMetadata().GetCreateTime()), + ) + } + return w.Flush() + default: + return fmt.Errorf("unsupported format %q", format) + } +} + +// PrintCsiDriverConfigTo prints a single CSI driver config to the provided writer. +func PrintCsiDriverConfigTo(out io.Writer, config *ateapi.CsiDriverConfig, format string) error { + if format == "json" || format == "yaml" { + return printProto(out, config, format) + } + return PrintCsiDriverConfigsTo(out, []*ateapi.CsiDriverConfig{config}, format) +} diff --git a/cmd/kubectl-ate/internal/printer/csi_driver_config_test.go b/cmd/kubectl-ate/internal/printer/csi_driver_config_test.go new file mode 100644 index 0000000000..15750ebb4e --- /dev/null +++ b/cmd/kubectl-ate/internal/printer/csi_driver_config_test.go @@ -0,0 +1,95 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package printer + +import ( + "bytes" + "strings" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "go.ate.dev/substrate/api/ateapi/v1" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func TestPrintCsiDriverConfigs(t *testing.T) { + now := time.Date(2026, 1, 1, 12, 0, 0, 0, time.UTC) + pinNow(t, now) + + csiNFS := &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs", Uid: "u-1", Version: 1, CreateTime: timestamppb.New(now.Add(-10 * time.Minute))}, + DriverName: "nfs.csi.k8s.io", + ControllerEndpoint: "tcp://csi-nfs.kube-system.svc:50052", + NodeSocketOverride: "unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock", + Tls: &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "csi-nfs.kube-system.svc"}, + } + csiPD := &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-pd", CreateTime: timestamppb.New(now.Add(-5 * time.Hour))}, + DriverName: "pd.csi.storage.gke.io", + ControllerEndpoint: "dns:///csi-pd.gke-system.svc:9000", + } + csiCustomTLS := &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-custom", CreateTime: timestamppb.New(now.Add(-30 * time.Second))}, + DriverName: "custom.csi.example.com", + ControllerEndpoint: "tcp://10.0.0.10:9000", + Tls: &ateapi.CsiDriverTlsConfig{Enabled: true}, + } + + var buf bytes.Buffer + if err := PrintCsiDriverConfigsTo(&buf, []*ateapi.CsiDriverConfig{csiPD, csiNFS, csiCustomTLS}, "table"); err != nil { + t.Fatalf("PrintCsiDriverConfigsTo(table) error = %v", err) + } + wantTable := "NAME DRIVER CONTROLLER-ENDPOINT NODE-SOCKET-OVERRIDE TLS AGE\n" + + "csi-custom custom.csi.example.com tcp://10.0.0.10:9000 - enabled 30s\n" + + "csi-nfs nfs.csi.k8s.io tcp://csi-nfs.kube-system.svc:50052 unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock mtls (pod-identity) 10m\n" + + "csi-pd pd.csi.storage.gke.io dns:///csi-pd.gke-system.svc:9000 - disabled 5h\n" + if diff := cmp.Diff(wantTable, buf.String()); diff != "" { + t.Errorf("table mismatch (-want +got):\n%s", diff) + } + + for _, tc := range []struct { + name, format string + single bool + wantSub []string + wantErr bool + }{ + {name: "list json", format: "json", wantSub: []string{`"csiDriverConfigs"`, `"driverName": "nfs.csi.k8s.io"`}}, + {name: "list yaml", format: "yaml", wantSub: []string{"csiDriverConfigs:", "driverName: nfs.csi.k8s.io"}}, + {name: "single json bare object", single: true, format: "json", wantSub: []string{`"driverName": "nfs.csi.k8s.io"`, `"uid": "u-1"`}}, + {name: "single yaml bare object", single: true, format: "yaml", wantSub: []string{"driverName: nfs.csi.k8s.io", "uid: u-1", `version: "1"`}}, + {name: "single table", single: true, format: "table", wantSub: []string{"NAME", "csi-nfs nfs.csi.k8s.io tcp://csi-nfs.kube-system.svc:50052 unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock mtls (pod-identity) 10m"}}, + {name: "unsupported list format", format: "xml", wantErr: true}, + {name: "unsupported single format", single: true, format: "xml", wantErr: true}, + } { + t.Run(tc.name, func(t *testing.T) { + var out bytes.Buffer + var err error + if tc.single { + err = PrintCsiDriverConfigTo(&out, csiNFS, tc.format) + } else { + err = PrintCsiDriverConfigsTo(&out, []*ateapi.CsiDriverConfig{csiNFS}, tc.format) + } + if (err != nil) != tc.wantErr { + t.Fatalf("error = %v, wantErr %v", err, tc.wantErr) + } + for _, w := range tc.wantSub { + if !strings.Contains(out.String(), w) { + t.Errorf("output = %q, want substring %q", out.String(), w) + } + } + }) + } +} diff --git a/cmd/kubectl-ate/internal/printer/external_volume_class.go b/cmd/kubectl-ate/internal/printer/external_volume_class.go new file mode 100644 index 0000000000..4d9cb13a4e --- /dev/null +++ b/cmd/kubectl-ate/internal/printer/external_volume_class.go @@ -0,0 +1,79 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package printer + +import ( + "cmp" + "fmt" + "io" + "maps" + "slices" + "strings" + "text/tabwriter" + + "go.ate.dev/substrate/api/ateapi/v1" +) + +// maxParametersWidth caps the PARAMETERS table column, in runes. -o yaml and +// -o json print every parameter. +const maxParametersWidth = 40 + +func formatParameters(params map[string]string) string { + if len(params) == 0 { + return "-" + } + keys := slices.Sorted(maps.Keys(params)) + for i, k := range keys { + keys[i] = k + "=" + params[k] + } + return truncateColumn(strings.Join(keys, ","), maxParametersWidth) +} + +// truncateColumn shortens s to at most n runes, ending in "..." when it cuts. +func truncateColumn(s string, n int) string { + r := []rune(s) + if len(r) <= n { + return s + } + return string(r[:n-3]) + "..." +} + +// PrintExternalVolumeClassesTo prints a slice of external volume classes to the provided writer. +func PrintExternalVolumeClassesTo(out io.Writer, classes []*ateapi.ExternalVolumeClass, format string) error { + slices.SortFunc(classes, func(a, b *ateapi.ExternalVolumeClass) int { + return cmp.Compare(a.GetMetadata().GetName(), b.GetMetadata().GetName()) + }) + switch format { + case "json", "yaml": + return printProto(out, &ateapi.ListExternalVolumeClassesResponse{ExternalVolumeClasses: classes}, format) + case "table": + w := tabwriter.NewWriter(out, 0, 0, 3, ' ', 0) + fmt.Fprintln(w, "NAME\tDRIVER\tPARAMETERS\tAGE") + for _, c := range classes { + fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", c.GetMetadata().GetName(), c.GetDriverName(), formatParameters(c.GetParameters()), formatAge(c.GetMetadata().GetCreateTime())) + } + return w.Flush() + default: + return fmt.Errorf("unsupported format %q", format) + } +} + +// PrintExternalVolumeClassTo prints a single external volume class to the provided writer. +func PrintExternalVolumeClassTo(out io.Writer, class *ateapi.ExternalVolumeClass, format string) error { + if format == "json" || format == "yaml" { + return printProto(out, class, format) + } + return PrintExternalVolumeClassesTo(out, []*ateapi.ExternalVolumeClass{class}, format) +} diff --git a/cmd/kubectl-ate/internal/printer/external_volume_class_test.go b/cmd/kubectl-ate/internal/printer/external_volume_class_test.go new file mode 100644 index 0000000000..4514d68f28 --- /dev/null +++ b/cmd/kubectl-ate/internal/printer/external_volume_class_test.go @@ -0,0 +1,110 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package printer + +import ( + "bytes" + "strings" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "go.ate.dev/substrate/api/ateapi/v1" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func TestPrintExternalVolumeClasses(t *testing.T) { + now := time.Date(2026, 1, 1, 12, 0, 0, 0, time.UTC) + pinNow(t, now) + + fastSSD := &ateapi.ExternalVolumeClass{ + Metadata: &ateapi.ResourceMetadata{Name: "fast-ssd", Uid: "u-1", Version: 1, CreateTime: timestamppb.New(now.Add(-10 * time.Minute))}, + DriverName: "pd.csi.storage.gke.io", + Parameters: map[string]string{"type": "pd-ssd", "replication-type": "none"}, + } + standardRWO := &ateapi.ExternalVolumeClass{ + Metadata: &ateapi.ResourceMetadata{Name: "standard-rwo", CreateTime: timestamppb.New(now.Add(-5 * time.Hour))}, + DriverName: "pd.csi.storage.gke.io", + } + + var buf bytes.Buffer + if err := PrintExternalVolumeClassesTo(&buf, []*ateapi.ExternalVolumeClass{standardRWO, fastSSD}, "table"); err != nil { + t.Fatalf("PrintExternalVolumeClassesTo(table) error = %v", err) + } + wantTable := "NAME DRIVER PARAMETERS AGE\n" + + "fast-ssd pd.csi.storage.gke.io replication-type=none,type=pd-ssd 10m\n" + + "standard-rwo pd.csi.storage.gke.io - 5h\n" + if diff := cmp.Diff(wantTable, buf.String()); diff != "" { + t.Errorf("table mismatch (-want +got):\n%s", diff) + } + + for _, tc := range []struct { + name, format string + single bool + wantSub []string + wantErr bool + }{ + {name: "list json", format: "json", wantSub: []string{`"externalVolumeClasses"`, `"driverName": "pd.csi.storage.gke.io"`}}, + {name: "list yaml", format: "yaml", wantSub: []string{"externalVolumeClasses:", "driverName: pd.csi.storage.gke.io"}}, + {name: "single yaml bare object", single: true, format: "yaml", wantSub: []string{"driverName: pd.csi.storage.gke.io", "uid: u-1", `version: "1"`}}, + {name: "single table", single: true, format: "table", wantSub: []string{"NAME", "fast-ssd pd.csi.storage.gke.io replication-type=none,type=pd-ssd 10m"}}, + {name: "unsupported format", single: true, format: "xml", wantErr: true}, + } { + t.Run(tc.name, func(t *testing.T) { + var out bytes.Buffer + err := PrintExternalVolumeClassesTo(&out, []*ateapi.ExternalVolumeClass{fastSSD}, tc.format) + if tc.single { + out.Reset() + err = PrintExternalVolumeClassTo(&out, fastSSD, tc.format) + } + if (err != nil) != tc.wantErr { + t.Fatalf("error = %v, wantErr %v", err, tc.wantErr) + } + for _, w := range tc.wantSub { + if !strings.Contains(out.String(), w) { + t.Errorf("output = %q, want substring %q", out.String(), w) + } + } + }) + } +} + +func TestPrintExternalVolumeClassTruncatesParameters(t *testing.T) { + nfs := &ateapi.ExternalVolumeClass{ + Metadata: &ateapi.ResourceMetadata{Name: "nfs"}, + DriverName: "nfs.csi.k8s.io", + Parameters: map[string]string{"server": "nfs-server.default.svc.cluster.local", "share": "/exports/team-a"}, + } + var table bytes.Buffer + if err := PrintExternalVolumeClassTo(&table, nfs, "table"); err != nil { + t.Fatal(err) + } + // "server=nfs-server.default.svc.cluster" is 37 runes; +"..." = 40. + if got := table.String(); !strings.Contains(got, "server=nfs-server.default.svc.cluster...") || strings.Contains(got, "share=") { + t.Errorf("table = %q, want PARAMETERS cut to 40 runes", got) + } + var yamlOut bytes.Buffer + if err := PrintExternalVolumeClassTo(&yamlOut, nfs, "yaml"); err != nil { + t.Fatal(err) + } + for _, w := range []string{"server: nfs-server.default.svc.cluster.local", "share: /exports/team-a"} { + if !strings.Contains(yamlOut.String(), w) { + t.Errorf("yaml = %q, want lossless %q", yamlOut.String(), w) + } + } + if got := truncateColumn("ééééé", 4); got != "é..." { + t.Errorf(`truncateColumn("ééééé", 4) = %q, want "é..."`, got) + } +} diff --git a/docs/guides/authorization.md b/docs/guides/authorization.md index 4de4c65184..c88c15ec38 100644 --- a/docs/guides/authorization.md +++ b/docs/guides/authorization.md @@ -129,6 +129,10 @@ one **atespace**. | Create an actor from a tag (`sourceTag`) | ✅ | | ✅ | ✅ | | | Workers: get, list, list assignments | ✅ | ✅ | | | | | Workers: create, update, delete, drain | ✅ | | | | | +| External volume classes: get, list | ✅ | ✅ | | | | +| External volume classes: create, delete | ✅ | | | | | +| CSI driver configs: get, list | ✅ | ✅ | | | | +| CSI driver configs: create, update, delete | ✅ | | | | | ### System roles @@ -143,7 +147,7 @@ through their pod certificates. `ate-api-server`'s `--controller-spiffe-id`, | `controller` | `ate-controller` | Create, get, list, update, delete and drain workers | | `egress_gateway` | `atenet-egress`, and any other SPIFFE IDs passed with `--egress-gateway-spiffe-id`, which ate-setup sets from `ATE_EGRESS_GATEWAY_EXTRA_SPIFFE_IDS` | Get actors and their egress policies; list actors across all atespaces; mint actor JWTs | | `ingress_router` | `atenet-router` | Resume actors; list actors across all atespaces | -| `atelet` | `atelet` | Get actors' egress policies, for the worker that enforces them | +| `atelet` | `atelet` | Get actors' egress policies, for the worker that enforces them; get and list CSI driver configs | | `api_server_sidecar` | the `ate-api-server` pod identity, which its sidecars share, today the objectstore control plugin | Get actors, to derive the snapshot prefixes a per-actor storage credential may cover | Only `egress_gateway` can mint actor credentials: not even a global owner can, @@ -216,6 +220,31 @@ Workers have no atespace; their permissions come from the global scope. | `DrainWorker` | `can_drain`, the worker | Global owner; `ate-controller` | | `ListWorkerActorAssignments` | `can_list_actor_assignments`, the worker | Global viewer | +### External volume classes + +External volume classes have no atespace; their permissions come from the +global scope. + +| RPC | Permission, on | Allowed for | +|---|---|---| +| `CreateExternalVolumeClass` | `can_create_external_volume_class`, global | Global owner | +| `ListExternalVolumeClasses` | `can_list_external_volume_classes`, global | Global viewer | +| `GetExternalVolumeClass` | `can_get`, the class | Global viewer | +| `DeleteExternalVolumeClass` | `can_delete`, the class | Global owner | + +### CSI driver configs + +CSI driver configs have no atespace; their permissions come from the global +scope. + +| RPC | Permission, on | Allowed for | +|---|---|---| +| `CreateCsiDriverConfig` | `can_create_csi_driver_config`, global | Global owner | +| `ListCsiDriverConfigs` | `can_list_csi_driver_configs`, global | Global viewer; `atelet` | +| `GetCsiDriverConfig` | `can_get`, the config | Global viewer; `atelet` | +| `UpdateCsiDriverConfig` | `can_update`, the config | Global owner | +| `DeleteCsiDriverConfig` | `can_delete`, the config | Global owner | + ### WorkerService The interceptor skips these; each handler requires `atelet`'s pod diff --git a/docs/reference/kubectl-ate.md b/docs/reference/kubectl-ate.md index 6e3e9819ca..11b386746f 100644 --- a/docs/reference/kubectl-ate.md +++ b/docs/reference/kubectl-ate.md @@ -4,7 +4,7 @@ linkTitle: "CLI Reference" weight: 3 card_icon: "fa-solid fa-terminal" description: > - Manage atespaces, actor templates, actors, snapshots, egress policies, and logs with the kubectl-ate plugin. + Manage atespaces, external volume classes, CSI driver configs, actor templates, actors, snapshots, egress policies, and logs with the kubectl-ate plugin. --- # `kubectl-ate` @@ -102,7 +102,7 @@ kubectl ate top workers > **Note:** `get actors` requires either `--atespace ` / `-a ` (one atespace) or `-A`/`--all-atespaces` (all atespaces) — there is no default atespace. Getting a single actor always requires `--atespace`/`-a`, since an actor is addressed by `(atespace, name)`. `-a` (lower-case) scopes to one atespace; `-A` (upper-case) spans all. -> **Note:** Actors, workers, and actor templates are not Kubernetes CRDs — they live in the Substrate control plane's PostgreSQL database, not `etcd`. `kubectl get actor`, `kubectl get worker`, and `kubectl get actortemplate` will not return anything; only `kubectl ate get …` queries the control plane (see [Actor Templates](#actor-templates)). `kubectl get workerpool` *does* work, because pools are CRDs. +> **Note:** Actors, workers, actor templates, external volume classes, and CSI driver configs live in the Substrate control plane's PostgreSQL database, not `etcd`. `kubectl get actor`, `kubectl get worker`, `kubectl get actortemplate`, and `kubectl get externalvolumeclass` return nothing; only `kubectl ate get …` queries the control plane (see [Actor Templates](#actor-templates), [External Volume Classes](#external-volume-classes), and [CSI Driver Configs](#csi-driver-configs)). `kubectl get csidriverconfig` lists the `ate.dev/v1` `CSIDriverConfig` CRD objects, which are separate from the control-plane `CsiDriverConfig` that `kubectl ate get csi-driver-config` shows. `kubectl get workerpool` *does* work, because pools are CRDs. #### `kubectl ate get actor` output columns @@ -157,6 +157,93 @@ kubectl ate delete atespace | `NAME` | The atespace name. Globally unique — atespaces are global-scoped. | | `AGE` | Time elapsed since the atespace was created. | +### External Volume Classes + +An **external volume class** (`ExternalVolumeClass`) is a global-scoped resource that names the CSI driver (`driverName`) and driver-specific `parameters` used to provision external volumes for actors. External volume classes are immutable. To change one, delete and recreate it. Creating an external volume class requires the `ExternalVolumes` preview gate on the server and `--preview` on the CLI. + +Example `volume-class.yaml`: + +```yaml +metadata: + name: csi-nfs +driverName: nfs.csi.k8s.io +parameters: + server: nfs-server.default.svc.cluster.local + share: / +``` + +```bash +# Create an external volume class from a manifest (protojson-shaped +# ateapi.ExternalVolumeClass, a single YAML/JSON document; use -f - for stdin). +kubectl ate create external-volume-class -f volume-class.yaml --preview + +# List all external volume classes, or get one (also: -o yaml prints the re-applyable manifest). +kubectl ate get external-volume-classes +kubectl ate get external-volume-class -o yaml + +# Delete an external volume class (optionally guarded by --uid and/or --version). +kubectl ate delete external-volume-class +kubectl ate delete external-volume-class --uid --version +``` + +#### `kubectl ate get external-volume-class` output columns + +| Column | Meaning | +|---|---| +| `NAME` | The external volume class name. Globally unique; external volume classes are global-scoped. | +| `DRIVER` | The CSI driver name (`driverName`) that provisions volumes of this class. | +| `PARAMETERS` | Comma-separated `key=value` driver parameters sorted by key, cut to 40 characters with `...`; `-o yaml` shows them all. `-` when the class defines no parameters. | +| `AGE` | Time elapsed since the external volume class was created. | + +### CSI Driver Configs + +A **CSI driver config** (`CsiDriverConfig`) is a global-scoped resource that records connection settings for a CSI driver (`driverName`): its controller gRPC endpoint (`controllerEndpoint`), optional node plugin socket (`nodeSocketOverride`), and mTLS settings (`tls`). Both `ate-api-server` and `atelet` read this resource first and fall back to the `ate.dev/v1` `CSIDriverConfig` CRD when no control-plane config matches (see [CSI Volumes](../guides/csi-volumes.md)). `driverName` is immutable after creation, while `controllerEndpoint`, `nodeSocketOverride`, and `tls` can be replaced with `update`. Creating or updating a CSI driver config requires the `ExternalVolumes` preview gate on the server and `--preview` on the CLI, and deleting fails while an external volume class references its `driverName`. + +Example `csi-driver-config.yaml`: + +```yaml +metadata: + name: csi-nfs +driverName: nfs.csi.k8s.io +controllerEndpoint: tcp://csi-nfs-controller.kube-system.svc.cluster.local:50052 +nodeSocketOverride: unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock +tls: + enabled: true + usePodIdentity: true + serverName: csi-nfs-controller.kube-system.svc +``` + +```bash +# Create a CSI driver config from a manifest (protojson-shaped +# ateapi.CsiDriverConfig, a single YAML/JSON document; use -f - for stdin). +kubectl ate create csi-driver-config -f csi-driver-config.yaml --preview + +# List all CSI driver configs, or get one (also: -o yaml prints the re-applyable manifest). +kubectl ate get csi-driver-configs +kubectl ate get csi-driver-config -o yaml + +# Replace a CSI driver config: dump it (with metadata.uid and metadata.version), +# edit mutable fields, and send it back. +kubectl ate get csi-driver-config -o yaml > csi-driver-config.yaml +$EDITOR csi-driver-config.yaml +kubectl ate update csi-driver-config -f csi-driver-config.yaml --preview + +# Delete a CSI driver config (optionally guarded by --uid and/or --version). +kubectl ate delete csi-driver-config +kubectl ate delete csi-driver-config --uid --version +``` + +#### `kubectl ate get csi-driver-config` output columns + +| Column | Meaning | +|---|---| +| `NAME` | The CSI driver config name. Globally unique; CSI driver configs are global-scoped. | +| `DRIVER` | The unique CSI driver name (`driverName`) this config binds to. | +| `CONTROLLER-ENDPOINT` | The CSI controller gRPC endpoint (`tcp://:` or `dns://[]/:`). | +| `NODE-SOCKET-OVERRIDE` | Custom `unix://` node plugin socket path, or `-` when using the default kubelet plugin path. | +| `TLS` | Controller connection TLS mode: `mtls (pod-identity)`, `enabled`, or `disabled`. | +| `AGE` | Time elapsed since the CSI driver config was created. | + ### Actor Templates An **actor template** describes what an actor runs: containers, volumes, diff --git a/docs/reference/resource-model.md b/docs/reference/resource-model.md index 05fa1136ef..77050471ff 100644 --- a/docs/reference/resource-model.md +++ b/docs/reference/resource-model.md @@ -45,6 +45,8 @@ Global │ ├── Actor │ │ └── EgressPolicy "default" subresource (singleton) │ └── Tag +├── ExternalVolumeClass +├── CsiDriverConfig └── Worker └── ActorAssignment subresource (one per hosted Actor, managed by Substrate) ``` @@ -57,6 +59,8 @@ Global | `ActorTemplate` | Atespace | 0..N | Clients | | `Actor` | Atespace | 0..N | Clients | | `Tag` | Atespace | 0..N | Clients | +| `ExternalVolumeClass` | Global | 0..N | Clients | +| `CsiDriverConfig` | Global | 0..N | Clients | | `Worker` | Global | 0..N | Substrate | ## Subresources @@ -99,6 +103,8 @@ classDiagram class Tag class Worker class ActorAssignment + class ExternalVolumeClass + class CsiDriverConfig } Atespace "1" *-- "0..1" AtespaceAccessPolicy @@ -112,6 +118,7 @@ classDiagram Tag "*" --> "1" Actor : source_actor ActorAssignment "0..1" --> "1" Actor : actor ActorTemplate ..> WorkerPool : worker_selector + ExternalVolumeClass ..> CsiDriverConfig : driver_name WorkerPool ..> SandboxConfig : sandboxClasses WorkerPool "1" *-- "*" WorkerPod Worker "1" --> "1" WorkerPod diff --git a/internal/volume/csi/k8s_getter.go b/internal/volume/csi/k8s_getter.go new file mode 100644 index 0000000000..46e53d0dc5 --- /dev/null +++ b/internal/volume/csi/k8s_getter.go @@ -0,0 +1,103 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package csi + +import ( + "context" + "errors" + "fmt" + "slices" + "strconv" + "strings" + + "go.ate.dev/substrate/api/ateapi/v1" + atev1 "go.ate.dev/substrate/api/infra/k8s/ate/v1" + atelisters "go.ate.dev/substrate/pkg/client/listers/ate/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// FromK8sCSIDriverConfig converts a Kubernetes CSIDriverConfig CRD object to +// a CsiDriverConfig protobuf message. +func FromK8sCSIDriverConfig(crd *atev1.CSIDriverConfig) *ateapi.CsiDriverConfig { + if crd == nil { + return nil + } + meta := &ateapi.ResourceMetadata{ + Name: crd.Name, + Uid: string(crd.UID), + } + if v, err := strconv.ParseInt(crd.ResourceVersion, 10, 64); err == nil && v > 0 { + meta.Version = v + } + out := &ateapi.CsiDriverConfig{ + Metadata: meta, + DriverName: crd.Spec.DriverName, + ControllerEndpoint: crd.Spec.ControllerEndpoint, + NodeSocketOverride: crd.Spec.NodeSocketOverride, + } + if crd.Spec.TLS != nil { + out.Tls = &ateapi.CsiDriverTlsConfig{ + Enabled: crd.Spec.TLS.Enabled, + UsePodIdentity: crd.Spec.TLS.UsePodIdentity, + ServerName: crd.Spec.TLS.ServerName, + } + } + return out +} + +type k8sCSIDriverConfigGetter struct { + lister atelisters.CSIDriverConfigLister +} + +// NewK8sCSIDriverConfigGetter adapts a Kubernetes CSIDriverConfigLister to CSIDriverConfigGetter. +func NewK8sCSIDriverConfigGetter(lister atelisters.CSIDriverConfigLister) CSIDriverConfigGetter { + return &k8sCSIDriverConfigGetter{lister: lister} +} + +func (g *k8sCSIDriverConfigGetter) Get(_ context.Context, driverName string) (*ateapi.CsiDriverConfig, error) { + if g.lister == nil { + return nil, errors.New("missing csiDriverConfigLister") + } + crd, err := g.lister.Get(driverName) + if err == nil && crd != nil && (crd.Spec.DriverName == "" || crd.Spec.DriverName == driverName) { + return FromK8sCSIDriverConfig(crd), nil + } + crds, listErr := g.lister.List(labels.Everything()) + if listErr != nil { + if err != nil { + return nil, errors.Join(err, listErr) + } + return nil, listErr + } + var matched *atev1.CSIDriverConfig + var matchedNames []string + for _, item := range crds { + if item != nil && item.Spec.DriverName == driverName { + matched = item + matchedNames = append(matchedNames, item.Name) + } + } + if len(matchedNames) > 1 { + slices.Sort(matchedNames) + return nil, fmt.Errorf("multiple CSIDriverConfigs match driver %q: %s", driverName, strings.Join(matchedNames, ", ")) + } + if matched != nil { + return FromK8sCSIDriverConfig(matched), nil + } + if err != nil { + return nil, err + } + return nil, fmt.Errorf("CSIDriverConfig for driver %q not found", driverName) +} diff --git a/internal/volume/csi/k8s_getter_test.go b/internal/volume/csi/k8s_getter_test.go new file mode 100644 index 0000000000..022a2df936 --- /dev/null +++ b/internal/volume/csi/k8s_getter_test.go @@ -0,0 +1,145 @@ +// Copyright 2026 The Agent Substrate Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package csi + +import ( + "errors" + "fmt" + "strings" + "testing" + + "github.com/google/go-cmp/cmp" + "go.ate.dev/substrate/api/ateapi/v1" + atev1 "go.ate.dev/substrate/api/infra/k8s/ate/v1" + atelisters "go.ate.dev/substrate/pkg/client/listers/ate/v1" + "google.golang.org/protobuf/testing/protocmp" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/types" +) + +func TestFromK8sCSIDriverConfig(t *testing.T) { + t.Parallel() + for _, tc := range []struct { + name string + in *atev1.CSIDriverConfig + want *ateapi.CsiDriverConfig + }{ + {name: "nil input", in: nil, want: nil}, + { + name: "full fields with TLS and numeric ResourceVersion", + in: &atev1.CSIDriverConfig{ + ObjectMeta: metav1.ObjectMeta{Name: "csi-nfs", UID: types.UID("uid-123"), ResourceVersion: "42"}, + Spec: atev1.CSIDriverConfigSpec{ + DriverName: "nfs.csi.k8s.io", + ControllerEndpoint: "tcp://csi-nfs.kube-system.svc:50052", + NodeSocketOverride: "unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock", + TLS: &atev1.CSIDriverTLSConfig{Enabled: true, UsePodIdentity: true, ServerName: "csi-nfs.kube-system.svc"}, + }, + }, + want: &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "csi-nfs", Uid: "uid-123", Version: 42}, + DriverName: "nfs.csi.k8s.io", + ControllerEndpoint: "tcp://csi-nfs.kube-system.svc:50052", + NodeSocketOverride: "unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock", + Tls: &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true, ServerName: "csi-nfs.kube-system.svc"}, + }, + }, + { + name: "non-numeric ResourceVersion leaves version zero", + in: &atev1.CSIDriverConfig{ + ObjectMeta: metav1.ObjectMeta{Name: "pd.csi.storage.gke.io", UID: types.UID("uid-pd"), ResourceVersion: "rv-opaque"}, + Spec: atev1.CSIDriverConfigSpec{DriverName: "pd.csi.storage.gke.io", ControllerEndpoint: "dns:///pd-csi:9000"}, + }, + want: &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: "pd.csi.storage.gke.io", Uid: "uid-pd"}, + DriverName: "pd.csi.storage.gke.io", + ControllerEndpoint: "dns:///pd-csi:9000", + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + if diff := cmp.Diff(tc.want, FromK8sCSIDriverConfig(tc.in), protocmp.Transform()); diff != "" { + t.Fatalf("FromK8sCSIDriverConfig() mismatch (-want +got):\n%s", diff) + } + }) + } +} + +type fakeK8sCSIDriverConfigLister struct { + items []*atev1.CSIDriverConfig + listErr error +} + +func (f *fakeK8sCSIDriverConfigLister) List(labels.Selector) ([]*atev1.CSIDriverConfig, error) { + return f.items, f.listErr +} + +func (f *fakeK8sCSIDriverConfigLister) Get(name string) (*atev1.CSIDriverConfig, error) { + for _, item := range f.items { + if item != nil && item.Name == name { + return item, nil + } + } + return nil, fmt.Errorf("csidriverconfig.ate.dev %q not found", name) +} + +var _ atelisters.CSIDriverConfigLister = (*fakeK8sCSIDriverConfigLister)(nil) + +func TestNewK8sCSIDriverConfigGetter(t *testing.T) { + t.Parallel() + crd := func(name, uid, driver, ep string) *atev1.CSIDriverConfig { + return &atev1.CSIDriverConfig{ + ObjectMeta: metav1.ObjectMeta{Name: name, UID: types.UID(uid)}, + Spec: atev1.CSIDriverConfigSpec{DriverName: driver, ControllerEndpoint: ep}, + } + } + sameName := crd("nfs.csi.k8s.io", "u-same", "nfs.csi.k8s.io", "tcp://127.0.0.1:9001") + diffName := crd("pd-custom", "u-diff", "pd.csi.storage.gke.io", "tcp://127.0.0.1:9002") + dupDiffName := crd("pd-alpha", "u-dup", "pd.csi.storage.gke.io", "tcp://127.0.0.1:9003") + mismatched := crd("pd.csi.storage.gke.io", "u-wrong", "other.csi.io", "tcp://127.0.0.1:9999") + listBoom := errors.New("lister failed") + + for _, tc := range []struct { + name, driverName, wantErr string + lister atelisters.CSIDriverConfigLister + want *ateapi.CsiDriverConfig + }{ + {name: "nil lister", driverName: "nfs.csi.k8s.io", wantErr: "missing csiDriverConfigLister"}, + {name: "metadata.name matches driverName", lister: &fakeK8sCSIDriverConfigLister{items: []*atev1.CSIDriverConfig{sameName}}, driverName: "nfs.csi.k8s.io", want: FromK8sCSIDriverConfig(sameName)}, + {name: "metadata.name differs from spec.driverName", lister: &fakeK8sCSIDriverConfigLister{items: []*atev1.CSIDriverConfig{diffName}}, driverName: "pd.csi.storage.gke.io", want: FromK8sCSIDriverConfig(diffName)}, + {name: "duplicate spec.driverName fails deterministically", lister: &fakeK8sCSIDriverConfigLister{items: []*atev1.CSIDriverConfig{diffName, dupDiffName}}, driverName: "pd.csi.storage.gke.io", wantErr: `multiple CSIDriverConfigs match driver "pd.csi.storage.gke.io": pd-alpha, pd-custom`}, + {name: "metadata.name collision skips mismatched spec.driverName", lister: &fakeK8sCSIDriverConfigLister{items: []*atev1.CSIDriverConfig{mismatched, diffName}}, driverName: "pd.csi.storage.gke.io", want: FromK8sCSIDriverConfig(diffName)}, + {name: "metadata.name collision with no match returns not found", lister: &fakeK8sCSIDriverConfigLister{items: []*atev1.CSIDriverConfig{mismatched}}, driverName: "pd.csi.storage.gke.io", wantErr: `CSIDriverConfig for driver "pd.csi.storage.gke.io" not found`}, + {name: "list error after Get miss joins errors", lister: &fakeK8sCSIDriverConfigLister{listErr: listBoom}, driverName: "missing.csi.io", wantErr: "lister failed"}, + {name: "list error after mismatched Get returns listErr", lister: &fakeK8sCSIDriverConfigLister{items: []*atev1.CSIDriverConfig{mismatched}, listErr: listBoom}, driverName: "pd.csi.storage.gke.io", wantErr: "lister failed"}, + {name: "not found returns lister Get error", lister: &fakeK8sCSIDriverConfigLister{items: []*atev1.CSIDriverConfig{sameName}}, driverName: "missing.csi.io", wantErr: `csidriverconfig.ate.dev "missing.csi.io" not found`}, + } { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + got, err := NewK8sCSIDriverConfigGetter(tc.lister).Get(t.Context(), tc.driverName) + if tc.wantErr != "" { + if err == nil || !strings.Contains(err.Error(), tc.wantErr) { + t.Fatalf("Get(%q) error = %v, want substring %q", tc.driverName, err, tc.wantErr) + } + return + } + if err != nil || cmp.Diff(tc.want, got, protocmp.Transform()) != "" { + t.Fatalf("Get(%q) = (%v, %v), want %v", tc.driverName, got, err, tc.want) + } + }) + } +} diff --git a/internal/volume/csi/plugin.go b/internal/volume/csi/plugin.go index 39a17207fb..1180f4943e 100644 --- a/internal/volume/csi/plugin.go +++ b/internal/volume/csi/plugin.go @@ -25,7 +25,7 @@ import ( "sync" "github.com/container-storage-interface/spec/lib/go/csi" - atev1 "go.ate.dev/substrate/api/infra/k8s/ate/v1" + "go.ate.dev/substrate/api/ateapi/v1" "go.ate.dev/substrate/internal/credbundle" "go.ate.dev/substrate/internal/nodepath" "go.ate.dev/substrate/internal/volume" @@ -50,7 +50,7 @@ var defaultTLSPaths = tlsPaths{ caCert: DefaultCACertPath, } -// Plugin implements volume.VolumePluginWorkerPlane using the CSI Client. +// Plugin implements volume.VolumePluginControlPlane and volume.VolumePluginWorkerPlane using the CSI Client. type Plugin struct { client *Client stagingDirPrefix string @@ -76,6 +76,14 @@ func NewPlugin(client *Client) *Plugin { } } +// Close closes the underlying CSI client connection. +func (p *Plugin) Close() error { + if p == nil || p.client == nil { + return nil + } + return p.client.Close() +} + // SupportsControllerCapability reports whether the driver supports the given controller RPC. func (p *Plugin) SupportsControllerCapability(rpc csi.ControllerServiceCapability_RPC_Type) bool { p.capsMu.RLock() @@ -375,10 +383,9 @@ func getStandardCapabilities() []*csi.VolumeCapability { } } -// CSIDriverConfigGetter provides access to retrieve a CSIDriverConfig by name. -// Both atelisters.CSIDriverConfigLister and direct client getters implement this interface. +// CSIDriverConfigGetter retrieves a CsiDriverConfig by CSI driver name. type CSIDriverConfigGetter interface { - Get(name string) (*atev1.CSIDriverConfig, error) + Get(ctx context.Context, driverName string) (*ateapi.CsiDriverConfig, error) } // NewCSIPlugin establishes a CSI client and returns a verified Plugin instance. @@ -386,23 +393,36 @@ func NewCSIPlugin(ctx context.Context, getter CSIDriverConfigGetter, driverName return newCSIPlugin(ctx, getter, driverName, isController, defaultTLSPaths) } +// NewCSIPluginFromConfig establishes a CSI client from cfg and returns a verified Plugin instance. +func NewCSIPluginFromConfig(ctx context.Context, cfg *ateapi.CsiDriverConfig, driverName string, isController bool) (*Plugin, error) { + return newCSIPluginFromConfig(ctx, cfg, driverName, isController, defaultTLSPaths) +} + func newCSIPlugin(ctx context.Context, getter CSIDriverConfigGetter, driverName string, isController bool, paths tlsPaths) (*Plugin, error) { if getter == nil { return nil, fmt.Errorf("missing csiDriverConfigGetter") } - cfg, err := getter.Get(driverName) + cfg, err := getter.Get(ctx, driverName) if err != nil { - return nil, fmt.Errorf("failed to retrieve CSIDriverConfig for %q: %w", driverName, err) + return nil, fmt.Errorf("failed to retrieve CsiDriverConfig for %q: %w", driverName, err) + } + + return newCSIPluginFromConfig(ctx, cfg, driverName, isController, paths) +} + +func newCSIPluginFromConfig(ctx context.Context, cfg *ateapi.CsiDriverConfig, driverName string, isController bool, paths tlsPaths) (*Plugin, error) { + if cfg == nil { + return nil, fmt.Errorf("missing CsiDriverConfig for %q", driverName) } var endpoint string switch { case isController: - endpoint = cfg.Spec.ControllerEndpoint - case cfg.Spec.NodeSocketOverride != "": - endpoint = cfg.Spec.NodeSocketOverride - slog.InfoContext(ctx, "Found CSIDriverConfig with NodeSocketOverride", slog.String("driver", driverName), slog.String("endpoint", endpoint)) + endpoint = cfg.GetControllerEndpoint() + case cfg.GetNodeSocketOverride() != "": + endpoint = cfg.GetNodeSocketOverride() + slog.InfoContext(ctx, "Found CsiDriverConfig with NodeSocketOverride", slog.String("driver", driverName), slog.String("endpoint", endpoint)) default: endpoint = "unix://" + kubeletPluginSocketPath(driverName) } @@ -443,19 +463,20 @@ func newCSIPlugin(ctx context.Context, getter CSIDriverConfigGetter, driverName return csiPlugin, nil } -func resolveTLSConfig(cfg *atev1.CSIDriverConfig, paths tlsPaths) (*tls.Config, error) { - if cfg == nil || cfg.Spec.TLS == nil || !cfg.Spec.TLS.Enabled { +func resolveTLSConfig(cfg *ateapi.CsiDriverConfig, paths tlsPaths) (*tls.Config, error) { + if !cfg.GetTls().GetEnabled() { return nil, nil } - tlsCfg := cfg.Spec.TLS + tlsCfg := cfg.GetTls() - if !tlsCfg.UsePodIdentity { + if !tlsCfg.GetUsePodIdentity() { // TODO: Support manual certificates loaded from Secrets specified in the config. return nil, fmt.Errorf("only pod identity TLS is supported in this configuration") } - if tlsCfg.ServerName == "" { + serverName := tlsCfg.GetServerName() + if serverName == "" { return nil, fmt.Errorf("tls.serverName is required when TLS is enabled") } @@ -468,7 +489,7 @@ func resolveTLSConfig(cfg *atev1.CSIDriverConfig, paths tlsPaths) (*tls.Config, return &tls.Config{ MinVersion: tls.VersionTLS13, - ServerName: tlsCfg.ServerName, + ServerName: serverName, // NextProtos configures ALPN h2 for gRPC over TLS. NextProtos: []string{"h2"}, // Load Client Certificate dynamically. @@ -503,7 +524,7 @@ func resolveTLSConfig(cfg *atev1.CSIDriverConfig, paths tlsPaths) (*tls.Config, leaf := state.PeerCertificates[0] opts := x509.VerifyOptions{ - DNSName: tlsCfg.ServerName, + DNSName: serverName, Roots: roots, Intermediates: intermediates, KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, diff --git a/internal/volume/csi/plugin_test.go b/internal/volume/csi/plugin_test.go index 9e9ad33916..7c845fe06f 100644 --- a/internal/volume/csi/plugin_test.go +++ b/internal/volume/csi/plugin_test.go @@ -20,6 +20,7 @@ import ( "net" "os" "path/filepath" + "strings" "testing" "github.com/container-storage-interface/spec/lib/go/csi" @@ -804,12 +805,12 @@ func TestNewCSIPlugin_CapabilityQueryFailureIsNotFatal(t *testing.T) { defer cleanup() cfg := driverConfig(endpoint, nil) - cfg.Spec.NodeSocketOverride = endpoint - plugin, err := newCSIPlugin(t.Context(), &mockLister{cfg: cfg}, mockDriverName, isController, tlsPaths{}) + cfg.NodeSocketOverride = endpoint + plugin, err := newCSIPlugin(t.Context(), &mockGetter{cfg: cfg}, mockDriverName, isController, tlsPaths{}) if err != nil { t.Fatalf("newCSIPlugin failed: %v", err) } - defer plugin.client.Close() + defer plugin.Close() if isController && !plugin.SupportsControllerCapability(csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME) { t.Errorf("expected PUBLISH_UNPUBLISH_VOLUME to be true") @@ -820,3 +821,43 @@ func TestNewCSIPlugin_CapabilityQueryFailureIsNotFatal(t *testing.T) { }) } } + +func TestPlugin_CloseAndNewCSIPluginFromConfig(t *testing.T) { + var nilPlugin *Plugin + if err := nilPlugin.Close(); err != nil { + t.Fatalf("nilPlugin.Close() = %v, want nil", err) + } + if err := (&Plugin{}).Close(); err != nil { + t.Fatalf("emptyPlugin.Close() = %v, want nil", err) + } + + ctx := t.Context() + if _, err := NewCSIPlugin(ctx, nil, mockDriverName, true); err == nil || !strings.Contains(err.Error(), "missing csiDriverConfigGetter") { + t.Fatalf("NewCSIPlugin(nil getter) error = %v, want missing csiDriverConfigGetter", err) + } + if _, err := NewCSIPlugin(ctx, &mockGetter{}, "other-driver", true); err == nil || !strings.Contains(err.Error(), "failed to retrieve CsiDriverConfig") { + t.Fatalf("NewCSIPlugin(missing driver) error = %v, want failed to retrieve CsiDriverConfig", err) + } + if _, err := NewCSIPluginFromConfig(ctx, nil, mockDriverName, true); err == nil || !strings.Contains(err.Error(), "missing CsiDriverConfig") { + t.Fatalf("NewCSIPluginFromConfig(nil) error = %v, want missing CsiDriverConfig", err) + } + + endpoint, cleanup := startMockCSIDriver(t, &mockCSIDriver{}) + defer cleanup() + + cfg := driverConfig(endpoint, nil) + cfg.NodeSocketOverride = endpoint + plugin, err := NewCSIPluginFromConfig(ctx, cfg, mockDriverName, false) + if err != nil { + t.Fatalf("NewCSIPluginFromConfig() error = %v", err) + } + if got, err := plugin.DriverName(ctx); err != nil || got != mockDriverName { + t.Fatalf("DriverName() = (%q, %v), want %q", got, err, mockDriverName) + } + if err := plugin.Close(); err != nil { + t.Fatalf("plugin.Close() error = %v", err) + } + if _, err := plugin.DriverName(ctx); err == nil { + t.Fatal("DriverName() after Close() succeeded, want error") + } +} diff --git a/internal/volume/csi/tls_test.go b/internal/volume/csi/tls_test.go index 2af87fc07a..43af0088be 100644 --- a/internal/volume/csi/tls_test.go +++ b/internal/volume/csi/tls_test.go @@ -15,6 +15,7 @@ package csi import ( + "context" "crypto/ecdsa" "crypto/elliptic" "crypto/rand" @@ -33,11 +34,9 @@ import ( "time" "github.com/container-storage-interface/spec/lib/go/csi" - atev1 "go.ate.dev/substrate/api/infra/k8s/ate/v1" - atelisters "go.ate.dev/substrate/pkg/client/listers/ate/v1" + "go.ate.dev/substrate/api/ateapi/v1" "google.golang.org/grpc" "google.golang.org/grpc/credentials" - "k8s.io/apimachinery/pkg/labels" ) const mockDriverName = "mock-driver" @@ -179,13 +178,12 @@ func startTLSServer(t *testing.T, serverCert tls.Certificate, clientCAs *x509.Ce return lis.Addr().String() } -func driverConfig(endpoint string, tlsCfg *atev1.CSIDriverTLSConfig) *atev1.CSIDriverConfig { - return &atev1.CSIDriverConfig{ - Spec: atev1.CSIDriverConfigSpec{ - DriverName: mockDriverName, - ControllerEndpoint: endpoint, - TLS: tlsCfg, - }, +func driverConfig(endpoint string, tlsCfg *ateapi.CsiDriverTlsConfig) *ateapi.CsiDriverConfig { + return &ateapi.CsiDriverConfig{ + Metadata: &ateapi.ResourceMetadata{Name: mockDriverName}, + DriverName: mockDriverName, + ControllerEndpoint: endpoint, + Tls: tlsCfg, } } @@ -194,29 +192,25 @@ func driverConfig(endpoint string, tlsCfg *atev1.CSIDriverTLSConfig) *atev1.CSID // and a real call both succeeded. func dialPlugin(t *testing.T, addr, serverName string, paths tlsPaths) (*Plugin, error) { t.Helper() - cfg := driverConfig("tcp://"+addr, &atev1.CSIDriverTLSConfig{ + cfg := driverConfig("tcp://"+addr, &ateapi.CsiDriverTlsConfig{ Enabled: true, UsePodIdentity: true, ServerName: serverName, }) - return newCSIPlugin(t.Context(), &mockLister{cfg: cfg}, mockDriverName, true /*isController*/, paths) + return newCSIPlugin(t.Context(), &mockGetter{cfg: cfg}, mockDriverName, true /*isController*/, paths) } -// mockLister serves a single CSIDriverConfig under mockDriverName. -type mockLister struct{ cfg *atev1.CSIDriverConfig } +// mockGetter serves a single CsiDriverConfig under mockDriverName. +type mockGetter struct{ cfg *ateapi.CsiDriverConfig } -func (m *mockLister) List(labels.Selector) ([]*atev1.CSIDriverConfig, error) { - return []*atev1.CSIDriverConfig{m.cfg}, nil -} - -func (m *mockLister) Get(name string) (*atev1.CSIDriverConfig, error) { - if name != mockDriverName { - return nil, fmt.Errorf("no CSIDriverConfig named %q", name) +func (m *mockGetter) Get(_ context.Context, driverName string) (*ateapi.CsiDriverConfig, error) { + if driverName != mockDriverName { + return nil, fmt.Errorf("no CsiDriverConfig for driver %q", driverName) } return m.cfg, nil } -var _ atelisters.CSIDriverConfigLister = (*mockLister)(nil) +var _ CSIDriverConfigGetter = (*mockGetter)(nil) func TestMTLSSucceeds(t *testing.T) { t.Parallel() @@ -272,11 +266,11 @@ func TestResolveTLSConfigDisabled(t *testing.T) { t.Parallel() for _, tc := range []struct { name string - cfg *atev1.CSIDriverConfig + cfg *ateapi.CsiDriverConfig }{ {"nil config", nil}, {"no TLS block", driverConfig("", nil)}, - {"TLS disabled", driverConfig("", &atev1.CSIDriverTLSConfig{Enabled: false})}, + {"TLS disabled", driverConfig("", &ateapi.CsiDriverTlsConfig{Enabled: false})}, } { t.Run(tc.name, func(t *testing.T) { got, err := resolveTLSConfig(tc.cfg, defaultTLSPaths) @@ -292,7 +286,7 @@ func TestResolveTLSConfigDisabled(t *testing.T) { func TestResolveTLSConfigRejectsManualCerts(t *testing.T) { t.Parallel() - cfg := driverConfig("", &atev1.CSIDriverTLSConfig{Enabled: true, UsePodIdentity: false}) + cfg := driverConfig("", &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: false}) if _, err := resolveTLSConfig(cfg, defaultTLSPaths); err == nil { t.Fatal("resolveTLSConfig accepted usePodIdentity=false; manual certificates are unsupported") @@ -301,7 +295,7 @@ func TestResolveTLSConfigRejectsManualCerts(t *testing.T) { func TestResolveTLSConfigRejectsEmptyServerName(t *testing.T) { t.Parallel() - cfg := driverConfig("", &atev1.CSIDriverTLSConfig{Enabled: true, UsePodIdentity: true}) + cfg := driverConfig("", &ateapi.CsiDriverTlsConfig{Enabled: true, UsePodIdentity: true}) _, err := resolveTLSConfig(cfg, defaultTLSPaths) if err == nil { t.Fatal("resolveTLSConfig accepted empty serverName when TLS is enabled") @@ -317,7 +311,7 @@ func TestResolveTLSConfigFields(t *testing.T) { ca := newTestCA(t) paths := writeCreds(t, ca.clientBundle(t), ca.certPEM()) - got, err := resolveTLSConfig(driverConfig("", &atev1.CSIDriverTLSConfig{ + got, err := resolveTLSConfig(driverConfig("", &ateapi.CsiDriverTlsConfig{ Enabled: true, UsePodIdentity: true, ServerName: serverName, diff --git a/internal/volume/plugin.go b/internal/volume/plugin.go index a3f9ca3aa9..c2a44991fe 100644 --- a/internal/volume/plugin.go +++ b/internal/volume/plugin.go @@ -24,7 +24,7 @@ type CreateVolumeRequest struct { Name string // CapacityBytes is the requested size in bytes. CapacityBytes int64 - // Parameters are the driver-specific parameters from the StorageClass. + // Parameters are the driver-specific parameters from the volume's class. Parameters map[string]string } diff --git a/tools/apitool/internal/examples/grpc/CsiDriverConfig.yaml b/tools/apitool/internal/examples/grpc/CsiDriverConfig.yaml new file mode 100644 index 0000000000..22c5b7db07 --- /dev/null +++ b/tools/apitool/internal/examples/grpc/CsiDriverConfig.yaml @@ -0,0 +1,26 @@ +# Copyright 2026 The Agent Substrate Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +metadata: + name: csi-nfs + uid: 9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d + version: "1" + createTime: "2026-06-01T00:00:00Z" + updateTime: "2026-06-01T00:00:00Z" +driverName: nfs.csi.k8s.io +controllerEndpoint: tcp://csi-nfs-controller.kube-system.svc.cluster.local:50052 +nodeSocketOverride: unix:///var/lib/kubelet/plugins/csi-nfsplugin/csi.sock +tls: + enabled: true + usePodIdentity: true + serverName: csi-nfs-controller.kube-system.svc diff --git a/tools/apitool/internal/examples/grpc/ExternalVolumeClass.yaml b/tools/apitool/internal/examples/grpc/ExternalVolumeClass.yaml new file mode 100644 index 0000000000..1faa0d1b45 --- /dev/null +++ b/tools/apitool/internal/examples/grpc/ExternalVolumeClass.yaml @@ -0,0 +1,23 @@ +# Copyright 2026 The Agent Substrate Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +metadata: + name: csi-nfs + uid: 9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d + version: "1" + createTime: "2026-06-01T00:00:00Z" + updateTime: "2026-06-01T00:00:00Z" +driverName: nfs.csi.k8s.io +parameters: + server: nfs-server.default.svc.cluster.local + share: / diff --git a/tools/apitool/internal/model/model_test.go b/tools/apitool/internal/model/model_test.go index 3e1bbcc25e..1b2232e12e 100644 --- a/tools/apitool/internal/model/model_test.go +++ b/tools/apitool/internal/model/model_test.go @@ -237,14 +237,16 @@ func TestBuild_Annotations(t *testing.T) { } } wantResources := map[string]*model.ResourceAnnotation{ - "Actor": {Scope: ateapi.Scope_SCOPE_ATESPACE, Plural: "Actors"}, - "EgressPolicy": {Parents: []string{"Actor"}, Singleton: true, Plural: "EgressPolicies"}, - "Tag": {Scope: ateapi.Scope_SCOPE_ATESPACE, Plural: "Tags"}, - "Atespace": {Scope: ateapi.Scope_SCOPE_GLOBAL, Plural: "Atespaces"}, - "ActorTemplate": {Scope: ateapi.Scope_SCOPE_ATESPACE, Plural: "ActorTemplates"}, - "Worker": {Scope: ateapi.Scope_SCOPE_GLOBAL, Plural: "Workers"}, - "ActorAssignment": {Parents: []string{"Worker"}, Plural: "ActorAssignments"}, - "AccessPolicy": {Parents: []string{"Global", "Atespace"}, Singleton: true, Plural: "AccessPolicies"}, + "Actor": {Scope: ateapi.Scope_SCOPE_ATESPACE, Plural: "Actors"}, + "EgressPolicy": {Parents: []string{"Actor"}, Singleton: true, Plural: "EgressPolicies"}, + "Tag": {Scope: ateapi.Scope_SCOPE_ATESPACE, Plural: "Tags"}, + "Atespace": {Scope: ateapi.Scope_SCOPE_GLOBAL, Plural: "Atespaces"}, + "ActorTemplate": {Scope: ateapi.Scope_SCOPE_ATESPACE, Plural: "ActorTemplates"}, + "ExternalVolumeClass": {Scope: ateapi.Scope_SCOPE_GLOBAL, Plural: "ExternalVolumeClasses"}, + "CsiDriverConfig": {Scope: ateapi.Scope_SCOPE_GLOBAL, Plural: "CsiDriverConfigs"}, + "Worker": {Scope: ateapi.Scope_SCOPE_GLOBAL, Plural: "Workers"}, + "ActorAssignment": {Parents: []string{"Worker"}, Plural: "ActorAssignments"}, + "AccessPolicy": {Parents: []string{"Global", "Atespace"}, Singleton: true, Plural: "AccessPolicies"}, } if diff := cmp.Diff(wantResources, gotResources); diff != "" { t.Errorf("resource annotations mismatch (-want +got):\n%s", diff)