config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDomainName

func ValidateDomainName(v string) error

ValidateDomainName checks if the given string is a valid domain name and returns an error if not.

func ValidateEmail

func ValidateEmail(v string) error

ValidateEmail checks if the given string is a valid email address and returns an error if not.

func ValidateJSON

func ValidateJSON(data []byte) error

ValidateJSON validates that the given data is valid JSON.

Types

type Admin

type Admin struct {
	Email    string `json:"tectonic_admin_email" yaml:"email,omitempty"`
	Password string `json:"tectonic_admin_password" yaml:"password,omitempty"`
	SSHKey   string `json:"tectonic_admin_ssh_key,omitempty" yaml:"sshKey,omitempty"`
}

Admin converts admin related config.

type Cluster

type Cluster struct {
	Admin      `json:",inline" yaml:"admin,omitempty"`
	aws.AWS    `json:",inline" yaml:"aws,omitempty"`
	BaseDomain string `json:"tectonic_base_domain,omitempty" yaml:"baseDomain,omitempty"`

	IgnitionBootstrap string   `json:"ignition_bootstrap,omitempty" yaml:"-"`
	IgnitionMasters   []string `json:"ignition_masters,omitempty" yaml:"-"`
	IgnitionWorker    string   `json:"ignition_worker,omitempty" yaml:"-"`

	Internal            `json:",inline" yaml:"-"`
	libvirt.Libvirt     `json:",inline" yaml:"libvirt,omitempty"`
	Master              `json:",inline" yaml:"master,omitempty"`
	Name                string `json:"tectonic_cluster_name,omitempty" yaml:"name,omitempty"`
	Networking          `json:",inline" yaml:"networking,omitempty"`
	NodePools           `json:"-" yaml:"nodePools"`
	openstack.OpenStack `json:",inline" yaml:"openstack,omitempty"`
	Platform            Platform `json:"tectonic_platform" yaml:"platform,omitempty"`
	PullSecret          string   `json:"tectonic_pull_secret,omitempty" yaml:"pullSecret,omitempty"`
	PullSecretPath      string   `json:"-" yaml:"pullSecretPath,omitempty"` // Deprecated: remove after openshift/release is ported to pullSecret
	Worker              `json:",inline" yaml:"worker,omitempty"`
}

Cluster defines the config for a cluster.

func ConvertInstallConfigToTFVars

func ConvertInstallConfigToTFVars(cfg *types.InstallConfig, bootstrapIgn string, masterIgns []string, workerIgn string) (*Cluster, error)

ConvertInstallConfigToTFVars converts the installconfig to the Cluster struct that represents the terraform.tfvar file. TODO(yifan): Clean up the Cluster struct to trim unnecessary fields.

func ParseConfig

func ParseConfig(data []byte) (*Cluster, error)

ParseConfig parses a yaml string and returns, if successful, a Cluster.

func ParseConfigFile

func ParseConfigFile(path string) (*Cluster, error)

ParseConfigFile parses a yaml file and returns, if successful, a Cluster.

func (Cluster) NodeCount

func (c Cluster) NodeCount(names []string) int

NodeCount will return the number of nodes specified in NodePools with matching names. If no matching NodePools are found, then 0 is returned.

func (*Cluster) TFVars

func (c *Cluster) TFVars() (string, error)

TFVars will return the config for the cluster in tfvars format.

func (*Cluster) Validate

func (c *Cluster) Validate() []error

Validate ensures that the Cluster is semantically correct and returns an error if not.

func (*Cluster) ValidateAndLog

func (c *Cluster) ValidateAndLog() error

ValidateAndLog performs cluster configuration validation using `Validate` but rather than return a slice of errors, it logs any errors and returns a single error for convenience.

func (*Cluster) YAML

func (c *Cluster) YAML() (string, error)

YAML will return the config for the cluster in yaml format.

type ErrInvalidIgnConfig

type ErrInvalidIgnConfig struct {
	// contains filtered or unexported fields
}

ErrInvalidIgnConfig is returned when a invalid ign config is given.

func (*ErrInvalidIgnConfig) Error

func (e *ErrInvalidIgnConfig) Error() string

ErrInvalidIgnConfig implements the error interface.

type ErrMissingNodePool

type ErrMissingNodePool struct {
	// contains filtered or unexported fields
}

ErrMissingNodePool is returned when a field that requires a nodePool does not specify one.

func (*ErrMissingNodePool) Error

func (e *ErrMissingNodePool) Error() string

ErrMissingNodePool implements the error interface.

type ErrMoreThanOneNodePool

type ErrMoreThanOneNodePool struct {
	// contains filtered or unexported fields
}

ErrMoreThanOneNodePool is returned when a field specifies more than one node pool.

func (*ErrMoreThanOneNodePool) Error

func (e *ErrMoreThanOneNodePool) Error() string

ErrMoreThanOneNodePool implements the error interface.

type ErrSharedNodePool

type ErrSharedNodePool struct {
	// contains filtered or unexported fields
}

ErrSharedNodePool is returned when two or more fields are defined to use the same nodePool.

func (*ErrSharedNodePool) Error

func (e *ErrSharedNodePool) Error() string

ErrSharedNodePool implements the error interface.

type ErrUnmatchedNodePool

type ErrUnmatchedNodePool struct {
	// contains filtered or unexported fields
}

ErrUnmatchedNodePool is returned when a nodePool was specified but not found in the nodePools list.

func (*ErrUnmatchedNodePool) Error

func (e *ErrUnmatchedNodePool) Error() string

ErrUnmatchedNodePool implements the error interface.

type Internal

type Internal struct {
	ClusterID string `json:"tectonic_cluster_id,omitempty" yaml:"clusterId"`
}

Internal converts internal related config.

func ParseInternal

func ParseInternal(data []byte) (*Internal, error)

ParseInternal parses a yaml string and returns, if successful, an internal.

func ParseInternalFile

func ParseInternalFile(path string) (*Internal, error)

ParseInternalFile parses a yaml file and returns, if successful, an internal.

type Master

type Master struct {
	Count     int      `json:"tectonic_master_count,omitempty" yaml:"-"`
	NodePools []string `json:"-" yaml:"nodePools"`
}

Master converts master related config.

type Networking

type Networking struct {
	Type        tectonicnetwork.NetworkType `json:"tectonic_networking,omitempty" yaml:"type,omitempty"`
	MTU         string                      `json:"-" yaml:"mtu,omitempty"`
	ServiceCIDR string                      `json:"tectonic_service_cidr,omitempty" yaml:"serviceCIDR,omitempty"`
	PodCIDR     string                      `json:"tectonic_cluster_cidr,omitempty" yaml:"podCIDR,omitempty"`
}

Networking converts networking related config.

type NodePool

type NodePool struct {
	Count int    `json:"-" yaml:"count"`
	Name  string `json:"-" yaml:"name"`
}

NodePool converts node pool related config.

type NodePools

type NodePools []NodePool

NodePools converts node pools related config.

func (NodePools) Map

func (n NodePools) Map() map[string]int

Map returns a nodePools' map equivalent.

type Platform

type Platform string

Platform indicates the target platform of the cluster.

const (
	// PlatformAWS is the platform for a cluster launched on AWS.
	PlatformAWS Platform = "aws"
	// PlatformLibvirt is the platform for a cluster launched on libvirt.
	PlatformLibvirt Platform = "libvirt"
	// PlatformOpenStack is the platform for a cluster launched on OpenStack.
	PlatformOpenStack Platform = "openstack"
)

func (*Platform) UnmarshalYAML

func (p *Platform) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals and verifies the platform.

type Worker

type Worker struct {
	Count     int      `json:"tectonic_worker_count,omitempty" yaml:"-"`
	NodePools []string `json:"-" yaml:"nodePools"`
}

Worker converts worker related config.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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