Documentation ¶
Index ¶
- Constants
- func NewComponents(provider config.Provider, configClient config.Client, rawyaml []byte, ...) (*components, error)
- func NewTemplate(rawYaml []byte, configVariablesClient config.VariablesClient, ...) (*template, error)
- type Client
- type Components
- type ComponentsClient
- type ComponentsOptions
- type MetadataClient
- type Option
- type Overrider
- type Repository
- type Template
- type TemplateClient
Constants ¶
const (
WebhookNamespaceName = "capi-webhook-system"
)
Variables ¶
This section is empty.
Functions ¶
func NewComponents ¶
func NewComponents(provider config.Provider, configClient config.Client, rawyaml []byte, options ComponentsOptions) (*components, error)
NewComponents returns a new objects embedding a component YAML file
It is important to notice that clusterctl applies a set of processing steps to the “raw” component YAML read from the provider repositories: 1. Checks for all the variables in the component YAML file and replace with corresponding config values 2. The variables replacement can be skipped using the SkipVariables flag in the input options 3. Ensure all the provider components are deployed in the target namespace (apply only to namespaced objects) 4. Ensure all the ClusterRoleBinding which are referencing namespaced objects have the name prefixed with the namespace name 5. Set the watching namespace for the provider controller 6. Adds labels to all the components in order to allow easy identification of the provider objects
func NewTemplate ¶
func NewTemplate(rawYaml []byte, configVariablesClient config.VariablesClient, targetNamespace string, listVariablesOnly bool) (*template, error)
NewTemplate returns a new objects embedding a cluster template YAML file.
Types ¶
type Client ¶
type Client interface { config.Provider // GetVersion return the list of versions that are available in a provider repository GetVersions() ([]string, error) // Components provide access to YAML file for creating provider components. Components() ComponentsClient // Templates provide access to YAML file for generating workload cluster templates. // Please note that templates are expected to exist for the infrastructure providers only. Templates(version string) TemplateClient // Metadata provide access to YAML with the provider's metadata. Metadata(version string) MetadataClient }
Client is used to interact with provider repositories. Provider repository are expected to contain two types of YAML files: - YAML files defining the provider components (CRD, Controller, RBAC etc.) - YAML files defining the cluster templates (Cluster, Machines)
type Components ¶
type Components interface { // configuration of the provider the provider components belongs to. config.Provider // Version of the provider. Version() string // Variables required by the provider components. // This value is derived by the component YAML. Variables() []string // Images required to install the provider components. // This value is derived by the component YAML. Images() []string // TargetNamespace where the provider components will be installed. // By default this value is derived by the component YAML, but it is possible to override it // during the creation of the Components object. TargetNamespace() string // WatchingNamespace defines the namespace where the provider controller is is watching (empty means all namespaces). // By default this value is derived by the component YAML, but it is possible to override it // during the creation of the Components object. WatchingNamespace() string // InventoryObject returns the clusterctl inventory object representing the provider that will be // generated by this components. InventoryObject() clusterctlv1.Provider // Yaml return the provider components in the form of a YAML file. Yaml() ([]byte, error) // InstanceObjs return the instance specific components in the form of a list of Unstructured objects. InstanceObjs() []unstructured.Unstructured SharedObjs() []unstructured.Unstructured }
Components wraps a YAML file that defines the provider components to be installed in a management cluster (CRD, Controller, RBAC etc.) It is important to notice that clusterctl applies a set of processing steps to the “raw” component YAML read from the provider repositories: 1. Checks for all the variables in the component YAML file and replace with corresponding config values 2. Ensure all the provider components are deployed in the target namespace (apply only to namespaced objects) 3. Ensure all the ClusterRoleBinding which are referencing namespaced objects have the name prefixed with the namespace name 4. Set the watching namespace for the provider controller 5. Adds labels to all the components in order to allow easy identification of the provider objects
type ComponentsClient ¶
type ComponentsClient interface {
Get(options ComponentsOptions) (Components, error)
}
ComponentsClient has methods to work with yaml file for generating provider components. Assets are yaml files to be used for deploying a provider into a management cluster.
type ComponentsOptions ¶ added in v0.3.4
type ComponentsOptions struct { Version string TargetNamespace string WatchingNamespace string // Allows for skipping variable replacement in the component YAML SkipVariables bool }
ComponentsOptions is the inputs needed by the NewComponents
type MetadataClient ¶
type MetadataClient interface { // Get returns the provider's metadata. Get() (*clusterctlv1.Metadata, error) }
MetadataClient has methods to work with metadata hosted on a provider repository. Metadata are yaml files providing additional information about provider's assets like e.g the version compatibility Matrix.
type Option ¶
type Option func(*repositoryClient)
Option is a configuration option supplied to New
func InjectRepository ¶
func InjectRepository(repository Repository) Option
InjectRepository allows to override the repository implementation to use; by default, the repository implementation to use is created according to the repository URL.
type Overrider ¶ added in v0.3.2
type Overrider interface {
Path() string
}
Overrider provides behavior to determine the overrides layer.
type Repository ¶
type Repository interface { // DefaultVersion returns the default provider version returned by a repository. // In case the repository URL points to latest, this method returns the current latest version; in other cases // it returns the version of the provider hosted in the repository. DefaultVersion() string // RootPath returns the path inside the repository where the YAML file for creating provider components and // the YAML file for generating workload cluster templates are stored. // This value is derived from the repository URL; all the paths returned by this interface should be relative to this path. RootPath() string // ComponentsPath return the path (a folder name or file name) of the YAML file for creating provider components. // This value is derived from the repository URL. ComponentsPath() string // GetFile return a file for a given provider version. GetFile(version string, path string) ([]byte, error) // GetVersion return the list of versions that are available in a provider repository GetVersions() ([]string, error) }
Repository defines the behavior of a repository implementation. clusterctl is designed to support different repository types; each repository implementation should be aware of the provider version they are hosting, and possibly to host more than one version.
type Template ¶
type Template interface { // Variables required by the template. // This value is derived by the template YAML. Variables() []string // TargetNamespace where the template objects will be installed. TargetNamespace() string // Yaml returns yaml defining all the cluster template objects as a byte array. Yaml() ([]byte, error) // Objs returns the cluster template as a list of Unstructured objects. Objs() []unstructured.Unstructured }
Template wraps a YAML file that defines the cluster objects (Cluster, Machines etc.). It is important to notice that clusterctl applies a set of processing steps to the “raw” cluster template YAML read from the provider repositories: 1. Checks for all the variables in the cluster template YAML file and replace with corresponding config values 2. Ensure all the cluster objects are deployed in the target namespace