powervs

package
v1.4.14 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 44 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRegion

func GetRegion(defaultRegion string) (string, error)

GetRegion prompts the user to select a region and returns that region.

func GetZone

func GetZone(region string, defaultZone string) (string, error)

GetZone prompts the user for a zone given a zone.

func IsKnownRegion

func IsKnownRegion(region string) bool

IsKnownRegion return true is a specified region is Known to the installer.

func IsKnownZone

func IsKnownZone(region string, zone string) bool

IsKnownZone return true is a specified zone is Known to the installer.

func Platform

func Platform() (*powervs.Platform, error)

Platform collects powervs-specific configuration.

func TransitGatewayEnabledZone added in v1.4.14

func TransitGatewayEnabledZone(zone string) bool

TransitGatewayEnabledZone returns if a zone is configured for transit gateways rather than cloud connections.

func Validate

func Validate(config *types.InstallConfig) error

Validate executes platform specific validation/

func ValidateCapacityWithPools

func ValidateCapacityWithPools(controlPlanes []machinev1beta1.Machine, computes []machinev1beta1.MachineSet, systemPools models.SystemPools) error

ValidateCapacityWithPools validates that the VMs created for both the controlPlanes and the computes will fit inside the given systemPools.

func ValidateCustomVPCSetup

func ValidateCustomVPCSetup(client API, ic *types.InstallConfig) error

ValidateCustomVPCSetup ensures optional VPC settings, if specified, are all legit.

func ValidatePreExistingDNS

func ValidatePreExistingDNS(client API, ic *types.InstallConfig, metadata MetadataAPI) error

ValidatePreExistingDNS ensures no pre-existing DNS record exists in the CIS DNS zone or IBM DNS zone for cluster's Kubernetes API.

func ValidateResourceGroup

func ValidateResourceGroup(client API, ic *types.InstallConfig) error

ValidateResourceGroup validates the resource group in our install config.

func ValidateServiceInstance

func ValidateServiceInstance(client API, ic *types.InstallConfig) error

ValidateServiceInstance validates the service instance in our install config.

Types

type API

type API interface {
	GetDNSRecordsByName(ctx context.Context, crnstr string, zoneID string, recordName string, publish types.PublishingStrategy) ([]DNSRecordResponse, error)
	GetDNSZoneIDByName(ctx context.Context, name string, publish types.PublishingStrategy) (string, error)
	GetDNSZones(ctx context.Context, publish types.PublishingStrategy) ([]DNSZoneResponse, error)
	GetDNSInstancePermittedNetworks(ctx context.Context, dnsID string, dnsZone string) ([]string, error)
	GetVPCByName(ctx context.Context, vpcName string) (*vpcv1.VPC, error)
	GetPublicGatewayByVPC(ctx context.Context, vpcName string) (*vpcv1.PublicGateway, error)
	GetSubnetByName(ctx context.Context, subnetName string, region string) (*vpcv1.Subnet, error)
	GetAuthenticatorAPIKeyDetails(ctx context.Context) (*iamidentityv1.APIKey, error)
	GetAPIKey() string
	SetVPCServiceURLForRegion(ctx context.Context, region string) error
	GetVPCs(ctx context.Context, region string) ([]vpcv1.VPC, error)
	ListResourceGroups(ctx context.Context) (*resourcemanagerv2.ResourceGroupList, error)
	ListServiceInstances(ctx context.Context) ([]string, error)
	ServiceInstanceIDToCRN(ctx context.Context, id string) (string, error)
}

API represents the calls made to the API.

type BxClient

type BxClient struct {
	*bxsession.Session
	APIKey               string
	Region               string
	Zone                 string
	PISession            *ibmpisession.IBMPISession
	User                 *User
	AccountAPIV2         accountv2.Accounts
	ServiceInstanceID    string
	PowerVSResourceGroup string
}

BxClient is struct which provides bluemix session details

func NewBxClient

func NewBxClient(survey bool) (*BxClient, error)

NewBxClient func returns bluemix client

func (*BxClient) GetAccountType

func (c *BxClient) GetAccountType() (string, error)

GetAccountType func return the type of account TRAIL/PAID

func (*BxClient) GetBxClientAPIKey

func (c *BxClient) GetBxClientAPIKey() string

GetBxClientAPIKey returns the API key used by the Blue Mix Client.

func (*BxClient) GetSystemPools

func (c *BxClient) GetSystemPools(ctx context.Context, serviceInstanceID string) (models.SystemPools, error)

GetSystemPools returns the system pools that are in the cloud.

func (*BxClient) NewPISession

func (c *BxClient) NewPISession() error

NewPISession updates pisession details, return error on fail.

func (*BxClient) ValidateAccountPermissions

func (c *BxClient) ValidateAccountPermissions() error

ValidateAccountPermissions Checks permission for provisioning Power VS resources

func (*BxClient) ValidateCapacity

func (c *BxClient) ValidateCapacity(ctx context.Context, controlPlanes []machinev1beta1.Machine, computes []machinev1beta1.MachineSet, serviceInstanceID string) error

ValidateCapacity validates space for processors and storage in the cloud.

func (*BxClient) ValidateCloudConnectionInPowerVSRegion

func (c *BxClient) ValidateCloudConnectionInPowerVSRegion(ctx context.Context, svcInsID string) error

ValidateCloudConnectionInPowerVSRegion counts cloud connection in PowerVS Region

func (*BxClient) ValidateDhcpService

func (c *BxClient) ValidateDhcpService(ctx context.Context, svcInsID string, machineNetworks []types.MachineNetworkEntry) error

ValidateDhcpService checks for existing Dhcp service for the provided PowerVS cloud instance

type Client

type Client struct {
	APIKey string
	BXCli  *BxClient
	// contains filtered or unexported fields
}

Client makes calls to the PowerVS API.

func NewClient

func NewClient() (*Client, error)

NewClient initializes a client with a session.

func (*Client) GetAPIKey

func (c *Client) GetAPIKey() string

GetAPIKey returns the PowerVS API key

func (*Client) GetAuthenticatorAPIKeyDetails

func (c *Client) GetAuthenticatorAPIKeyDetails(ctx context.Context) (*iamidentityv1.APIKey, error)

GetAuthenticatorAPIKeyDetails gets detailed information on the API key used for authentication to the IBM Cloud APIs.

func (*Client) GetDNSInstancePermittedNetworks

func (c *Client) GetDNSInstancePermittedNetworks(ctx context.Context, dnsID string, dnsZone string) ([]string, error)

GetDNSInstancePermittedNetworks gets the permitted VPC networks for a DNS Services instance

func (*Client) GetDNSRecordsByName

func (c *Client) GetDNSRecordsByName(ctx context.Context, crnstr string, zoneID string, recordName string, publish types.PublishingStrategy) ([]DNSRecordResponse, error)

GetDNSRecordsByName gets DNS records in specific Cloud Internet Services instance by its CRN, zone ID, and DNS record name.

func (*Client) GetDNSZoneIDByName

func (c *Client) GetDNSZoneIDByName(ctx context.Context, name string, publish types.PublishingStrategy) (string, error)

GetDNSZoneIDByName gets the CIS zone ID from its domain name.

func (*Client) GetDNSZones

func (c *Client) GetDNSZones(ctx context.Context, publish types.PublishingStrategy) ([]DNSZoneResponse, error)

GetDNSZones returns all of the active DNS zones managed by CIS.

func (*Client) GetInstanceCRNByName

func (c *Client) GetInstanceCRNByName(ctx context.Context, name string, publish types.PublishingStrategy) (string, error)

GetInstanceCRNByName finds the CRN of the instance with the specified name.

func (*Client) GetPublicGatewayByVPC

func (c *Client) GetPublicGatewayByVPC(ctx context.Context, vpcName string) (*vpcv1.PublicGateway, error)

GetPublicGatewayByVPC gets all PublicGateways in a region

func (*Client) GetSubnetByName

func (c *Client) GetSubnetByName(ctx context.Context, subnetName string, region string) (*vpcv1.Subnet, error)

GetSubnetByName gets a VPC Subnet by its name and region.

func (*Client) GetVPCByName

func (c *Client) GetVPCByName(ctx context.Context, vpcName string) (*vpcv1.VPC, error)

GetVPCByName gets a VPC by its name.

func (*Client) GetVPCs

func (c *Client) GetVPCs(ctx context.Context, region string) ([]vpcv1.VPC, error)

GetVPCs gets all VPCs in a region.

func (*Client) ListResourceGroups

func (c *Client) ListResourceGroups(ctx context.Context) (*resourcemanagerv2.ResourceGroupList, error)

ListResourceGroups returns a list of resource groups.

func (*Client) ListServiceInstances

func (c *Client) ListServiceInstances(ctx context.Context) ([]string, error)

ListServiceInstances lists all service instances in the cloud.

func (*Client) ServiceInstanceIDToCRN added in v1.4.14

func (c *Client) ServiceInstanceIDToCRN(ctx context.Context, id string) (string, error)

ServiceInstanceIDToCRN returns the CRN of the matching service instance GUID which was passed in.

func (*Client) SetVPCServiceURLForRegion

func (c *Client) SetVPCServiceURLForRegion(ctx context.Context, region string) error

SetVPCServiceURLForRegion will set the VPC Service URL to a specific IBM Cloud Region, in order to access Region scoped resources

type DNSRecordResponse

type DNSRecordResponse struct {
	Name string
	Type string
}

DNSRecordResponse represents a DNS record response.

type DNSZoneResponse

type DNSZoneResponse struct {
	// Name is the domain name of the zone.
	Name string

	// ID is the zone's ID.
	ID string

	// CISInstanceCRN is the IBM Cloud Resource Name for the CIS instance where
	// the DNS zone is managed.
	InstanceCRN string

	// CISInstanceName is the display name of the CIS instance where the DNS zone
	// is managed.
	InstanceName string

	// ResourceGroupID is the resource group ID of the CIS instance.
	ResourceGroupID string
}

DNSZoneResponse represents a DNS zone response.

type Metadata

type Metadata struct {
	BaseDomain string
	// contains filtered or unexported fields
}

Metadata holds additional metadata for InstallConfig resources that do not need to be user-supplied (e.g. because it can be retrieved from external APIs).

func NewMetadata

func NewMetadata(baseDomain string) *Metadata

NewMetadata initializes a new Metadata object.

func (*Metadata) APIKey

func (m *Metadata) APIKey(ctx context.Context) (string, error)

APIKey returns the IBM Cloud account API Key associated with the authentication credentials.

func (*Metadata) AccountID

func (m *Metadata) AccountID(ctx context.Context) (string, error)

AccountID returns the IBM Cloud account ID associated with the authentication credentials.

func (*Metadata) CISInstanceCRN

func (m *Metadata) CISInstanceCRN(ctx context.Context) (string, error)

CISInstanceCRN returns the Cloud Internet Services instance CRN that is managing the DNS zone for the base domain.

func (*Metadata) DNSInstanceCRN

func (m *Metadata) DNSInstanceCRN(ctx context.Context) (string, error)

DNSInstanceCRN returns the IBM DNS Service instance CRN that is managing the DNS zone for the base domain.

func (*Metadata) GetExistingVPCGateway

func (m *Metadata) GetExistingVPCGateway(ctx context.Context, vpcName string, vpcSubnet string) (string, bool, error)

GetExistingVPCGateway checks if the VPC is a Permitted Network for the DNS Zone

func (*Metadata) IsVPCPermittedNetwork

func (m *Metadata) IsVPCPermittedNetwork(ctx context.Context, vpcName string, baseDomain string) (bool, error)

IsVPCPermittedNetwork checks if the VPC is a Permitted Network for the DNS Zone

func (*Metadata) SetCISInstanceCRN

func (m *Metadata) SetCISInstanceCRN(crn string)

SetCISInstanceCRN sets Cloud Internet Services instance CRN to a string value.

func (*Metadata) SetDNSInstanceCRN

func (m *Metadata) SetDNSInstanceCRN(crn string)

SetDNSInstanceCRN sets IBM DNS Service instance CRN to a string value.

type MetadataAPI

type MetadataAPI interface {
	AccountID(ctx context.Context) (string, error)
	APIKey(ctx context.Context) (string, error)
	CISInstanceCRN(ctx context.Context) (string, error)
	DNSInstanceCRN(ctx context.Context) (string, error)
}

MetadataAPI represents functions that eventually call out to the API

type SessionStore

type SessionStore struct {
	ID                   string `json:"id,omitempty"`
	APIKey               string `json:"apikey,omitempty"`
	DefaultRegion        string `json:"region,omitempty"`
	DefaultZone          string `json:"zone,omitempty"`
	ServiceInstanceID    string `json:"serviceinstance,omitempty"`
	PowerVSResourceGroup string `json:"resourcegroup,omitempty"`
}

SessionStore is an object and store that holds credentials and variables required to create a SessionVars object.

type SessionVars

type SessionVars struct {
	ID                   string
	APIKey               string
	Region               string
	Zone                 string
	ServiceInstanceID    string
	PowerVSResourceGroup string
}

SessionVars is an object that holds the variables required to create an ibmpisession object.

type User

type User struct {
	ID      string
	Email   string
	Account string
}

User is struct with user details

type Zone

type Zone struct {
	Name            string
	CISInstanceCRN  string
	ResourceGroupID string
}

Zone represents a DNS Zone

func GetDNSZone

func GetDNSZone() (*Zone, error)

GetDNSZone returns a DNS Zone chosen by survey.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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