common

package
v0.0.0-...-b3f0fa4 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ADAnnotationName     string = "oci.oracle.com.ad"
	SubnetAnnotationName string = "oci.oracle.com.subnet"
)

Variables

This section is empty.

Functions

func CloudTypes

func CloudTypes() map[string]CloudType

CloudTypes returns a mapping of kind (e.g. "network") to the type information required to configure its resource.

func CreateControllerRef

func CreateControllerRef(controller metav1.Object, groupVersionWithKind schema.GroupVersionKind) *metav1.OwnerReference

Create OwnerReference

func FilteredConditions

FilteredConditions returns a new slice of operator conditions without conditions with the provided type.

func GetAvailabilityDomains

func GetAvailabilityDomains(c clientset.Interface, namespace string, compartmentRef string) ([]string, error)

Get list of oci availability domains

func GetCondition

Get condition (status) from object by the type

func GetControllerOf

func GetControllerOf(controllee metav1.Object) *metav1.OwnerReference

Retrieves OwnerReference from the object

func GetImage

func GetImage(c clientset.Interface, osType string, osVersion string, namespace string) (string, error)

Get OCI instance image

func GetImageSpecific

func GetImageSpecific(c clientset.Interface, namespace string, img string) (string, error)

Get specific OCI image

func GetShape

func GetShape(c clientset.Interface, cpuCores int, ramGbytes int, isVirtual bool, namespace string) (string, error)

Get OCI instance shape

func GetShapeByResourceRequirements

func GetShapeByResourceRequirements(c clientset.Interface, namespace string, requirements *v1.ResourceRequirements) (string, error)

Get OCI instance shape

func GetShapeSpecific

func GetShapeSpecific(c clientset.Interface, namespace string, shape string) (string, error)

Get specific OCI shape

func GetSubnetOffset

func GetSubnetOffset(c clientset.Interface, namespace string, networkName string, key string) (int, error)

get subnet offset - used by compute and loadbalancer (key)

func RegisterCloudType

func RegisterCloudType(plural, kind, groupName string, validation *apiextv1beta1.CustomResourceValidation, factory AdapterFactory)

Register cloud type adpater factory

func RemoveCondition

func RemoveCondition(status *cloudv1alpha1.OperatorStatus, conditionType cloudv1alpha1.OperatorConditionType)

RemoveCondition removes the condition with the provided type from the operator status.

func SetCondition

func SetCondition(status *cloudv1alpha1.OperatorStatus, conditionType cloudv1alpha1.OperatorConditionType, reason string)

Set the condition (status) on the object by the type

Types

type AdapterFactory

type AdapterFactory func(clientset versioned.Interface, kubeclient kubernetes.Interface) CloudTypeAdapter

AdapterFactory defines the function signature for factory methods that create instances of CloudTypeAdapter. Such methods should be registered with RegisterAdapterFactory to ensure the type adapter is discoverable.

type CloudType

type CloudType struct {
	GroupName      string
	Kind           string
	ResourcePlural string
	Validation     *apiextv1beta1.CustomResourceValidation
	AdapterFactory AdapterFactory
}

CloudType configures kubernetes for a cloud workload type

type CloudTypeAdapter

type CloudTypeAdapter interface {
	Kind() string
	Resource() string
	Equivalent(obj1, obj2 runtime.Object) bool
	GroupVersionWithResource() schema.GroupVersionResource
	Subscriptions() []schema.GroupVersionResource
	CallbackForResource(schema.GroupVersionResource) cache.ResourceEventHandlerFuncs
	SetLister(lister cache.GenericLister)
	SetQueue(queue workqueue.RateLimitingInterface)
	ObjectMeta(obj runtime.Object) *metav1.ObjectMeta
	Delete(obj runtime.Object) (runtime.Object, error)
	Update(obj runtime.Object) (runtime.Object, error)
	Reconcile(obj runtime.Object) (runtime.Object, error)
}

ResourceTypeAdapter defines operations for interacting with a cloud workload type. Code written to this interface can then target any type for which an implementation of this interface exists.

Jump to

Keyboard shortcuts

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