v1alpha1

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the remediation v1alpha1 API group +kubebuilder:object:generate=true +groupName=remediation.medik8s.io

Index

Constants

View Source
const (
	// ConditionTypeDisabled is the condition type used when NHC will get disabled
	ConditionTypeDisabled = "Disabled"
	// ConditionReasonDisabledMHC is the condition reason for type Disabled in case NHC is disabled because
	// of conflicts with MHC
	ConditionReasonDisabledMHC = "ConflictingMachineHealthCheckDetected"
	// ConditionReasonDisabledTemplateNotFound is the reason for type Disabled when the template wasn't found
	ConditionReasonDisabledTemplateNotFound = "RemediationTemplateNotFound"
	// ConditionReasonDisabledTemplateInvalid is the reason for type Disabled when the template is invalid
	ConditionReasonDisabledTemplateInvalid = "RemediationTemplateInvalid"
	// ConditionReasonEnabled is the condition reason for type Disabled and status False
	ConditionReasonEnabled = "NodeHealthCheckEnabled"
)
View Source
const (
	OngoingRemediationError = "prohibited due to running remediation"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "remediation.medik8s.io", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type EscalatingRemediation added in v0.5.0

type EscalatingRemediation struct {
	// RemediationTemplate is a reference to a remediation template
	// provided by a remediation provider.
	//
	// If a node needs remediation the controller will create an object from this template
	// and then it should be picked up by a remediation provider.
	//
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	RemediationTemplate corev1.ObjectReference `json:"remediationTemplate"`

	// Order defines the order for this remediation.
	// Remediations with lower order will be used before remediations with higher order.
	// Remediations must not have the same order.
	//
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	Order int `json:"order"`

	// Timeout defines how long NHC will wait for the node getting healthy
	// before the next remediation (if any) will be used. When the last remediation times out,
	// the overall remediation is considered as failed.
	// As a safeguard for preventing parallel remediations, a minimum of 60s is enforced.
	//
	// Expects a string of decimal numbers each with optional
	// fraction and a unit suffix, eg "300ms", "1.5h" or "2h45m".
	// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
	//
	//+kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
	//+kubebuilder:validation:Type=string
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	Timeout metav1.Duration `json:"timeout"`
}

EscalatingRemediation defines a remediation template with order and timeout

func (*EscalatingRemediation) DeepCopy added in v0.5.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EscalatingRemediation.

func (*EscalatingRemediation) DeepCopyInto added in v0.5.0

func (in *EscalatingRemediation) DeepCopyInto(out *EscalatingRemediation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NHCPhase added in v0.3.0

type NHCPhase string

NHCPhase is the string used for NHC.Status.Phase

const (
	// PhaseDisabled is used when the Disabled condition is true
	PhaseDisabled NHCPhase = "Disabled"

	// PhasePaused is used when not disabled, but PauseRequests is set
	PhasePaused NHCPhase = "Paused"

	// PhaseRemediating is used when not disabled and not paused, and InFlightRemediations is set
	PhaseRemediating NHCPhase = "Remediating"

	// PhaseEnabled is used in all other cases
	PhaseEnabled NHCPhase = "Enabled"
)

type NodeHealthCheck

type NodeHealthCheck struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   NodeHealthCheckSpec   `json:"spec,omitempty"`
	Status NodeHealthCheckStatus `json:"status,omitempty"`
}

NodeHealthCheck is the Schema for the nodehealthchecks API

+operator-sdk:csv:customresourcedefinitions:resources={{"NodeHealthCheck","v1alpha1","nodehealthchecks"}}

func (*NodeHealthCheck) DeepCopy

func (in *NodeHealthCheck) DeepCopy() *NodeHealthCheck

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeHealthCheck.

func (*NodeHealthCheck) DeepCopyInto

func (in *NodeHealthCheck) DeepCopyInto(out *NodeHealthCheck)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NodeHealthCheck) DeepCopyObject

func (in *NodeHealthCheck) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*NodeHealthCheck) SetupWebhookWithManager added in v0.4.0

func (nhc *NodeHealthCheck) SetupWebhookWithManager(mgr ctrl.Manager) error

func (*NodeHealthCheck) ValidateCreate added in v0.4.0

func (nhc *NodeHealthCheck) ValidateCreate() error

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*NodeHealthCheck) ValidateDelete added in v0.4.0

func (nhc *NodeHealthCheck) ValidateDelete() error

ValidateDelete implements webhook.Validator so a webhook will be registered for the type

func (*NodeHealthCheck) ValidateUpdate added in v0.4.0

func (nhc *NodeHealthCheck) ValidateUpdate(old runtime.Object) error

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type NodeHealthCheckList

type NodeHealthCheckList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []NodeHealthCheck `json:"items"`
}

NodeHealthCheckList contains a list of NodeHealthCheck

func (*NodeHealthCheckList) DeepCopy

func (in *NodeHealthCheckList) DeepCopy() *NodeHealthCheckList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeHealthCheckList.

func (*NodeHealthCheckList) DeepCopyInto

func (in *NodeHealthCheckList) DeepCopyInto(out *NodeHealthCheckList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NodeHealthCheckList) DeepCopyObject

func (in *NodeHealthCheckList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type NodeHealthCheckSpec

type NodeHealthCheckSpec struct {
	// Label selector to match nodes whose health will be exercised.
	//
	// Selecting both control-plane and worker nodes in one NHC CR is
	// highly discouraged and can result in undesired behaviour.
	//
	// Note: mandatory now for above reason, but for backwards compatibility existing
	// CRs will continue to work with an empty selector, which matches all nodes.
	//
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	Selector metav1.LabelSelector `json:"selector"`

	// UnhealthyConditions contains a list of the conditions that determine
	// whether a node is considered unhealthy.  The conditions are combined in a
	// logical OR, i.e. if any of the conditions is met, the node is unhealthy.
	//
	//+optional
	//+listType=map
	//+listMapKey=type
	//+listMapKey=status
	//+kubebuilder:default:={{type:Ready,status:False,duration:"300s"},{type:Ready,status:Unknown,duration:"300s"}}
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	UnhealthyConditions []UnhealthyCondition `json:"unhealthyConditions,omitempty"`

	// Remediation is allowed if at least "MinHealthy" nodes selected by "selector" are healthy.
	// Expects either a positive integer value or a percentage value.
	// Percentage values must be positive whole numbers and are capped at 100%.
	// 100% is valid and will block all remediation.
	//
	//+kubebuilder:default="51%"
	//+kubebuilder:validation:XIntOrString
	//+kubebuilder:validation:Pattern="^((100|[0-9]{1,2})%|[0-9]+)$"
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	MinHealthy *intstr.IntOrString `json:"minHealthy,omitempty"`

	// RemediationTemplate is a reference to a remediation template
	// provided by an infrastructure provider.
	//
	// If a node needs remediation the controller will create an object from this template
	// and then it should be picked up by a remediation provider.
	//
	// Mutually exclusive with EscalatingRemediations
	//
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	RemediationTemplate *corev1.ObjectReference `json:"remediationTemplate,omitempty"`

	// EscalatingRemediations contain a list of ordered remediation templates with a timeout.
	// The remediation templates will be used one after another, until the unhealthy node
	// gets healthy within the timeout of the currently processed remediation. The order of
	// remediation is defined by the "order" field of each "escalatingRemediation".
	//
	// Mutually exclusive with RemediationTemplate
	//
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	EscalatingRemediations []EscalatingRemediation `json:"escalatingRemediations,omitempty"`

	// PauseRequests will prevent any new remediation to start, while in-flight remediations
	// keep running. Each entry is free form, and ideally represents the requested party reason
	// for this pausing - i.e:
	//     "imaginary-cluster-upgrade-manager-operator"
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	PauseRequests []string `json:"pauseRequests,omitempty"`
}

NodeHealthCheckSpec defines the desired state of NodeHealthCheck

func (*NodeHealthCheckSpec) DeepCopy

func (in *NodeHealthCheckSpec) DeepCopy() *NodeHealthCheckSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeHealthCheckSpec.

func (*NodeHealthCheckSpec) DeepCopyInto

func (in *NodeHealthCheckSpec) DeepCopyInto(out *NodeHealthCheckSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NodeHealthCheckStatus

type NodeHealthCheckStatus struct {
	// ObservedNodes specified the number of nodes observed by using the NHC spec.selector
	//
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=status
	ObservedNodes *int `json:"observedNodes,omitempty"`

	// HealthyNodes specified the number of healthy nodes observed
	//
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=status
	HealthyNodes *int `json:"healthyNodes,omitempty"`

	// UnhealthyNodes tracks currently unhealthy nodes and their remediations.
	//
	//+listType=map
	//+listMapKey=name
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=status
	UnhealthyNodes []*UnhealthyNode `json:"unhealthyNodes,omitempty"`

	// InFlightRemediations records the timestamp when remediation triggered per node.
	// Deprecated in favour of UnhealthyNodes.
	//
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=status
	InFlightRemediations map[string]metav1.Time `json:"inFlightRemediations,omitempty"`

	// Represents the observations of a NodeHealthCheck's current state.
	// Known .status.conditions.type are: "Disabled"
	//
	//+listType=map
	//+listMapKey=type
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:io.kubernetes.conditions"
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// Phase represents the current phase of this Config.
	// Known phases are Disabled, Paused, Remediating and Enabled, based on:\n
	// - the status of the Disabled condition\n
	// - the value of PauseRequests\n
	// - the value of InFlightRemediations
	//
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:io.kubernetes.phase"
	Phase NHCPhase `json:"phase,omitempty"`

	// Reason explains the current phase in more detail.
	//
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:io.kubernetes.phase:reason"
	Reason string `json:"reason,omitempty"`

	// LastUpdateTime is the last time the status was updated.
	//
	//+optional
	//+kubebuilder:validation:Type=string
	//+kubebuilder:validation:Format=date-time
	//+operator-sdk:csv:customresourcedefinitions:type=status
	LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`
}

NodeHealthCheckStatus defines the observed state of NodeHealthCheck

func (*NodeHealthCheckStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeHealthCheckStatus.

func (*NodeHealthCheckStatus) DeepCopyInto

func (in *NodeHealthCheckStatus) DeepCopyInto(out *NodeHealthCheckStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Remediation added in v0.5.0

type Remediation struct {
	// Resource is the reference to the remediation CR which was created
	//
	//+operator-sdk:csv:customresourcedefinitions:type=status
	Resource corev1.ObjectReference `json:"resource"`

	// Started is the creation time of the remediation CR
	//
	//+operator-sdk:csv:customresourcedefinitions:type=status
	Started metav1.Time `json:"started"`

	// TimedOut is the time when the remediation timed out.
	// Applicable for escalating remediations only.
	//
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=status
	TimedOut *metav1.Time `json:"timedOut,omitempty"`
}

Remediation defines a remediation which was created for a node

func (*Remediation) DeepCopy added in v0.5.0

func (in *Remediation) DeepCopy() *Remediation

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Remediation.

func (*Remediation) DeepCopyInto added in v0.5.0

func (in *Remediation) DeepCopyInto(out *Remediation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type UnhealthyCondition

type UnhealthyCondition struct {
	// The condition type in the node's status to watch for.
	//
	//+kubebuilder:validation:Type=string
	//+kubebuilder:validation:MinLength=1
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	Type corev1.NodeConditionType `json:"type"`

	// The condition status in the node's status to watch for.
	// Typically False, True or Unknown.
	//
	//+kubebuilder:validation:Type=string
	//+kubebuilder:validation:MinLength=1
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	Status corev1.ConditionStatus `json:"status"`

	// Duration of the condition specified when a node is considered unhealthy.
	//
	// Expects a string of decimal numbers each with optional
	// fraction and a unit suffix, eg "300ms", "1.5h" or "2h45m".
	// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
	//
	//+kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
	//+kubebuilder:validation:Type=string
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	Duration metav1.Duration `json:"duration"`
}

UnhealthyCondition represents a Node condition type and value with a specified duration. When the named condition has been in the given status for at least the duration value a node is considered unhealthy.

func (*UnhealthyCondition) DeepCopy

func (in *UnhealthyCondition) DeepCopy() *UnhealthyCondition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UnhealthyCondition.

func (*UnhealthyCondition) DeepCopyInto

func (in *UnhealthyCondition) DeepCopyInto(out *UnhealthyCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type UnhealthyNode added in v0.5.0

type UnhealthyNode struct {
	// Name is the name of the unhealthy node
	//
	//+operator-sdk:csv:customresourcedefinitions:type=status
	Name string `json:"name"`

	// Remediations tracks the remediations created for this node
	//
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=status
	Remediations []*Remediation `json:"remediations,omitempty"`

	// ConditionsHealthyTimestamp is RFC 3339 date and time at which the unhealthy conditions didn't match anymore.
	// The remediation CR will be deleted at that time, but the node will still be tracked as unhealthy until all
	// remediation CRs are actually deleted, when remediators finished cleanup and removed their finalizers.
	//
	//+optional
	//+operator-sdk:csv:customresourcedefinitions:type=status
	ConditionsHealthyTimestamp *metav1.Time `json:"conditionsHealthyTimestamp,omitempty"`
}

UnhealthyNode defines an unhealthy node and its remediations

func (*UnhealthyNode) DeepCopy added in v0.5.0

func (in *UnhealthyNode) DeepCopy() *UnhealthyNode

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UnhealthyNode.

func (*UnhealthyNode) DeepCopyInto added in v0.5.0

func (in *UnhealthyNode) DeepCopyInto(out *UnhealthyNode)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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