Documentation ¶
Index ¶
- func Params(s CAPITemplateSpec) ([]string, error)
- func ParseConfigMap(cm corev1.ConfigMap) (map[string]*CAPITemplate, error)
- func Render(spec CAPITemplateSpec, vars map[string]string) ([][]byte, error)
- type CAPIResourceTemplate
- type CAPITemplate
- type CAPITemplateMetadata
- type CAPITemplateMetadataSpec
- type CAPITemplateSpec
- type CAPITemplateStatus
- type Flavour
- type Param
- type TemplateParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Params ¶
func Params(s CAPITemplateSpec) ([]string, error)
Params extracts the named parameters from resource templates in a spec.
func ParseConfigMap ¶
func ParseConfigMap(cm corev1.ConfigMap) (map[string]*CAPITemplate, error)
ParseConfigMap parses a ConfigMap and returns a map of CAPITemplates indexed by their name. The name of the template is set to the key of the ConfigMap.Data map.
Types ¶
type CAPIResourceTemplate ¶
type CAPIResourceTemplate struct {
runtime.RawExtension `json:",inline"`
}
CAPIResourceTemplate describes a resource to create.
type CAPITemplate ¶
type CAPITemplate struct { metav1.TypeMeta `json:",inline"` // +optional metav1.ObjectMeta `json:"metadata,omitempty"` // Spec holds the desired state of the CAPITemplate from the client // +optional Spec CAPITemplateSpec `json:"spec"` // +optional Status CAPITemplateStatus `json:"status,omitempty"` }
CAPITemplate takes parameters and uses them to create CAPI templates.
+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +k8s:openapi-gen=true
func ParseBytes ¶
func ParseBytes(b []byte, name string) (*CAPITemplate, error)
func ParseFile ¶
func ParseFile(fname string) (*CAPITemplate, error)
func ParseFileFromFS ¶
func ParseFileFromFS(fsys fs.FS, fname string) (*CAPITemplate, error)
type CAPITemplateMetadata ¶
type CAPITemplateMetadata struct { metav1.TypeMeta `json:",inline"` // +optional metav1.ObjectMeta `json:"metadata,omitempty"` // Spec holds the desired state of the CAPITemplate from the client // +optional Spec CAPITemplateMetadataSpec `json:"spec"` }
type CAPITemplateMetadataSpec ¶
type CAPITemplateMetadataSpec struct { Description string `json:"description,omitempty"` Params []TemplateParam `json:"params,omitempty"` }
CAPITemplateMetadataSpec holds the desired state of CAPITemplateMetadata.
type CAPITemplateSpec ¶
type CAPITemplateSpec struct { Description string `json:"description,omitempty"` Params []TemplateParam `json:"params,omitempty"` ResourceTemplates []CAPIResourceTemplate `json:"resourcetemplates,omitempty"` }
CAPITemplateSpec holds the desired state of CAPITemplate.
type CAPITemplateStatus ¶
type CAPITemplateStatus struct{}
CAPITemplateStatus describes the desired state of CAPITemplate
type Flavour ¶
type Flavour struct { Name string `json:"name"` Description string `json:"description"` Params []Param `json:"params"` Version string `json:"version"` }
Flavour represents a specific template.
type Param ¶
type Param struct { Name string `json:"name"` Description string `json:"description"` Required bool `json:"required"` Options []string `json:"options"` }
Param is a parameter that can be templated into a struct.
func ParamsFromSpec ¶
func ParamsFromSpec(s CAPITemplateSpec) ([]Param, error)
ParamsFromSpec extracts the named parameters from a CAPITemplate, finding all the named parameters in each of the resource templates, and enriching that with data from the params field in the spec (if found).
Any fields in the templates, but not in the params will not be enriched, and only the name will be returned.
func ParseMultiDoc ¶
ParseMultiDoc takes a single template with multiple YAML documents, and parses the parameters from it.
If a TemplateMetadata object is found, the parameters returned are enriched with the data.
type TemplateParam ¶
type TemplateParam struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` }
TemplateParam provides metadata for a template parameter.