Documentation ¶
Overview ¶
Package spi defines the service provider interface for cluster providers.
Index ¶
- Constants
- func RegisterProvider(name string, providerCreate func() (Provider, error))
- type AddOnID
- type AddOnParams
- type CincinnatiChannel
- type Cluster
- func (c *Cluster) Addons() []string
- func (c *Cluster) ChannelGroup() string
- func (c *Cluster) CloudProvider() string
- func (c *Cluster) CreationTimestamp() time.Time
- func (c *Cluster) ExpirationTimestamp() time.Time
- func (c *Cluster) Flavour() string
- func (c *Cluster) ID() string
- func (c *Cluster) Name() string
- func (c *Cluster) NumComputeNodes() int
- func (c *Cluster) Product() string
- func (c *Cluster) Properties() map[string]string
- func (c *Cluster) Region() string
- func (c *Cluster) State() ClusterState
- func (c *Cluster) Version() string
- type ClusterBuilder
- func (cb *ClusterBuilder) AddAddon(addon string) *ClusterBuilder
- func (cb *ClusterBuilder) Addons(addons []string) *ClusterBuilder
- func (cb *ClusterBuilder) Build() *Cluster
- func (cb *ClusterBuilder) ChannelGroup(channelGroup string) *ClusterBuilder
- func (cb *ClusterBuilder) CloudProvider(cloudProvider string) *ClusterBuilder
- func (cb *ClusterBuilder) CreationTimestamp(creationTimestamp time.Time) *ClusterBuilder
- func (cb *ClusterBuilder) ExpirationTimestamp(expirationTimestamp time.Time) *ClusterBuilder
- func (cb *ClusterBuilder) Flavour(flavour string) *ClusterBuilder
- func (cb *ClusterBuilder) ID(id string) *ClusterBuilder
- func (cb *ClusterBuilder) Name(name string) *ClusterBuilder
- func (cb *ClusterBuilder) NumComputeNodes(numComputeNodes int) *ClusterBuilder
- func (cb *ClusterBuilder) Product(product string) *ClusterBuilder
- func (cb *ClusterBuilder) Properties(properties map[string]string) *ClusterBuilder
- func (cb *ClusterBuilder) Region(region string) *ClusterBuilder
- func (cb *ClusterBuilder) State(state ClusterState) *ClusterBuilder
- func (cb *ClusterBuilder) Version(version string) *ClusterBuilder
- type ClusterState
- type Provider
- type ProviderCreateFunction
- type UpgradeSource
- type Version
- type VersionBuilder
- type VersionList
- type VersionListBuilder
Constants ¶
const ( // CincinnatiStableChannel is the stable Cincinnati channel. CincinnatiStableChannel = "stable" // CincinnatiFastChannel is the fast Cincinnati channel. CincinnatiFastChannel = "fast" // CincinnatiCandidateChannel is the candidate Cincinnati channel. CincinnatiCandidateChannel = "candidate" )
Variables ¶
This section is empty.
Functions ¶
func RegisterProvider ¶
RegisterProvider will register a provider with the given name that will be created by the given provider factory.
Types ¶
type AddOnParams ¶
AddOnParams is a key-value store of parameters for an addon's installation
type CincinnatiChannel ¶
type CincinnatiChannel string
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster is the intermediary cluster object between a provisioner and osde2e.
func (*Cluster) ChannelGroup ¶
ChannelGroup returns the cluster channel group
func (*Cluster) CloudProvider ¶
CloudProvider returns the cloud provider.
func (*Cluster) CreationTimestamp ¶
CreationTimestamp returns the creation timestamp.
func (*Cluster) ExpirationTimestamp ¶
ExpirationTimestamp returns the expiration timestamp.
func (*Cluster) NumComputeNodes ¶
NumComputeNodes returns the number of compute nodes.
func (*Cluster) Properties ¶
Properties returns properties related to the given cluster.
type ClusterBuilder ¶
type ClusterBuilder struct {
// contains filtered or unexported fields
}
ClusterBuilder is a struct that can create cluster objects.
func NewClusterBuilder ¶
func NewClusterBuilder() *ClusterBuilder
NewClusterBuilder creates a new cluster builder that can create a new cluster.
func (*ClusterBuilder) AddAddon ¶
func (cb *ClusterBuilder) AddAddon(addon string) *ClusterBuilder
AddAddon appends the addon to the list of addons.
func (*ClusterBuilder) Addons ¶
func (cb *ClusterBuilder) Addons(addons []string) *ClusterBuilder
Addons sets the list of addons for a cluster builder.
func (*ClusterBuilder) Build ¶
func (cb *ClusterBuilder) Build() *Cluster
Build will create the cluster from the cluster build.
func (*ClusterBuilder) ChannelGroup ¶
func (cb *ClusterBuilder) ChannelGroup(channelGroup string) *ClusterBuilder
ChannelGroup returns the cluster channel group
func (*ClusterBuilder) CloudProvider ¶
func (cb *ClusterBuilder) CloudProvider(cloudProvider string) *ClusterBuilder
CloudProvider sets the cloud provider for a cluster builder.
func (*ClusterBuilder) CreationTimestamp ¶
func (cb *ClusterBuilder) CreationTimestamp(creationTimestamp time.Time) *ClusterBuilder
CreationTimestamp sets the creation timestamp for a cluster builder.
func (*ClusterBuilder) ExpirationTimestamp ¶
func (cb *ClusterBuilder) ExpirationTimestamp(expirationTimestamp time.Time) *ClusterBuilder
ExpirationTimestamp sets the expiration timestamp for a cluster builder.
func (*ClusterBuilder) Flavour ¶
func (cb *ClusterBuilder) Flavour(flavour string) *ClusterBuilder
Flavour sets the flavour for a cluster builder.
func (*ClusterBuilder) ID ¶
func (cb *ClusterBuilder) ID(id string) *ClusterBuilder
ID sets the ID for a cluster builder.
func (*ClusterBuilder) Name ¶
func (cb *ClusterBuilder) Name(name string) *ClusterBuilder
Name sets the name for a cluster builder.
func (*ClusterBuilder) NumComputeNodes ¶
func (cb *ClusterBuilder) NumComputeNodes(numComputeNodes int) *ClusterBuilder
NumComputeNodes sets the number of compute nodes
func (*ClusterBuilder) Product ¶
func (cb *ClusterBuilder) Product(product string) *ClusterBuilder
Product sets the cloud provider for a cluster builder.
func (*ClusterBuilder) Properties ¶
func (cb *ClusterBuilder) Properties(properties map[string]string) *ClusterBuilder
Properties sets the list of properties for a cluster builder.
func (*ClusterBuilder) Region ¶
func (cb *ClusterBuilder) Region(region string) *ClusterBuilder
Region sets the region for a cluster builder.
func (*ClusterBuilder) State ¶
func (cb *ClusterBuilder) State(state ClusterState) *ClusterBuilder
State sets the state for a cluster builder.
func (*ClusterBuilder) Version ¶
func (cb *ClusterBuilder) Version(version string) *ClusterBuilder
Version sets the version for a cluster builder.
type ClusterState ¶
type ClusterState string
ClusterState is the state of the cluster.
const ( // ClusterStateError is the cluster error state. ClusterStateError ClusterState = "error" // ClusterStateInstalling the cluster is being isntalled. ClusterStateInstalling ClusterState = "installing" // ClusterStatePending the cluster is awaiting installation. ClusterStatePending ClusterState = "pending" // ClusterStatePendingAccount the cluster is awaiting an account ClusterStatePendingAccount ClusterState = "pending_account" // ClusterStateReady the cluster is ready to use. ClusterStateReady ClusterState = "ready" // ClusterStateUninstalling the cluster is uninstalling. ClusterStateUninstalling ClusterState = "uninstalling" // ClusterStateUnknown the cluster state is unknown. ClusterStateUnknown ClusterState = "unknown" // ClusterStatePoweringDown ClusterStatePoweringDown ClusterState = "powering_down" // ClusterStateHibernating ClusterStateHibernating ClusterState = "hibernating" // ClusterStateResuming ClusterStateResuming ClusterState = "resuming" )
type Provider ¶
type Provider interface { // IsValidClusterName validates that the proposed name used for creating the cluster. // // Currently this validates if the proposed clusterName already exists before attempting to // create and cycling on OCM errors. IsValidClusterName(clusterName string) (bool, error) // LaunchCluster creates a new cluster and returns the cluster ID. // // This is expected to kick off the cluster provisioning process and // report back an identifier without waiting. Subsequent calls within OSDe2e will // use the status reported by GetCluster to determine the provision state of // the cluster and wait for it to start before running tests. LaunchCluster(clusterName string) (string, error) // DeleteCluster deletes a cluster. // // Calling this will start a cluster deletion and return as soon as the process // has begun. OSDe2e will not wait for the cluster to delete. DeleteCluster(clusterID string) error // ListCluster lists clusters from a provider based on a SQL-like query. ListClusters(query string) ([]*Cluster, error) // GetCluster gets a cluster. // // This is what OSDe2e will use to gather cluster information, including whether // the cluser has finished provisioning. GetCluster(clusterID string) (*Cluster, error) // ClusterKubeconfig should return the raw kubeconfig for the cluster. // // OSDe2e needs administrative cluster level access for a cluster, so this should // return a raw kubeconfig that will allow OSDe2e to connect with administrative // access. ClusterKubeconfig(clusterID string) ([]byte, error) // CheckQuota will return true if there is enough quota to provision a cluster. // // To prevent a provisioning attempt, OSDe2e will first check the quota first. This quota // is currently expected to be configured by the global config object. CheckQuota(sku string) (bool, error) // InstallAddons will install addons onto the cluster. // // OpenShift dedicated has the notion of addon installation, which users can request from // the OCM API. If you wish to emulate this support, the provider will need to support a similar // mechanism. InstallAddons(clusterID string, addonIDs []AddOnID, params map[AddOnID]AddOnParams) (int, error) // Versions returns a sorted list of supported OpenShift versions. // // A version list of the available OpenShift versions supported by this provider. One of the // versions is expected to be labeled as "default." The provider can also set a default version // override, which is useful if you want to select relative versions to test against, e.g. // 4.3.12 + nightly of next release == 4.4.0-0.nightly. Versions() (*VersionList, error) // Logs will get logs relevant to the cluster from the provider. // // Any provider level logs that are relevant to the cluster. Logs(clusterID string) (map[string][]byte, error) // Metrics will get metrics relevant to the cluster from the provider. Metrics(clusterID string) (bool, error) // Environment retrives the environment from the provider. // // This is for providers that have situations like "integration," "stage," and "production" // environments. There's no restriction on what values are expected to be returned here. Environment() string // UpgradeSource is what upgrade source to use when attempting an upgrade. // // This returns what OSDe2e should use to try to select an upgrade version. Right now only // Cincinnati and the release controller are supported. UpgradeSource() UpgradeSource // CincinnatiChannel is the Cincinnati channel to use for upgrades (where applicable). // // If the upgrade channel uses a Cincinnati source, this will dictate what channel should be // used. This is only a prefix, so "fast," "stable," etc. CincinnatiChannel() CincinnatiChannel // Type is the Provider type, specific to each Plugin // // This simply returns the name of the Provider Type() string // ExtendExpiry extends the expiration time of an existing cluster. ExtendExpiry(clusterID string, hours uint64, minutes uint64, seconds uint64) error // Expire sets the expiration of an existing cluster to the current time. Expire(clusterID string, duration time.Duration) error // AddProperty adds a new property to the properties field of an existing cluster. AddProperty(cluster *Cluster, tag string, value string) error // GetProperty gets a property from the properties field of an existing cluster. GetProperty(clusterID string, property string) (string, error) // Upgrade requests the provider initiate a cluster upgrade to the given version Upgrade(clusterID string, version string, t time.Time) error // GetUpgradePolicyID gets the first upgrade policy from the top GetUpgradePolicyID(clusterID string) (string, error) // UpdateSchedule updates the existing upgrade policy for re-scheduling UpdateSchedule(clusterID string, version string, t time.Time, policyID string) error // DetermineMachineType selects a random machine type for a given cluster. DetermineMachineType(cloudProvider string) (string, error) // Hibernate triggers a hibernation of the cluster // If hibernation is unsupported by the provider, it will log that it's unsupported // but still return True. Hibernate(clusterID string) bool // Resume triggers a hibernated cluster to wake up // If hibernation is unsupported by the provider, it will log that it's unsupported // but still return True. Resume(clusterID string) bool // AddClusterProxy adds a cluster-wide proxy to the cluster. AddClusterProxy(clusterId string, httpsProxy string, httpProxy string, userCABundle string) error // RemoveClusterProxy removes the cluster proxy configuration for the supplied cluster RemoveClusterProxy(clusterId string) error // RemoveUserCABundle removes only the Additional Trusted CA Bundle from the cluster RemoveUserCABundle(clusterId string) error // LoadUserCaBundleData loads CA contents from CA cert file LoadUserCaBundleData(file string) (string, error) // VersionGateLabel returns the provider version gate label VersionGateLabel() string // GetVersionGateID checks to see if a version gate exists for the cluster version provided GetVersionGateID(version string, label string) (string, error) // AddGateAgreement adds gate agreement to the cluster to acknowledge cluster upgrade AddGateAgreement(clusterID string, versionGateID string) error }
Provider is the interface that must be implemented in order to provision clusters in osde2e.
func GetProvider ¶
GetProvider will retrieve a provider with the given name.
type ProviderCreateFunction ¶
ProviderCreateFunction is a function that creates providers.
type UpgradeSource ¶
type UpgradeSource string
UpgradeSource is the source that should be used when attempting upgrades.
const ( // CincinnatiSource indicates that upgrades should use Cincinnati. CincinnatiSource UpgradeSource = "cincinnati" // ReleaseControllerSource indicates that upgrades should use the release controller. ReleaseControllerSource UpgradeSource = "release-controller" )
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version represents an Openshift version.
func (*Version) AddUpgradePath ¶
func (v *Version) AddUpgradePath(version *semver.Version)
AddUpgradePath adds an upgrade edge to a version
func (*Version) AvailableUpgrades ¶
AvailableUpgrades returns the available upgrades
func (*Version) CanUpgradeTo ¶
CanUpgradeTo returns whether a version is a valid upgrade path
type VersionBuilder ¶
type VersionBuilder struct {
// contains filtered or unexported fields
}
VersionBuilder is used to build version objects.
func NewVersionBuilder ¶
func NewVersionBuilder() *VersionBuilder
NewVersionBuilder creates a new version builder.
func (*VersionBuilder) AvailableUpgrades ¶
func (vb *VersionBuilder) AvailableUpgrades(availableUpgrades map[*semver.Version]bool) *VersionBuilder
AvailableUpgrades sets the availableUpgrades value for the builder
func (*VersionBuilder) Build ¶
func (vb *VersionBuilder) Build() *Version
Build will build the version object.
func (*VersionBuilder) Default ¶
func (vb *VersionBuilder) Default(isDefault bool) *VersionBuilder
Default sets the isDefault value for the builder.
func (*VersionBuilder) Version ¶
func (vb *VersionBuilder) Version(version *semver.Version) *VersionBuilder
Version sets the version for the builder.
type VersionList ¶
type VersionList struct {
// contains filtered or unexported fields
}
VersionList is the list of versions found by the provider.
func (*VersionList) AvailableVersions ¶
func (vl *VersionList) AvailableVersions() []*Version
AvailableVersions is the list of versions available to the provider.
func (*VersionList) Default ¶
func (vl *VersionList) Default() *semver.Version
Default is the default version in the VersionList. If defaultVersionOverride is set, it will be returned instead of the availableVersion tagged as default.
func (*VersionList) FindVersion ¶
func (vl *VersionList) FindVersion(version string) []*Version
FindVersion looks for a version in the list and returns it Since duplicate versions can be in the list thanks to channels We must return multiple versions. /shrug
type VersionListBuilder ¶
type VersionListBuilder struct {
// contains filtered or unexported fields
}
VersionListBuilder will build VersionList objects.
func NewVersionListBuilder ¶
func NewVersionListBuilder() *VersionListBuilder
NewVersionListBuilder creates a new version list builder.
func (*VersionListBuilder) AvailableVersions ¶
func (vb *VersionListBuilder) AvailableVersions(availableVersions []*Version) *VersionListBuilder
AvailableVersions sets the available versions in the builder.
func (*VersionListBuilder) Build ¶
func (vb *VersionListBuilder) Build() *VersionList
Build will build the version list object.
func (*VersionListBuilder) DefaultVersionOverride ¶
func (vb *VersionListBuilder) DefaultVersionOverride(defaultVersionOverride *semver.Version) *VersionListBuilder
DefaultVersionOverride sets the default version override in the builder.