/*
Copyright 2025 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta2

import clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"

// Conditions and condition Reasons for the KubeadmControlPlane object.

const (
	// MachinesReadyV1Beta1Condition reports an aggregate of current status of the machines controlled by the KubeadmControlPlane.
	MachinesReadyV1Beta1Condition clusterv1.ConditionType = "MachinesReady"
)

const (
	// CertificatesAvailableV1Beta1Condition documents that cluster certificates were generated as part of the
	// processing of a KubeadmControlPlane object.
	CertificatesAvailableV1Beta1Condition clusterv1.ConditionType = "CertificatesAvailable"

	// CertificatesGenerationFailedV1Beta1Reason (Severity=Warning) documents a KubeadmControlPlane controller detecting
	// an error while generating certificates; those kind of errors are usually temporary and the controller
	// automatically recover from them.
	CertificatesGenerationFailedV1Beta1Reason = "CertificatesGenerationFailed"
)

const (
	// AvailableV1Beta1Condition documents that the first control plane instance has completed the kubeadm init operation
	// and so the control plane is available and an API server instance is ready for processing requests.
	AvailableV1Beta1Condition clusterv1.ConditionType = "Available"

	// WaitingForKubeadmInitV1Beta1Reason (Severity=Info) documents a KubeadmControlPlane object waiting for the first
	// control plane instance to complete the kubeadm init operation.
	WaitingForKubeadmInitV1Beta1Reason = "WaitingForKubeadmInit"
)

const (
	// MachinesSpecUpToDateV1Beta1Condition documents that the spec of the machines controlled by the KubeadmControlPlane
	// is up to date. When this condition is false, the KubeadmControlPlane is executing a rolling upgrade.
	MachinesSpecUpToDateV1Beta1Condition clusterv1.ConditionType = "MachinesSpecUpToDate"

	// RollingUpdateInProgressV1Beta1Reason (Severity=Warning) documents a KubeadmControlPlane object executing a
	// rolling upgrade for aligning the machines spec to the desired state.
	RollingUpdateInProgressV1Beta1Reason = "RollingUpdateInProgress"
)

const (
	// ResizedV1Beta1Condition documents a KubeadmControlPlane that is resizing the set of controlled machines.
	ResizedV1Beta1Condition clusterv1.ConditionType = "Resized"

	// ScalingUpV1Beta1Reason (Severity=Info) documents a KubeadmControlPlane that is increasing the number of replicas.
	ScalingUpV1Beta1Reason = "ScalingUp"

	// ScalingDownV1Beta1Reason (Severity=Info) documents a KubeadmControlPlane that is decreasing the number of replicas.
	ScalingDownV1Beta1Reason = "ScalingDown"
)

const (
	// ControlPlaneComponentsHealthyV1Beta1Condition reports the overall status of control plane components
	// implemented as static pods generated by kubeadm including kube-api-server, kube-controller manager,
	// kube-scheduler and etcd if managed.
	ControlPlaneComponentsHealthyV1Beta1Condition clusterv1.ConditionType = "ControlPlaneComponentsHealthy"

	// ControlPlaneComponentsUnhealthyV1Beta1Reason (Severity=Error) documents a control plane component not healthy.
	ControlPlaneComponentsUnhealthyV1Beta1Reason = "ControlPlaneComponentsUnhealthy"

	// ControlPlaneComponentsUnknownV1Beta1Reason reports a control plane component in unknown status.
	ControlPlaneComponentsUnknownV1Beta1Reason = "ControlPlaneComponentsUnknown"

	// ControlPlaneComponentsInspectionFailedV1Beta1Reason documents a failure in inspecting the control plane component status.
	ControlPlaneComponentsInspectionFailedV1Beta1Reason = "ControlPlaneComponentsInspectionFailed"

	// MachineAPIServerPodHealthyV1Beta1Condition reports a machine's kube-apiserver's operational status.
	MachineAPIServerPodHealthyV1Beta1Condition clusterv1.ConditionType = "APIServerPodHealthy"

	// MachineControllerManagerPodHealthyV1Beta1Condition reports a machine's kube-controller-manager's health status.
	MachineControllerManagerPodHealthyV1Beta1Condition clusterv1.ConditionType = "ControllerManagerPodHealthy"

	// MachineSchedulerPodHealthyV1Beta1Condition reports a machine's kube-scheduler's operational status.
	MachineSchedulerPodHealthyV1Beta1Condition clusterv1.ConditionType = "SchedulerPodHealthy"

	// MachineEtcdPodHealthyV1Beta1Condition reports a machine's etcd pod's operational status.
	// NOTE: This conditions exists only if a stacked etcd cluster is used.
	MachineEtcdPodHealthyV1Beta1Condition clusterv1.ConditionType = "EtcdPodHealthy"

	// PodProvisioningV1Beta1Reason (Severity=Info) documents a pod waiting to be provisioned i.e., Pod is in "Pending" phase.
	PodProvisioningV1Beta1Reason = "PodProvisioning"

	// PodMissingV1Beta1Reason (Severity=Error) documents a pod does not exist.
	PodMissingV1Beta1Reason = "PodMissing"

	// PodFailedV1Beta1Reason (Severity=Error) documents if a pod failed during provisioning i.e., e.g CrashLoopbackOff, ImagePullBackOff
	// or if all the containers in a pod have terminated.
	PodFailedV1Beta1Reason = "PodFailed"

	// PodInspectionFailedV1Beta1Reason documents a failure in inspecting the pod status.
	PodInspectionFailedV1Beta1Reason = "PodInspectionFailed"
)

const (
	// EtcdClusterHealthyV1Beta1Condition documents the overall etcd cluster's health.
	EtcdClusterHealthyV1Beta1Condition clusterv1.ConditionType = "EtcdClusterHealthy"

	// EtcdClusterInspectionFailedV1Beta1Reason documents a failure in inspecting the etcd cluster status.
	EtcdClusterInspectionFailedV1Beta1Reason = "EtcdClusterInspectionFailed"

	// EtcdClusterUnknownV1Beta1Reason reports an etcd cluster in unknown status.
	EtcdClusterUnknownV1Beta1Reason = "EtcdClusterUnknown"

	// EtcdClusterUnhealthyV1Beta1Reason (Severity=Error) is set when the etcd cluster is unhealthy.
	EtcdClusterUnhealthyV1Beta1Reason = "EtcdClusterUnhealthy"

	// MachineEtcdMemberHealthyV1Beta1Condition report the machine's etcd member's health status.
	// NOTE: This conditions exists only if a stacked etcd cluster is used.
	MachineEtcdMemberHealthyV1Beta1Condition clusterv1.ConditionType = "EtcdMemberHealthy"

	// EtcdMemberInspectionFailedV1Beta1Reason documents a failure in inspecting the etcd member status.
	EtcdMemberInspectionFailedV1Beta1Reason = "MemberInspectionFailed"

	// EtcdMemberUnhealthyV1Beta1Reason (Severity=Error) documents a Machine's etcd member is unhealthy.
	EtcdMemberUnhealthyV1Beta1Reason = "EtcdMemberUnhealthy"

	// MachinesCreatedV1Beta1Condition documents that the machines controlled by the KubeadmControlPlane are created.
	// When this condition is false, it indicates that there was an error when cloning the infrastructure/bootstrap template or
	// when generating the machine object.
	MachinesCreatedV1Beta1Condition clusterv1.ConditionType = "MachinesCreated"

	// InfrastructureTemplateCloningFailedV1Beta1Reason (Severity=Error) documents a KubeadmControlPlane failing to
	// clone the infrastructure template.
	InfrastructureTemplateCloningFailedV1Beta1Reason = "InfrastructureTemplateCloningFailed"

	// BootstrapTemplateCloningFailedV1Beta1Reason (Severity=Error) documents a KubeadmControlPlane failing to
	// clone the bootstrap template.
	BootstrapTemplateCloningFailedV1Beta1Reason = "BootstrapTemplateCloningFailed"

	// MachineGenerationFailedV1Beta1Reason (Severity=Error) documents a KubeadmControlPlane failing to
	// generate a machine object.
	MachineGenerationFailedV1Beta1Reason = "MachineGenerationFailed"
)
