v1alpha1

package
v0.4.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Apache-2.0 Imports: 14 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"
	// ConditionReasonEnabled is the condition reason for type Disabled and status False
	ConditionReasonEnabled = "NodeHealthCheckEnabled"
)
View Source
const (
	WebhookCertDir  = "/apiserver.local.config/certificates"
	WebhookCertName = "apiserver.crt"
	WebhookKeyName  = "apiserver.key"

	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 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 (r *NodeHealthCheck) SetupWebhookWithManager(mgr ctrl.Manager) error

func (*NodeHealthCheck) ValidateCreate added in v0.4.0

func (r *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 (r *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 (r *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.
	// Note: An empty selector will match 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
	// +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.
	//+operator-sdk:csv:customresourcedefinitions:type=spec
	RemediationTemplate *corev1.ObjectReference `json:"remediationTemplate"`

	// PauseRequests will prevent any new remdiation 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 {
	// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="observedNodes",xDescriptors="urn:alm:descriptor:com.tectonic.ui:observedNodes"
	//ObservedNodes specified the number of nodes observed by using the NHC spec.selector
	// +kubebuilder:default:=0
	ObservedNodes int `json:"observedNodes"`

	// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="healthynodes",xDescriptors="urn:alm:descriptor:com.tectonic.ui:healthyNodes"
	//HealthyNodes specified the number of healthy nodes observed
	// +kubebuilder:default:=0
	HealthyNodes int `json:"healthyNodes"`

	// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="inFlightRemediations",xDescriptors="urn:alm:descriptor:com.tectonic.ui:inFlightRemediations"
	//InFlightRemediations records the timestamp when remediation triggered per node
	//+optional
	InFlightRemediations map[string]metav1.Time `json:"inFlightRemediations,omitempty"`

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

	// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="phase",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
	// 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
	Phase NHCPhase `json:"phase,omitempty"`

	// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="reason",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
	// Reason explains the current phase in more detail.
	// +optional
	Reason string `json:"reason,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 UnhealthyCondition

type UnhealthyCondition struct {
	// +kubebuilder:validation:Type=string
	// +kubebuilder:validation:MinLength=1
	Type corev1.NodeConditionType `json:"type"`

	// +kubebuilder:validation:Type=string
	// +kubebuilder:validation:MinLength=1
	Status corev1.ConditionStatus `json:"status"`

	// Duration of the condition specified where 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
	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.

Jump to

Keyboard shortcuts

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