Documentation
¶
Index ¶
- Variables
- type Build
- type Chart
- type Container
- type CustomTemplates
- type Data
- type Dependency
- type Deployment
- type Field
- type GeneratorType
- type GeneratorTypes
- type Group
- type Image
- type OpenApiSchemas
- type Operator
- type Properties
- type Resource
- type Service
- type ServicePort
- type Sidecar
- type Type
- type ValuesReferenceDocs
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
// Only generate the chart
ChartOnly bool
// if specified, generate refernece docs for the chart values to the provided filename
ValuesReferenceDocs ValuesReferenceDocs
}
func (Chart) BuildChartValues ¶ added in v0.7.17
func (c Chart) BuildChartValues() values.UserHelmValues
func (Chart) GenerateHelmDoc ¶ added in v0.7.17
func (c Chart) GenerateHelmDoc() string
type Container ¶ added in v0.18.0
type Container struct {
// not configurable via helm values
Args []string
VolumeMounts []v1.VolumeMount
ReadinessProbe *v1.Probe
LivenessProbe *v1.Probe
Image Image
Env []v1.EnvVar
Resources *v1.ResourceRequirements
}
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 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
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 add the chart version to the generated manifests?
AddChartVersion string
// Should we not add the spec hash to the annotation of the generated manifests?
SkipSpecHash 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
// Custom properties used for custom templates
Properties
}
func (*Group) InitDescriptors ¶ added in v0.22.1
func (g *Group) InitDescriptors(descriptors []*collector.DescriptorWithPath)
type OpenApiSchemas ¶ added in v0.7.17
type OpenApiSchemas map[string]*apiextv1.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
// if at least one port is defined, create a service for the
Service Service
}
type Properties ¶ added in v0.22.1
type Properties map[string]string
Properties is an arbitrary set of KV properties which can be associated to an skv2 resource. Can be used in conjunction with custom templates
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 []apiextv1.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 ValuesReferenceDocs ¶ added in v0.22.1
type ValuesReferenceDocs struct {
Title string
Filename string
}
Click to show internal directories.
Click to hide internal directories.