model

package
v0.6.46 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidRequestCode                       = "1000"
	ErrNilClientCode                            = "1001"
	ErrCreateDataCode                           = "1002"
	ErrQueryCode                                = "1003"
	ErrMeshsyncSubscriptionCode                 = "1004"
	ErrOperatorSubscriptionCode                 = "1005"
	ErrAddonSubscriptionCode                    = "1006"
	ErrControlPlaneSubscriptionCode             = "1007"
	ErrMesheryClientCode                        = "1008"
	ErrSubscribeChannelCode                     = "1009"
	ErrPublishBrokerCode                        = "1010"
	ErrNoMeshSyncCode                           = "1011"
	ErrNoExternalEndpointCode                   = "1012"
	ErrApplyHelmChartCode                       = "2155"
	ErrMesheryControllersStatusSubscriptionCode = "2239"
	ErrMeshSyncEventsSubscriptionCode           = "2240"
)
View Source
const (
	Namespace       = "meshery"
	RequestSubject  = "meshery.meshsync.request"
	MeshsyncSubject = "meshery.meshsync.core"
	BrokerQueue     = "meshery"
)

Variables

View Source
var (
	ErrEmptyHandler = errors.New(ErrNoMeshSyncCode, errors.Alert, []string{"Database handler not initialized"}, []string{"Meshery Database handler is not accessible to perform operations"}, []string{"Meshery Database is crashed or not reachable"}, []string{"Restart Meshery Server", "Please check if Meshery server is accessible to the Database"})
)

Functions

func ErrApplyHelmChart

func ErrApplyHelmChart(err error) error

ErrApplyHelmChart is the error which occurs while applying helm chart

func ErrCreateData

func ErrCreateData(err error) error

func ErrDeleteData

func ErrDeleteData(err error) error

func ErrMeshSyncEventsSubscription

func ErrMeshSyncEventsSubscription(err error) error

func ErrMesheryClient

func ErrMesheryClient(err error) error

func ErrMesheryControllersStatusSubscription

func ErrMesheryControllersStatusSubscription(err error) error

func ErrMeshsyncSubscription

func ErrMeshsyncSubscription(err error) error

func ErrPublishBroker

func ErrPublishBroker(err error) error

func ErrQuery

func ErrQuery(err error) error

func ErrSubscribeChannel

func ErrSubscribeChannel(err error) error

func ErrUpdateData

func ErrUpdateData(err error) error

func GetOperator

func GetOperator(kubeclient *mesherykube.Client) (string, string, error)

func Initialize

func Initialize(client *mesherykube.Client, delete bool, adapterTracker models.AdaptersTrackerInterface) error

func ListernToEvents

func ListernToEvents(log logger.Handler,
	handler *database.Handler,
	datach chan *broker.Message,
	meshsyncCh chan struct{},
	broadcast broadcast.Broadcaster,
)

listernToEvents - scale this function with the number of channels

func PersistClusterNames

func PersistClusterNames(
	ctx context.Context,
	log logger.Handler,
	handler *database.Handler,
	meshsyncCh chan struct{},
)

func SelectivelyFetchNamespaces added in v0.6.3

func SelectivelyFetchNamespaces(cids []string, provider models.Provider) ([]string, error)

SelectivelyFetchNamespaces fetches the an array of namespaces from DB based on ClusterIDs (or KubernetesServerIDs) passed as param

func SetOverrideValues

func SetOverrideValues(delete bool, adapterTracker models.AdaptersTrackerInterface) map[string]interface{}

to be depricated

func SubscribeToBroker

func SubscribeToBroker(provider models.Provider, mesheryKubeClient *mesherykube.Client, datach chan *brokerpkg.Message, brokerConn brokerpkg.Handler, ct *K8sConnectionTracker) (string, error)

Types

type AddonList

type AddonList struct {
	Name  string `json:"name"`
	Owner string `json:"owner"`
}

func GetAddonsState

func GetAddonsState(ctx context.Context, selectors []MeshType, provider models.Provider, cid []string) ([]*AddonList, error)

type AddonStatusInput

type AddonStatusInput struct {
	Selector     *MeshType `json:"selector"`
	K8scontextID string    `json:"k8scontextID"`
	TargetStatus Status    `json:"targetStatus"`
}

type ApplicationPage

type ApplicationPage struct {
	Page         int                  `json:"page"`
	PageSize     int                  `json:"page_size"`
	TotalCount   int                  `json:"total_count"`
	Applications []*ApplicationResult `json:"applications"`
}

type ApplicationResult

type ApplicationResult struct {
	ID              string      `json:"id"`
	Name            string      `json:"name"`
	ApplicationFile string      `json:"application_file"`
	Type            *NullString `json:"type"`
	UserID          string      `json:"user_id"`
	Location        *Location   `json:"location"`
	CreatedAt       *string     `json:"created_at"`
	UpdatedAt       *string     `json:"updated_at"`
}

type CatalogFilter added in v0.6.4

type CatalogFilter struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	FilterFile  string                 `json:"filter_file"`
	UserID      string                 `json:"user_id"`
	Location    *Location              `json:"location"`
	Visibility  string                 `json:"visibility"`
	CatalogData map[string]interface{} `json:"catalog_data"`
	CreatedAt   *string                `json:"created_at"`
	UpdatedAt   *string                `json:"updated_at"`
}

type CatalogPattern added in v0.6.4

type CatalogPattern struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	UserID      string                 `json:"user_id"`
	PatternFile string                 `json:"pattern_file"`
	Location    *Location              `json:"location"`
	Visibility  string                 `json:"visibility"`
	CatalogData map[string]interface{} `json:"catalog_data"`
	CreatedAt   *string                `json:"created_at"`
	UpdatedAt   *string                `json:"updated_at"`
}

type CatalogSelector added in v0.6.4

type CatalogSelector struct {
	Search string `json:"search"`
	Order  string `json:"order"`
}

type ClusterResources

type ClusterResources struct {
	Resources []*Resource `json:"resources"`
}

type ConfigurationPage

type ConfigurationPage struct {
	Applications *ApplicationPage   `json:"applications"`
	Patterns     *PatternPageResult `json:"patterns"`
	Filters      *FilterPage        `json:"filters"`
}

type Container

type Container struct {
	ControlPlaneMemberName string           `json:"controlPlaneMemberName"`
	ContainerName          string           `json:"containerName"`
	Image                  string           `json:"image"`
	Status                 *ContainerStatus `json:"status"`
	Ports                  []*ContainerPort `json:"ports"`
	Resources              interface{}      `json:"resources"`
}

type ContainerPort

type ContainerPort struct {
	Name          *string `json:"name"`
	ContainerPort int     `json:"containerPort"`
	Protocol      string  `json:"protocol"`
}

type ContainerStatus

type ContainerStatus struct {
	ContainerStatusName string      `json:"containerStatusName"`
	Image               string      `json:"image"`
	State               interface{} `json:"state"`
	LastState           interface{} `json:"lastState"`
	Ready               bool        `json:"ready"`
	RestartCount        interface{} `json:"restartCount"`
	Started             bool        `json:"started"`
	ImageID             interface{} `json:"imageID"`
	ContainerID         interface{} `json:"containerID"`
}

type ControlPlane

type ControlPlane struct {
	Name    string                `json:"name"`
	Members []*ControlPlaneMember `json:"members"`
}

func GetControlPlaneState

func GetControlPlaneState(ctx context.Context, selectors []MeshType, provider models.Provider, cid []string) ([]*ControlPlane, error)

type ControlPlaneMember

type ControlPlaneMember struct {
	Name       string       `json:"name"`
	Component  string       `json:"component"`
	Version    string       `json:"version"`
	Namespace  string       `json:"namespace"`
	DataPlanes []*Container `json:"data_planes"`
}

type DataPlane

type DataPlane struct {
	Name    string       `json:"name"`
	Proxies []*Container `json:"proxies"`
}

func GetDataPlaneState

func GetDataPlaneState(ctx context.Context, selectors []MeshType, provider models.Provider, cid []string) ([]*DataPlane, error)

type Error

type Error struct {
	Code        string `json:"code"`
	Description string `json:"description"`
}

type FilterPage

type FilterPage struct {
	Page       int             `json:"page"`
	PageSize   int             `json:"page_size"`
	TotalCount int             `json:"total_count"`
	Filters    []*FilterResult `json:"filters"`
}

type FilterResult

type FilterResult struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	FilterFile  string                 `json:"filter_file"`
	UserID      string                 `json:"user_id"`
	Location    *Location              `json:"location"`
	Visibility  string                 `json:"visibility"`
	CatalogData map[string]interface{} `json:"catalog_data"`
	CreatedAt   *string                `json:"created_at"`
	UpdatedAt   *string                `json:"updated_at"`
}

type K8sConnectionTracker

type K8sConnectionTracker struct {
	// contains filtered or unexported fields
}

K8sConnectionTracker keeps track of BrokerURLs per kubernetes context

func NewK8sConnctionTracker

func NewK8sConnctionTracker() *K8sConnectionTracker

func (*K8sConnectionTracker) Get

func (k *K8sConnectionTracker) Get(id string) (url string)

func (*K8sConnectionTracker) ListBrokerEndpoints

func (k *K8sConnectionTracker) ListBrokerEndpoints() (a []string)

func (*K8sConnectionTracker) Log

Takes the meshkit Logger and logs a comma separated list of currently tracked Broker Endpoints

func (*K8sConnectionTracker) ResetEndpoints

func (k *K8sConnectionTracker) ResetEndpoints(available map[string]bool)

Takes a set of endpoints and discard the current endpoint if its not present in the set

func (*K8sConnectionTracker) Set

func (k *K8sConnectionTracker) Set(id string, url string)

type K8sContext

type K8sContext struct {
	ID                 string                 `json:"id"`
	Name               string                 `json:"name"`
	Auth               map[string]interface{} `json:"auth"`
	Cluster            map[string]interface{} `json:"cluster"`
	Server             string                 `json:"server"`
	Owner              string                 `json:"owner"`
	CreatedBy          string                 `json:"created_by"`
	MesheryInstanceID  string                 `json:"meshery_instance_id"`
	KubernetesServerID string                 `json:"kubernetes_server_id"`
	DeploymentType     string                 `json:"deployment_type"`
	UpdatedAt          string                 `json:"updated_at"`
	CreatedAt          string                 `json:"created_at"`
}

type K8sContextsPage

type K8sContextsPage struct {
	TotalCount int           `json:"total_count"`
	Contexts   []*K8sContext `json:"contexts"`
}

type KctlDescribeDetails

type KctlDescribeDetails struct {
	Describe *string `json:"describe"`
	Ctxid    *string `json:"ctxid"`
}

type Location

type Location struct {
	Branch *string `json:"branch"`
	Host   *string `json:"host"`
	Path   *string `json:"path"`
	Type   *string `json:"type"`
}

type MeshModelComponent added in v0.6.46

type MeshModelComponent struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

type MeshModelRelationship added in v0.6.46

type MeshModelRelationship struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

type MeshModelSummary added in v0.6.46

type MeshModelSummary struct {
	Components    []*MeshModelComponent    `json:"components"`
	Relationships []*MeshModelRelationship `json:"relationships"`
}

type MeshModelSummarySelector added in v0.6.46

type MeshModelSummarySelector struct {
	Type string `json:"type"`
}

type MeshSyncEvent

type MeshSyncEvent struct {
	Type      string      `json:"type"`
	Object    interface{} `json:"object"`
	ContextID string      `json:"contextId"`
}

type MeshType

type MeshType string
const (
	MeshTypeAllMesh            MeshType = "ALL_MESH"
	MeshTypeInvalidMesh        MeshType = "INVALID_MESH"
	MeshTypeAppMesh            MeshType = "APP_MESH"
	MeshTypeCitrixServiceMesh  MeshType = "CITRIX_SERVICE_MESH"
	MeshTypeConsul             MeshType = "CONSUL"
	MeshTypeIstio              MeshType = "ISTIO"
	MeshTypeKuma               MeshType = "KUMA"
	MeshTypeLinkerd            MeshType = "LINKERD"
	MeshTypeTraefikMesh        MeshType = "TRAEFIK_MESH"
	MeshTypeOctarine           MeshType = "OCTARINE"
	MeshTypeNetworkServiceMesh MeshType = "NETWORK_SERVICE_MESH"
	MeshTypeTanzu              MeshType = "TANZU"
	MeshTypeOpenServiceMesh    MeshType = "OPEN_SERVICE_MESH"
	MeshTypeNginxServiceMesh   MeshType = "NGINX_SERVICE_MESH"
	MeshTypeCiliumServiceMesh  MeshType = "CILIUM_SERVICE_MESH"
)

func (MeshType) IsValid

func (e MeshType) IsValid() bool

func (MeshType) MarshalGQL

func (e MeshType) MarshalGQL(w io.Writer)

func (MeshType) String

func (e MeshType) String() string

func (*MeshType) UnmarshalGQL

func (e *MeshType) UnmarshalGQL(v interface{}) error

type MesheryController

type MesheryController string
const (
	MesheryControllerBroker   MesheryController = "BROKER"
	MesheryControllerOperator MesheryController = "OPERATOR"
	MesheryControllerMeshsync MesheryController = "MESHSYNC"
)

func GetInternalController

func GetInternalController(controller models.MesheryController) MesheryController

func (MesheryController) IsValid

func (e MesheryController) IsValid() bool

func (MesheryController) MarshalGQL

func (e MesheryController) MarshalGQL(w io.Writer)

func (MesheryController) String

func (e MesheryController) String() string

func (*MesheryController) UnmarshalGQL

func (e *MesheryController) UnmarshalGQL(v interface{}) error

type MesheryControllerStatus

type MesheryControllerStatus string
const (
	MesheryControllerStatusDeployed    MesheryControllerStatus = "DEPLOYED"
	MesheryControllerStatusNotdeployed MesheryControllerStatus = "NOTDEPLOYED"
	MesheryControllerStatusDeploying   MesheryControllerStatus = "DEPLOYING"
	MesheryControllerStatusUnkown      MesheryControllerStatus = "UNKOWN"
)

func (MesheryControllerStatus) IsValid

func (e MesheryControllerStatus) IsValid() bool

func (MesheryControllerStatus) MarshalGQL

func (e MesheryControllerStatus) MarshalGQL(w io.Writer)

func (MesheryControllerStatus) String

func (e MesheryControllerStatus) String() string

func (*MesheryControllerStatus) UnmarshalGQL

func (e *MesheryControllerStatus) UnmarshalGQL(v interface{}) error

type MesheryControllersStatusListItem

type MesheryControllersStatusListItem struct {
	ContextID  string                  `json:"contextId"`
	Controller MesheryController       `json:"controller"`
	Status     MesheryControllerStatus `json:"status"`
}

type MesheryResult

type MesheryResult struct {
	MesheryID          *string                `json:"meshery_id"`
	Name               *string                `json:"name"`
	Mesh               *string                `json:"mesh"`
	PerformanceProfile *string                `json:"performance_profile"`
	TestID             *string                `json:"test_id"`
	RunnerResults      map[string]interface{} `json:"runner_results"`
	ServerMetrics      *string                `json:"server_metrics"`
	ServerBoardConfig  *string                `json:"server_board_config"`
	TestStartTime      *string                `json:"test_start_time"`
	UserID             *string                `json:"user_id"`
	UpdatedAt          *string                `json:"updated_at"`
	CreatedAt          *string                `json:"created_at"`
}

type NameSpace

type NameSpace struct {
	Namespace string `json:"namespace"`
}

type NullString

type NullString struct {
	String string `json:"String"`
	Valid  bool   `json:"Valid"`
}

type OAMCapability

type OAMCapability struct {
	OamDefinition interface{} `json:"oam_definition"`
	ID            *string     `json:"id"`
	OamRefSchema  *string     `json:"oam_ref_schema"`
	Host          *string     `json:"host"`
	Restricted    *bool       `json:"restricted"`
	Metadata      interface{} `json:"metadata"`
}

type OperatorControllerStatus

type OperatorControllerStatus struct {
	Name      string `json:"name"`
	Version   string `json:"version"`
	Status    Status `json:"status"`
	Error     *Error `json:"error"`
	ContextID string `json:"contextID"`
}

func GetBrokerInfo

func GetBrokerInfo(mesheryclient operatorClient.Interface, mesheryKubeClient *mesherykube.Client, brokerConn brokerpkg.Handler) (OperatorControllerStatus, error)

func GetControllersInfo

func GetControllersInfo(mesheryKubeClient *mesherykube.Client, brokerConn brokerpkg.Handler) ([]*OperatorControllerStatus, error)

func GetMeshSyncInfo

func GetMeshSyncInfo(mesheryclient operatorClient.Interface, mesheryKubeClient *mesherykube.Client) (OperatorControllerStatus, error)

type OperatorControllerStatusPerK8sContext

type OperatorControllerStatusPerK8sContext struct {
	ContextID                string                    `json:"contextID"`
	OperatorControllerStatus *OperatorControllerStatus `json:"OperatorControllerStatus"`
}

type OperatorStatus

type OperatorStatus struct {
	Status      Status                      `json:"status"`
	Version     string                      `json:"version"`
	Controllers []*OperatorControllerStatus `json:"controllers"`
	Error       *Error                      `json:"error"`
	ContextID   string                      `json:"contextID"`
}

type OperatorStatusInput

type OperatorStatusInput struct {
	TargetStatus Status `json:"targetStatus"`
	ContextID    string `json:"contextID"`
}

type OperatorStatusPerK8sContext

type OperatorStatusPerK8sContext struct {
	ContextID      string          `json:"contextID"`
	OperatorStatus *OperatorStatus `json:"operatorStatus"`
}

type PageFilter

type PageFilter struct {
	Page         string  `json:"page"`
	PageSize     string  `json:"pageSize"`
	Order        *string `json:"order"`
	Search       *string `json:"search"`
	From         *string `json:"from"`
	To           *string `json:"to"`
	UpdatedAfter *string `json:"updated_after"`
}

type PatternPageResult

type PatternPageResult struct {
	Page       int              `json:"page"`
	PageSize   int              `json:"page_size"`
	TotalCount int              `json:"total_count"`
	Patterns   []*PatternResult `json:"patterns"`
}

type PatternResult

type PatternResult struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	UserID      string                 `json:"user_id"`
	Location    *Location              `json:"location"`
	PatternFile string                 `json:"pattern_file"`
	Visibility  string                 `json:"visibility"`
	CatalogData map[string]interface{} `json:"catalog_data"`
	CanSupport  bool                   `json:"canSupport"`
	Errmsg      *string                `json:"errmsg"`
	CreatedAt   *string                `json:"created_at"`
	UpdatedAt   *string                `json:"updated_at"`
}

type PerfPageProfiles

type PerfPageProfiles struct {
	Page       int            `json:"page"`
	PageSize   int            `json:"page_size"`
	TotalCount int            `json:"total_count"`
	Profiles   []*PerfProfile `json:"profiles"`
}

type PerfPageResult

type PerfPageResult struct {
	Page       int              `json:"page"`
	PageSize   int              `json:"page_size"`
	TotalCount int              `json:"total_count"`
	Results    []*MesheryResult `json:"results"`
}

type PerfProfile

type PerfProfile struct {
	ConcurrentRequest int       `json:"concurrent_request"`
	CreatedAt         *string   `json:"created_at"`
	Duration          string    `json:"duration"`
	Endpoints         []*string `json:"endpoints"`
	ID                string    `json:"id"`
	LastRun           *string   `json:"last_run"`
	LoadGenerators    []*string `json:"load_generators"`
	Name              *string   `json:"name"`
	QPS               *int      `json:"qps"`
	TotalResults      *int      `json:"total_results"`
	UpdatedAt         *string   `json:"updated_at"`
	UserID            string    `json:"user_id"`
	RequestHeaders    *string   `json:"request_headers"`
	RequestCookies    *string   `json:"request_cookies"`
	RequestBody       *string   `json:"request_body"`
	ContentType       *string   `json:"content_type"`
	ServiceMesh       *string   `json:"service_mesh"`
}

type ReSyncActions

type ReSyncActions struct {
	ClearDb   string `json:"clearDB"`
	ReSync    string `json:"ReSync"`
	HardReset string `json:"hardReset"`
}

type Resource

type Resource struct {
	Kind  string `json:"kind"`
	Count int    `json:"count"`
}

type ServiceMeshFilter

type ServiceMeshFilter struct {
	Type          *MeshType `json:"type"`
	K8sClusterIDs []string  `json:"k8sClusterIDs"`
}

type Status

type Status string
const (
	StatusEnabled    Status = "ENABLED"
	StatusConnected  Status = "CONNECTED"
	StatusDisabled   Status = "DISABLED"
	StatusProcessing Status = "PROCESSING"
	StatusUnknown    Status = "UNKNOWN"
)

func (Status) IsValid

func (e Status) IsValid() bool

func (Status) MarshalGQL

func (e Status) MarshalGQL(w io.Writer)

func (Status) String

func (e Status) String() string

func (*Status) UnmarshalGQL

func (e *Status) UnmarshalGQL(v interface{}) error

Jump to

Keyboard shortcuts

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