manifests

package
v0.0.0-...-78aeb2e Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// service mesh resource
	SERVICE_MESH = iota
	// native Kubernetes resource
	K8s
	// native Meshplay resource
	MESHPLAY
)

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

func DeFormatReadableString(input string) string

func ErrAbsentFilter

func ErrAbsentFilter(err error) error

func ErrCreatingDirectory

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

func ErrGetResourceIdentifier(err error) error

func ErrGetSchemas

func ErrGetSchemas(err error) error

func ErrPopulatingYaml

func ErrPopulatingYaml(err error) error

func FormatToReadableString

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

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

func RemoveHelmTemplatingFromCRD

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 "meshplay" to make the YAML valid

Types

type Component

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

func GenerateComponents

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 meshplay
	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

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

func NewCueCrdFilter(ep ExtractorPaths, isJson bool) CueCrdFilter

type CueFilter

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

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

type ResolveOpenApiRefs

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

func (*ResolveOpenApiRefs) ResolveReferences

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