Documentation ¶
Index ¶
- Constants
- func IsInstanceInStoppedState(instance *core.Instance) bool
- func IsInstanceInTerminalState(instance *core.Instance) bool
- func IsNotFound(err error) bool
- func IsRetryable(err error) bool
- func MapProviderIDToInstanceID(providerID string) string
- func NewRetryPolicyWithMaxAttempts(retryAttempts uint) *common.RetryPolicy
- func RateLimitError(isWrite bool, opName string) error
- type BlockStorageInterface
- type ComputeInterface
- type FileStorageInterface
- type IdentityInterface
- type Interface
- type LoadBalancerInterface
- type NetworkingInterface
- type RateLimiter
- type VolumeAttachmentInterface
Constants ¶
const ( // KiB is 1024 bytes KiB = 1 << (10 * iota) // MiB is 1024KB MiB // GiB is 1024 MB GiB // TiB is 1024 GB TiB )
const ( // OCIVolumeID is the name of the oci volume id. OCIVolumeID = "ociVolumeID" // OCIVolumeBackupID is the name of the oci volume backup id annotation. OCIVolumeBackupID = "volume.beta.kubernetes.io/oci-volume-source" // FSType is the name of the file storage type parameter for storage classes. FSType = "fsType" )
const ( HTTP400RelatedResourceNotAuthorizedOrNotFoundCode = "RelatedResourceNotAuthorizedOrNotFound" HTTP401NotAuthenticatedCode = "NotAuthenticated" HTTP404NotAuthorizedOrNotFoundCode = "NotAuthorizedOrNotFound" HTTP409IncorrectStateCode = "IncorrectState" HTTP409NotAuthorizedOrResourceAlreadyExistsCode = "NotAuthorizedOrResourceAlreadyExists" HTTP429TooManyRequestsCode = "TooManyRequests" HTTP500InternalServerErrorCode = "InternalServerError" )
HTTP Error Types
Variables ¶
This section is empty.
Functions ¶
func IsInstanceInStoppedState ¶
IsInstanceInStoppedState returns true if the instance is in a stopped or stopping state, false otherwise.
func IsInstanceInTerminalState ¶
IsInstanceInTerminalState returns true if the instance is in a terminal state, false otherwise.
func IsNotFound ¶
IsNotFound returns true if the given error indicates that a resource could not be found.
func IsRetryable ¶
IsRetryable returns true if the given error is retriable.
func MapProviderIDToInstanceID ¶
MapProviderIDToInstanceID parses the provider id and returns the instance ocid.
func NewRetryPolicyWithMaxAttempts ¶
func NewRetryPolicyWithMaxAttempts(retryAttempts uint) *common.RetryPolicy
NewRetryPolicyWithMaxAttempts returns a RetryPolicy with the specified max retryAttempts
func RateLimitError ¶
RateLimitError produces an Errorf for rate limiting.
Types ¶
type BlockStorageInterface ¶
type BlockStorageInterface interface { AwaitVolumeAvailableORTimeout(ctx context.Context, id string) (*core.Volume, error) CreateVolume(ctx context.Context, details core.CreateVolumeDetails) (*core.Volume, error) DeleteVolume(ctx context.Context, id string) error GetVolume(ctx context.Context, id string) (*core.Volume, error) GetVolumesByName(ctx context.Context, volumeName, compartmentID string) ([]core.Volume, error) UpdateVolume(ctx context.Context, volumeId string, details core.UpdateVolumeDetails) (*core.Volume, error) }
BlockStorageInterface defines the interface to OCI block storage utilised by the volume provisioner.
type ComputeInterface ¶
type ComputeInterface interface { // GetInstance gets information about the specified instance. GetInstance(ctx context.Context, id string) (*core.Instance, error) // GetInstanceByNodeName gets the OCI instance corresponding to the given // Kubernetes node name. GetInstanceByNodeName(ctx context.Context, compartmentID, vcnID, nodeName string) (*core.Instance, error) GetPrimaryVNICForInstance(ctx context.Context, compartmentID, instanceID string) (*core.Vnic, error) VolumeAttachmentInterface }
ComputeInterface defines the subset of the OCI compute API utilised by the CCM.
type FileStorageInterface ¶
type FileStorageInterface interface { AwaitMountTargetActive(ctx context.Context, logger *zap.SugaredLogger, id string) (*fss.MountTarget, error) GetFileSystem(ctx context.Context, id string) (*fss.FileSystem, error) GetFileSystemSummaryByDisplayName(ctx context.Context, compartmentID, ad, displayName string) (*fss.FileSystemSummary, error) AwaitFileSystemActive(ctx context.Context, logger *zap.SugaredLogger, id string) (*fss.FileSystem, error) CreateFileSystem(ctx context.Context, details fss.CreateFileSystemDetails) (*fss.FileSystem, error) DeleteFileSystem(ctx context.Context, id string) error CreateExport(ctx context.Context, details fss.CreateExportDetails) (*fss.Export, error) FindExport(ctx context.Context, compartmentID, fsID, exportSetID string) (*fss.ExportSummary, error) AwaitExportActive(ctx context.Context, logger *zap.SugaredLogger, id string) (*fss.Export, error) DeleteExport(ctx context.Context, id string) error }
FileStorageInterface defines the interface to OCI File Storage Service consumed by the volume provisioner.
type IdentityInterface ¶
type IdentityInterface interface { GetAvailabilityDomainByName(ctx context.Context, compartmentID, name string) (*identity.AvailabilityDomain, error) ListAvailabilityDomains(ctx context.Context, compartmentID string) ([]identity.AvailabilityDomain, error) }
IdentityInterface defines the interface to the OCI identity service consumed by the volume provisioner.
type Interface ¶
type Interface interface { Compute() ComputeInterface LoadBalancer() LoadBalancerInterface Networking() NetworkingInterface BlockStorage() BlockStorageInterface FSS() FileStorageInterface Identity() IdentityInterface }
Interface of consumed OCI API functionality.
func New ¶
func New(logger *zap.SugaredLogger, cp common.ConfigurationProvider, opRateLimiter *RateLimiter) (Interface, error)
New constructs an OCI API client.
type LoadBalancerInterface ¶
type LoadBalancerInterface interface { CreateLoadBalancer(ctx context.Context, details loadbalancer.CreateLoadBalancerDetails) (string, error) GetLoadBalancer(ctx context.Context, id string) (*loadbalancer.LoadBalancer, error) GetLoadBalancerByName(ctx context.Context, compartmentID, name string) (*loadbalancer.LoadBalancer, error) DeleteLoadBalancer(ctx context.Context, id string) (string, error) GetCertificateByName(ctx context.Context, lbID, name string) (*loadbalancer.Certificate, error) CreateCertificate(ctx context.Context, lbID string, cert loadbalancer.CertificateDetails) (string, error) CreateBackendSet(ctx context.Context, lbID, name string, details loadbalancer.BackendSetDetails) (string, error) UpdateBackendSet(ctx context.Context, lbID, name string, details loadbalancer.BackendSetDetails) (string, error) DeleteBackendSet(ctx context.Context, lbID, name string) (string, error) UpdateListener(ctx context.Context, lbID, name string, details loadbalancer.ListenerDetails) (string, error) CreateListener(ctx context.Context, lbID, name string, details loadbalancer.ListenerDetails) (string, error) DeleteListener(ctx context.Context, lbID, name string) (string, error) UpdateLoadBalancerShape(context.Context, string, loadbalancer.UpdateLoadBalancerShapeDetails) (string, error) UpdateNetworkSecurityGroups(context.Context, string, loadbalancer.UpdateNetworkSecurityGroupsDetails) (string, error) AwaitWorkRequest(ctx context.Context, id string) (*loadbalancer.WorkRequest, error) }
LoadBalancerInterface for consumed LB functionality.
type NetworkingInterface ¶
type NetworkingInterface interface { GetSubnet(ctx context.Context, id string) (*core.Subnet, error) GetSubnetFromCacheByIP(ip string) (*core.Subnet, error) IsRegionalSubnet(ctx context.Context, id string) (bool, error) GetVcn(ctx context.Context, id string) (*core.Vcn, error) GetSecurityList(ctx context.Context, id string) (core.GetSecurityListResponse, error) UpdateSecurityList(ctx context.Context, id string, etag string, ingressRules []core.IngressSecurityRule, egressRules []core.EgressSecurityRule) (core.UpdateSecurityListResponse, error) GetPrivateIP(ctx context.Context, id string) (*core.PrivateIp, error) GetPublicIpByIpAddress(ctx context.Context, id string) (*core.PublicIp, error) }
NetworkingInterface defines the subset of the OCI compute API utilised by the CCM.
type RateLimiter ¶
type RateLimiter struct { Reader flowcontrol.RateLimiter Writer flowcontrol.RateLimiter }
RateLimiter reader and writer.
func NewRateLimiter ¶
func NewRateLimiter(logger *zap.SugaredLogger, config *providercfg.RateLimiterConfig) RateLimiter
NewRateLimiter builds and returns a struct containing read and write rate limiters. Defaults are used where no (0) value is provided.
type VolumeAttachmentInterface ¶
type VolumeAttachmentInterface interface { // FindVolumeAttachment searches for a volume attachment in either the state // ATTACHING or ATTACHED and returns the first volume attachment found. FindVolumeAttachment(ctx context.Context, compartmentID, volumeID string) (core.VolumeAttachment, error) // AttachVolume attaches a block storage volume to the specified instance. // See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeAttachment/AttachVolume AttachVolume(ctx context.Context, instanceID, volumeID string) (core.VolumeAttachment, error) AttachParavirtualizedVolume(ctx context.Context, instanceID, volumeID string, isPvEncryptionInTransitEnabled bool) (core.VolumeAttachment, error) // WaitForVolumeAttached polls waiting for a OCI block volume to be in the // ATTACHED state. WaitForVolumeAttached(ctx context.Context, attachmentID string) (core.VolumeAttachment, error) // DetachVolume detaches a storage volume from the specified instance. // See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Volume/DetachVolume DetachVolume(ctx context.Context, id string) error // WaitForVolumeDetached polls waiting for a OCI block volume to be in the // DETACHED state. WaitForVolumeDetached(ctx context.Context, attachmentID string) error FindActiveVolumeAttachment(ctx context.Context, compartmentID, volumeID string) (core.VolumeAttachment, error) }
VolumeAttachmentInterface defines the interface to the OCI volume attachement API.