v2alpha1

package
v0.0.0-...-a49f6f1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package v2alpha1 contains API Schema definitions for the apps v2alpha1 API group +kubebuilder:object:generate=true +groupName=apps.emqx.io

Index

Constants

Variables

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

	// 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

func GetDashboardServicePort

func GetDashboardServicePort(instance *EMQX) (*corev1.ServicePort, error)

func MergeServicePorts

func MergeServicePorts(ports1, ports2 []corev1.ServicePort) []corev1.ServicePort

Types

type BootstrapAPIKey

type BootstrapAPIKey struct {
	// +kubebuilder:validation:Pattern:=`^[a-zA-Z\d_]+$`
	Key string `json:"key"`
	// +kubebuilder:validation:MinLength:=3
	// +kubebuilder:validation:MaxLength:=32
	Secret string `json:"secret"`
}

func (*BootstrapAPIKey) DeepCopy

func (in *BootstrapAPIKey) DeepCopy() *BootstrapAPIKey

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

func (*BootstrapAPIKey) DeepCopyInto

func (in *BootstrapAPIKey) DeepCopyInto(out *BootstrapAPIKey)

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

type Condition

type Condition struct {
	// Status of cluster condition.
	Type ConditionType `json:"type"`
	// Status of the condition, one of True, False, Unknown.
	Status corev1.ConditionStatus `json:"status"`
	// The reason for the condition's last transition.
	Reason string `json:"reason,omitempty"`
	// A human readable message indicating details about the transition.
	Message string `json:"message,omitempty"`
	// Last time the condition transitioned from one status to another.
	LastTransitionTime string `json:"lastTransitionTime,omitempty"`
	// The last time this condition was updated.
	LastUpdateTime string      `json:"lastUpdateTime,omitempty"`
	LastUpdateAt   metav1.Time `json:"-"`
}

func NewCondition

func NewCondition(condType ConditionType, status corev1.ConditionStatus, reason, message string) *Condition

EMQX Status

func (*Condition) DeepCopy

func (in *Condition) DeepCopy() *Condition

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

func (*Condition) DeepCopyInto

func (in *Condition) DeepCopyInto(out *Condition)

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

type ConditionType

type ConditionType string
const (
	ClusterCreating     ConditionType = "Creating"
	ClusterCoreUpdating ConditionType = "CoreNodesUpdating"
	ClusterCoreReady    ConditionType = "CoreNodesReady"
	ClusterRunning      ConditionType = "Running"
)

type EMQX

type EMQX struct {
	metav1.TypeMeta `json:",inline"`
	// Standard object's metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Spec defines the desired identities of EMQX nodes in this set.
	Spec EMQXSpec `json:"spec,omitempty"`
	// Status is the current status of EMQX nodes. This data
	// may be out of date by some window of time.
	Status EMQXStatus `json:"status,omitempty"`
}

EMQX is the Schema for the emqxes API

func (*EMQX) BootstrapConfigNamespacedName

func (instance *EMQX) BootstrapConfigNamespacedName() types.NamespacedName

func (*EMQX) BootstrapUserNamespacedName

func (instance *EMQX) BootstrapUserNamespacedName() types.NamespacedName

func (*EMQX) ConvertFrom

func (dst *EMQX) ConvertFrom(srcRaw conversion.Hub) error

ConvertFrom converts from the Hub version (v1) to this version.

func (*EMQX) ConvertTo

func (src *EMQX) ConvertTo(dstRaw conversion.Hub) error

ConvertTo converts this version to the Hub version (v1).

func (*EMQX) CoreNodeNamespacedName

func (instance *EMQX) CoreNodeNamespacedName() types.NamespacedName

func (*EMQX) DashboardServiceNamespacedName

func (instance *EMQX) DashboardServiceNamespacedName() types.NamespacedName

func (*EMQX) DeepCopy

func (in *EMQX) DeepCopy() *EMQX

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

func (*EMQX) DeepCopyInto

func (in *EMQX) DeepCopyInto(out *EMQX)

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

func (*EMQX) DeepCopyObject

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

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

func (*EMQX) HeadlessServiceNamespacedName

func (instance *EMQX) HeadlessServiceNamespacedName() types.NamespacedName

func (*EMQX) ListenersServiceNamespacedName

func (instance *EMQX) ListenersServiceNamespacedName() types.NamespacedName

func (*EMQX) NodeCookieNamespacedName

func (instance *EMQX) NodeCookieNamespacedName() types.NamespacedName

func (*EMQX) ReplicantNodeNamespacedName

func (instance *EMQX) ReplicantNodeNamespacedName() types.NamespacedName

type EMQXCoreTemplate

type EMQXCoreTemplate struct {
	// Standard object's metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Specification of the desired behavior of the EMQX core node.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
	Spec EMQXCoreTemplateSpec `json:"spec,omitempty"`
}

func (*EMQXCoreTemplate) DeepCopy

func (in *EMQXCoreTemplate) DeepCopy() *EMQXCoreTemplate

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

func (*EMQXCoreTemplate) DeepCopyInto

func (in *EMQXCoreTemplate) DeepCopyInto(out *EMQXCoreTemplate)

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

type EMQXCoreTemplateSpec

type EMQXCoreTemplateSpec struct {
	EMQXReplicantTemplateSpec `json:",inline"`
	// VolumeClaimTemplates is a list of claims that pods are allowed to reference.
	// The StatefulSet controller is responsible for mapping network identities to
	// claims in a way that maintains the identity of a pod. Every claim in
	// this list must have at least one matching (by name) volumeMount in one
	// container in the template. A claim in this list takes precedence over
	// any volumes in the template, with the same name.
	// More than EMQXReplicantTemplateSpec
	VolumeClaimTemplates corev1.PersistentVolumeClaimSpec `json:"volumeClaimTemplates,omitempty"`
}

func (*EMQXCoreTemplateSpec) DeepCopy

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

func (*EMQXCoreTemplateSpec) DeepCopyInto

func (in *EMQXCoreTemplateSpec) DeepCopyInto(out *EMQXCoreTemplateSpec)

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

type EMQXList

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

EMQXList contains a list of EMQX

func (*EMQXList) DeepCopy

func (in *EMQXList) DeepCopy() *EMQXList

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

func (*EMQXList) DeepCopyInto

func (in *EMQXList) DeepCopyInto(out *EMQXList)

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

func (*EMQXList) DeepCopyObject

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

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

type EMQXNode

type EMQXNode struct {
	// EMQX node name, example: emqx@127.0.0.1
	Node string `json:"node,omitempty"`
	// EMQX node status, example: Running
	NodeStatus string `json:"node_status,omitempty"`
	// Erlang/OTP version used by EMQX, example: 24.2/12.2
	OTPRelease string `json:"otp_release,omitempty"`
	// EMQX version
	Version string `json:"version,omitempty"`
	// EMQX cluster node role, enum: "core" "replicant"
	Role string `json:"role,omitempty"`
	// EMQX cluster node edition, enum: "Opensource" "Enterprise"
	Edition string `json:"edition,omitempty"`
	// EMQX node uptime, milliseconds
	Uptime int64 `json:"uptime,omitempty"`
	// MQTT connection count
	Connections int64 `json:"connections,omitempty"`
}

func (*EMQXNode) DeepCopy

func (in *EMQXNode) DeepCopy() *EMQXNode

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

func (*EMQXNode) DeepCopyInto

func (in *EMQXNode) DeepCopyInto(out *EMQXNode)

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

type EMQXReplicantTemplate

type EMQXReplicantTemplate struct {
	// Standard object's metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Specification of the desired behavior of the EMQX replicant node.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
	Spec EMQXReplicantTemplateSpec `json:"spec,omitempty"`
}

func (*EMQXReplicantTemplate) DeepCopy

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

func (*EMQXReplicantTemplate) DeepCopyInto

func (in *EMQXReplicantTemplate) DeepCopyInto(out *EMQXReplicantTemplate)

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

type EMQXReplicantTemplateSpec

type EMQXReplicantTemplateSpec struct {
	// NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node.
	// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`
	// NodeName is a request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements.
	NodeName string `json:"nodeName,omitempty"`
	// Affinity for pod assignment
	// ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
	Affinity *corev1.Affinity `json:"affinity,omitempty"`
	// If specified, the pod's tolerations.
	// The pod this Toleration is attached to tolerates any taint that matches the triple <key,value,effect> using the matching operator .
	ToleRations []corev1.Toleration `json:"toleRations,omitempty"`
	// Replicas is the desired number of replicas of the given Template.
	// These are replicas in the sense that they are instantiations of the
	// same Template, but individual replicas also have a consistent identity.
	// If unspecified, defaults to 3.
	//+kubebuilder:default:=3
	Replicas *int32 `json:"replicas,omitempty"`
	// Entrypoint array. Not executed within a shell.
	// The container image's ENTRYPOINT is used if this is not provided.
	// Variable references $(VAR_NAME) are expanded using the container's environment. If a variable
	// cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced
	// to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will
	// produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless
	// of whether the variable exists or not. Cannot be updated.
	// More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
	// +optional
	Command []string `json:"command,omitempty"`
	// Arguments to the entrypoint.
	// The container image's CMD is used if this is not provided.
	// Variable references $(VAR_NAME) are expanded using the container's environment. If a variable
	// cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced
	// to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will
	// produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless
	// of whether the variable exists or not. Cannot be updated.
	// More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
	Args []string `json:"args,omitempty"`
	// List of ports to expose from the container. Exposing a port here gives
	// the system additional information about the network connections a
	// container uses, but is primarily informational. Not specifying a port here
	// DOES NOT prevent that port from being exposed. Any port which is
	// listening on the default "0.0.0.0" address inside a container will be
	// accessible from the network.
	// Cannot be updated.
	Ports []corev1.ContainerPort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"containerPort" protobuf:"bytes,6,rep,name=ports"`
	// List of environment variables to set in the container.
	// Cannot be updated.
	Env []corev1.EnvVar `json:"env,omitempty"`
	// List of sources to populate environment variables in the container.
	// The keys defined within a source must be a C_IDENTIFIER. All invalid keys
	// will be reported as an event when the container is starting. When a key exists in multiple
	// sources, the value associated with the last source will take precedence.
	// Values defined by an Env with a duplicate key will take precedence.
	// Cannot be updated.
	EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty" protobuf:"bytes,19,rep,name=envFrom"`
	// Compute Resources required by this container.
	// Cannot be updated.
	// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`
	// SecurityContext holds pod-level security attributes and common container settings.
	// Optional: Defaults to empty.  See type description for default values of each field.
	PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
	// SecurityContext defines the security options the container should be run with.
	// If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext.
	// More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
	ContainerSecurityContext *corev1.SecurityContext `json:"containerSecurityContext,omitempty"`
	// List of initialization containers belonging to the pod.
	// Init containers are executed in order prior to containers being started. If any
	// init container fails, the pod is considered to have failed and is handled according
	// to its restartPolicy. The name for an init container or normal container must be
	// unique among all containers.
	// Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes.
	// The resourceRequirements of an init container are taken into account during scheduling
	// by finding the highest request/limit for each resource type, and then using the max of
	// of that value or the sum of the normal containers. Limits are applied to init containers
	// in a similar fashion.
	// Init containers cannot currently be added or removed.
	// Cannot be updated.
	// More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
	InitContainers []corev1.Container `json:"initContainers,omitempty"`
	// ExtraContainers represents extra containers to be added to the pod.
	// See https://github.com/emqx/emqx-operator/issues/252
	ExtraContainers []corev1.Container `json:"extraContainers,omitempty"`
	// See https://github.com/emqx/emqx-operator/pull/72
	ExtraVolumes []corev1.Volume `json:"extraVolumes,omitempty"`
	// See https://github.com/emqx/emqx-operator/pull/72
	ExtraVolumeMounts []corev1.VolumeMount `json:"extraVolumeMounts,omitempty"`
	// Periodic probe of container liveness.
	// Container will be restarted if the probe fails.
	// Cannot be updated.
	// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
	LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty"`
	// Periodic probe of container service readiness.
	// Container will be removed from service endpoints if the probe fails.
	// Cannot be updated.
	// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
	ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty"`
	// StartupProbe indicates that the Pod has successfully initialized.
	// If specified, no other probes are executed until this completes successfully.
	// If this probe fails, the Pod will be restarted, just as if the livenessProbe failed.
	// This can be used to provide different probe parameters at the beginning of a Pod's lifecycle,
	// when it might take a long time to load data or warm a cache, than during steady-state operation.
	// This cannot be updated.
	// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
	StartupProbe *corev1.Probe `json:"startupProbe,omitempty"`
	// Actions that the management system should take in response to container lifecycle events.
	// Cannot be updated.
	Lifecycle *corev1.Lifecycle `json:"lifecycle,omitempty" protobuf:"bytes,12,opt,name=lifecycle"`
}

func (*EMQXReplicantTemplateSpec) DeepCopy

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

func (*EMQXReplicantTemplateSpec) DeepCopyInto

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

type EMQXSpec

type EMQXSpec struct {
	// EMQX image name.
	// More info: https://kubernetes.io/docs/concepts/containers/images
	Image string `json:"image,omitempty"`
	// Image pull policy.
	// More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
	// +kubebuilder:default="IfNotPresent"
	ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
	// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec.
	// If specified, these secrets will be passed to individual puller implementations for them to use.
	// More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
	ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
	// EMQX bootstrap user
	// Cannot be updated.
	BootstrapAPIKeys []BootstrapAPIKey `json:"bootstrapAPIKeys,omitempty"`
	// EMQX bootstrap config, hocon style, like emqx.conf
	// Cannot be updated.
	BootstrapConfig string `json:"bootstrapConfig,omitempty"`
	// CoreTemplate is the object that describes the EMQX core node that will be created
	CoreTemplate EMQXCoreTemplate `json:"coreTemplate,omitempty"`
	// ReplicantTemplate is the object that describes the EMQX replicant node that will be created
	ReplicantTemplate EMQXReplicantTemplate `json:"replicantTemplate,omitempty"`
	// DashboardServiceTemplate is the object that describes the EMQX dashboard service that will be created
	// This service always selector the EMQX core node
	DashboardServiceTemplate corev1.Service `json:"dashboardServiceTemplate,omitempty"`
	// ListenersServiceTemplate is the object that describes the EMQX listener service that will be created
	// If the EMQX replicant node exist, this service will selector the EMQX replicant node
	// Else this service will selector EMQX core node
	ListenersServiceTemplate corev1.Service `json:"listenersServiceTemplate,omitempty"`
}

EMQXSpec defines the desired state of EMQX

func (*EMQXSpec) DeepCopy

func (in *EMQXSpec) DeepCopy() *EMQXSpec

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

func (*EMQXSpec) DeepCopyInto

func (in *EMQXSpec) DeepCopyInto(out *EMQXSpec)

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

type EMQXStatus

type EMQXStatus struct {
	// CurrentImage, indicates the image of the EMQX used to generate Pods in the
	CurrentImage string `json:"currentImage,omitempty"`
	// CoreNodeReplicas is the number of EMQX core node Pods created by the EMQX controller.
	CoreNodeReplicas int32 `json:"coreNodeReplicas,omitempty"`
	// CoreNodeReadyReplicas is the number of EMQX core node Pods created for this EMQX Custom Resource with a Ready Condition.
	CoreNodeReadyReplicas int32 `json:"coreNodeReadyReplicas,omitempty"`
	// ReplicantNodeReplicas is the number of EMQX replicant node Pods created by the EMQX controller.
	ReplicantNodeReplicas int32 `json:"replicantNodeReplicas,omitempty"`
	// ReplicantNodeReadyReplicas is the number of EMQX replicant node Pods created for this EMQX Custom Resource with a Ready Condition.
	ReplicantNodeReadyReplicas int32 `json:"replicantNodeReadyReplicas,omitempty"`
	// EMQX nodes info
	EMQXNodes []EMQXNode `json:"emqxNodes,omitempty"`
	// Represents the latest available observations of a EMQX Custom Resource current state.
	Conditions []Condition `json:"conditions,omitempty"`
}

EMQXStatus defines the observed state of EMQX

func (*EMQXStatus) DeepCopy

func (in *EMQXStatus) DeepCopy() *EMQXStatus

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

func (*EMQXStatus) DeepCopyInto

func (in *EMQXStatus) DeepCopyInto(out *EMQXStatus)

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

func (*EMQXStatus) IsCoreNodesReady

func (s *EMQXStatus) IsCoreNodesReady() bool

func (*EMQXStatus) IsCoreNodesUpdating

func (s *EMQXStatus) IsCoreNodesUpdating() bool

func (*EMQXStatus) IsCreating

func (s *EMQXStatus) IsCreating() bool

func (*EMQXStatus) IsRunning

func (s *EMQXStatus) IsRunning() bool

func (*EMQXStatus) RemoveCondition

func (s *EMQXStatus) RemoveCondition(t ConditionType)

func (*EMQXStatus) SetCondition

func (s *EMQXStatus) SetCondition(c Condition)

func (*EMQXStatus) SetEMQXNodes

func (s *EMQXStatus) SetEMQXNodes(nodes []EMQXNode)

type ServiceTemplate

type ServiceTemplate struct {
	// Standard object's metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Spec defines the behavior of a service.
	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
	Spec corev1.ServiceSpec `json:"spec,omitempty"`
}

func (*ServiceTemplate) DeepCopy

func (in *ServiceTemplate) DeepCopy() *ServiceTemplate

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

func (*ServiceTemplate) DeepCopyInto

func (in *ServiceTemplate) DeepCopyInto(out *ServiceTemplate)

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