Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertMapInterfaceMapString(v interface{}, prettify bool, isSchema bool) interface{}
- func DeleteK8sWorkloads(ctx string)
- func ErrCreatePatternService(err error) error
- func ErrGetK8sComponents(err error) error
- func ErrParseK8sManifest(err error) error
- func ErrPatternFromCytoscape(err error) error
- func GetK8Components(ctxt context.Context, config []byte) (*manifests.Component, error)
- func IsValidPattern(stringifiedFile string) (err error)
- type ComponentTypes
- type DryRunFailureCause
- type DryRunResponse
- type DryRunResponseWrapper
- type Pattern
- func (p *Pattern) GenerateApplicationConfiguration() (v1alpha1.Configuration, error)
- func (p *Pattern) GetApplicationComponent(name string) (v1alpha1.Component, error)
- func (p *Pattern) GetServiceType(name string) string
- func (p *Pattern) ToCytoscapeJS() (cytoscapejs.GraphElem, error)
- func (p *Pattern) ToYAML() ([]byte, error)
- type Service
- type TraitCapability
- type WorkloadCapability
Constants ¶
const ( ErrGetK8sComponentsCode = "1400" ErrParseK8sManifestCode = "1401" ErrCreatePatternServiceCode = "1402" ErrPatternFromCytoscapeCode = "1403" )
Please reference the following before contributing an error code: https://docs.khulnasoft.com/project/contributing/contributing-error https://github.com/khulnasoft/meshkit/blob/master/errors/errors.go
const Format prettifier = true
In case of any breaking change or bug caused by this, set this to false and the whitespace addition in schema generated/consumed would be removed(will go back to default behavior)
Variables ¶
var ComponentTypesSingleton = ComponentTypes{ Names: make(map[string]bool), LatestVersionForComponent: make(map[string]string), }
ComponentTypesSingleton is initialized per meshplay instance and acts as a helper middleware between client facing API and capability registry. Examples of names stored in this struct are: core,kubernetes,istio,linkerd
Functions ¶
func ConvertMapInterfaceMapString ¶
ConvertMapInterfaceMapString converts map[interface{}]interface{} => map[string]interface{}
It will also convert []interface{} => []string
func DeleteK8sWorkloads ¶
func DeleteK8sWorkloads(ctx string)
DeleteK8sWorkloads deletes the registered in memory k8s workloads for a given k8s contextID.
func ErrCreatePatternService ¶
func ErrGetK8sComponents ¶
func ErrParseK8sManifest ¶
func ErrPatternFromCytoscape ¶
func GetK8Components ¶
GetK8Components returns all the generated definitions and schemas for available api resources
func IsValidPattern ¶
isValidPattern checks if the pattern file is valid or not
Types ¶
type ComponentTypes ¶
type ComponentTypes struct { Names map[string]bool LatestVersionForComponent map[string]string // contains filtered or unexported fields }
present in metadata."adapter.khulnasoft.com/name". Ex- core,kubernetes,istio,linkerd,etc
func (*ComponentTypes) Get ¶
func (c *ComponentTypes) Get() (names []string)
func (*ComponentTypes) Set ¶
func (c *ComponentTypes) Set(name string)
func (*ComponentTypes) SetLatestVersion ¶
func (c *ComponentTypes) SetLatestVersion(typ string, ver string)
type DryRunFailureCause ¶
type DryRunResponse ¶
type DryRunResponse struct { Status string Causes []DryRunFailureCause }
type DryRunResponseWrapper ¶
type DryRunResponseWrapper struct { //When success is true, error will be nil and Component will contain the structure of the component as it will look after deployment //When success is false, error will contain the errors. And Component will be set to Nil Success bool `json:"success"` Error *DryRunResponse `json:"error"` Component *Service `json:"component"` //Service is synonymous with Component. Later Service is to be changed to "Component" }
type Pattern ¶
type Pattern struct { // Name is the human-readable, display-friendly descriptor of the pattern Name string `yaml:"name,omitempty" json:"name,omitempty"` //Vars will be used to configure the pattern when it is imported from other patterns. Vars map[string]interface{} `yaml:"vars,omitempty" json:"vars,omitempty"` // PatternID is the moniker use to uniquely identify any given pattern // Convention: SMP-###-v#.#.# PatternID string `yaml:"patternID,omitempty" json:"patternID,omitempty"` Services map[string]*Service `yaml:"services,omitempty" json:"services,omitempty"` }
Pattern is the golang representation of the Pattern config file model
func NewPatternFile ¶
NewPatternFile takes in raw yaml and encodes it into a construct
func NewPatternFileFromCytoscapeJSJSON ¶
NewPatternFileFromCytoscapeJSJSON takes in CytoscapeJS JSON and creates a PatternFile from it. This function always returns meshkit error
func NewPatternFileFromK8sManifest ¶
func NewPatternFileFromK8sManifest(data string, ignoreErrors bool, reg *meshmodel.RegistryManager) (Pattern, error)
Note: If modified, make sure this function always returns a meshkit error
func (*Pattern) GenerateApplicationConfiguration ¶
func (p *Pattern) GenerateApplicationConfiguration() (v1alpha1.Configuration, error)
GenerateApplicationConfiguration generates OAM Application Configuration from the the given Pattern file for a particular deploymnet
func (*Pattern) GetApplicationComponent ¶
GetApplicationComponent generates OAM Application Components from the the given Pattern file
func (*Pattern) GetServiceType ¶
GetServiceType returns the type of the service
func (*Pattern) ToCytoscapeJS ¶
func (p *Pattern) ToCytoscapeJS() (cytoscapejs.GraphElem, error)
ToCytoscapeJS converts pattern file into cytoscape object
type Service ¶
type Service struct { // ID is the id of the service and is completely internal to // Meshplay Server and meshplay providers ID *uuid.UUID `yaml:"id,omitempty" json:"id,omitempty"` // Name is the name of the service and is an optional parameter // If given then this supercedes the name of the service inherited // from the parent Name string `yaml:"name,omitempty" json:"name,omitempty"` Type string `yaml:"type,omitempty" json:"type,omitempty"` APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"` Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty"` Version string `yaml:"version,omitempty" json:"version,omitempty"` Model string `yaml:"model,omitempty" json:"model,omitempty"` IsAnnotation bool `yaml:"isAnnotation,omitempty" json:"isAnnotation,omitempty"` Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"` Annotations map[string]string `yaml:"annotations,omitempty" json:"annotations,omitempty"` // DependsOn correlates one or more objects as a required dependency of this service // DependsOn is used to determine sequence of operations DependsOn []string `yaml:"dependsOn,omitempty" json:"dependsOn,omitempty"` Settings map[string]interface{} `yaml:"settings,omitempty" json:"settings,omitempty"` Traits map[string]interface{} `yaml:"traits,omitempty" json:"traits,omitempty"` }
Service represents the services defined within the appfile
type TraitCapability ¶
type TraitCapability struct { OAMDefinition v1alpha1.TraitDefinition `json:"oam_definition,omitempty"` // contains filtered or unexported fields }
TraitCapability is the struct for capturing the workload definition of a particular type
type WorkloadCapability ¶
type WorkloadCapability struct { OAMDefinition v1alpha1.WorkloadDefinition `json:"oam_definition,omitempty"` // contains filtered or unexported fields }
WorkloadCapability is the struct for capturing the workload definition of a particular type