ocm

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 30 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ANY                 = "any"
	HibernateCapability = "capability.organization.hibernate_cluster"
)
View Source
const AcceleratedComputing = "accelerated_computing"
View Source
const DefaultChannelGroup = "stable"
View Source
const LowestSTSMinor = "4.7"
View Source
const LowestSTSSupport = "4.7.11"

Variables

View Source
var URLAliases = map[string]string{
	"production":  "https://api.openshift.com",
	"staging":     "https://api.stage.openshift.com",
	"integration": "https://api.integration.openshift.com",
}

URLAliases allows the value of the `--env` option to map to the various API URLs.

Functions

func AddClusterFlag added in v1.1.5

func AddClusterFlag(cmd *cobra.Command)

func ClusterNameValidator added in v1.1.1

func ClusterNameValidator(name interface{}) error

func GetAvailableMachineTypeList added in v1.1.0

func GetAvailableMachineTypeList(machineTypes []*MachineType, multiAZ bool) (machineTypeList []string)

func GetClusterKey added in v1.1.5

func GetClusterKey() (string, error)

func GetEnv added in v1.1.0

func GetEnv() (string, error)

func GetVersionID added in v1.1.0

func GetVersionID(cluster *cmv1.Cluster) string

func GetVersionMinorList added in v1.1.3

func GetVersionMinorList(ocmClient *Client) (versionList []string, err error)

Get a list of all STS-supported minor versions

func HasSTSSupport added in v1.1.0

func HasSTSSupport(rawID string, channelGroup string) bool

func HasSTSSupportMinor added in v1.1.0

func HasSTSSupportMinor(minor string) bool

func IdentityProviderType

func IdentityProviderType(idp *cmv1.IdentityProvider) string

func IsEmptyCIDR added in v1.1.0

func IsEmptyCIDR(cidr net.IPNet) bool

func IsValidClusterKey

func IsValidClusterKey(clusterKey string) bool

func IsValidClusterName added in v1.1.0

func IsValidClusterName(clusterName string) bool

func IsValidUsername

func IsValidUsername(username string) bool

func Location added in v1.1.0

func Location() (path string, err error)

Location returns the location of the configuration file. If a configuration file already exists in the HOME directory, it uses that, otherwise it prefers to use the XDG config directory.

func RandomLabel added in v1.1.2

func RandomLabel(size int) string

func Remove added in v1.1.0

func Remove() error

Remove removes the configuration file.

func Save added in v1.1.0

func Save(cfg *Config) error

Save saves the given configuration to the configuration file.

func SetClusterKey added in v1.1.5

func SetClusterKey(key string)

func ValidateMachineType added in v1.1.0

func ValidateMachineType(machineType string, machineTypes []*MachineType, multiAZ bool) (string, error)

Validate AWS machine types

func ValidateVersion added in v1.1.3

func ValidateVersion(version string, versionList []string) (string, error)

Validate OpenShift versions

Types

type AddOnParam added in v1.1.0

type AddOnParam struct {
	Key string
	Val string
}

type AddOnResource added in v0.1.10

type AddOnResource struct {
	AddOn     *cmv1.AddOn
	AZType    string
	Available bool
}

type Client added in v1.1.0

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

func (*Client) CancelUpgrade added in v1.1.0

func (c *Client) CancelUpgrade(clusterID string) (bool, error)

func (*Client) Close added in v1.1.0

func (c *Client) Close() error

func (*Client) CreateCluster added in v1.1.0

func (c *Client) CreateCluster(config Spec) (*cmv1.Cluster, error)

func (*Client) CreateIdentityProvider added in v1.1.0

func (c *Client) CreateIdentityProvider(clusterID string, idp *cmv1.IdentityProvider) (*cmv1.IdentityProvider, error)

func (*Client) CreateIngress added in v1.1.0

func (c *Client) CreateIngress(clusterID string, ingress *cmv1.Ingress) (*cmv1.Ingress, error)

func (*Client) CreateMachinePool added in v1.1.0

func (c *Client) CreateMachinePool(clusterID string, machinePool *cmv1.MachinePool) (*cmv1.MachinePool, error)

func (*Client) CreateUser added in v1.1.0

func (c *Client) CreateUser(clusterID string, group string, user *cmv1.User) (*cmv1.User, error)

func (*Client) DeleteCluster added in v1.1.0

func (c *Client) DeleteCluster(clusterKey string, creator *aws.Creator) (*cmv1.Cluster, error)

func (*Client) DeleteIdentityProvider added in v1.1.0

func (c *Client) DeleteIdentityProvider(clusterID string, idpID string) error

func (*Client) DeleteIngress added in v1.1.0

func (c *Client) DeleteIngress(clusterID string, ingressID string) error

func (*Client) DeleteMachinePool added in v1.1.0

func (c *Client) DeleteMachinePool(clusterID string, machinePoolID string) error

func (*Client) DeleteUser added in v1.1.0

func (c *Client) DeleteUser(clusterID string, group string, username string) error

func (*Client) GetAddOn added in v1.1.0

func (c *Client) GetAddOn(id string) (*cmv1.AddOn, error)

func (*Client) GetAddOnInstallation added in v1.1.0

func (c *Client) GetAddOnInstallation(clusterKey string, creator *aws.Creator,
	addOnID string) (*cmv1.AddOnInstallation, error)

func (*Client) GetAddOnParameters added in v1.1.0

func (c *Client) GetAddOnParameters(clusterID string, addOnID string) (*cmv1.AddOnParameterList, error)

func (*Client) GetAllClusters added in v1.1.5

func (c *Client) GetAllClusters(creator *aws.Creator) (clusters []*cmv1.Cluster, err error)

func (*Client) GetAvailableAddOns added in v1.1.0

func (c *Client) GetAvailableAddOns() ([]*AddOnResource, error)

Get complete list of available add-ons for the current organization

func (*Client) GetAvailableMachineTypes added in v1.1.0

func (c *Client) GetAvailableMachineTypes() ([]*MachineType, error)

func (*Client) GetAvailableUpgrades added in v1.1.0

func (c *Client) GetAvailableUpgrades(versionID string) ([]string, error)

func (*Client) GetCluster added in v1.1.0

func (c *Client) GetCluster(clusterKey string, creator *aws.Creator) (*cmv1.Cluster, error)

func (*Client) GetClusterAddOns added in v1.1.0

func (c *Client) GetClusterAddOns(cluster *cmv1.Cluster) ([]*ClusterAddOn, error)

Get all add-ons available for a cluster

func (*Client) GetClusterByID added in v1.1.5

func (c *Client) GetClusterByID(clusterKey string, creator *aws.Creator) (*cmv1.Cluster, error)

func (*Client) GetClusterState added in v1.1.0

func (c *Client) GetClusterState(clusterID string) (cmv1.ClusterState, error)

func (*Client) GetClusterStatus added in v1.1.0

func (c *Client) GetClusterStatus(clusterID string) (*cmv1.ClusterStatus, error)

func (*Client) GetClusters added in v1.1.0

func (c *Client) GetClusters(creator *aws.Creator, count int) (clusters []*cmv1.Cluster, err error)

* pass 0 to get all clusters

func (*Client) GetConnectionTokens added in v1.1.0

func (c *Client) GetConnectionTokens() (string, string, error)

func (*Client) GetConnectionURL added in v1.1.0

func (c *Client) GetConnectionURL() string

func (*Client) GetCurrentAccount added in v1.1.0

func (c *Client) GetCurrentAccount() (*amsv1.Account, error)

func (*Client) GetCurrentOrganization added in v1.1.0

func (c *Client) GetCurrentOrganization() (string, error)

func (*Client) GetDefaultClusterFlavors added in v1.1.0

func (c *Client) GetDefaultClusterFlavors(flavour string) (dMachinecidr *net.IPNet, dPodcidr *net.IPNet,
	dServicecidr *net.IPNet, dhostPrefix int)

func (*Client) GetIdentityProviders added in v1.1.0

func (c *Client) GetIdentityProviders(clusterID string) ([]*cmv1.IdentityProvider, error)

func (*Client) GetIngresses added in v1.1.0

func (c *Client) GetIngresses(clusterID string) ([]*cmv1.Ingress, error)

func (*Client) GetInstallLogs added in v1.1.0

func (c *Client) GetInstallLogs(clusterID string, tail int) (logs *cmv1.Log, err error)

func (*Client) GetMachinePools added in v1.1.0

func (c *Client) GetMachinePools(clusterID string) ([]*cmv1.MachinePool, error)

func (*Client) GetMachineTypeList added in v1.1.0

func (c *Client) GetMachineTypeList() (machineTypeList []string, err error)

func (*Client) GetMachineTypes added in v1.1.0

func (c *Client) GetMachineTypes() (machineTypes []*cmv1.MachineType, err error)

func (*Client) GetPendingClusterForARN added in v1.1.0

func (c *Client) GetPendingClusterForARN(creator *aws.Creator) (cluster *cmv1.Cluster, err error)

Gets only pending non-STS clusters that are installed in the same AWS account

func (*Client) GetRegionList added in v1.1.0

func (c *Client) GetRegionList(multiAZ bool, roleARN string,
	externalID string) (regionList []string, regionAZ map[string]bool, err error)

func (*Client) GetRegions added in v1.1.0

func (c *Client) GetRegions(roleARN string, externalID string) (regions []*cmv1.CloudRegion, err error)

func (*Client) GetScheduledUpgrade added in v1.1.0

func (c *Client) GetScheduledUpgrade(clusterID string) (*cmv1.UpgradePolicy, *cmv1.UpgradePolicyState, error)

func (*Client) GetUninstallLogs added in v1.1.0

func (c *Client) GetUninstallLogs(clusterID string, tail int) (logs *cmv1.Log, err error)

func (*Client) GetUpgradePolicies added in v1.1.0

func (c *Client) GetUpgradePolicies(clusterID string) (upgradePolicies []*cmv1.UpgradePolicy, err error)

func (*Client) GetUser added in v1.1.0

func (c *Client) GetUser(clusterID string, group string, username string) (*cmv1.User, error)

func (*Client) GetUsers added in v1.1.0

func (c *Client) GetUsers(clusterID string, group string) ([]*cmv1.User, error)

func (*Client) GetVersions added in v1.1.0

func (c *Client) GetVersions(channelGroup string) (versions []*cmv1.Version, err error)

func (*Client) HasClusters added in v1.1.0

func (c *Client) HasClusters(creator *aws.Creator) (bool, error)

func (*Client) HibernateCluster added in v1.1.0

func (c *Client) HibernateCluster(clusterID string) error

func (*Client) InstallAddOn added in v1.1.0

func (c *Client) InstallAddOn(clusterKey string, creator *aws.Creator, addOnID string,
	params []AddOnParam) error

func (*Client) IsCapabilityEnabled added in v1.1.0

func (c *Client) IsCapabilityEnabled(capabilityName string, orgID string) (bool, error)

func (*Client) IsHibernateCapabilityEnabled added in v1.1.0

func (c *Client) IsHibernateCapabilityEnabled() error

func (*Client) IsSTSClusterExists added in v1.1.5

func (c *Client) IsSTSClusterExists(creator *aws.Creator, count int, roleARN string) (exists bool, err error)

func (*Client) LogEvent added in v1.1.0

func (c *Client) LogEvent(key string)

func (*Client) PollInstallLogs added in v1.1.0

func (c *Client) PollInstallLogs(clusterID string, cb func(*cmv1.LogGetResponse) bool) (logs *cmv1.Log, err error)

func (*Client) PollUninstallLogs added in v1.1.0

func (c *Client) PollUninstallLogs(clusterID string,
	cb func(*cmv1.LogGetResponse) bool) (logs *cmv1.Log, err error)

func (*Client) ResumeCluster added in v1.1.0

func (c *Client) ResumeCluster(clusterID string) error

func (*Client) ScheduleUpgrade added in v1.1.0

func (c *Client) ScheduleUpgrade(clusterID string, upgradePolicy *cmv1.UpgradePolicy) error

func (*Client) UninstallAddOn added in v1.1.0

func (c *Client) UninstallAddOn(clusterKey string, creator *aws.Creator, addOnID string) error

func (*Client) UpdateAddOnInstallation added in v1.1.0

func (c *Client) UpdateAddOnInstallation(clusterKey string, creator *aws.Creator, addOnID string,
	params []AddOnParam) error

func (*Client) UpdateCluster added in v1.1.0

func (c *Client) UpdateCluster(clusterKey string, creator *aws.Creator, config Spec) error

func (*Client) UpdateIngress added in v1.1.0

func (c *Client) UpdateIngress(clusterID string, ingress *cmv1.Ingress) (*cmv1.Ingress, error)

func (*Client) UpdateMachinePool added in v1.1.0

func (c *Client) UpdateMachinePool(clusterID string, machinePool *cmv1.MachinePool) (*cmv1.MachinePool, error)

type ClientBuilder added in v1.1.0

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

ClientBuilder contains the information and logic needed to build a connection to OCM. Don't create instances of this type directly; use the NewClient function instead.

func NewClient added in v1.1.0

func NewClient() *ClientBuilder

NewClient creates a builder that can then be used to configure and build an OCM connection.

func (*ClientBuilder) Build added in v1.1.0

func (b *ClientBuilder) Build() (result *Client, err error)

Build uses the information stored in the builder to create a new OCM connection.

func (*ClientBuilder) Config added in v1.1.0

func (b *ClientBuilder) Config(value *Config) *ClientBuilder

Config sets the configuration that the connection will use to authenticate the user

func (*ClientBuilder) Logger added in v1.1.0

func (b *ClientBuilder) Logger(value *logrus.Logger) *ClientBuilder

Logger sets the logger that the connection will use to send messages to the log. This is mandatory.

type ClusterAddOn

type ClusterAddOn struct {
	ID    string
	Name  string
	State string
}

type Config added in v1.1.0

type Config struct {
	AccessToken  string   `json:"access_token,omitempty"`
	ClientID     string   `json:"client_id,omitempty"`
	ClientSecret string   `json:"client_secret,omitempty"`
	Insecure     bool     `json:"insecure,omitempty"`
	RefreshToken string   `json:"refresh_token,omitempty"`
	Scopes       []string `json:"scopes,omitempty"`
	TokenURL     string   `json:"token_url,omitempty"`
	URL          string   `json:"url,omitempty"`
}

Config is the type used to store the configuration of the client.

func Load added in v1.1.0

func Load() (cfg *Config, err error)

Load loads the configuration from the configuration file. If the configuration file doesn't exist it will return an empty configuration object.

func (*Config) Armed added in v1.1.0

func (c *Config) Armed() (armed bool, err error)

Armed checks if the configuration contains either credentials or tokens that haven't expired, so that it can be used to perform authenticated requests.

func (*Config) Connection added in v1.1.0

func (c *Config) Connection() (connection *sdk.Connection, err error)

Connection creates a connection using this configuration.

func (*Config) GetData added in v1.1.0

func (c *Config) GetData(key string) (value string, err error)

type MachineType added in v1.1.0

type MachineType struct {
	MachineType    *cmv1.MachineType
	Available      bool
	AvailableQuota int
}

type OperatorIAMRole added in v1.1.0

type OperatorIAMRole struct {
	Name      string
	Namespace string
	RoleARN   string
}

type Spec added in v1.1.0

type Spec struct {
	// Basic configs
	Name                      string
	Region                    string
	MultiAZ                   bool
	Version                   string
	ChannelGroup              string
	Expiration                time.Time
	Flavour                   string
	DisableWorkloadMonitoring bool
	//Encryption
	EtcdEncryption bool
	KMSKeyArn      string
	// Scaling config
	ComputeMachineType string
	ComputeNodes       int
	Autoscaling        bool
	MinReplicas        int
	MaxReplicas        int

	// SubnetIDs
	SubnetIds []string

	// AvailabilityZones
	AvailabilityZones []string

	// Network config
	MachineCIDR net.IPNet
	ServiceCIDR net.IPNet
	PodCIDR     net.IPNet
	HostPrefix  int
	Private     *bool
	PrivateLink *bool

	// Properties
	CustomProperties map[string]string

	// User-defined tags for AWS resources
	Tags map[string]string

	// Simulate creating a cluster but don't actually create it
	DryRun *bool

	// Disable SCP checks in the installer by setting credentials mode as mint
	DisableSCPChecks *bool

	// STS
	IsSTS               bool
	RoleARN             string
	ExternalID          string
	SupportRoleARN      string
	OperatorIAMRoles    []OperatorIAMRole
	ControlPlaneRoleARN string
	WorkerRoleARN       string
	Mode                string

	NodeDrainGracePeriodInMinutes float64
}

Spec is the configuration for a cluster spec.

Jump to

Keyboard shortcuts

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