common

package
v0.0.0-...-4c37ff3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnnotateNode

func AnnotateNode(kubeClient kubernetes.Interface, nodeName string, key string, value string) error

AnnotateNode adds an annotation to a new based on the key/value

func BuildCSINodePod

func BuildCSINodePod() *apiv1.Pod

BuildCSINodePod builds a template of the CSI Node Driver pod

func BuildFlannelPod

func BuildFlannelPod() *apiv1.Pod

BuildFlannelPod builds a template of the Flannel pod

func BuildGenericLabels

func BuildGenericLabels(ocid string, nodeName, shape, availabilityDomain string) map[string]string

BuildGenericLabels defines all the default labels that nodes should have

func BuildProxymuxClientPod

func BuildProxymuxClientPod() *apiv1.Pod

BuildProxymuxClientPod builds a template of the Proxymux Client pod

func GetAllPoolTypes

func GetAllPoolTypes(groups []string) (string, error)

GetAllPoolTypes returns the resource type of the specified groups i.e. (instance pool or node pool) or an error if it cannot be determined

func GetPoolType

func GetPoolType(group string) (string, error)

GetPoolType returns the resource type of the specified group i.e. (instance pool or node pool) or an error if it cannot be determined

func HasNodeGroupTags

func HasNodeGroupTags(nodeGroupAutoDiscoveryList []string) (bool, bool, error)

HasNodeGroupTags checks if nodepoolTags is provided

func IsRetryable

func IsRetryable(err error) bool

IsRetryable returns true if the given error is retryable.

func LabelNode

func LabelNode(kubeClient kubernetes.Interface, nodeName string, key string, value string) error

LabelNode adds a label to a new based on the key/value

func NewRetryPolicy

func NewRetryPolicy() *common.RetryPolicy

NewRetryPolicy returns an exponential backoff retry policy

func NewRetryPolicyWithMaxAttempts

func NewRetryPolicyWithMaxAttempts(retryAttempts uint) *common.RetryPolicy

NewRetryPolicyWithMaxAttempts returns a RetryPolicy with the specified max retryAttempts

func SetNodeProviderID

func SetNodeProviderID(kubeClient kubernetes.Interface, nodeName string, value string) error

SetNodeProviderID sets the provider id value on the node object

Types

type CloudConfig

type CloudConfig struct {
	Global struct {
		RefreshInterval        time.Duration `gcfg:"refresh-interval"`
		CompartmentID          string        `gcfg:"compartment-id"`
		Region                 string        `gcfg:"region"`
		UseInstancePrinciples  bool          `gcfg:"use-instance-principals"`
		UseNonMemberAnnotation bool          `gcfg:"use-non-member-annotation"`
	}
}

CloudConfig holds the cloud config for OCI provider.

func CreateCloudConfig

func CreateCloudConfig(cloudConfigPath string, configProvider common.ConfigurationProvider, implType string) (*CloudConfig, error)

CreateCloudConfig creates a CloudConfig object based on a file or env vars

type OciRef

type OciRef struct {
	AvailabilityDomain string
	Name               string
	CompartmentID      string
	InstanceID         string
	NodePoolID         string
	InstancePoolID     string
	PrivateIPAddress   string
	PublicIPAddress    string
	Shape              string
	IsNodeSelfManaged  bool
}

OciRef contains s reference to some entity in OCI world.

func NodeToOciRef

func NodeToOciRef(n *apiv1.Node) (OciRef, error)

NodeToOciRef converts a node object into an oci reference

type Shape

type Shape struct {
	Name                    string
	CPU                     float32
	GPU                     int
	MemoryInBytes           float32
	EphemeralStorageInBytes float32
}

Shape includes the resource attributes of a given shape which should be used for constructing node templates.

type ShapeClient

ShapeClient is an interface around the GetInstanceConfiguration and ListShapes calls.

type ShapeClientImpl

type ShapeClientImpl struct {
	// Can fetch instance configs (flexible shapes)
	ComputeMgmtClient core.ComputeManagementClient
	// Can fetch shapes directly
	ComputeClient core.ComputeClient
}

ShapeClientImpl is the implementation for fetching shape information.

func (ShapeClientImpl) GetInstanceConfiguration

GetInstanceConfiguration gets the instance configuration.

func (ShapeClientImpl) ListShapes

ListShapes lists the shapes.

type ShapeGetter

type ShapeGetter interface {
	GetNodePoolShape(*oke.NodePool, int64) (*Shape, error)
	GetInstancePoolShape(pool *core.InstancePool) (*Shape, error)
	Refresh()
}

ShapeGetter returns the oci shape attributes for the pool.

func CreateShapeGetter

func CreateShapeGetter(shapeClient ShapeClient) ShapeGetter

CreateShapeGetter creates a new oci shape getter.

type TagsGetter

type TagsGetter interface {
	GetNodePoolFreeformTags(*oke.NodePool) (map[string]string, error)
}

TagsGetter returns the oci tags for the pool.

func CreateTagsGetter

func CreateTagsGetter() TagsGetter

CreateTagsGetter creates a new oci tags getter.

type TagsGetterImpl

type TagsGetterImpl struct{}

TagsGetterImpl is the implementation to fetch the oci tags for the pool.

func (*TagsGetterImpl) GetNodePoolFreeformTags

func (tgi *TagsGetterImpl) GetNodePoolFreeformTags(np *oke.NodePool) (map[string]string, error)

GetNodePoolFreeformTags returns the FreeformTags for the nodepool

Jump to

Keyboard shortcuts

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