model

package
v0.20.9 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 12 Imported by: 8

Documentation

Index

Constants

View Source
const ProjectConfigFilename = "solo-kit.json"

Variables

This section is empty.

Functions

func GetGVForProject added in v0.19.0

func GetGVForProject(project *Project) kubeschema.GroupVersion

Types

type CustomResourceConfig

type CustomResourceConfig struct {
	// the import path for the Go Type
	Package string `json:"package"`
	// the name of the Go Type
	Type                   string `json:"type"`
	PluralName             string `json:"plural_name"`
	ShortName              string `json:"short_name"`
	ClusterScoped          bool   `json:"cluster_scoped"`
	SkipHashingAnnotations bool   `json:"skip_hashing_annotations"`
	// set by load
	Imported bool
}

Create a Solo-Kit backed resource from a Go Type that implements the Resource Interface

type DescriptorWithPath added in v0.11.2

type DescriptorWithPath struct {
	*descriptor.FileDescriptorProto
	ProtoFilePath string
}

type Field

type Field struct {
	Name        string
	TypeName    string
	IsOneof     bool // we ignore oneof fields in test generation
	SkipHashing bool // skip this field when hashing the resource
	Original    *descriptor.FieldDescriptorProto
}

type Oneof

type Oneof struct {
	Name string
}

type Project

type Project struct {
	ProjectConfig  ProjectConfig
	ProtoPackage   string
	Resources      []*Resource
	ResourceGroups []*ResourceGroup
	XDSResources   []*XDSResource

	Request *plugin_go.CodeGeneratorRequest
	// generated by calling protokit.ParseCodeGenRequest on the request field
	Descriptors []*protokit.FileDescriptor
}

func (*Project) String added in v0.19.0

func (p *Project) String() string

type ProjectConfig

type ProjectConfig struct {
	Title          string                      `json:"title"`
	Description    string                      `json:"description"`
	Name           string                      `json:"name"`
	Version        string                      `json:"version"`
	DocsDir        string                      `json:"docs_dir"`
	ResourceGroups map[string][]ResourceConfig `json:"resource_groups"`
	// if set, this group will override the proto package typically used
	// as the api group for the crd
	CrdGroupOverride string `json:"crd_group_override"`

	// imported solokit projects
	Imports []string `json:"imports"`

	// define custom resources here
	CustomResources []CustomResourceConfig `json:"custom_resources"`

	// set by load if not specified
	GoPackage string `json:"go_package"`

	// Generate Kube clientset & types
	GenKubeTypes bool `json:"gen_kube_types"`

	// Generate Kube validation schemas
	GenKubeValidationSchemas bool `json:"gen_kube_validation_schemas"`

	// set by load
	ProjectFile   string
	ProjectProtos []string
}

func LoadProjectConfig

func LoadProjectConfig(path string) (ProjectConfig, error)

func (ProjectConfig) IsOurProto

func (p ProjectConfig) IsOurProto(protoFile string) bool

type Resource

type Resource struct {
	Name         string
	PluralName   string
	ShortName    string
	ProtoPackage string // eg. gloo.solo.io
	// ImportPrefix will equal ProtoPackage+"." if the resource does not belong to the project
	// else it will be empty string. used in event loop files
	ImportPrefix string
	// empty unless resource is external
	// format "github.com/solo-io/solo-kit/foo/bar"
	GoPackage string

	HasStatus          bool
	ClusterScoped      bool                 // the resource lives at the cluster level, namespace is ignored
	SkipDocsGen        bool                 // if true, no docs will be generated for the proto file where this resource is defined
	IsCustom           bool                 // if true, this will be treated as a custom resource without a proto file behind it
	CustomResource     CustomResourceConfig // this struct will be empty unless IsCustom is true
	CustomImportPrefix string               // import prefix for the struct type the generated wrapper will wrap

	SkipHashingAnnotations bool // if true, zero out annotations in the generated hash func

	Fields []*Field
	Oneofs []*Oneof

	// resource groups i belong to
	ResourceGroups []*ResourceGroup
	// project i belong to
	Project *Project

	Filename string // the proto file where this resource is contained
	Version  string // set during parsing from this resource's solo-kit.json

	// TODO (ilackarms): change to use descriptor.DescriptorProto
	Original *protokit.Descriptor
}

type ResourceConfig

type ResourceConfig struct {
	ResourceName    string `json:"name"`
	ResourcePackage string `json:"package"` // resource package doubles as the proto package or the go import package
	ResourceVersion string `json:"version"` // version of the resource, used to distinguish when multiple versions of a resource exist
}

type ResourceGroup

type ResourceGroup struct {
	Name      string // eg. api.gloo.solo.io
	GoName    string // will be Api
	Imports   string // if this resource group contains any imports from other projects
	Project   *Project
	Resources []*Resource
}

type XDSResource

type XDSResource struct {
	Name         string
	MessageType  string
	NameField    string
	NoReferences bool

	Project      *Project
	ProtoPackage string // eg. gloo.solo.io

	Filename string // the proto file where this resource is contained
}

Jump to

Keyboard shortcuts

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