Skip to content

Commit

Permalink
Merge pull request #978 from nprokopic/azuremachinepool-conditions
Browse files Browse the repository at this point in the history
✨ Initial support for conditions for AzureMachinePool
  • Loading branch information
k8s-ci-robot authored Oct 29, 2020
2 parents 254746e + 81728bb commit 1d9ad20
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,52 @@ spec:
status:
description: AzureMachinePoolStatus defines the observed state of AzureMachinePool
properties:
conditions:
description: Conditions defines current service state of the AzureMachinePool.
items:
description: Condition defines an observation of a Cluster API resource
operational state.
properties:
lastTransitionTime:
description: Last time the condition transitioned from one status
to another. This should be when the underlying condition changed.
If that is not known, then using the time when the API field
changed is acceptable.
format: date-time
type: string
message:
description: A human readable message indicating details about
the transition. This field may be empty.
type: string
reason:
description: The reason for the condition's last transition
in CamelCase. The specific API may choose whether or not this
field is considered a guaranteed API. This field may not be
empty.
type: string
severity:
description: Severity provides an explicit classification of
Reason code, so the users or machines can immediately understand
the current situation and act accordingly. The Severity field
MUST be set only when Status=False.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important.
type: string
required:
- status
- type
type: object
type: array
failureMessage:
description: "ErrorMessage will be set in the event that there is
description: "FailureMessage will be set in the event that there is
a terminal problem reconciling the MachinePool and will contain
a more verbose string suitable for logging and human consumption.
\n This field should not be set for transitive errors that a controller
Expand All @@ -356,9 +400,9 @@ spec:
output."
type: string
failureReason:
description: "ErrorReason will be set in the event that there is a
terminal problem reconciling the MachinePool and will contain a
succinct value suitable for machine interpretation. \n This field
description: "FailureReason will be set in the event that there is
a terminal problem reconciling the MachinePool and will contain
a succinct value suitable for machine interpretation. \n This field
should not be set for transitive errors that a controller faces
that are expected to be fixed automatically over time (like service
outages), but instead indicate that something is fundamentally wrong
Expand Down
19 changes: 17 additions & 2 deletions exp/api/v1alpha3/azuremachinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha3

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
"sigs.k8s.io/cluster-api/errors"

infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha3"
Expand Down Expand Up @@ -126,7 +127,7 @@ type (
// +optional
ProvisioningState *infrav1.VMState `json:"provisioningState,omitempty"`

// ErrorReason will be set in the event that there is a terminal problem
// FailureReason will be set in the event that there is a terminal problem
// reconciling the MachinePool and will contain a succinct value suitable
// for machine interpretation.
//
Expand All @@ -145,7 +146,7 @@ type (
// +optional
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`

// ErrorMessage will be set in the event that there is a terminal problem
// FailureMessage will be set in the event that there is a terminal problem
// reconciling the MachinePool and will contain a more verbose string suitable
// for logging and human consumption.
//
Expand All @@ -163,6 +164,10 @@ type (
// controller's output.
// +optional
FailureMessage *string `json:"failureMessage,omitempty"`

// Conditions defines current service state of the AzureMachinePool.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
}

// AzureMachinePoolInstanceStatus provides status information for each instance in the VMSS
Expand Down Expand Up @@ -219,6 +224,16 @@ type (
}
)

// GetConditions returns the list of conditions for an AzureMachinePool API object.
func (amp *AzureMachinePool) GetConditions() clusterv1.Conditions {
return amp.Status.Conditions
}

// SetConditions will set the given conditions on an AzureMachinePool object
func (amp *AzureMachinePool) SetConditions(conditions clusterv1.Conditions) {
amp.Status.Conditions = conditions
}

func init() {
SchemeBuilder.Register(&AzureMachinePool{}, &AzureMachinePoolList{})
}
8 changes: 8 additions & 0 deletions exp/api/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1d9ad20

Please sign in to comment.