v1

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package v1 contains API Schema definitions for the operator v1 API group +kubebuilder:object:generate=true +groupName=operator.fhivemind.io

Index

Constants

View Source
const (
	DefaultContainerPort int32 = 80 // DefaultContainerPort defines the default value of ContainerPort for CRD
	DefaultReplicaCount  int32 = 1  // DefaultReplicaCount defines the default value of Replicas for CRD
)

Variables

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

	// 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
)
View Source
var (
	GroupName = GroupVersion.Group // GroupName exports defined operator group
	Finalizer = GroupName          // Finalizer defines CRD resource finalizer name

	ManagedByLabel = GroupName + "/" + "managed-by" // ManagedByLabel defines a kind-based owner label
	OwnerNameLabel = GroupName + "/" + "owner-name" // OwnerNameLabel defines a resource-based owner label

	PlantKind     = "Plant"          // PlantKind exports Plant operator kind
	PlantOperator = "plant-operator" // PlantOperator exports Plant operator name
)

Functions

func ConditionsReady

func ConditionsReady(conditions []metav1.Condition) bool

ConditionsReady returns true if all Conditions are satisfied.

Types

type ConditionType

type ConditionType string

ConditionType sets the type to a concrete type for safety.

func ConditionTypeAvailableFor

func ConditionTypeAvailableFor(name string) ConditionType

type Plant

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

	Spec   PlantSpec   `json:"spec,omitempty"`
	Status PlantStatus `json:"status,omitempty"`
}

Plant is the Schema for the plants API.

func (*Plant) ConditionsReady

func (plant *Plant) ConditionsReady() bool

ConditionsReady returns true if all Conditions are satisfied for Plant.

func (*Plant) ContainsCondition

func (plant *Plant) ContainsCondition(conditionType ConditionType, conditionStatus ...metav1.ConditionStatus) bool

ContainsCondition returns true if the given condition is equal to any of the statuses.

func (*Plant) DeepCopy

func (in *Plant) DeepCopy() *Plant

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

func (*Plant) DeepCopyInto

func (in *Plant) DeepCopyInto(out *Plant)

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

func (*Plant) DeepCopyObject

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

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

func (*Plant) Default

func (r *Plant) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type

func (*Plant) DetermineState

func (plant *Plant) DetermineState() State

DetermineState returns calculated state from resource and conditions.

func (*Plant) GetWaitingConditions

func (plant *Plant) GetWaitingConditions() (res []string)

GetWaitingConditions returns not ready conditions.

func (*Plant) OperatorLabels

func (plant *Plant) OperatorLabels() map[string]string

func (*Plant) RemoveCondition

func (plant *Plant) RemoveCondition(conditionType ConditionType)

RemoveCondition removes a condiditon

func (*Plant) SetupWebhookWithManager

func (r *Plant) SetupWebhookWithManager(mgr ctrl.Manager) error

func (*Plant) UpdateCondition

func (plant *Plant) UpdateCondition(conditionType ConditionType, status bool, reason, msg string)

UpdateCondition updates specific condition based on type.

func (*Plant) ValidateCreate

func (r *Plant) ValidateCreate() error

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

func (*Plant) ValidateDelete

func (r *Plant) ValidateDelete() error

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

func (*Plant) ValidateUpdate

func (r *Plant) ValidateUpdate(old runtime.Object) error

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

type PlantList

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

PlantList contains a list of Plant

func (*PlantList) DeepCopy

func (in *PlantList) DeepCopy() *PlantList

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

func (*PlantList) DeepCopyInto

func (in *PlantList) DeepCopyInto(out *PlantList)

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

func (*PlantList) DeepCopyObject

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

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

type PlantSpec

type PlantSpec struct {
	// Image specifies the image use for Deployment containers.
	//+kubebuilder:validation:Required
	Image string `json:"image,omitempty"`

	// ContainerPort to expose for host traffic.
	// Defaults to 80.
	// +optional
	ContainerPort *int32 `json:"containerPort,omitempty"`

	// Replicas defines the number of desired pods to deploy.
	// Defaults to 1.
	// +kubebuilder:validation:Minimum=1
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`

	// Host defines the domain name of a network host where the deployed image will be accessible.
	// Follows RFC 3986 standard.
	// +kubebuilder:validation:Required
	Host string `json:"host,omitempty"`

	// IngressClassName specifies the name of the Ingress controller to use. If not set,
	// it will use cluster default Ingress class.
	// +optional
	IngressClassName *string `json:"ingressClassName,omitempty"`

	// TlsSecretName can be used to specify the name of an existing TLS secret for given host.
	// Specify either TlsSecretName or TlsCertIssuerRef, but not both.
	// +optional
	TlsSecretName *string `json:"tlsSecretName,omitempty"`

	// TlsCertIssuerRef specifies the name Cert Manager Issuer to use for
	// obtaining certificates.
	// Specify either TlsSecretName or TlsCertIssuerRef, but not both.
	// +optional
	TlsCertIssuerRef *cmmeta.ObjectReference `json:"tlsCertIssuerRef,omitempty"`
}

PlantSpec defines the desired state of Plant

func (*PlantSpec) DeepCopy

func (in *PlantSpec) DeepCopy() *PlantSpec

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

func (*PlantSpec) DeepCopyInto

func (in *PlantSpec) DeepCopyInto(out *PlantSpec)

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

type PlantStatus

type PlantStatus struct {
	// State signifies current state of Plant.
	State State `json:"state,omitempty"`

	// Conditions defines a list which indicates the status of the Plant.
	// +optional
	// +listType=map
	// +listMapKey=type
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// Resources contains various identifiers about managed objects' states.
	Resources []ResourceStatus `json:"objects,omitempty"`

	// LastUpdateTime specifies the last time this resource has been updated.
	// +optional
	LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`
}

PlantStatus defines the observed state of Plant

func (*PlantStatus) DeepCopy

func (in *PlantStatus) DeepCopy() *PlantStatus

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

func (*PlantStatus) DeepCopyInto

func (in *PlantStatus) DeepCopyInto(out *PlantStatus)

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

type ResourceStatus

type ResourceStatus struct {
	Name  string    `json:"name,omitempty"`
	GVK   string    `json:"gvk,omitempty"`
	UID   types.UID `json:"UID,omitempty"`
	State State     `json:"state,omitempty"`
}

ResourceStatus defines the observed state of Plant-managed or other objects. If more context is required, embed into the object.

func (*ResourceStatus) DeepCopy

func (in *ResourceStatus) DeepCopy() *ResourceStatus

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

func (*ResourceStatus) DeepCopyInto

func (in *ResourceStatus) DeepCopyInto(out *ResourceStatus)

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

type State

type State string

State defines all possible resource states +kubebuilder:validation:Enum=Processing;Deleting;Ready;Error;""

const (
	// StateReady implies that the resource is ready and has been installed successfully.
	StateReady State = "Ready"
	// StateProcessing implies that the resource has just started or is being fixed by reconciliation.
	StateProcessing State = "Processing"
	// StateError implies an error for the resource occurred. The state can during next reconsiliation.
	StateError State = "Error"
	// StateDeleting implies the resource is being deleted.
	StateDeleting State = "Deleting"
)

Jump to

Keyboard shortcuts

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