Skip to content

Commit

Permalink
Address the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Evalle committed Jan 18, 2021
1 parent 6b3cb13 commit c934222
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/v1alpha3/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ type Bootstrap struct {
// +optional
ConfigRef *corev1.ObjectReference `json:"configRef,omitempty"`

// Data contains the bootstrap data, such as cloud-init details scripts.
// If nil, the Machine should remain in the Pending state.
//
// Deprecated: This field has been deprecated in v1alpha3 and
// will be removed in a future version. Switch to DataSecretName.
//
// +optional
Data *string `json:"data,omitempty"`

// DataSecretName is the name of the secret that stores the bootstrap data script.
// If nil, the Machine should remain in the Pending state.
// +optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ type KubeadmConfigStatus struct {
// +optional
DataSecretName *string `json:"dataSecretName,omitempty"`

// BootstrapData will be a cloud-init script for now.
//
// Deprecated: This field has been deprecated in v1alpha3 and
// will be removed in a future version. Switch to DataSecretName.
//
// +optional
BootstrapData []byte `json:"bootstrapData,omitempty"`

// FailureReason will be set on non-retryable errors
// +optional
FailureReason string `json:"failureReason,omitempty"`
Expand Down
33 changes: 33 additions & 0 deletions errors/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,41 @@ package errors
import (
"fmt"
"time"

"github.com/pkg/errors"
)
)

// HasRequeueAfterError represents that an actuator managed object should
// be requeued for further processing after the given RequeueAfter time has
// passed.
//
// DEPRECATED: This error is deprecated and should not be used for new code.
// See https://github.com/kubernetes-sigs/cluster-api/issues/3370 for more information.
//
// Users should switch their methods and functions to return a (ctrl.Result, error) pair,
// instead of relying on this error. Controller runtime exposes a Result.IsZero() (from 0.5.9, and 0.6.2)
// which can be used from callers to see if reconciliation should be stopped or continue.
type HasRequeueAfterError interface {
// GetRequeueAfter gets the duration to wait until the managed object is
// requeued for further processing.
GetRequeueAfter() time.Duration
}

// RequeueAfterError represents that an actuator managed object should be
// requeued for further processing after the given RequeueAfter time has
// passed.
//
// DEPRECATED: This error is deprecated and should not be used for new code.
// See https://github.com/kubernetes-sigs/cluster-api/issues/3370 for more information.
//
// Users should switch their methods and functions to return a (ctrl.Result, error) pair,
// instead of relying on this error. Controller runtime exposes a Result.IsZero() (from 0.5.9, and 0.6.2)
// which can be used from callers to see if reconciliation should be stopped or continue.
type RequeueAfterError struct {
RequeueAfter time.Duration
}

// Error implements the error interface
func (e *RequeueAfterError) Error() string {
return fmt.Sprintf("requeue in %v", e.RequeueAfter)
Expand Down
10 changes: 10 additions & 0 deletions util/conditions/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ func (o *applyOptions) isOwnedCondition(t clusterv1.ConditionType) bool {
// ApplyOption defines an option for applying a condition patch.
type ApplyOption func(*applyOptions)

// WithOwnedConditions allows to define condition types owned by the controller.
// In case of conflicts for the owned conditions, the patch helper will always use the value provided by the controller.
//
// DEPRECATED: Use WithForceOverwrite.
func WithOwnedConditions(t ...clusterv1.ConditionType) ApplyOption {
return func(c *applyOptions) {
c.ownedConditions = t
}
}

// WithForceOverwrite In case of conflicts for the owned conditions, the patch helper will always use the value provided by the controller.
func WithForceOverwrite(v bool) ApplyOption {
return func(c *applyOptions) {
Expand Down

0 comments on commit c934222

Please sign in to comment.