Documentation ¶
Index ¶
- Constants
- Variables
- func InputReconciler(params SnapshotTemplateParameters) model.CustomTemplates
- func InputSnapshot(params SnapshotTemplateParameters) model.CustomTemplates
- func InputSnapshotManualBuilder(params SnapshotTemplateParameters) model.CustomTemplates
- func OutputSnapshot(params SnapshotTemplateParameters) model.CustomTemplates
- type HomogenousSnapshotResources
- type HybridSnapshotResources
- type SnapshotResources
- type SnapshotTemplateParameters
Constants ¶
const ( SetOutputFilename = "sets/sets.go" SetCustomTemplatePath = "sets/sets.gotmpl" )
Sets custom template
const ( ClientProvidersOutputFilename = "providers/client_providers.go" ClientProvidersCustomTemplatePath = "providers/client_providers.gotmpl" )
ClientProviders custom template
const ( HomogenousInputReconcilerCustomTemplatePath = "input/input_reconciler.gotmpl" HybridInputReconcilerCustomTemplatePath = "input/hybrid_input_reconciler.gotmpl" )
InputReconciler custom templates
const (
InputSnapshotCustomTemplatePath = "input/input_snapshot.gotmpl"
)
InputSnapshot custom template
const (
InputSnapshotManualBuilderCustomTemplatePath = "input/input_snapshot_manual_builder.gotmpl"
)
InputSnapshot test builder custom template
const (
OutputSnapshotCustomTemplatePath = "output/output_snapshot.gotmpl"
)
OutputSnapshot custom template
Variables ¶
var AllGroupCustomTemplates []model.CustomTemplates
use to get all group-level templates in contrib
var ClientProviders = func() model.CustomTemplates { templateContentsBytes, err := ioutil.ReadFile(templatesDir + ClientProvidersCustomTemplatePath) if err != nil { panic(err) } templateContents := string(templateContentsBytes) clientProvidersTemplate := model.CustomTemplates{ Templates: map[string]string{ClientProvidersOutputFilename: templateContents}, } AllGroupCustomTemplates = append(AllGroupCustomTemplates, clientProvidersTemplate) return clientProvidersTemplate }()
var Sets = func() model.CustomTemplates { templateContentsBytes, err := ioutil.ReadFile(templatesDir + SetCustomTemplatePath) if err != nil { panic(err) } templateContents := string(templateContentsBytes) setsTemplates := model.CustomTemplates{ Templates: map[string]string{SetOutputFilename: templateContents}, } AllGroupCustomTemplates = append(AllGroupCustomTemplates, setsTemplates) return setsTemplates }()
Functions ¶
func InputReconciler ¶
func InputReconciler(params SnapshotTemplateParameters) model.CustomTemplates
Returns the template for generating input reconcilers.
func InputSnapshot ¶
func InputSnapshot(params SnapshotTemplateParameters) model.CustomTemplates
Returns the template for generating input snapshots.
func InputSnapshotManualBuilder ¶ added in v0.7.17
func InputSnapshotManualBuilder(params SnapshotTemplateParameters) model.CustomTemplates
Returns the template for generating input snapshots.
func OutputSnapshot ¶
func OutputSnapshot(params SnapshotTemplateParameters) model.CustomTemplates
Returns the template for generating output snapshots.
Types ¶
type HomogenousSnapshotResources ¶ added in v0.7.17
type HomogenousSnapshotResources struct { // a map of the GVKs to the resources which we want to include in the input snapshot. ResourcesToSelect map[schema.GroupVersion][]string }
HomogenousSnapshotResources represents a set of snapshot resources read from a single source (either remote clusters or local cluster)
type HybridSnapshotResources ¶ added in v0.7.17
type HybridSnapshotResources struct { // a map of the GVKs to the resources which we want to include in the input snapshot. // these resourecs will be stored in the the local cluster where the controller is running. LocalResourcesToSelect map[schema.GroupVersion][]string // a map of the GVKs to the resources which we want to include in the input snapshot. // these resourecs will be stored in the the remote cluster which the controller manages. RemoteResourcesToSelect map[schema.GroupVersion][]string }
HybridSnapshotResources represents a set of snapshot resources read from a both source remote clusters and the local cluster
type SnapshotResources ¶ added in v0.7.17
type SnapshotResources interface {
// contains filtered or unexported methods
}
SnapshotResources acts as a "oneof" to encapsulate HybridSnapshot or a HomogenousSnapshot
type SnapshotTemplateParameters ¶ added in v0.7.17
type SnapshotTemplateParameters struct { // the path of the output file produced from this template. relative to project root. OutputFilename string // a map of Go modules to (a superset of) the imported codegen Groups. only required if the codegen group is defined in a different go module than the types (i.e. it is using a CustomTypesImportPath) SelectFromGroups map[string][]model.Group // the resources contained in the snapshot SnapshotResources SnapshotResources // name of the snapshot SnapshotName string }
Parameters for constructing templates that span across multiple Groups.
func (SnapshotTemplateParameters) ConstructTemplate ¶ added in v0.7.17
func (p SnapshotTemplateParameters) ConstructTemplate(params SnapshotTemplateParameters, templateContents string, mockgenDirective bool) model.CustomTemplates
NOTE(awang): to use your template in a separate repo, use this function and pass in your own mockgenDirective and templateContents