Documentation
¶
Index ¶
- Constants
- type ClassSpec
- type ConditionStatus
- type CurrentStatus
- type LastOperation
- type Machine
- type MachineConfiguration
- type MachineDeployment
- type MachineDeploymentCondition
- type MachineDeploymentConditionType
- type MachineDeploymentList
- type MachineDeploymentSpec
- type MachineDeploymentStatus
- type MachineDeploymentStrategy
- type MachineDeploymentStrategyType
- type MachineList
- type MachineOperationType
- type MachinePhase
- type MachineSpec
- type MachineState
- type MachineStatus
- type MachineSummary
- type MachineTemplateSpec
- type NodeTemplateSpec
- type RollbackConfig
- type RollingUpdateMachineDeployment
Constants ¶
const ( // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added // to existing MCs (and label key that is added to its machines) to prevent the existing MCs // to select new machines (and old machines being select by new MC). DefaultMachineDeploymentUniqueLabelKey string = "machine-template-hash" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClassSpec ¶
type ClassSpec struct {
// API group to which it belongs
APIGroup string `json:"apiGroup,omitempty"`
// Kind for machine class
Kind string `json:"kind,omitempty"`
// Name of machine class
Name string `json:"name,omitempty"`
}
ClassSpec is the class specification of machine
type ConditionStatus ¶
type ConditionStatus string
const ( ConditionTrue ConditionStatus = "True" ConditionFalse ConditionStatus = "False" ConditionUnknown ConditionStatus = "Unknown" )
These are valid condition statuses. "ConditionTrue" means a resource is in the condition; "ConditionFalse" means a resource is not in the condition; "ConditionUnknown" means kubernetes can't decide if a resource is in the condition or not. In the future, we could add other intermediate conditions, e.g. ConditionDegraded.
type CurrentStatus ¶
type CurrentStatus struct {
Phase MachinePhase `json:"phase,omitempty"`
TimeoutActive bool `json:"timeoutActive,omitempty"`
// Last update time of current status
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
}
CurrentStatus contains information about the current status of Machine.
type LastOperation ¶
type LastOperation struct {
// Description of the current operation
Description string `json:"description,omitempty"`
// Last update time of current operation
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
// State of operation
State MachineState `json:"state,omitempty"`
// Type of operation
Type MachineOperationType `json:"type,omitempty"`
}
LastOperation suggests the last operation performed on the object
type Machine ¶
type Machine struct {
// ObjectMeta for machine object
metav1.ObjectMeta `json:"metadata,omitempty"`
// TypeMeta for machine object
metav1.TypeMeta `json:",inline"`
// Spec contains the specification of the machine
Spec MachineSpec `json:"spec,omitempty"`
// Status contains fields depicting the status
Status MachineStatus `json:"status,omitempty"`
}
Machine TODO
type MachineConfiguration ¶
type MachineConfiguration struct {
// MachineDraintimeout is the timeout after which machine is forcefully deleted.
// +optional
MachineDrainTimeout *metav1.Duration `json:"drainTimeout,omitempty"`
// MachineHealthTimeout is the timeout after which machine is declared unhealthy/failed.
// +optional
MachineHealthTimeout *metav1.Duration `json:"healthTimeout,omitempty"`
// MachineCreationTimeout is the timeout after which machinie creation is declared failed.
// +optional
MachineCreationTimeout *metav1.Duration `json:"creationTimeout,omitempty"`
// MaxEvictRetries is the number of retries that will be attempted while draining the node.
// +optional
MaxEvictRetries *int32 `json:"maxEvictRetries,omitempty"`
// NodeConditions are the set of conditions if set to true for MachineHealthTimeOut, machine will be declared failed.
// +optional
NodeConditions *string `json:"nodeConditions,omitempty"`
}
MachineConfiguration describes the configurations useful for the machine-controller.
type MachineDeployment ¶
type MachineDeployment struct {
metav1.TypeMeta `json:",inline"`
// Standard object metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the MachineDeployment.
// +optional
Spec MachineDeploymentSpec `json:"spec,omitempty"`
// Most recently observed status of the MachineDeployment.
// +optional
Status MachineDeploymentStatus `json:"status,omitempty"`
}
+genclient +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas +kubebuilder:printcolumn:name="Ready",type=integer,JSONPath=`.status.readyReplicas`,description="Total number of ready machines targeted by this machine deployment." +kubebuilder:printcolumn:name="Desired",type=integer,JSONPath=`.spec.replicas`,description="Number of desired machines." +kubebuilder:printcolumn:name="Up-to-date",type=integer,JSONPath=`.status.updatedReplicas`,description="Total number of non-terminated machines targeted by this machine deployment that have the desired template spec." +kubebuilder:printcolumn:name="Available",type=integer,JSONPath=`.status.availableReplicas`,description="Total number of available machines (ready for at least minReadySeconds) targeted by this machine deployment." +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata" Deployment enables declarative updates for machines and MachineSets.
type MachineDeploymentCondition ¶
type MachineDeploymentCondition struct {
// Type of MachineDeployment condition.
Type MachineDeploymentConditionType `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
// A human readable message indicating details about the transition.
Message string `json:"message,omitempty"`
}
MachineDeploymentCondition describes the state of a MachineDeployment at a certain point.
type MachineDeploymentConditionType ¶
type MachineDeploymentConditionType string
const ( // Available means the MachineDeployment is available, ie. at least the minimum available // replicas required are up and running for at least minReadySeconds. MachineDeploymentAvailable MachineDeploymentConditionType = "Available" // Progressing means the MachineDeployment is progressing. Progress for a MachineDeployment is // considered when a new machine set is created or adopted, and when new machines scale // up or old machines scale down. Progress is not estimated for paused MachineDeployments or // when progressDeadlineSeconds is not specified. MachineDeploymentProgressing MachineDeploymentConditionType = "Progressing" // ReplicaFailure is added in a MachineDeployment when one of its machines fails to be created // or deleted. MachineDeploymentReplicaFailure MachineDeploymentConditionType = "ReplicaFailure" // MachineDeploymentFrozen is added in a MachineDeployment when one of its machines fails to be created // or deleted. MachineDeploymentFrozen MachineDeploymentConditionType = "Frozen" )
These are valid conditions of a MachineDeployment.
type MachineDeploymentList ¶
type MachineDeploymentList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata.
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// Items is the list of MachineDeployments.
Items []MachineDeployment `json:"items"`
}
MachineDeploymentList is a list of MachineDeployments.
type MachineDeploymentSpec ¶
type MachineDeploymentSpec struct {
// Number of desired machines. This is a pointer to distinguish between explicit
// zero and not specified. Defaults to 0.
// +optional
Replicas int32 `json:"replicas,omitempty"`
// Label selector for machines. Existing MachineSets whose machines are
// selected by this will be the ones affected by this MachineDeployment.
// +optional
Selector *metav1.LabelSelector `json:"selector,omitempty"`
// Template describes the machines that will be created.
Template MachineTemplateSpec `json:"template"`
// The MachineDeployment strategy to use to replace existing machines with new ones.
// +optional
// +patchStrategy=retainKeys
Strategy MachineDeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys"`
// Minimum number of seconds for which a newly created machine should be ready
// without any of its container crashing, for it to be considered available.
// Defaults to 0 (machine will be considered available as soon as it is ready)
// +optional
MinReadySeconds int32 `json:"minReadySeconds,omitempty"`
// The number of old MachineSets to retain to allow rollback.
// This is a pointer to distinguish between explicit zero and not specified.
// +optional
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
// Indicates that the MachineDeployment is paused and will not be processed by the
// MachineDeployment controller.
// +optional
Paused bool `json:"paused,omitempty"`
// DEPRECATED.
// The config this MachineDeployment is rolling back to. Will be cleared after rollback is done.
// +optional
RollbackTo *RollbackConfig `json:"rollbackTo,omitempty"`
// The maximum time in seconds for a MachineDeployment to make progress before it
// is considered to be failed. The MachineDeployment controller will continue to
// process failed MachineDeployments and a condition with a ProgressDeadlineExceeded
// reason will be surfaced in the MachineDeployment status. Note that progress will
// not be estimated during the time a MachineDeployment is paused. This is not set
// by default.
// +optional
ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty"`
}
MachineDeploymentSpec is the specification of the desired behavior of the MachineDeployment.
type MachineDeploymentStatus ¶
type MachineDeploymentStatus struct {
// The generation observed by the MachineDeployment controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Total number of non-terminated machines targeted by this MachineDeployment (their labels match the selector).
// +optional
Replicas int32 `json:"replicas,omitempty"`
// Total number of non-terminated machines targeted by this MachineDeployment that have the desired template spec.
// +optional
UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
// Total number of ready machines targeted by this MachineDeployment.
// +optional
ReadyReplicas int32 `json:"readyReplicas,omitempty"`
// Total number of available machines (ready for at least minReadySeconds) targeted by this MachineDeployment.
// +optional
AvailableReplicas int32 `json:"availableReplicas,omitempty"`
// machines that are still required for the MachineDeployment to have 100% available capacity. They may
// either be machines that are running but not yet available or machines that still have not been created.
// +optional
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty"`
// Represents the latest available observations of a MachineDeployment's current state.
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []MachineDeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
// Count of hash collisions for the MachineDeployment. The MachineDeployment controller uses this
// field as a collision avoidance mechanism when it needs to create the name for the
// newest MachineSet.
// +optional
CollisionCount *int32 `json:"collisionCount,omitempty"`
// FailedMachines has summary of machines on which lastOperation Failed
// +optional
FailedMachines []*MachineSummary `json:"failedMachines,omitempty"`
}
MachineDeploymentStatus is the most recently observed status of the MachineDeployment.
type MachineDeploymentStrategy ¶
type MachineDeploymentStrategy struct {
// Type of MachineDeployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.
// +optional
Type MachineDeploymentStrategyType `json:"type,omitempty"`
// Rolling update config params. Present only if MachineDeploymentStrategyType =
// RollingUpdate.
//---
// TODO: Update this to follow our convention for oneOf, whatever we decide it
// to be.
// +optional
RollingUpdate *RollingUpdateMachineDeployment `json:"rollingUpdate,omitempty"`
}
MachineDeploymentStrategy describes how to replace existing machines with new ones.
type MachineDeploymentStrategyType ¶
type MachineDeploymentStrategyType string
const ( // Kill all existing machines before creating new ones. RecreateMachineDeploymentStrategyType MachineDeploymentStrategyType = "Recreate" // Replace the old MCs by new one using rolling update i.e gradually scale down the old MCs and scale up the new one. RollingUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "RollingUpdate" )
type MachineList ¶
type MachineList struct {
// ObjectMeta for MachineList object
metav1.TypeMeta `json:",inline"`
// TypeMeta for MachineList object
metav1.ListMeta `json:"metadata,omitempty"`
// Items contains the list of machines
Items []Machine `json:"items"`
}
MachineList is a collection of Machines.
type MachineOperationType ¶
type MachineOperationType string
MachineOperationType is a label for the operation performed on a machine object.
const ( // MachineOperationCreate indicates that the operation was a create MachineOperationCreate MachineOperationType = "Create" // MachineOperationUpdate indicates that the operation was an update MachineOperationUpdate MachineOperationType = "Update" // MachineOperationHealthCheck indicates that the operation was a create MachineOperationHealthCheck MachineOperationType = "HealthCheck" // MachineOperationDelete indicates that the operation was a create MachineOperationDelete MachineOperationType = "Delete" )
These are the valid statuses of machines.
type MachinePhase ¶
type MachinePhase string
MachinePhase is a label for the condition of a machines at the current time.
const ( // MachinePending means that the machine is being created MachinePending MachinePhase = "Pending" // MachineAvailable means that machine is present on provider but hasn't joined cluster yet MachineAvailable MachinePhase = "Available" // MachineRunning means node is ready and running successfully MachineRunning MachinePhase = "Running" // MachineRunning means node is terminating MachineTerminating MachinePhase = "Terminating" // MachineUnknown indicates that the node is not ready at the movement MachineUnknown MachinePhase = "Unknown" // MachineFailed means operation failed leading to machine status failure MachineFailed MachinePhase = "Failed" // MachineCrashLoopBackOff means creation or deletion of the machine is failing. MachineCrashLoopBackOff MachinePhase = "CrashLoopBackOff" )
These are the valid statuses of machines.
type MachineSpec ¶
type MachineSpec struct {
// Class contains the machineclass attributes of a machine
// +optional
Class ClassSpec `json:"class,omitempty"`
// ProviderID represents the provider's unique ID given to a machine
// +optional
ProviderID string `json:"providerID,omitempty"`
// NodeTemplateSpec describes the data a node should have when created from a template
// +optional
NodeTemplateSpec NodeTemplateSpec `json:"nodeTemplate,omitempty"`
// Configuration for the machine-controller.
// +optional
*MachineConfiguration `json:",inline"`
}
MachineSpec is the specification of a Machine.
type MachineState ¶
type MachineState string
MachineState is a current state of the machine.
const ( // MachineStatePending means there are operations pending on this machine state MachineStateProcessing MachineState = "Processing" // MachineStateFailed means operation failed leading to machine status failure MachineStateFailed MachineState = "Failed" // MachineStateSuccessful indicates that the node is not ready at the moment MachineStateSuccessful MachineState = "Successful" )
These are the valid statuses of machines.
type MachineStatus ¶
type MachineStatus struct {
// Node string
Node string `json:"node,omitempty"`
// Conditions of this machine, same as node
Conditions []corev1.NodeCondition `json:"conditions,omitempty"`
// Last operation refers to the status of the last operation performed
LastOperation LastOperation `json:"lastOperation,omitempty"`
// Current status of the machine object
CurrentStatus CurrentStatus `json:"currentStatus,omitempty"`
// LastKnownState can store details of the last known state of the VM by the plugins.
// It can be used by future operation calls to determine current infrastucture state
// +optional
LastKnownState string `json:"lastKnownState,omitempty"`
}
MachineStatus holds the most recently observed status of Machine.
type MachineSummary ¶
type MachineSummary struct {
// Name of the machine object
Name string `json:"name,omitempty"`
// ProviderID represents the provider's unique ID given to a machine
ProviderID string `json:"providerID,omitempty"`
// Last operation refers to the status of the last operation performed
LastOperation LastOperation `json:"lastOperation,omitempty"`
// OwnerRef
OwnerRef string `json:"ownerRef,omitempty"`
}
MachineSummary store the summary of machine.
type MachineTemplateSpec ¶
type MachineTemplateSpec struct {
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the machine.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
// +optional
Spec MachineSpec `json:"spec,omitempty"`
}
MachineTemplateSpec describes the data a machine should have when created from a template
type NodeTemplateSpec ¶
type NodeTemplateSpec struct {
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// NodeSpec describes the attributes that a node is created with.
// +optional
Spec corev1.NodeSpec `json:"spec,omitempty"`
}
NodeTemplateSpec describes the data a node should have when created from a template
type RollbackConfig ¶
type RollbackConfig struct {
// The revision to rollback to. If set to 0, rollback to the last revision.
// +optional
Revision int64 `json:"revision,omitempty"`
}
type RollingUpdateMachineDeployment ¶
type RollingUpdateMachineDeployment struct {
// Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%).
// Absolute number is calculated from percentage by rounding down.
// This can not be 0 if MaxSurge is 0.
// By default, a fixed value of 1 is used.
// Example: when this is set to 30%, the old MC can be scaled down to 70% of desired machines
// immediately when the rolling update starts. Once new machines are ready, old MC
// can be scaled down further, followed by scaling up the new MC, ensuring
// that the total number of machines available at all times during the update is at
// least 70% of desired machines.
// +optional
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
// The maximum number of machines that can be scheduled above the desired number of
// machines.
// Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%).
// This can not be 0 if MaxUnavailable is 0.
// Absolute number is calculated from percentage by rounding up.
// By default, a value of 1 is used.
// Example: when this is set to 30%, the new MC can be scaled up immediately when
// the rolling update starts, such that the total number of old and new machines do not exceed
// 130% of desired machines. Once old machines have been killed,
// new MC can be scaled up further, ensuring that total number of machines running
// at any time during the update is atmost 130% of desired machines.
// +optional
MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"`
}
Spec to control the desired behavior of rolling update.