model

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: Apache-2.0 Imports: 12 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 {
		return fmt.Sprintf("pkg/apis/%v/%v", strings.ToLower(stringutils.Pluralize(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

	// inline string of custom _helpers.tpl which can be provided for the generated chart
	HelpersTpl string
}

func (Chart) BuildChartValues added in v0.7.17

func (c Chart) BuildChartValues() HelmValues

func (Chart) GenerateHelmDoc added in v0.7.17

func (c Chart) GenerateHelmDoc(title string) string

type Container added in v0.18.0

type Container struct {
	// not configurable via helm values
	Args         []string         `json:"-"`
	VolumeMounts []v1.VolumeMount `json:"-"`

	Image     Image                    `json:"image" desc:"Specify the container image"`
	Env       []v1.EnvVar              `` /* 239-byte string literal not displayed */
	Resources *v1.ResourceRequirements `` /* 235-byte string literal not displayed */
}

values for a container

type CustomTemplates

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

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

	// 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"`
	Condition  string `json:"condition,omitempty"`
}

Helm chart dependency

type Deployment

type Deployment struct {
	// TODO support use of a DaemonSet instead of a Deployment
	UseDaemonSet bool
	Container
	Sidecars                    []Sidecar
	Volumes                     []v1.Volume
	CustomPodLabels             map[string]string
	CustomPodAnnotations        map[string]string
	CustomDeploymentLabels      map[string]string
	CustomDeploymentAnnotations map[string]string
}

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 validating schemas for CRDs?
	RenderValidationSchemas bool

	// Should we generate deepcopy functions for non-proto Spec/Status fields?
	RenderFieldJsonDeepcopy 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 []*collector.DescriptorWithPath

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

	// Mapping from protobuf message name to generated open api structural schema
	// This is populated during skv2 generation by the manifests renderer.
	OpenApiSchemas OpenApiSchemas
}

func (Group) HasProtos

func (g Group) HasProtos() bool

func (*Group) Init

func (g *Group) Init()

ensures the resources point to this group

type HelmValues added in v0.7.17

type HelmValues struct {
	Operators    []OperatorValues
	CustomValues interface{}
}

fields exposed as Helm values

type Image

type Image struct {
	Tag        string        `json:"tag,omitempty"  desc:"Tag for the container."`
	Repository string        `json:"repository,omitempty"  desc:"Image name (repository)."`
	Registry   string        `json:"registry,omitempty" desc:"Image registry."`
	PullPolicy v1.PullPolicy `json:"pullPolicy,omitempty"  desc:"Image pull policy."`
	PullSecret string        `json:"pullSecret,omitempty" desc:"Image pull secret."`
}

type OpenApiSchemas added in v0.7.17

type OpenApiSchemas map[string]*apiextv1beta1.JSONSchemaProps

Mapping from protobuf message name to OpenApi schema

type Operator

type Operator struct {
	Name string

	// deployment config
	Deployment Deployment

	// these populate the generated ClusterRole for the operator
	Rbac []rbacv1.PolicyRule

	// add a manifest for each configmap
	ConfigMaps []v1.ConfigMap

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

type OperatorValues added in v0.7.17

type OperatorValues struct {
	Name   string
	Values Values
}

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

	// Set the short name of the resource
	ShortNames []string

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

type Service

type Service struct {
	Type              v1.ServiceType
	Ports             []ServicePort
	CustomLabels      map[string]string
	CustomAnnotations map[string]string
}

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" desc:"The name of this port within the service."`

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

type Sidecar added in v0.18.0

type Sidecar struct {
	Container
	Name string
}

sidecars require a container config and a unique name

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
}

type Values added in v0.7.17

type Values struct {
	Container `json:",inline"`
	// Required to have an interface value in order to use the `index` function in the template
	Sidecars     map[string]Container `json:"sidecars" desc:"Configuration for the deployed containers."`
	ServiceType  v1.ServiceType       `` /* 133-byte string literal not displayed */
	ServicePorts map[string]uint32    `json:"ports" desc:"Specify service ports as a map from port name to port number."`

	CustomPodLabels             map[string]string `json:"customPodLabels,omitempty" desc:"Custom labels for the pod"`
	CustomPodAnnotations        map[string]string `json:"customPodAnnotations,omitempty" desc:"Custom annotations for the pod"`
	CustomDeploymentLabels      map[string]string `json:"customDeploymentLabels,omitempty" desc:"Custom labels for the deployment"`
	CustomDeploymentAnnotations map[string]string `json:"customDeploymentAnnotations,omitempty" desc:"Custom annotations for the deployment"`
	CustomServiceLabels         map[string]string `json:"customServiceLabels,omitempty" desc:"Custom labels for the service"`
	CustomServiceAnnotations    map[string]string `json:"customServiceAnnotations,omitempty" desc:"Custom annotations for the service"`
}

Jump to

Keyboard shortcuts

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