contract

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: Apache-2.0 Imports: 25 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

View Source
var ErrFieldNotFound = errors.New("field not found")

ErrFieldNotFound is returned when a field is not found in the object.

View Source
var (
	// Version is the contract version supported by this Cluster API version.
	// Note: Each Cluster API version supports one contract version, and by convention the contract version matches the current API version.
	Version = clusterv1.GroupVersion.Version
)

Functions

func GetAPIVersion added in v1.11.0

func GetAPIVersion(ctx context.Context, c client.Reader, gk schema.GroupKind) (string, error)

GetAPIVersion gets the latest compatible apiVersion from a CRD based on the current contract Version.

func GetCompatibleVersions added in v1.11.0

func GetCompatibleVersions(contract string) sets.Set[string]

GetCompatibleVersions return the list of contract version compatible with a given contract version. NOTE: A contract version might be temporarily compatible with older contract versions e.g. to allow users time to transition to the new API. NOTE: The return value must include also the contract version received in input.

func GetContractVersion added in v1.11.0

func GetContractVersion(ctx context.Context, c client.Reader, gk schema.GroupKind) (string, error)

GetContractVersion gets the latest compatible contract version from a CRD based on the current contract Version.

func GetContractVersionForVersion added in v1.11.0

func GetContractVersionForVersion(ctx context.Context, c client.Reader, gk schema.GroupKind, version string) (string, error)

GetContractVersionForVersion gets the contract version for an apiVersion from a CRD. The passed in version is only the version part of the apiVersion, not the full apiVersion.

func GetGKMetadata added in v1.11.0

GetGKMetadata retrieves a CustomResourceDefinition metadata from the API server using partial object metadata.

This function is greatly more efficient than GetCRDWithContract and should be preferred in most cases.

func GetLatestContractAndAPIVersionFromContract added in v1.11.0

func GetLatestContractAndAPIVersionFromContract(metadata metav1.Object, currentContractVersion string) (string, string, error)

GetLatestContractAndAPIVersionFromContract gets the latest compatible contract version and apiVersion from a CRD based on the passed in currentContractVersion.

func ObjToContractVersionedObjectReference added in v1.11.0

func ObjToContractVersionedObjectReference(obj *unstructured.Unstructured) clusterv1.ContractVersionedObjectReference

ObjToContractVersionedObjectReference returns a reference to the given object. Note: This function only operates on Unstructured instead of client.Object because it is only safe to assume for Unstructured that the GVK is set.

func ObjToRef

ObjToRef returns a reference to the given object. Note: This function only operates on Unstructured instead of client.Object because it is only safe to assume for Unstructured that the GVK is set.

func UpdateReferenceAPIContract added in v1.11.0

func UpdateReferenceAPIContract(ctx context.Context, c client.Reader, ref *corev1.ObjectReference) error

UpdateReferenceAPIContract takes a client and object reference, queries the API Server for the Custom Resource Definition and looks which one is the stored version available.

The object reference passed as input is modified in place if an updated compatible version is found. NOTE: This version depends on CRDs being named correctly as defined by contract.CalculateCRDName.

Types

type Bool added in v1.3.0

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

Bool represents an accessor to an bool path value.

func (*Bool) Get added in v1.3.0

func (b *Bool) Get(obj *unstructured.Unstructured) (*bool, error)

Get gets the bool value.

func (*Bool) Path added in v1.3.0

func (b *Bool) Path() Path

Path returns the path to the bool value.

func (*Bool) Set added in v1.3.0

func (b *Bool) Set(obj *unstructured.Unstructured, value bool) error

Set sets the bool value in the path.

type BootstrapConfigTemplateContract added in v1.4.0

type BootstrapConfigTemplateContract struct{}

BootstrapConfigTemplateContract encodes information about the Cluster API contract for BootstrapConfigTemplate objects like KubeadmConfigTemplate, etc.

func BootstrapConfigTemplate added in v1.4.0

func BootstrapConfigTemplate() *BootstrapConfigTemplateContract

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

func (*BootstrapConfigTemplateContract) Template added in v1.4.0

Template provides access to the template.

type BootstrapConfigTemplateTemplate added in v1.4.0

type BootstrapConfigTemplateTemplate struct{}

BootstrapConfigTemplateTemplate provides a helper struct for working with the template in an BootstrapConfigTemplate.

func (*BootstrapConfigTemplateTemplate) Metadata added in v1.4.0

Metadata provides access to the metadata of a template.

type BootstrapContract added in v1.3.0

type BootstrapContract struct{}

BootstrapContract encodes information about the Cluster API contract for bootstrap objects.

func Bootstrap added in v1.3.0

func Bootstrap() *BootstrapContract

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

func (*BootstrapContract) DataSecretCreated added in v1.11.0

func (b *BootstrapContract) DataSecretCreated(contractVersion string) *Bool

DataSecretCreated returns if the data secret has been created.

func (*BootstrapContract) DataSecretName added in v1.3.0

func (b *BootstrapContract) DataSecretName() *String

DataSecretName provide access to status.dataSecretName field in a bootstrap object.

func (*BootstrapContract) FailureMessage deprecated added in v1.3.0

func (b *BootstrapContract) FailureMessage() *String

FailureMessage provides access to the status.failureMessage field in an bootstrap object. Note that this field is optional.

Deprecated: This function is deprecated and is going to be removed. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.

func (*BootstrapContract) FailureReason deprecated added in v1.3.0

func (b *BootstrapContract) FailureReason() *String

FailureReason provides access to the status.failureReason field in an bootstrap object. Note that this field is optional.

Deprecated: This function is deprecated and is going to be removed. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.

func (*BootstrapContract) ReadyConditionType added in v1.9.0

func (b *BootstrapContract) ReadyConditionType() string

ReadyConditionType returns the type of the ready condition.

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) AvailableConditionType added in v1.9.0

func (c *ControlPlaneContract) AvailableConditionType() string

AvailableConditionType returns the type of the available condition.

func (*ControlPlaneContract) AvailableReplicas added in v1.11.0

func (c *ControlPlaneContract) AvailableReplicas() *Int32

AvailableReplicas provide access to the status.availableReplicas field in a ControlPlane object, if any. Applies to implementations using replicas. NOTE: availableReplicas was introduced by the v1beta2 contract; use unavailableReplicas for the v1beta1 contract.

func (*ControlPlaneContract) ControlPlaneEndpoint added in v1.11.0

func (c *ControlPlaneContract) ControlPlaneEndpoint() *ControlPlaneEndpoint

ControlPlaneEndpoint provides access to ControlPlaneEndpoint in an ControlPlane object.

func (*ControlPlaneContract) ExternalManagedControlPlane added in v1.3.0

func (c *ControlPlaneContract) ExternalManagedControlPlane() *Bool

ExternalManagedControlPlane provides access to the status.externalManagedControlPlane field in an ControlPlane object. Note that this field is optional.

func (*ControlPlaneContract) FailureMessage deprecated added in v1.3.0

func (c *ControlPlaneContract) FailureMessage() *String

FailureMessage provides access to the status.failureMessage field in an ControlPlane object. Note that this field is optional.

Deprecated: This function is deprecated and is going to be removed. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.

func (*ControlPlaneContract) FailureReason deprecated added in v1.3.0

func (c *ControlPlaneContract) FailureReason() *String

FailureReason provides access to the status.failureReason field in an ControlPlane object. Note that this field is optional.

Deprecated: This function is deprecated and is going to be removed. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.

func (*ControlPlaneContract) Initialized added in v1.3.0

func (c *ControlPlaneContract) Initialized(contractVersion string) *Bool

Initialized returns if the control plane has been initialized.

func (*ControlPlaneContract) IsProvisioning

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

IsProvisioning returns true if the control plane is being created for the first time. Returns false, if the control plane was already previously provisioned.

func (*ControlPlaneContract) IsScaling

func (c *ControlPlaneContract) IsScaling(obj *unstructured.Unstructured, contractVersion string) (bool, error)

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.upToDateReplicas. - spec.replicas != status.readyReplicas. - spec.replicas != status.availableReplicas. NOTE: this function is used only in E2E tests.

func (*ControlPlaneContract) IsUpgrading

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.version. Note: A control plane is considered not upgrading if the status or status.version is not set.

func (*ControlPlaneContract) MachineTemplate

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

func (c *ControlPlaneContract) ReadyReplicas() *Int32

ReadyReplicas provide access to the status.readyReplicas field in a ControlPlane object, if any. Applies to implementations using replicas. NOTE: readyReplicas changed semantic in v1beta2 contract.

func (*ControlPlaneContract) Replicas

func (c *ControlPlaneContract) Replicas() *Int32

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) Selector added in v1.3.0

func (c *ControlPlaneContract) Selector() *String

Selector provide access to the status.selector field in a ControlPlane object, if any. Applies to implementations using replicas.

func (*ControlPlaneContract) StatusReplicas

func (c *ControlPlaneContract) StatusReplicas() *Int32

StatusReplicas provide access to the status.replicas field in a ControlPlane object, if any. Applies to implementations using replicas.

func (*ControlPlaneContract) StatusVersion

func (c *ControlPlaneContract) StatusVersion() *String

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

func (*ControlPlaneContract) UpToDateReplicas added in v1.11.0

func (c *ControlPlaneContract) UpToDateReplicas(contractVersion string) *Int32

UpToDateReplicas provide access to the status.upToDateReplicas field in a ControlPlane object, if any. Applies to implementations using replicas. NOTE: upToDateReplicas was introduced by the v1beta2 contract; code will fall back to updatedReplicas for the v1beta1 contract.

func (*ControlPlaneContract) V1Beta1UnavailableReplicas added in v1.11.0

func (c *ControlPlaneContract) V1Beta1UnavailableReplicas() *Int64

V1Beta1UnavailableReplicas provide access to the status.unavailableReplicas field in a ControlPlane object, if any. Applies to implementations using replicas. NOTE: use availableReplicas when working with the v1beta2 contract.

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 ControlPlaneEndpoint added in v1.11.0

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

ControlPlaneEndpoint provides a helper struct for working with ControlPlaneEndpoint in an InfrastructureCluster object.

func (*ControlPlaneEndpoint) Get added in v1.11.0

Get gets the ControlPlaneEndpoint value.

func (*ControlPlaneEndpoint) Path added in v1.11.0

func (c *ControlPlaneEndpoint) Path() Path

Path returns the path to the ControlPlaneEndpoint in an InfrastructureCluster object.

func (*ControlPlaneEndpoint) Set added in v1.11.0

Set sets the ControlPlaneEndpoint value.

type ControlPlaneMachineTemplate

type ControlPlaneMachineTemplate struct{}

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

func (*ControlPlaneMachineTemplate) InfrastructureRef

InfrastructureRef provides access to the infrastructureRef of a MachineTemplate.

func (*ControlPlaneMachineTemplate) InfrastructureV1Beta1Ref added in v1.11.0

func (c *ControlPlaneMachineTemplate) InfrastructureV1Beta1Ref() *V1Beta1Ref

InfrastructureV1Beta1Ref provides access to the infrastructureRef of a MachineTemplate.

func (*ControlPlaneMachineTemplate) Metadata

func (c *ControlPlaneMachineTemplate) Metadata() *Metadata

Metadata provides access to the metadata of a MachineTemplate.

func (*ControlPlaneMachineTemplate) NodeDeletionTimeout added in v1.3.0

func (c *ControlPlaneMachineTemplate) NodeDeletionTimeout() *Duration

NodeDeletionTimeout provides access to the nodeDeletionTimeout of a MachineTemplate.

func (*ControlPlaneMachineTemplate) NodeDeletionTimeoutSeconds added in v1.11.0

func (c *ControlPlaneMachineTemplate) NodeDeletionTimeoutSeconds() *Int32

NodeDeletionTimeoutSeconds provides access to the nodeDeletionTimeout of a MachineTemplate.

func (*ControlPlaneMachineTemplate) NodeDrainTimeout

func (c *ControlPlaneMachineTemplate) NodeDrainTimeout() *Duration

NodeDrainTimeout provides access to the nodeDrainTimeout of a MachineTemplate.

func (*ControlPlaneMachineTemplate) NodeDrainTimeoutSeconds added in v1.11.0

func (c *ControlPlaneMachineTemplate) NodeDrainTimeoutSeconds() *Int32

NodeDrainTimeoutSeconds provides access to the nodeDrainTimeout of a MachineTemplate.

func (*ControlPlaneMachineTemplate) NodeVolumeDetachTimeout added in v1.3.0

func (c *ControlPlaneMachineTemplate) NodeVolumeDetachTimeout() *Duration

NodeVolumeDetachTimeout provides access to the nodeVolumeDetachTimeout of a MachineTemplate.

func (*ControlPlaneMachineTemplate) NodeVolumeDetachTimeoutSeconds added in v1.11.0

func (c *ControlPlaneMachineTemplate) NodeVolumeDetachTimeoutSeconds() *Int32

NodeVolumeDetachTimeoutSeconds provides access to the nodeVolumeDetachTimeout of a MachineTemplate.

func (*ControlPlaneMachineTemplate) ReadinessGates added in v1.10.0

func (c *ControlPlaneMachineTemplate) ReadinessGates(contractVersion string) *ReadinessGates

ReadinessGates provides access to control plane's ReadinessGates.

type ControlPlaneMachineTemplateInfrastructureRef added in v1.11.0

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

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

func (*ControlPlaneMachineTemplateInfrastructureRef) Get added in v1.11.0

Get gets the reference value from the Unstructured object.

func (*ControlPlaneMachineTemplateInfrastructureRef) Path added in v1.11.0

Path returns the path of the reference.

func (*ControlPlaneMachineTemplateInfrastructureRef) Set added in v1.11.0

Set sets the reference value in the Unstructured object.

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) Template added in v1.4.0

Template provides access to the template.

type ControlPlaneTemplateMachineTemplate added in v1.4.0

type ControlPlaneTemplateMachineTemplate struct{}

ControlPlaneTemplateMachineTemplate provides a helper struct for working with MachineTemplate.

func (*ControlPlaneTemplateMachineTemplate) Metadata added in v1.4.0

Metadata provides access to the metadata of the MachineTemplate of a ControlPlaneTemplate.

func (*ControlPlaneTemplateMachineTemplate) NodeDeletionTimeout added in v1.4.0

func (c *ControlPlaneTemplateMachineTemplate) NodeDeletionTimeout() *Duration

NodeDeletionTimeout provides access to the nodeDeletionTimeout of a MachineTemplate.

func (*ControlPlaneTemplateMachineTemplate) NodeDrainTimeout added in v1.4.0

func (c *ControlPlaneTemplateMachineTemplate) NodeDrainTimeout() *Duration

NodeDrainTimeout provides access to the nodeDrainTimeout of a MachineTemplate.

func (*ControlPlaneTemplateMachineTemplate) NodeVolumeDetachTimeout added in v1.4.0

func (c *ControlPlaneTemplateMachineTemplate) NodeVolumeDetachTimeout() *Duration

NodeVolumeDetachTimeout provides access to the nodeVolumeDetachTimeout of a MachineTemplate.

type ControlPlaneTemplateTemplate added in v1.4.0

type ControlPlaneTemplateTemplate struct{}

ControlPlaneTemplateTemplate provides a helper struct for working with the template in an ControlPlaneTemplate.

func (*ControlPlaneTemplateTemplate) MachineTemplate added in v1.4.0

MachineTemplate provides access to MachineTemplate in a ControlPlaneTemplate object, if any.

func (*ControlPlaneTemplateTemplate) Metadata added in v1.4.0

func (c *ControlPlaneTemplateTemplate) Metadata() *Metadata

Metadata provides access to the metadata of a template.

type Duration

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

Duration represents an accessor to a metav1.Duration path value.

func (*Duration) Get

Get gets the metav1.Duration value.

func (*Duration) Path

func (i *Duration) Path() Path

Path returns the path to the metav1.Duration value.

func (*Duration) Set

func (i *Duration) Set(obj *unstructured.Unstructured, value metav1.Duration) error

Set sets the metav1.Duration value in the path.

type FailureDomains added in v1.3.0

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

FailureDomains represents an accessor to a clusterv1.FailureDomains path value.

func (*FailureDomains) Get added in v1.3.0

Get gets the metav1.MachineAddressList value.

func (*FailureDomains) Path added in v1.3.0

func (d *FailureDomains) Path() Path

Path returns the path to the clusterv1.FailureDomains value.

func (*FailureDomains) Set added in v1.3.0

Set sets the []clusterv1.FailureDomain value in the path.

type InfrastructureClusterContract

type InfrastructureClusterContract struct{}

InfrastructureClusterContract encodes information about the Cluster API contract for InfrastructureCluster objects like DockerClusters, AWS Clusters, etc.

func InfrastructureCluster

func InfrastructureCluster() *InfrastructureClusterContract

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

func (*InfrastructureClusterContract) ControlPlaneEndpoint added in v1.1.6

func (c *InfrastructureClusterContract) ControlPlaneEndpoint() *ControlPlaneEndpoint

ControlPlaneEndpoint provides access to ControlPlaneEndpoint in an InfrastructureCluster object.

func (*InfrastructureClusterContract) FailureDomains added in v1.3.0

func (c *InfrastructureClusterContract) FailureDomains(contractVersion string) *FailureDomains

FailureDomains provides access to the status.failureDomains field in an InfrastructureCluster object. Note that this field is optional.

func (*InfrastructureClusterContract) FailureMessage deprecated added in v1.3.0

func (c *InfrastructureClusterContract) FailureMessage() *String

FailureMessage provides access to the status.failureMessage field in an InfrastructureCluster object. Note that this field is optional.

Deprecated: This function is deprecated and is going to be removed. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.

func (*InfrastructureClusterContract) FailureReason deprecated added in v1.3.0

func (c *InfrastructureClusterContract) FailureReason() *String

FailureReason provides access to the status.failureReason field in an InfrastructureCluster object. Note that this field is optional.

Deprecated: This function is deprecated and is going to be removed. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.

func (*InfrastructureClusterContract) IgnorePaths

func (c *InfrastructureClusterContract) IgnorePaths(infrastructureCluster *unstructured.Unstructured) ([]Path, error)

IgnorePaths returns a list of paths to be ignored when reconciling an InfrastructureCluster. NOTE: The controlPlaneEndpoint struct currently contains two mandatory fields (host and port). As the host and port fields are not using omitempty, they are automatically set to their zero values if they are not set by the user. We don't want to reconcile the zero values as we would then overwrite changes applied by the infrastructure provider controller.

func (*InfrastructureClusterContract) Provisioned added in v1.11.0

func (c *InfrastructureClusterContract) Provisioned(contractVersion string) *Bool

Provisioned returns if the infrastructure cluster has been provisioned.

func (*InfrastructureClusterContract) ReadyConditionType added in v1.9.0

func (c *InfrastructureClusterContract) ReadyConditionType() string

ReadyConditionType returns the type of the ready condition.

type InfrastructureClusterTemplateContract added in v1.4.0

type InfrastructureClusterTemplateContract struct{}

InfrastructureClusterTemplateContract encodes information about the Cluster API contract for InfrastructureClusterTemplate objects like DockerClusterTemplates, AWSClusterTemplates, etc.

func InfrastructureClusterTemplate added in v1.4.0

func InfrastructureClusterTemplate() *InfrastructureClusterTemplateContract

InfrastructureClusterTemplate provides access to the information about the Cluster API contract for InfrastructureClusterTemplate objects.

func (*InfrastructureClusterTemplateContract) Template added in v1.4.0

Template provides access to the template.

type InfrastructureClusterTemplateTemplate added in v1.4.0

type InfrastructureClusterTemplateTemplate struct{}

InfrastructureClusterTemplateTemplate provides a helper struct for working with the template in an InfrastructureClusterTemplate..

func (*InfrastructureClusterTemplateTemplate) Metadata added in v1.4.0

Metadata provides access to the metadata of a template.

type InfrastructureMachineContract added in v1.3.0

type InfrastructureMachineContract struct{}

InfrastructureMachineContract encodes information about the Cluster API contract for InfrastructureMachine objects like DockerMachines, AWS Machines, etc.

func InfrastructureMachine added in v1.3.0

func InfrastructureMachine() *InfrastructureMachineContract

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

func (*InfrastructureMachineContract) Addresses added in v1.3.0

Addresses provides access to the status.addresses field in an InfrastructureMachine object. Note that this field is optional.

func (*InfrastructureMachineContract) FailureDomain added in v1.3.0

func (m *InfrastructureMachineContract) FailureDomain() *String

FailureDomain provides access to the spec.failureDomain field in an InfrastructureMachine object. Note that this field is optional.

func (*InfrastructureMachineContract) FailureMessage deprecated added in v1.3.0

func (m *InfrastructureMachineContract) FailureMessage() *String

FailureMessage provides access to the status.failureMessage field in an InfrastructureMachine object. Note that this field is optional.

Deprecated: This function is deprecated and is going to be removed. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.

func (*InfrastructureMachineContract) FailureReason deprecated added in v1.3.0

func (m *InfrastructureMachineContract) FailureReason() *String

FailureReason provides access to the status.failureReason field in an InfrastructureMachine object. Note that this field is optional.

Deprecated: This function is deprecated and is going to be removed. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.

func (*InfrastructureMachineContract) ProviderID added in v1.3.0

func (m *InfrastructureMachineContract) ProviderID() *String

ProviderID provides access to the spec.providerID field in an InfrastructureMachine object.

func (*InfrastructureMachineContract) Provisioned added in v1.11.0

func (m *InfrastructureMachineContract) Provisioned(contractVersion string) *Bool

Provisioned returns if the InfrastructureMachine is provisioned.

func (*InfrastructureMachineContract) ReadyConditionType added in v1.9.0

func (m *InfrastructureMachineContract) ReadyConditionType() string

ReadyConditionType returns the type of the ready condition.

type InfrastructureMachinePoolTemplateContract added in v1.6.0

type InfrastructureMachinePoolTemplateContract struct{}

InfrastructureMachinePoolTemplateContract encodes information about the Cluster API contract for InfrastructureMachinePoolTemplate objects like DockerMachinePoolTemplates, AWSMachinePoolTemplates, etc.

func InfrastructureMachinePoolTemplate added in v1.6.0

func InfrastructureMachinePoolTemplate() *InfrastructureMachinePoolTemplateContract

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

func (*InfrastructureMachinePoolTemplateContract) Template added in v1.6.0

Template provides access to the template.

type InfrastructureMachinePoolTemplateTemplate added in v1.6.0

type InfrastructureMachinePoolTemplateTemplate struct{}

InfrastructureMachinePoolTemplateTemplate provides a helper struct for working with the template in an InfrastructureMachinePoolTemplate.

func (*InfrastructureMachinePoolTemplateTemplate) Metadata added in v1.6.0

Metadata provides access to the metadata of a template.

type InfrastructureMachineTemplateContract added in v1.4.0

type InfrastructureMachineTemplateContract struct{}

InfrastructureMachineTemplateContract encodes information about the Cluster API contract for InfrastructureMachineTemplate objects like DockerMachineTemplates, AWSMachineTemplates, etc.

func InfrastructureMachineTemplate added in v1.4.0

func InfrastructureMachineTemplate() *InfrastructureMachineTemplateContract

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

func (*InfrastructureMachineTemplateContract) Template added in v1.4.0

Template provides access to the template.

type InfrastructureMachineTemplateTemplate added in v1.4.0

type InfrastructureMachineTemplateTemplate struct{}

InfrastructureMachineTemplateTemplate provides a helper struct for working with the template in an InfrastructureMachineTemplate.

func (*InfrastructureMachineTemplateTemplate) Metadata added in v1.4.0

Metadata provides access to the metadata of a template.

type Int32 added in v1.9.0

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

Int32 represents an accessor to an int32 path value.

func (*Int32) Get added in v1.9.0

func (i *Int32) Get(obj *unstructured.Unstructured) (*int32, error)

Get gets the int32 value.

func (*Int32) Path added in v1.9.0

func (i *Int32) Path() Path

Path returns the path to the int32 value.

func (*Int32) Set added in v1.9.0

func (i *Int32) Set(obj *unstructured.Unstructured, value int32) error

Set sets the int32 value in the path. Note: Cluster API should never Set values on external objects owner by providers; however this method is useful for writing tests.

type Int64

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

Int64 represents an accessor to an int64 path value.

func (*Int64) Get

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

Get gets the int64 value.

func (*Int64) Path

func (i *Int64) Path() Path

Path returns the path to the int64 value.

func (*Int64) Set

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

Set sets the int64 value in the path.

type MachineAddresses added in v1.3.0

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

MachineAddresses represents an accessor to a []clusterv1.MachineAddress path value.

func (*MachineAddresses) Get added in v1.3.0

Get gets the metav1.MachineAddressList value.

func (*MachineAddresses) Path added in v1.3.0

func (m *MachineAddresses) Path() Path

Path returns the path to the []clusterv1.MachineAddress value.

func (*MachineAddresses) Set added in v1.3.0

Set sets the []clusterv1.MachineAddress value in the path.

type Metadata

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

Metadata provides a helper struct for working with Metadata.

func (*Metadata) Get

Get gets the metadata object.

func (*Metadata) Path

func (m *Metadata) Path() Path

Path returns the path of the metadata.

func (*Metadata) Set

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

Set sets the metadata value. Note: We are blanking out empty label annotations, thus avoiding triggering infinite reconcile given that at json level label: {} or annotation: {} is different from no field, which is the corresponding value stored in etcd given that those fields are defined as omitempty.

type Path

type Path []string

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

func (Path) Append added in v1.2.0

func (p Path) Append(k string) Path

Append a field name to a path.

func (Path) Equal added in v1.2.0

func (p Path) Equal(other Path) bool

Equal check if two path are equal (exact match).

func (Path) IsParentOf added in v1.2.0

func (p Path) IsParentOf(other Path) bool

IsParentOf check if one path is Parent of the other.

func (Path) Overlaps added in v1.2.0

func (p Path) Overlaps(other Path) bool

Overlaps return true if two paths are Equal or one IsParentOf the other.

func (Path) String added in v1.1.6

func (p Path) String() string

String returns the path as a dotted string.

type ReadinessGates added in v1.10.0

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

ReadinessGates provides a helper struct for working with ReadinessGates.

func (*ReadinessGates) Get added in v1.10.0

Get gets the ReadinessGates object.

func (*ReadinessGates) Path added in v1.10.0

func (m *ReadinessGates) Path() Path

Path returns the path of the ReadinessGates.

func (*ReadinessGates) Set added in v1.10.0

Set sets the ReadinessGates value. Note: in case the value is nil, the system assumes that the control plane do not implement the optional list of readiness gates.

type String

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

String represents an accessor to a string path value.

func (*String) Get

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

Get gets the string value.

func (*String) Path

func (s *String) Path() Path

Path returns the path to the string value.

func (*String) Set

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

Set sets the string value in the path.

type V1Beta1Ref deprecated added in v1.11.0

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

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

Deprecated: Will be removed when v1beta1 will be removed.

func (*V1Beta1Ref) Get added in v1.11.0

Get gets the reference value from the Unstructured object.

func (*V1Beta1Ref) Path added in v1.11.0

func (r *V1Beta1Ref) Path() Path

Path returns the path of the reference.

func (*V1Beta1Ref) Set added in v1.11.0

Set sets the reference value in the Unstructured object.

Jump to

Keyboard shortcuts

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