Documentation
¶
Index ¶
- Constants
- func IsBootVolume(ocid string) bool
- func IsInstanceInStoppedState(instance *core.Instance) bool
- func IsInstanceInTerminalState(instance *core.Instance) bool
- func IsIpv6SingleStackCluster() bool
- func IsNotFound(err error) bool
- func IsRetryable(err error) bool
- func IsSystemTagNotFoundOrNotAuthorisedError(logger *zap.SugaredLogger, err error) bool
- func MapProviderIDToInstanceID(providerID string) string
- func NewLBClient(lb loadBalancerClient, rm common.RequestMetadata, lim *RateLimiter) *loadbalancerClientStruct
- func NewNLBClient(nlb networkLoadBalancerClient, rm common.RequestMetadata, lim *RateLimiter) *networkLoadbalancer
- func NewRetryPolicyWithMaxAttempts(retryAttempts uint) *common.RetryPolicy
- func RateLimitError(isWrite bool, opName string) error
- type BlockStorageInterface
- type ComputeInterface
- type FileStorageInterface
- type GenericBackend
- type GenericBackendSetDetails
- type GenericBackendSetHealth
- type GenericCertificate
- type GenericConnectionConfiguration
- type GenericCreateLoadBalancerDetails
- type GenericHealthChecker
- type GenericIpAddress
- type GenericIpVersion
- type GenericListener
- type GenericLoadBalancer
- type GenericLoadBalancerInterface
- type GenericReservedIp
- type GenericSessionPersistenceConfiguration
- type GenericShapeDetails
- type GenericSslConfigurationDetails
- type GenericUpdateLoadBalancerDetails
- type GenericUpdateLoadBalancerShapeDetails
- type GenericUpdateNetworkSecurityGroupsDetails
- type GenericWorkRequest
- type IdentityInterface
- type Interface
- type IpAddresses
- type NetworkingInterface
- type OCIClientConfig
- 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
const ( NetworkLoadBalancerEntityType = "NetworkLoadBalancer" // <ns>/<svc>/<svc UID> LBNameRegex = "^" + dns1123LabelFmt + "/" + dns1123LabelFmt + "/" + uuidFmt + "$" )
const ClusterIpFamilyEnv = "CLUSTER_IP_FAMILY"
const Ipv6Stack = "IPv6"
const (
ListWorkRequestLimit = 100
)
Variables ¶
This section is empty.
Functions ¶
func IsBootVolume ¶ added in v1.30.2
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 IsIpv6SingleStackCluster ¶ added in v1.28.2
func IsIpv6SingleStackCluster() bool
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 IsSystemTagNotFoundOrNotAuthorisedError ¶ added in v1.26.4
func IsSystemTagNotFoundOrNotAuthorisedError(logger *zap.SugaredLogger, err error) bool
func MapProviderIDToInstanceID ¶
MapProviderIDToInstanceID parses the provider id and returns the instance ocid.
func NewLBClient ¶ added in v1.29.2
func NewLBClient(lb loadBalancerClient, rm common.RequestMetadata, lim *RateLimiter) *loadbalancerClientStruct
func NewNLBClient ¶ added in v1.29.2
func NewNLBClient(nlb networkLoadBalancerClient, rm common.RequestMetadata, lim *RateLimiter) *networkLoadbalancer
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)
AwaitVolumeHydratedOrTimeout(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)
GetBootVolume(ctx context.Context, id string) (*core.BootVolume, error)
AwaitVolumeBackupAvailableOrTimeout(ctx context.Context, id string) (*core.VolumeBackup, error)
CreateVolumeBackup(ctx context.Context, details core.CreateVolumeBackupDetails) (*core.VolumeBackup, error)
DeleteVolumeBackup(ctx context.Context, id string) error
GetVolumeBackup(ctx context.Context, id string) (*core.VolumeBackup, error)
GetVolumeBackupsByName(ctx context.Context, snapshotName, compartmentID string) ([]core.VolumeBackup, 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)
ListInstancesByCompartmentAndAD(ctx context.Context, compartmentId, availabilityDomain string) (response []core.Instance, err 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)
GetSecondaryVNICsForInstance(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) (bool, []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, fsID, path, exportSetID string) (*fss.ExportSummary, error)
AwaitExportActive(ctx context.Context, logger *zap.SugaredLogger, id string) (*fss.Export, error)
DeleteExport(ctx context.Context, id string) error
GetMountTarget(ctx context.Context, id string) (*fss.MountTarget, error)
CreateMountTarget(ctx context.Context, details fss.CreateMountTargetDetails) (*fss.MountTarget, error)
DeleteMountTarget(ctx context.Context, id string) error
GetMountTargetSummaryByDisplayName(ctx context.Context, compartmentID, ad, mountTargetName string) (bool, []fss.MountTargetSummary, error)
}
FileStorageInterface defines the interface to OCI File Storage Service consumed by the volume provisioner and fss-controller.
type GenericBackend ¶ added in v1.19.12
type GenericBackendSetDetails ¶ added in v1.19.12
type GenericBackendSetDetails struct {
Name *string
HealthChecker *GenericHealthChecker
Policy *string
Backends []GenericBackend
SessionPersistenceConfiguration *GenericSessionPersistenceConfiguration
// Only needed for LB
SslConfiguration *GenericSslConfigurationDetails
// Only needed for NLB
IsPreserveSource *bool
IpVersion *GenericIpVersion
}
type GenericBackendSetHealth ¶ added in v1.30.2
type GenericCertificate ¶ added in v1.19.12
type GenericConnectionConfiguration ¶ added in v1.19.12
type GenericCreateLoadBalancerDetails ¶ added in v1.19.12
type GenericCreateLoadBalancerDetails struct {
CompartmentId *string
DisplayName *string
ShapeName *string
SubnetIds []string
ShapeDetails *GenericShapeDetails
IsPrivate *bool
IsPreserveSourceDestination *bool
ReservedIps []GenericReservedIp
Listeners map[string]GenericListener
BackendSets map[string]GenericBackendSetDetails
NetworkSecurityGroupIds []string
FreeformTags map[string]string
DefinedTags map[string]map[string]interface{}
IpVersion *GenericIpVersion
// Only needed for LB
Certificates map[string]GenericCertificate
RuleSets map[string]loadbalancer.RuleSetDetails
// Supported only in NLB
AssignedPrivateIpv4 *string
AssignedIpv6 *string
}
type GenericHealthChecker ¶ added in v1.19.12
type GenericIpAddress ¶ added in v1.19.12
type GenericIpAddress struct {
IpAddress *string
IsPublic *bool
ReservedIp *GenericReservedIp
}
type GenericIpVersion ¶ added in v1.28.2
type GenericIpVersion string
const ( GenericIPv4 GenericIpVersion = "IPv4" GenericIPv6 GenericIpVersion = "IPv6" GenericIPv4AndIPv6 GenericIpVersion = "IPv4_AND_IPv6" )
type GenericListener ¶ added in v1.19.12
type GenericListener struct {
Name *string
DefaultBackendSetName *string
Port *int
Protocol *string
HostnameNames []string
PathRouteSetName *string
SslConfiguration *GenericSslConfigurationDetails
ConnectionConfiguration *GenericConnectionConfiguration
RoutingPolicyName *string
RuleSetNames []string
IpVersion *GenericIpVersion
IsPpv2Enabled *bool
}
type GenericLoadBalancer ¶ added in v1.19.12
type GenericLoadBalancer struct {
Id *string
CompartmentId *string
DisplayName *string
LifecycleState *string
ShapeName *string
IpAddresses []GenericIpAddress
ShapeDetails *GenericShapeDetails
IsPrivate *bool
SubnetIds []string
NetworkSecurityGroupIds []string
Listeners map[string]GenericListener
Certificates map[string]GenericCertificate
BackendSets map[string]GenericBackendSetDetails
RuleSets map[string]loadbalancer.RuleSetDetails
IpVersion *GenericIpVersion
FreeformTags map[string]string
DefinedTags map[string]map[string]interface{}
SystemTags map[string]map[string]interface{}
}
type GenericLoadBalancerInterface ¶ added in v1.19.12
type GenericLoadBalancerInterface interface {
CreateLoadBalancer(ctx context.Context, details *GenericCreateLoadBalancerDetails, serviceUid *string) (string, error)
GetLoadBalancer(ctx context.Context, id string) (*GenericLoadBalancer, error)
GetLoadBalancerByName(ctx context.Context, compartmentID, name string) (*GenericLoadBalancer, error)
DeleteLoadBalancer(ctx context.Context, id string) (string, error)
GetCertificateByName(ctx context.Context, lbID, name string) (*GenericCertificate, error)
CreateCertificate(ctx context.Context, lbID string, cert *GenericCertificate) (string, error)
CreateBackendSet(ctx context.Context, lbID, name string, details *GenericBackendSetDetails) (string, error)
UpdateBackendSet(ctx context.Context, lbID, name string, details *GenericBackendSetDetails) (string, error)
DeleteBackendSet(ctx context.Context, lbID, name string) (string, error)
UpdateListener(ctx context.Context, lbID, name string, details *GenericListener) (string, error)
CreateListener(ctx context.Context, lbID, name string, details *GenericListener) (string, error)
DeleteListener(ctx context.Context, lbID, name string) (string, error)
CreateRuleSet(ctx context.Context, lbID string, name string, details *loadbalancer.RuleSetDetails) (string, error)
UpdateRuleSet(ctx context.Context, lbID string, name string, details *loadbalancer.RuleSetDetails) (string, error)
DeleteRuleSet(ctx context.Context, lbID string, name string) (string, error)
UpdateLoadBalancerShape(context.Context, string, *GenericUpdateLoadBalancerShapeDetails) (string, error)
UpdateNetworkSecurityGroups(context.Context, string, []string) (string, error)
AwaitWorkRequest(ctx context.Context, id string) (*GenericWorkRequest, error)
ListWorkRequests(ctx context.Context, compartmentId, lbId string) ([]*GenericWorkRequest, error)
UpdateLoadBalancer(ctx context.Context, lbID string, details *GenericUpdateLoadBalancerDetails) (string, error)
}
type GenericReservedIp ¶ added in v1.19.12
type GenericReservedIp struct {
Id *string
}
type GenericSessionPersistenceConfiguration ¶ added in v1.19.12
type GenericShapeDetails ¶ added in v1.19.12
type GenericSslConfigurationDetails ¶ added in v1.19.12
type GenericSslConfigurationDetails struct {
VerifyDepth *int `json:"verifyDepth"`
VerifyPeerCertificate *bool `json:"verifyPeerCertificate"`
HasSessionResumption *bool `json:"hasSessionResumption"`
TrustedCertificateAuthorityIds []string `json:"trustedCertificateAuthorityIds"`
CertificateIds []string `json:"certificateIds"`
CertificateName *string `json:"certificateName"`
Protocols []string `json:"protocols"`
CipherSuiteName *string `json:"cipherSuiteName"`
ServerOrderPreference string `json:"serverOrderPreference"`
}
type GenericUpdateLoadBalancerDetails ¶ added in v1.26.4
type GenericUpdateLoadBalancerDetails struct {
IpVersion *GenericIpVersion
FreeformTags map[string]string
DefinedTags map[string]map[string]interface{}
}
type GenericUpdateLoadBalancerShapeDetails ¶ added in v1.19.12
type GenericUpdateLoadBalancerShapeDetails struct {
ShapeName *string
ShapeDetails *GenericShapeDetails
}
type GenericUpdateNetworkSecurityGroupsDetails ¶ added in v1.19.12
type GenericUpdateNetworkSecurityGroupsDetails struct {
NetworkSecurityGroupIds []string
}
type GenericWorkRequest ¶ added in v1.19.12
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(*zap.SugaredLogger, string, string, *authv1.TokenRequest) GenericLoadBalancerInterface
Networking(*OCIClientConfig) NetworkingInterface
BlockStorage() BlockStorageInterface
FSS(*OCIClientConfig) FileStorageInterface
Identity(*OCIClientConfig) IdentityInterface
}
Interface of consumed OCI API functionality.
func New ¶
func New(logger *zap.SugaredLogger, cp common.ConfigurationProvider, opRateLimiter *RateLimiter, cloudProviderConfig *providercfg.Config) (Interface, error)
New constructs an OCI API client.
type IpAddresses ¶ added in v1.28.2
type NetworkingInterface ¶
type NetworkingInterface interface {
GetSubnet(ctx context.Context, id string) (*core.Subnet, error)
GetSubnetFromCacheByIP(ip IpAddresses) (*core.Subnet, error)
IsRegionalSubnet(ctx context.Context, id string) (bool, error)
GetVcn(ctx context.Context, id string) (*core.Vcn, error)
GetVNIC(ctx context.Context, id string) (*core.Vnic, 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)
ListPrivateIps(ctx context.Context, vnicId string) ([]core.PrivateIp, error)
GetPrivateIp(ctx context.Context, id string) (*core.PrivateIp, error)
CreatePrivateIp(ctx context.Context, vnicID string) (*core.PrivateIp, error)
GetIpv6(ctx context.Context, id string) (*core.Ipv6, error)
GetPublicIpByIpAddress(ctx context.Context, id string) (*core.PublicIp, error)
CreateNetworkSecurityGroup(ctx context.Context, compartmentId, vcnId, displayName, serviceUid string) (*core.NetworkSecurityGroup, error)
GetNetworkSecurityGroup(ctx context.Context, id string) (*core.NetworkSecurityGroup, *string, error)
ListNetworkSecurityGroups(ctx context.Context, displayName, compartmentId, vcnId string) ([]core.NetworkSecurityGroup, error)
UpdateNetworkSecurityGroup(ctx context.Context, id, etag string, freeformTags map[string]string) (*core.NetworkSecurityGroup, error)
DeleteNetworkSecurityGroup(ctx context.Context, id, etag string) (*string, error)
AddNetworkSecurityGroupSecurityRules(ctx context.Context, id string, details core.AddNetworkSecurityGroupSecurityRulesDetails) (*core.AddNetworkSecurityGroupSecurityRulesResponse, error)
RemoveNetworkSecurityGroupSecurityRules(ctx context.Context, id string, details core.RemoveNetworkSecurityGroupSecurityRulesDetails) (*core.RemoveNetworkSecurityGroupSecurityRulesResponse, error)
ListNetworkSecurityGroupSecurityRules(ctx context.Context, id string, direction core.ListNetworkSecurityGroupSecurityRulesDirectionEnum) ([]core.SecurityRule, error)
UpdateNetworkSecurityGroupSecurityRules(ctx context.Context, id string, details core.UpdateNetworkSecurityGroupSecurityRulesDetails) (*core.UpdateNetworkSecurityGroupSecurityRulesResponse, error)
}
NetworkingInterface defines the subset of the OCI compute API utilised by the CCM
type OCIClientConfig ¶ added in v1.28.2
type OCIClientConfig struct {
SaToken *authv1.TokenRequest
ParentRptURL string
TenancyId string
}
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. If no attachments are found, errNotFound is returned.
FindVolumeAttachment(ctx context.Context, compartmentID, volumeID string, instanceID *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, isShareable bool) (core.VolumeAttachment, error)
AttachParavirtualizedVolume(ctx context.Context, instanceID, volumeID string, isPvEncryptionInTransitEnabled bool, isShareable 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
// WaitForUHPVolumeLoggedOut WaitForUHPVolumeLogout polls waiting for a OCI UHP block volume attachment to be in the
// LOGGED_OUT state.
WaitForUHPVolumeLoggedOut(ctx context.Context, attachmentID string) error
// ListVolumeAttachments returns all non-DETACHED volume attachments
// If no attachments are found, errNotFound is returned
ListVolumeAttachments(ctx context.Context, compartmentID, volumeID string) ([]core.VolumeAttachment, error)
}
VolumeAttachmentInterface defines the interface to the OCI volume attachement API.