manifests

package
v0.7.25 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 16 Imported by: 14

Documentation

Index

Constants

View Source
const (
	// service mesh resource
	SERVICE_MESH = iota
	// native Kubernetes resource
	K8s
	// native Meshery resource
	MESHERY
)

Type of resource

View Source
const (
	ErrGetCrdNamesCode           = "meshkit-11233"
	ErrGetSchemasCode            = "meshkit-11234"
	ErrGetAPIVersionCode         = "meshkit-11235"
	ErrGetAPIGroupCode           = "meshkit-11236"
	ErrPopulatingYamlCode        = "meshkit-11237"
	ErrAbsentFilterCode          = "meshkit-11238"
	ErrCreatingDirectoryCode     = "meshkit-11239"
	ErrGetResourceIdentifierCode = "meshkit-11240"
)
View Source
const (
	JsonSchemaPropsRef = "JSONSchemaProps"
)

Variables

This section is empty.

Functions

func DeFormatReadableString added in v0.6.9

func DeFormatReadableString(input string) string

func ErrAbsentFilter added in v0.2.30

func ErrAbsentFilter(err error) error

func ErrCreatingDirectory added in v0.5.10

func ErrCreatingDirectory(err error) error

func ErrGetAPIGroup

func ErrGetAPIGroup(err error) error

func ErrGetAPIVersion

func ErrGetAPIVersion(err error) error

func ErrGetCrdNames

func ErrGetCrdNames(err error) error

func ErrGetResourceIdentifier added in v0.5.19

func ErrGetResourceIdentifier(err error) error

func ErrGetSchemas

func ErrGetSchemas(err error) error

func ErrPopulatingYaml

func ErrPopulatingYaml(err error) error

func FormatToReadableString added in v0.5.1

func FormatToReadableString(input string) string

While going from Capital letter to small, insert a whitespace before the capital letter. While going from small letter to capital, insert a whitespace after the small letter The above is a general rule and further "exceptions" are used.

func GetCrdsFromHelm added in v0.5.38

func GetCrdsFromHelm(url string) ([]string, error)

func RemoveHelmTemplatingFromCRD added in v0.5.20

func RemoveHelmTemplatingFromCRD(crdyaml *string)

removeMetadataFromCRD is used because in few cases (like linkerd), helm templating might be used there which makes the yaml invalid. As those templates are useless for component creatin, we can replace them with "meshery" to make the YAML valid

Types

type Component

type Component struct {
	Schemas     []string
	Definitions []string
}

func GenerateComponents added in v0.2.26

func GenerateComponents(ctx context.Context, manifest string, resource int, cfg Config) (*Component, error)

func GetFromHelm

func GetFromHelm(ctx context.Context, url string, resource int, cfg Config) (*Component, error)

func GetFromManifest

func GetFromManifest(ctx context.Context, url string, resource int, cfg Config) (*Component, error)

type Config

type Config struct {
	Name            string                 // Name of the service mesh,or k8 or meshery
	Type            string                 //Type of the workload like- Istio, TraefikMesh, Kuma, OSM, Linkerd,AppMesh,NginxMesh
	MeshVersion     string                 // For service meshes
	K8sVersion      string                 //For K8ss
	ModifyDefSchema func(*string, *string) //takes in definition and schema, does some manipulation on them and returns the new def and schema
	CrdFilter       CueCrdFilter
	ExtractCrds     func(manifest string) []string //takes in the manifest and returns a list of all the crds
}

all the data that is needed to get a certain value should be present in the config created by the adapter.

type CueCrdFilter added in v0.5.19

type CueCrdFilter struct {
	NameExtractor       CueFilter
	GroupExtractor      CueFilter
	VersionExtractor    CueFilter
	SpecExtractor       CueFilter
	IsJson              bool
	IdentifierExtractor CueFilter // identifiers are the values that uniquely identify a CRD (in most of the cases, it is the 'Name' field)
}

basically getter functions applicable for a single CRD can be interpreted as the things that are needed for generating a Component

func NewCueCrdFilter added in v0.5.19

func NewCueCrdFilter(ep ExtractorPaths, isJson bool) CueCrdFilter

type CueFilter added in v0.5.19

type CueFilter func(rootCRDCueVal cue.Value) (cue.Value, error)

takes in the parsed root cue value of the CRD as its input and returns the extracted value

type ExtractorPaths added in v0.5.19

type ExtractorPaths struct {
	NamePath    string
	GroupPath   string
	VersionPath string
	SpecPath    string
	IdPath      string
}

type ResolveOpenApiRefs added in v0.5.26

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

func (*ResolveOpenApiRefs) ResolveReferences added in v0.5.26

func (ro *ResolveOpenApiRefs) ResolveReferences(manifest []byte, definitions cue.Value, cache map[string][]byte) ([]byte, error)

TODO: Refactor to use interface{} as an argument while doing type conversion recursively instead of assuming the input to always be a marshaled map[string]interface{}

Jump to

Keyboard shortcuts

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