Documentation ¶
Overview ¶
Package ocmprovider allows for the creation and management of OSD clusters through OCM.
Index ¶
- Constants
- Variables
- func GetAvailabilityZones(subnetworks []*v1.Subnetwork, configSubnetIDs []string) (availabilityZones []string)
- func HasQuotaForSKU(q *accounts.QuotaCost, skuQuota string) bool
- func HyperShiftInvalidCertWorkaround(kubeConfigContent string) ([]byte, error)
- func OCMConnection(token, clientID, clientSecret, env string, debug bool) (*ocm.Connection, error)
- type CloudRegion
- type Cluster
- type ClusterData
- type ClusterWideProxy
- type Context
- type ContextData
- type KubeConfig
- type ModCluster
- type ModClusterData
- type ModKubeConfig
- type OCMProvider
- func (o *OCMProvider) AddClusterProxy(clusterId string, httpsProxy string, httpProxy string, userCABundle string) error
- func (o *OCMProvider) AddGateAgreement(clusterID string, versionGateID string) error
- func (o *OCMProvider) AddProperty(cluster *spi.Cluster, tag string, value string) error
- func (o *OCMProvider) CheckQuota(skuRuleID string) (bool, error)
- func (o *OCMProvider) ChooseImageSource(choice string) (source string)
- func (o *OCMProvider) CincinnatiChannel() spi.CincinnatiChannel
- func (o *OCMProvider) ClusterKubeconfig(clusterID string) ([]byte, error)
- func (o *OCMProvider) DeleteCluster(clusterID string) error
- func (o *OCMProvider) DetermineMachineType(cloudProvider string) (string, error)
- func (o *OCMProvider) DetermineRegion(cloudProvider string) (string, error)
- func (o *OCMProvider) Environment() string
- func (o *OCMProvider) Expire(clusterID string, duration time.Duration) error
- func (o *OCMProvider) ExtendExpiry(clusterID string, hours uint64, minutes uint64, seconds uint64) error
- func (o *OCMProvider) FindRecycledCluster(originalVersion, cloudProvider, product string) string
- func (o *OCMProvider) GateAgreementExist(clusterID string, gateAgreementID string) (bool, error)
- func (o *OCMProvider) GenerateProperties() (map[string]string, error)
- func (o *OCMProvider) GetCluster(clusterID string) (*spi.Cluster, error)
- func (o *OCMProvider) GetConnection() *ocm.Connection
- func (o *OCMProvider) GetOCMCluster(clusterID string) (*v1.Cluster, error)
- func (o *OCMProvider) GetProperty(clusterID string, property string) (string, error)
- func (o *OCMProvider) GetSubnetworks(cloudProviderData *v1.CloudProviderData) (subnetworks []*v1.Subnetwork, err error)
- func (o *OCMProvider) GetUpgradePolicyID(clusterID string) (string, error)
- func (o *OCMProvider) GetVersionGate(id string) (*v1.VersionGate, error)
- func (o *OCMProvider) GetVersionGateID(version string, label string) (string, error)
- func (o *OCMProvider) Hibernate(id string) bool
- func (o *OCMProvider) InstallAddons(clusterID string, addonIDs []spi.AddOnID, ...) (num int, err error)
- func (o *OCMProvider) IsValidClusterName(clusterName string) (bool, error)
- func (o *OCMProvider) LaunchCluster(clusterName string) (string, error)
- func (o *OCMProvider) ListClusters(query string) ([]*spi.Cluster, error)
- func (o *OCMProvider) LoadUserCaBundleData(file string) (string, error)
- func (o *OCMProvider) Logs(clusterID string) (logs map[string][]byte, err error)
- func (o *OCMProvider) Metrics(clusterID string) (bool, error)
- func (o *OCMProvider) RemoveClusterProxy(clusterId string) error
- func (o *OCMProvider) RemoveUserCABundle(clusterId string) error
- func (o *OCMProvider) Resume(id string) bool
- func (o *OCMProvider) RetrieveGCPConfigs() error
- func (o *OCMProvider) Type() string
- func (o *OCMProvider) UpdateSchedule(clusterID string, version string, t time.Time, policyID string) error
- func (o *OCMProvider) Upgrade(clusterID string, version string, t time.Time) error
- func (o *OCMProvider) UpgradeSource() spi.UpgradeSource
- func (o *OCMProvider) VersionGateLabel() string
- func (o *OCMProvider) VersionGates() (*v1.VersionGateList, error)
- func (o *OCMProvider) Versions() (*spi.VersionList, error)
- type User
- type UserData
Constants ¶
const ( // Token is used to authenticate with OCM. Token = "ocm.token" // Env is the OpenShift Dedicated environment used to provision clusters. Env = "ocm.env" // Debug shows debug level messages when enabled. Debug = "ocm.debug" // NumRetries is the number of times to retry each OCM call. NumRetries = "ocm.numRetries" // ComputeMachineType is the specific cloud machine type to use for compute nodes. ComputeMachineType = "ocm.computeMachineType" // ComputeMachineTypeRegex is the regex for cloud machine type to use for compute nodes. ComputeMachineTypeRegex = "ocm.computeMachineTypeRegex" // UserOverride will hard set the user assigned to the "owner" tag by the OCM provider. UserOverride = "ocm.userOverride" // Flavour is an OCM cluster descriptor for cluster defaults Flavour = "ocm.flavour" // SKU Rule ID is an identifier for a SKU that OCM can provision Sku = "ocm.skuRule" // AdditionalLabels is used to add more specific labels to a cluster in OCM. AdditionalLabels = "ocm.additionalLabels" // CCS defines whether the cluster should expect cloud credentials or not CCS = "ocm.ccs" // FedRamp Keycloack Client ID FedRampClientID = "fedRamp.clientID" // FedRamp Keycloack Client Secret FedRampClientSecret = "fedRamp.clientSecret" // HTTPS_PROXY - Currently only used for FedRamp HTTPSProxy = "ocm.https_proxy" )
const ( // APIVersion is the version of the OSD API to use. APIVersion = "v1" // TokenURL specifies the endpoint used to create access tokens. TokenURL = "https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token" // ClientID is used to identify the client to OSD. ClientID = "cloud-services" )
const ( // VersionPrefix is the string that every OSD version begins with. VersionPrefix = "openshift-" // PageSize is the number of results to get per page from the cluster versions endpoint PageSize = 100 // NoVersionFound is the value placed into a version string when no valid Cincinnati version can be selected. NoVersionFound = "NoVersionFound" )
Variables ¶
var Environments = environments{ "": integration, // contains filtered or unexported fields }
Environments are known instance of OSD.
Functions ¶
func GetAvailabilityZones ¶
func GetAvailabilityZones(subnetworks []*v1.Subnetwork, configSubnetIDs []string) (availabilityZones []string)
func HasQuotaForSKU ¶
HasQuotaForSKU looks for a quota cost for the desired SKU and returns it if one is found and sufficient quota exists.
func HyperShiftInvalidCertWorkaround ¶
Remove admin-kubeconfig certificate from HyperShift clusters as it is invalid. Refer to OCPBUGS-8101. This is only a workaround until the bug is resolved.
func OCMConnection ¶
func OCMConnection(token, clientID, clientSecret, env string, debug bool) (*ocm.Connection, error)
OCMConnection returns a raw OCM connection.
Types ¶
type CloudRegion ¶
CloudRegion provides an interface for methods on *v1.CloudRegion so that compatible types can be instantiated from tests.
func ChooseRandomRegion ¶
func ChooseRandomRegion(regions ...CloudRegion) (CloudRegion, bool)
ChooseRandomRegion chooses a random enabled region from the provided options. Its second return parameter indicates whether it was successful in finding an enabled region.
type Cluster ¶
type Cluster struct { Name string Cluster ClusterData }
type ClusterData ¶
type ClusterWideProxy ¶
type Context ¶
type Context struct { Name string Context ContextData }
type ContextData ¶
type KubeConfig ¶
type ModCluster ¶
type ModCluster struct { Name string Cluster ModClusterData }
type ModClusterData ¶
type ModClusterData struct {
Server string
}
type ModKubeConfig ¶
type OCMProvider ¶
type OCMProvider struct {
// contains filtered or unexported fields
}
OCMProvider will provision clusters using the OCM API.
func NewWithEnv ¶
func NewWithEnv(env string) (*OCMProvider, error)
NewWithEnv creates a new provider with a specific environment.
func (*OCMProvider) AddClusterProxy ¶
func (o *OCMProvider) AddClusterProxy(clusterId string, httpsProxy string, httpProxy string, userCABundle string) error
AddClusterProxy sets the cluster proxy configuration for the supplied cluster
func (*OCMProvider) AddGateAgreement ¶
func (o *OCMProvider) AddGateAgreement(clusterID string, versionGateID string) error
AddGateAgreement adds the gate agreement to the cluster for cluster upgrades
func (*OCMProvider) AddProperty ¶
AddProperty adds a new property to the properties field of an existing cluster
func (*OCMProvider) CheckQuota ¶
func (o *OCMProvider) CheckQuota(skuRuleID string) (bool, error)
CheckQuota determines if enough quota is available to launch with cfg.
func (*OCMProvider) ChooseImageSource ¶
func (o *OCMProvider) ChooseImageSource(choice string) (source string)
func (*OCMProvider) CincinnatiChannel ¶
func (o *OCMProvider) CincinnatiChannel() spi.CincinnatiChannel
CincinnatiChannel returns a "fast" channel for stage and a "stable" channel for prod. This channel won't be used for integration since the upgrade source for integration is the release controller and not Cincinnati.
func (*OCMProvider) ClusterKubeconfig ¶
func (o *OCMProvider) ClusterKubeconfig(clusterID string) ([]byte, error)
ClusterKubeconfig returns the kubeconfig for the given cluster ID.
func (*OCMProvider) DeleteCluster ¶
func (o *OCMProvider) DeleteCluster(clusterID string) error
DeleteCluster requests the deletion of clusterID.
func (*OCMProvider) DetermineMachineType ¶
func (o *OCMProvider) DetermineMachineType(cloudProvider string) (string, error)
DetermineMachineType will return the machine type provided by configs. This mainly wraps the random functionality for use by the OCM provider. Returns a random machine type if the machine type is set to "random" and a more narrowed random if a regex was specified.
func (*OCMProvider) DetermineRegion ¶
func (o *OCMProvider) DetermineRegion(cloudProvider string) (string, error)
DetermineRegion will return the region provided by configs. This mainly wraps the random functionality for use by the ROSA provider.
func (*OCMProvider) Environment ¶
func (o *OCMProvider) Environment() string
Environment simply returns the environment this OCMProvider is pointed to.
func (*OCMProvider) Expire ¶
func (o *OCMProvider) Expire(clusterID string, duration time.Duration) error
Expire sets the expiration time of an existing cluster to the current time + N minutes
func (*OCMProvider) ExtendExpiry ¶
func (o *OCMProvider) ExtendExpiry(clusterID string, hours uint64, minutes uint64, seconds uint64) error
ExtendExpiry extends the expiration time of an existing cluster
func (*OCMProvider) FindRecycledCluster ¶
func (o *OCMProvider) FindRecycledCluster(originalVersion, cloudProvider, product string) string
func (*OCMProvider) GateAgreementExist ¶
func (o *OCMProvider) GateAgreementExist(clusterID string, gateAgreementID string) (bool, error)
GateAgreementExist checks to see if the gate agreement id is already applied to the cluster provided
func (*OCMProvider) GenerateProperties ¶
func (o *OCMProvider) GenerateProperties() (map[string]string, error)
GenerateProperties will generate a set of properties to assign to a cluster.
func (*OCMProvider) GetCluster ¶
func (o *OCMProvider) GetCluster(clusterID string) (*spi.Cluster, error)
GetCluster returns a cluster from OCM.
func (*OCMProvider) GetConnection ¶
func (o *OCMProvider) GetConnection() *ocm.Connection
GetConnection returns the connection used by this provider.
func (*OCMProvider) GetOCMCluster ¶
func (o *OCMProvider) GetOCMCluster(clusterID string) (*v1.Cluster, error)
func (*OCMProvider) GetProperty ¶
func (o *OCMProvider) GetProperty(clusterID string, property string) (string, error)
Get a specific cluster property
func (*OCMProvider) GetSubnetworks ¶
func (o *OCMProvider) GetSubnetworks(cloudProviderData *v1.CloudProviderData) (subnetworks []*v1.Subnetwork, err error)
func (*OCMProvider) GetUpgradePolicyID ¶
func (o *OCMProvider) GetUpgradePolicyID(clusterID string) (string, error)
GetUpgradePolicyID gets the first upgrade policy from the top
func (*OCMProvider) GetVersionGate ¶
func (o *OCMProvider) GetVersionGate(id string) (*v1.VersionGate, error)
GetVersionGate gets the version gate resource using the version gate id provided
func (*OCMProvider) GetVersionGateID ¶
func (o *OCMProvider) GetVersionGateID(version string, label string) (string, error)
GetVersionGateID checks to see if a version gate exists for the cluster version provided
func (*OCMProvider) Hibernate ¶
func (o *OCMProvider) Hibernate(id string) bool
Hibernate resumes a cluster via OCM
func (*OCMProvider) InstallAddons ¶
func (o *OCMProvider) InstallAddons(clusterID string, addonIDs []spi.AddOnID, addonParams map[spi.AddOnID]spi.AddOnParams) (num int, err error)
InstallAddons loops through the addons list in the config and performs the CRUD operation to trigger addon installation
func (*OCMProvider) IsValidClusterName ¶
func (o *OCMProvider) IsValidClusterName(clusterName string) (bool, error)
IsValidClusterName validates the clustername prior to proceeding with it in launching a cluster.
func (*OCMProvider) LaunchCluster ¶
func (o *OCMProvider) LaunchCluster(clusterName string) (string, error)
LaunchCluster setups an new cluster using the OSD API and returns it's ID. nolint:gocyclo
func (*OCMProvider) ListClusters ¶
func (o *OCMProvider) ListClusters(query string) ([]*spi.Cluster, error)
ListClusters returns a list of clusters filtered on key/value pairs
func (*OCMProvider) LoadUserCaBundleData ¶
func (o *OCMProvider) LoadUserCaBundleData(file string) (string, error)
func (*OCMProvider) Logs ¶
func (o *OCMProvider) Logs(clusterID string) (logs map[string][]byte, err error)
Logs provides all logs available for clusterID, ids can be optionally provided for only specific logs.
func (*OCMProvider) Metrics ¶
func (o *OCMProvider) Metrics(clusterID string) (bool, error)
Metrics returns the metrics of the cluster
func (*OCMProvider) RemoveClusterProxy ¶
func (o *OCMProvider) RemoveClusterProxy(clusterId string) error
RemoveClusterProxy removes the cluster proxy configuration for the supplied cluster
func (*OCMProvider) RemoveUserCABundle ¶
func (o *OCMProvider) RemoveUserCABundle(clusterId string) error
RemoveUserCABundle removes only the Additional Trusted CA Bundle from the cluster
func (*OCMProvider) Resume ¶
func (o *OCMProvider) Resume(id string) bool
Resume resumes a cluster via OCM
func (*OCMProvider) RetrieveGCPConfigs ¶
func (o *OCMProvider) RetrieveGCPConfigs() error
func (*OCMProvider) Type ¶
func (o *OCMProvider) Type() string
Type returns the provisioner type: ocm
func (*OCMProvider) UpdateSchedule ¶
func (o *OCMProvider) UpdateSchedule(clusterID string, version string, t time.Time, policyID string) error
UpdateSchedule updates the existing upgrade policy for re-scheduling
func (*OCMProvider) UpgradeSource ¶
func (o *OCMProvider) UpgradeSource() spi.UpgradeSource
UpgradeSource indicates that for stage/production clusters, we should use Cincinnati. For integration clusters, we should use the release controller.
func (*OCMProvider) VersionGateLabel ¶
func (o *OCMProvider) VersionGateLabel() string
VersionGateLabel returns the provider version gate label
func (*OCMProvider) VersionGates ¶
func (o *OCMProvider) VersionGates() (*v1.VersionGateList, error)
VersionGates gets the list of available version gates from ocm
func (*OCMProvider) Versions ¶
func (o *OCMProvider) Versions() (*spi.VersionList, error)
Versions will return all of the available version and a default override of the production default version if using a non-production environment.