model

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: Apache-2.0 Imports: 10 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// function for determining the relative path of generated api types package
	TypesRelativePath = func(kind, version string) string {
		c := pluralize.NewClient()
		return fmt.Sprintf("pkg/apis/%v/%v", strings.ToLower(c.Plural(kind)), version)
	}

	// function for determining the relative path of generated schduler package
	SchedulerRelativePath = "pkg/scheduler"

	// function for determining the relative path of generated finalizer package
	FinalizerRelativePath = "pkg/finalizer"

	// function for determining the relative path of generated parameters package
	ParametersRelativePath = "pkg/parameters"

	// function for determining the relative path of generated metrics package
	MetricsRelativePath = "pkg/metrics"
)

Functions

This section is empty.

Types

type Build

type Build struct {
	// path to the main.go file
	MainFile string

	// push image after  build
	Push bool

	Image
}

type Chart

type Chart struct {
	Operators []Operator

	// filter out the template based on its output name
	FilterTemplate func(outPath string) bool

	// outPath: content template map
	CustomTemplates CustomTemplates

	Values interface{}

	// goes into the chart.yaml
	Data Data
}

type CustomTemplates

type CustomTemplates struct {
	// the custom templates to run generation on.
	// maps output filename to template text
	Templates map[string]string

	// custom template funcs which will be inserted into the
	// default template funcmap at rendering time
	Funcs template.FuncMap
}

type Data

type Data struct {
	ApiVersion   string       `json:"apiVersion,omitempty"`
	Description  string       `json:"description,omitempty"`
	Name         string       `json:"name,omitempty"`
	Version      string       `json:"version,omitempty"`
	Home         string       `json:"home,omitempty"`
	Icon         string       `json:"icon,omitempty"`
	Sources      []string     `json:"sources,omitempty"`
	Dependencies []Dependency `json:"dependencies,omitempty"`
}

type Dependency

type Dependency struct {
	Name       string `json:"name,omitempty"`
	Version    string `json:"version,omitempty"`
	Repository string `json:"repository,omitempty"`
}

Helm chart dependency

type Deployment

type Deployment struct {
	// use a DaemonSet instead of a Deployment
	UseDaemonSet bool                     `json:"-"`
	Image        Image                    `json:"image,omitempty"`
	Resources    *v1.ResourceRequirements `json:"resources,omitempty"`
}

values for Deployment template

type Field

type Field struct {
	Type Type
}

type GeneratorType

type GeneratorType string
const (
	GeneratorType_Deepcopy  GeneratorType = "deepcopy"
	GeneratorType_Defaulter GeneratorType = "defaulter"
	GeneratorType_Client    GeneratorType = "client"
	GeneratorType_Lister    GeneratorType = "lister"
	GeneratorType_Informer  GeneratorType = "informer"
	GeneratorType_All       GeneratorType = "all"
)

type GeneratorTypes

type GeneratorTypes []GeneratorType

func (GeneratorTypes) HasDeepcopy

func (g GeneratorTypes) HasDeepcopy() bool

returns true if the 'deepcopy' or 'all' generator is present

func (GeneratorTypes) Strings

func (g GeneratorTypes) Strings() []string

type Group

type Group struct {
	// the group version of the group
	schema.GroupVersion

	// the go  module this group belongs to
	Module string

	// the root directory for generated API code
	ApiRoot string

	// the kinds in the group
	Resources []Resource

	// Should we generate kubernetes manifests?
	RenderManifests bool

	// Should we generate kubernetes Go structs?
	RenderTypes bool

	// Should we generate kubernetes Go clients?
	RenderClients bool

	// Deprecated: use generated deepcopy methods instead
	// Should we run kubernetes code generators? (see https://github.com/kubernetes/code-generator/blob/master/generate-groups.sh)
	// Note: if this field is nil and RenderTypes is true,
	// skv2 will run the 'deepcopy' generator by default.
	Generators GeneratorTypes

	// Should we generate kubernetes Go controllers?
	RenderController bool

	// Enable to add //go:generate mockgen directive to the top of generated Go files.
	MockgenDirective bool

	// custom import path to the package
	// containing the Go types
	// use this if you are generating controllers
	// for types in an external project
	CustomTypesImportPath string

	// proto descriptors will be available to the templates if the group was compiled with them.
	Descriptors []*model.DescriptorWithPath

	// data for providing custom templates to generate custom code for groups
	CustomTemplates []CustomTemplates
}

func (Group) HasProtos

func (g Group) HasProtos() bool

func (*Group) Init

func (g *Group) Init()

ensures the resources point to this group

type Image

type Image struct {
	Tag        string        `json:"tag,omitempty"  desc:"tag for the container"`
	Repository string        `json:"repository,omitempty"  desc:"image name (repository) for the container."`
	Registry   string        `json:"registry,omitempty" desc:"image prefix/registry e.g. (quay.io/solo-io)"`
	PullPolicy v1.PullPolicy `json:"pullPolicy,omitempty"  desc:"image pull policy for the container"`
	PullSecret string        `json:"pullSecret,omitempty" desc:"image pull policy for the container "`
}

type Operator

type Operator struct {
	Name string

	// deployment config
	Deployment Deployment

	// these populate the generated ClusterRole for the operator
	Rbac []rbacv1.PolicyRule
	// these populate the generated ClusterRole for the operator
	Volumes []v1.Volume
	// mount these volumes to the operator container
	VolumeMounts []v1.VolumeMount
	// set these environment variables on the operator container
	Env []v1.EnvVar
	// add a manifest for each configmap
	ConfigMaps []v1.ConfigMap

	// if at least one port is defined, create a service for the
	Service Service

	// args for the container
	Args []string
}

type Resource

type Resource struct {
	Group  // the group I belong to
	Kind   string
	Spec   Field
	Status *Field

	// Whether or not the resource is cluster-scoped.
	// This is important when rendering the CustomResourceDefinition manifest.
	ClusterScoped bool

	// The set of additional printer columns to apply to the CustomResourceDefinition
	AdditionalPrinterColumns []apiextv1beta1.CustomResourceColumnDefinition
}

type Service

type Service struct {
	Type  v1.ServiceType
	Ports []ServicePort
}

values for struct template

type ServicePort

type ServicePort struct {
	// The name of this port within the service.
	Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`

	// The default port that will be exposed by this service.
	DefaultPort int32 `json:"port" protobuf:"varint,3,opt,name=port"`
}

type Type

type Type struct {
	// name of the type.
	Name string

	// proto message for the type, if the proto message is compiled with skv2
	Message proto.Message

	/*

		The go package containing the type, if different than group root api directory (where the resource itself lives).
		Will be set automatically for proto-based types.

		If unset, SKv2 uses the default types package for the type.
	*/
	GoPackage string

	/*
		The proto package containing the type, if different than the Group name of the Resource.
		If unset, SKv2 uses the Group name of the Resource that specifies this Type.
	*/
	ProtoPackage string
}

Jump to

Keyboard shortcuts

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