contract

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package contract provides support for the ClusterReconciler to handle with providers objects according to the Cluster API contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNestedRef

func GetNestedRef(obj *unstructured.Unstructured, fields ...string) (*corev1.ObjectReference, error)

GetNestedRef returns the ref value from a nested field in an Unstructured object.

func ObjToRef

func ObjToRef(obj client.Object) *corev1.ObjectReference

ObjToRef returns a reference to the given object.

func SetNestedRef

func SetNestedRef(obj, refObj *unstructured.Unstructured, fields ...string) error

SetNestedRef sets the value of a nested field in an Unstructured to a reference to the refObj provided.

Types

type ControlPlaneContract

type ControlPlaneContract struct{}

ControlPlaneContract encodes information about the Cluster API contract for ControlPlane objects like e.g the KubeadmControlPlane etc.

func ControlPlane

func ControlPlane() *ControlPlaneContract

ControlPlane provide access to the information about the Cluster API contract for ControlPlane objects.

func (*ControlPlaneContract) IsScaling added in v0.4.3

IsScaling returns true if the control plane is in the middle of a scale operation, false otherwise. A control plane is considered scaling if: - status.replicas is not yet set. - spec.replicas != status.replicas. - spec.replicas != status.updatedReplicas. - spec.replicas != status.readyReplicas.

func (*ControlPlaneContract) IsUpgrading added in v0.4.3

func (c *ControlPlaneContract) IsUpgrading(obj *unstructured.Unstructured) (bool, error)

IsUpgrading returns true if the control plane is in the middle of an upgrade, false otherwise. A control plane is considered upgrading if: - if spec.version is greater than status.verison. Note: A control plane is considered not upgrading if the status or status.version is not set.

func (*ControlPlaneContract) MachineTemplate added in v0.4.3

func (c *ControlPlaneContract) MachineTemplate() *ControlPlaneMachineTemplate

MachineTemplate provides access to MachineTemplate in a ControlPlane object, if any. NOTE: When working with unstructured there is no way to understand if the ControlPlane provider do support a field in the type definition from the fact that a field is not set in a given instance. This is why in we are deriving if MachineTemplate is required from the ClusterClass in the topology reconciler code.

func (*ControlPlaneContract) ReadyReplicas added in v0.4.3

func (c *ControlPlaneContract) ReadyReplicas() *Int64

ReadyReplicas provide access to status.readyReplicas field in a ControlPlane object, if any.

func (*ControlPlaneContract) Replicas

func (c *ControlPlaneContract) Replicas() *Int64

Replicas provide access to replicas field in a ControlPlane object, if any. NOTE: When working with unstructured there is no way to understand if the ControlPlane provider do support a field in the type definition from the fact that a field is not set in a given instance. This is why in we are deriving if replicas is required from the ClusterClass in the topology reconciler code.

func (*ControlPlaneContract) StatusReplicas added in v0.4.3

func (c *ControlPlaneContract) StatusReplicas() *Int64

StatusReplicas provide access to status.replicas field in a ControlPlane object, if any.

func (*ControlPlaneContract) StatusVersion added in v0.4.3

func (c *ControlPlaneContract) StatusVersion() *String

StatusVersion provide access to version field in a ControlPlane object status, if any.

func (*ControlPlaneContract) UpdatedReplicas added in v0.4.3

func (c *ControlPlaneContract) UpdatedReplicas() *Int64

UpdatedReplicas provide access to status.updatedReplicas field in a ControlPlane object, if any.

func (*ControlPlaneContract) Version

func (c *ControlPlaneContract) Version() *String

Version provide access to version field in a ControlPlane object, if any. NOTE: When working with unstructured there is no way to understand if the ControlPlane provider do support a field in the type definition from the fact that a field is not set in a given instance. This is why in we are deriving if version is required from the ClusterClass in the topology reconciler code.

type ControlPlaneMachineTemplate added in v0.4.3

type ControlPlaneMachineTemplate struct{}

ControlPlaneMachineTemplate provides a helper struct for working with MachineTemplate in ClusterClass.

func (*ControlPlaneMachineTemplate) InfrastructureRef added in v0.4.3

func (c *ControlPlaneMachineTemplate) InfrastructureRef() *Ref

InfrastructureRef provides access to the infrastructureRef of a MachineTemplate.

func (*ControlPlaneMachineTemplate) Metadata added in v0.4.3

func (c *ControlPlaneMachineTemplate) Metadata() *Metadata

Metadata provides access to the metadata of a MachineTemplate.

type ControlPlaneTemplateContract

type ControlPlaneTemplateContract struct{}

ControlPlaneTemplateContract encodes information about the Cluster API contract for ControlPlaneTemplate objects like e.g. the KubeadmControlPlane etc.

func ControlPlaneTemplate

func ControlPlaneTemplate() *ControlPlaneTemplateContract

ControlPlaneTemplate provide access to the information about the Cluster API contract for ControlPlaneTemplate objects.

func (*ControlPlaneTemplateContract) InfrastructureMachineTemplate

func (c *ControlPlaneTemplateContract) InfrastructureMachineTemplate() *Ref

InfrastructureMachineTemplate provide access to InfrastructureMachineTemplate reference, if any. NOTE: When working with unstructured there is no way to understand if the ControlPlane provider do support a field in the type definition from the fact that a field is not set in a given instance. This is why in we are deriving if this field is required from the ClusterClass in the topology reconciler code.

type InfrastructureClusterContract

type InfrastructureClusterContract struct{}

InfrastructureClusterContract encodes information about the Cluster API contract for InfrastructureCluster objects like e.g the DockerCluster, AWS Cluster etc.

func InfrastructureCluster

func InfrastructureCluster() *InfrastructureClusterContract

InfrastructureCluster provide access to the information about the Cluster API contract for InfrastructureCluster objects.

func (*InfrastructureClusterContract) IgnorePaths

func (c *InfrastructureClusterContract) IgnorePaths() []Path

IgnorePaths returns a list of paths to be ignored when reconciling a topology.

type Int64 added in v0.4.3

type Int64 struct {
	// contains filtered or unexported fields
}

Int64 represents an accessor to an int64 path value.

func (*Int64) Get added in v0.4.3

func (i *Int64) Get(obj *unstructured.Unstructured) (*int64, error)

Get gets the int64 value.

func (*Int64) Path added in v0.4.3

func (i *Int64) Path() Path

Path returns the path to the int64 value.

func (*Int64) Set added in v0.4.3

func (i *Int64) Set(obj *unstructured.Unstructured, value int64) error

Set set the int64 value in the path.

type Metadata added in v0.4.3

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

Metadata provides a helper struct for working with Metadata.

func (*Metadata) Get added in v0.4.3

Get gets the metadata object.

func (*Metadata) Path added in v0.4.3

func (m *Metadata) Path() Path

Path returns the path of the metadata.

func (*Metadata) Set added in v0.4.3

func (m *Metadata) Set(obj *unstructured.Unstructured, metadata *clusterv1.ObjectMeta) error

Set sets the metadata value.

type Path

type Path []string

Path defines a how to access a field in an Unstructured object.

type Ref

type Ref struct {
	// contains filtered or unexported fields
}

Ref provide a helper struct for working with references in Unstructured objects.

func (*Ref) Get

Get gets the reference value from the Unstructured object.

func (*Ref) Path

func (r *Ref) Path() Path

Path returns the path of the reference.

func (*Ref) Set

func (r *Ref) Set(obj, refObj *unstructured.Unstructured) error

Set sets the reference value in the Unstructured object.

type String added in v0.4.3

type String struct {
	// contains filtered or unexported fields
}

String represents an accessor to a string path value.

func (*String) Get added in v0.4.3

func (s *String) Get(obj *unstructured.Unstructured) (*string, error)

Get gets the string value.

func (*String) Path added in v0.4.3

func (s *String) Path() Path

Path returns the path to the string value.

func (*String) Set added in v0.4.3

func (s *String) Set(obj *unstructured.Unstructured, value string) error

Set set the string value in the path.

Jump to

Keyboard shortcuts

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