service

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertificateService

type CertificateService struct {
	CertificateAuthorityRepo repo.CertificateAuthorityRepository
	CertificateRepo          repo.CertificateRepository
	CertificateBindingRepo   repo.CertificateBindingRepository
}

CertificateService provides functions to work with certificate related workflows

func (*CertificateService) CreateBinding

func (s *CertificateService) CreateBinding(cert *entity.Certificate,
	serviceType entity.CertificateBindingServiceType,
	participantUUID string,
	federationUUID string,
	federationType entity.FederationType) error

CreateBinding create a binding record of a certificate and a participant

func (*CertificateService) CreateCertificateSimple

func (s *CertificateService) CreateCertificateSimple(commonName string, lifetime time.Duration, dnsNames []string) (cert *entity.Certificate, pk *rsa.PrivateKey, err error)

CreateCertificateSimple just take the CN, lifetime and dnsNames and will give the automatically generated private key and the certificate using the first available CA

func (*CertificateService) DefaultCA

DefaultCA returns the default CA info

func (*CertificateService) RemoveBinding

func (s *CertificateService) RemoveBinding(participantUUID string) error

RemoveBinding deletes a bindings record and deletes the certificate if there is no bindings for it

type EndpointScanResult

type EndpointScanResult struct {
	*entity.EndpointBase
	IsManaged    bool
	IsCompatible bool
}

EndpointScanResult records the scanning result from an infra provider

type EndpointService

type EndpointService struct {
	InfraProviderKubernetesRepo repo.InfraProviderRepository
	EndpointKubeFATERepo        repo.EndpointRepository
	ParticipantFATERepo         repo.ParticipantFATERepository
	ParticipantOpenFLRepo       repo.ParticipantOpenFLRepository
	EventService                EventServiceInt
}

EndpointService is the domain service for the endpoint management

func (*EndpointService) BuildKubeFATEManager

func (s *EndpointService) BuildKubeFATEManager(infraUUID, namespace, yaml, ingressControllerYAML string) (kubefate.Manager, error)

BuildKubeFATEManager retrieve a KubeFATE manager instance from the provided endpoint uuid

func (*EndpointService) CreateKubeFATEEndpoint

func (s *EndpointService) CreateKubeFATEEndpoint(infraUUID, namespace, name, description, yaml string,
	install bool,
	ingressControllerServiceMode entity.EndpointKubeFATEIngressControllerServiceMode) (string, error)

CreateKubeFATEEndpoint install a kubefate endpoint or add an existing kubefate as a managed endpoint

func (*EndpointService) FindKubeFATEEndpoint

func (s *EndpointService) FindKubeFATEEndpoint(infraUUID string, namespace string) ([]EndpointScanResult, error)

FindKubeFATEEndpoint returns endpoints installation status from an infra provider within particular namespace

func (*EndpointService) GetDeploymentYAML

func (s *EndpointService) GetDeploymentYAML(namespace, serviceUserName, servicePassword, hostname string, registryConfig valueobject.KubeRegistryConfig) (string, error)

GetDeploymentYAML returns the default kubefate deployment yaml

func (*EndpointService) GetIngressControllerDeploymentYAML

func (s *EndpointService) GetIngressControllerDeploymentYAML(mode entity.EndpointKubeFATEIngressControllerServiceMode) (string, error)

GetIngressControllerDeploymentYAML returns the default ingress controller deployment yaml

func (*EndpointService) RemoveEndpoint

func (s *EndpointService) RemoveEndpoint(uuid string, uninstall bool) error

RemoveEndpoint removes the specified endpoint

func (*EndpointService) TestKubeFATE

func (s *EndpointService) TestKubeFATE(uuid string) error

TestKubeFATE checks a KubeFATE connection

type EventService

type EventService struct {
	EventRepo repo.EventRepository
}

EventService provides functions to work with core entities' lifecycle events

func (*EventService) CreateEvent

func (s *EventService) CreateEvent(eventType entity.EventType, entityType entity.EntityType, entityUUID string, description string, level entity.EventLogLevel) error

type EventServiceInt

type EventServiceInt interface {
	// CreateEvent creates a new event record
	CreateEvent(eventType entity.EventType, entityType entity.EntityType, entityUUID string, description string, level entity.EventLogLevel) error
}

EventServiceInt provides functions to work with core entities' lifecycle events

type ExternalHDFS added in v0.2.0

type ExternalHDFS struct {
	Enable      bool
	Name_node   string
	Path_prefix string
}

ExternalHDFS is the request to get the external HDFS information

type ExternalPulsar added in v0.2.0

type ExternalPulsar struct {
	Enable   bool
	Host     string
	Mng_port int
	Port     int
	SSLPort  int
}

ExternalPulsar is the request to get the external Pulsar information

type ExternalSpark added in v0.2.0

type ExternalSpark struct {
	Enable                bool
	Cores_per_node        int
	Nodes                 int
	Master                string
	DriverHost            string
	DriverHostType        string
	PortMaxRetries        int
	DriverStartPort       int
	BlockManagerStartPort int
	PysparkPython         string
}

ExternalSpark is the request to get the external Spark information

type ParticipantCertificateServiceInt

type ParticipantCertificateServiceInt interface {
	DefaultCA() (*entity.CertificateAuthority, error)
	CreateCertificateSimple(commonName string, lifetime time.Duration, dnsNames []string) (cert *entity.Certificate, pk *rsa.PrivateKey, err error)
	CreateBinding(cert *entity.Certificate, serviceType entity.CertificateBindingServiceType, participantUUID string, federationUUID string, federationType entity.FederationType) error
	RemoveBinding(participantUUID string) error
}

ParticipantCertificateServiceInt declares the methods of a certificate service that this service needs. "Caller defines interfaces"

type ParticipantDeploymentBaseInfo

type ParticipantDeploymentBaseInfo struct {
	Description    string `json:"description"`
	EndpointUUID   string `json:"endpoint_uuid"`
	DeploymentYAML string `json:"deployment_yaml"`
}

ParticipantDeploymentBaseInfo contains basic deployment information for a participant

type ParticipantEndpointServiceInt

type ParticipantEndpointServiceInt interface {
	TestKubeFATE(uuid string) error
	// contains filtered or unexported methods
}

ParticipantEndpointServiceInt declares the methods of an endpoint service that participant service needs

type ParticipantFATEClusterCreationRequest

type ParticipantFATEClusterCreationRequest struct {
	ParticipantFATEClusterYAMLCreationRequest
	ParticipantDeploymentBaseInfo
	PulsarServerCertInfo     entity.ParticipantComponentCertInfo `json:"pulsar_server_cert_info"`
	SitePortalServerCertInfo entity.ParticipantComponentCertInfo `json:"site_portal_server_cert_info"`
	SitePortalClientCertInfo entity.ParticipantComponentCertInfo `json:"site_portal_client_cert_info"`
}

ParticipantFATEClusterCreationRequest is the cluster creation request

type ParticipantFATEClusterUpgradeRequest added in v0.3.0

type ParticipantFATEClusterUpgradeRequest struct {
	ClusterUUID    string `json:"cluster_uuid"`
	FederationUUID string `json:"federation_uuid"`
	UpgradeVersion string `json:"upgrade_version"`
}

ParticipantFATEClusterUpgradeRequest is the cluster upgrade request

type ParticipantFATEClusterYAMLCreationRequest

type ParticipantFATEClusterYAMLCreationRequest struct {
	ParticipantFATEExchangeYAMLCreationRequest
	FederationUUID    string `json:"federation_uuid"`
	PartyID           int    `json:"party_id"`
	EnablePersistence bool   `json:"enable_persistence"`
	StorageClass      string `json:"storage_class"`
	FATEFlowGPUNum    int    `json:"fateflow_gpu_num"`
	ExternalSpark     ExternalSpark
	ExternalHDFS      ExternalHDFS
	ExternalPulsar    ExternalPulsar
}

ParticipantFATEClusterYAMLCreationRequest is the request to get the cluster deployment yaml

type ParticipantFATEExchangeCreationRequest

type ParticipantFATEExchangeCreationRequest struct {
	ParticipantFATEExchangeYAMLCreationRequest
	ParticipantDeploymentBaseInfo
	FederationUUID           string                              `json:"federation_uuid"`
	ProxyServerCertInfo      entity.ParticipantComponentCertInfo `json:"proxy_server_cert_info"`
	FMLManagerServerCertInfo entity.ParticipantComponentCertInfo `json:"fml_manager_server_cert_info"`
	FMLManagerClientCertInfo entity.ParticipantComponentCertInfo `json:"fml_manager_client_cert_info"`
}

ParticipantFATEExchangeCreationRequest is the exchange creation request

type ParticipantFATEExchangeUpgradeRequest added in v0.3.0

type ParticipantFATEExchangeUpgradeRequest struct {
	ExchangeUUID   string `json:"exchange_uuid"`
	FederationUUID string `json:"federation_uuid"`
	UpgradeVersion string `json:"upgrade_version"`
}

ParticipantFATEExchangeUpgradeRequest is the exchange upgrade request

type ParticipantFATEExchangeYAMLCreationRequest

type ParticipantFATEExchangeYAMLCreationRequest struct {
	ChartUUID   string                               `json:"chart_uuid"`
	Name        string                               `json:"name"`
	Namespace   string                               `json:"namespace"`
	ServiceType entity.ParticipantDefaultServiceType `json:"service_type"`
	// RegistrySecretConfig in valueobject.KubeRegistryConfig is not used for generating the yaml content
	RegistryConfig valueobject.KubeRegistryConfig `json:"registry_config"`
	EnablePSP      bool                           `json:"enable_psp"`
}

ParticipantFATEExchangeYAMLCreationRequest is the request to get the exchange deployment yaml file

type ParticipantFATEExternalClusterCreationRequest

type ParticipantFATEExternalClusterCreationRequest struct {
	Name             string                          `json:"name"`
	Description      string                          `json:"description"`
	FederationUUID   string                          `json:"federation_uuid"`
	PartyID          int                             `json:"party_id"`
	PulsarAccessInfo entity.ParticipantModulesAccess `json:"pulsar_access_info"`
	NginxAccessInfo  entity.ParticipantModulesAccess `json:"nginx_access_info"`
}

ParticipantFATEExternalClusterCreationRequest is the request for creating a record of a FATE cluster not managed by this service

type ParticipantFATEExternalExchangeCreationRequest

type ParticipantFATEExternalExchangeCreationRequest struct {
	Name                    string                          `json:"name"`
	Description             string                          `json:"description"`
	FederationUUID          string                          `json:"federation_uuid"`
	TrafficServerAccessInfo entity.ParticipantModulesAccess `json:"traffic_server_access_info"`
	NginxAccessInfo         entity.ParticipantModulesAccess `json:"nginx_access_info"`
}

ParticipantFATEExternalExchangeCreationRequest is the request for creating a record of an exchange not managed by this service

type ParticipantFATEService

type ParticipantFATEService struct {
	ParticipantFATERepo repo.ParticipantFATERepository
	ParticipantService
}

ParticipantFATEService is the service to manage fate participants

func (*ParticipantFATEService) BuildIngressInfoMap

func (s *ParticipantFATEService) BuildIngressInfoMap(participant *entity.ParticipantFATE) error

func (*ParticipantFATEService) CheckPartyIDConflict

func (s *ParticipantFATEService) CheckPartyIDConflict(federationUUID string, partyID int) error

CheckPartyIDConflict returns error if the party id is taken in a federation

func (*ParticipantFATEService) CreateCluster

CreateCluster creates a FATE cluster with exchange's access info, and will update exchange's route table

func (*ParticipantFATEService) CreateExchange

CreateExchange creates a FATE exchange, the returned *sync.WaitGroup can be used to wait for the completion of the async goroutine

func (*ParticipantFATEService) CreateExternalCluster

CreateExternalCluster creates an external FATE cluster with the access info provided by user

func (*ParticipantFATEService) CreateExternalExchange

CreateExternalExchange creates an external FATE exchange with the access info provided by user

func (*ParticipantFATEService) GetClusterDeploymentYAML

GetClusterDeploymentYAML returns a cluster deployment yaml

func (*ParticipantFATEService) GetExchangeDeploymentYAML

func (s *ParticipantFATEService) GetExchangeDeploymentYAML(req *ParticipantFATEExchangeYAMLCreationRequest) (string, error)

GetExchangeDeploymentYAML returns the exchange deployment yaml content

func (*ParticipantFATEService) RemoveCluster

func (s *ParticipantFATEService) RemoveCluster(uuid string, force bool) (*sync.WaitGroup, error)

RemoveCluster uninstall the cluster as well as remove it from the exchange's route table

func (*ParticipantFATEService) RemoveExchange

func (s *ParticipantFATEService) RemoveExchange(uuid string, force bool) (*sync.WaitGroup, error)

RemoveExchange removes and uninstalls a FATE exchange

func (*ParticipantFATEService) UpgradeCluster added in v0.3.0

UpgradeCluster upgrade a FATE cluster with exchange's access info, and will update exchange's route table

func (*ParticipantFATEService) UpgradeExchange added in v0.3.0

UpgradeExchange upgrade the FATE exchange, the returned *sync.WaitGroup can be used to wait for the completion of the async goroutine

type ParticipantOpenFLDirectorCreationRequest

type ParticipantOpenFLDirectorCreationRequest struct {
	ParticipantOpenFLDirectorYAMLCreationRequest
	ParticipantDeploymentBaseInfo
	DirectorServerCertInfo entity.ParticipantComponentCertInfo `json:"director_server_cert_info"`
	JupyterClientCertInfo  entity.ParticipantComponentCertInfo `json:"jupyter_client_cert_info"`
}

ParticipantOpenFLDirectorCreationRequest is the director creation request

type ParticipantOpenFLDirectorYAMLCreationRequest

type ParticipantOpenFLDirectorYAMLCreationRequest struct {
	FederationUUID string                               `json:"federation_uuid" form:"federation_uuid"`
	ChartUUID      string                               `json:"chart_uuid" form:"chart_uuid"`
	Name           string                               `json:"name" form:"name"`
	Namespace      string                               `json:"namespace" form:"namespace"`
	ServiceType    entity.ParticipantDefaultServiceType `json:"service_type" form:"service_type"`
	// for generating the yaml, RegistrySecretConfig is not used in RegistryConfig
	RegistryConfig  valueobject.KubeRegistryConfig `json:"registry_config"`
	JupyterPassword string                         `json:"jupyter_password" form:"jupyter_password"`
	EnablePSP       bool                           `json:"enable_psp" form:"enable_psp"`
}

ParticipantOpenFLDirectorYAMLCreationRequest contains necessary info to generate the deployment yaml content for KubeFATE to deploy OpenFL director

type ParticipantOpenFLEnvoyRegistrationRequest

type ParticipantOpenFLEnvoyRegistrationRequest struct {
	// required
	KubeConfig string `json:"kubeconfig"`
	TokenStr   string `json:"token"`

	// optional
	Name                  string                         `json:"name"`
	Description           string                         `json:"description"`
	Namespace             string                         `json:"namespace"`
	ChartUUID             string                         `json:"chart_uuid"`
	Labels                valueobject.Labels             `json:"labels"`
	ConfigYAML            string                         `json:"config_yaml"`
	SkipCommonPythonFiles bool                           `json:"skip_common_python_files"`
	RegistryConfig        valueobject.KubeRegistryConfig `json:"registry_config"`
	EnablePSP             bool                           `json:"enable_psp"`
	LessPrivileged        bool                           `json:"less_privileged"`
	// contains filtered or unexported fields
}

ParticipantOpenFLEnvoyRegistrationRequest is the registration request from an envoy

type ParticipantOpenFLService

type ParticipantOpenFLService struct {
	ParticipantOpenFLRepo repo.ParticipantOpenFLRepository
	TokenRepo             repo.RegistrationTokenRepository
	InfraRepo             repo.InfraProviderRepository
	ParticipantService
}

ParticipantOpenFLService is the service to manage openfl participants

func (*ParticipantOpenFLService) CreateDirector

CreateDirector creates an OpenFL director

func (*ParticipantOpenFLService) GetOpenFLDirectorYAML

GetOpenFLDirectorYAML returns the exchange deployment yaml content

func (*ParticipantOpenFLService) GetOpenFLEnvoyYAML

GetOpenFLEnvoyYAML generates the envoy deployment yaml based on the envoy registration request

func (*ParticipantOpenFLService) HandleRegistrationRequest

HandleRegistrationRequest process a Envoy device registration request

func (*ParticipantOpenFLService) RemoveDirector

func (s *ParticipantOpenFLService) RemoveDirector(uuid string, force bool) (*sync.WaitGroup, error)

RemoveDirector removes and uninstalls an OpenFL director

func (*ParticipantOpenFLService) RemoveEnvoy

func (s *ParticipantOpenFLService) RemoveEnvoy(uuid string, force bool) error

RemoveEnvoy removes and uninstalls an OpenFL envoy

type ParticipantService

type ParticipantService struct {
	FederationRepo     repo.FederationRepository
	ChartRepo          repo.ChartRepository
	EventService       EventServiceInt
	CertificateService ParticipantCertificateServiceInt
	EndpointService    ParticipantEndpointServiceInt
}

ParticipantService provides functions to manage participants

type UserService

type UserService struct {
	Repo repo.UserRepository
}

UserService provides common services to work with entity.User

func (*UserService) LoginService

func (s *UserService) LoginService(username, password string) (*entity.User, error)

LoginService validates the provided username and password and returns the user entity when succeeded

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL