Documentation ¶
Index ¶
- Constants
- func DeFormatReadableString(input string) string
- func ErrAbsentFilter(err error) error
- func ErrCreatingDirectory(err error) error
- func ErrGetAPIGroup(err error) error
- func ErrGetAPIVersion(err error) error
- func ErrGetCrdNames(err error) error
- func ErrGetResourceIdentifier(err error) error
- func ErrGetSchemas(err error) error
- func ErrPopulatingYaml(err error) error
- func FormatToReadableString(input string) string
- func GetCrdsFromHelm(url string) ([]string, error)
- func RemoveHelmTemplatingFromCRD(crdyaml *string)
- type Component
- func GenerateComponents(ctx context.Context, manifest string, resource int, cfg Config) (*Component, error)
- func GetFromHelm(ctx context.Context, url string, resource int, cfg Config) (*Component, error)
- func GetFromManifest(ctx context.Context, url string, resource int, cfg Config) (*Component, error)
- type Config
- type CueCrdFilter
- type CueFilter
- type ExtractorPaths
- type ResolveOpenApiRefs
Constants ¶
const ( // service mesh resource SERVICE_MESH = iota // native Kubernetes resource K8s // native Meshplay resource MESHPLAY )
Type of resource
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" )
const (
JsonSchemaPropsRef = "JSONSchemaProps"
)
Variables ¶
This section is empty.
Functions ¶
func DeFormatReadableString ¶
func ErrAbsentFilter ¶
func ErrCreatingDirectory ¶
func ErrGetAPIGroup ¶
func ErrGetAPIVersion ¶
func ErrGetCrdNames ¶
func ErrGetSchemas ¶
func ErrPopulatingYaml ¶
func FormatToReadableString ¶
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 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 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 ¶
takes in the parsed root cue value of the CRD as its input and returns the extracted value
type ExtractorPaths ¶
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{}