v2beta1

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: 19 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	// labels
	LabelsInstanceKey        string = "apps.emqx.io/instance"   // my-emqx
	LabelsManagedByKey       string = "apps.emqx.io/managed-by" // emqx-operator
	LabelsDBRoleKey          string = "apps.emqx.io/db-role"    // core, replicant
	LabelsPodTemplateHashKey string = "apps.emqx.io/pod-template-hash"
)
View Source
const (
	Initialized               string = "Initialized"
	CoreNodesProgressing      string = "CoreNodesProgressing"
	CoreNodesReady            string = "CoreNodesReady"
	ReplicantNodesProgressing string = "ReplicantNodesProgressing"
	ReplicantNodesReady       string = "ReplicantNodesReady"
	Available                 string = "Available"
	Ready                     string = "Ready"
)
View Source
const (
	// annotations
	AnnotationsLastEMQXConfigKey string = "apps.emqx.io/last-emqx-configuration"
)
View Source
const DefaultBootstrapAPIKey string = "emqx-operator-controller"
View Source
const DefaultContainerName string = "emqx"

Variables

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

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

func AddLabel(labels map[string]string, labelKey, labelValue string) map[string]string

AddLabel returns a map with the given key and value added to the given map.

func AddLabelToSelector

func AddLabelToSelector(selector *metav1.LabelSelector, labelKey, labelValue string) *metav1.LabelSelector

AddLabelToSelector returns a selector with the given key and value added to the given selector's MatchLabels.

func CloneAndAddLabel

func CloneAndAddLabel(labels map[string]string, labelKey, labelValue string) map[string]string

Clones the given map and returns a new map with the given key and value added. Returns the given map, if labelKey is empty.

func CloneAndMergeMap

func CloneAndMergeMap(dst map[string]string, src ...map[string]string) map[string]string

func CloneAndRemoveLabel

func CloneAndRemoveLabel(labels map[string]string, labelKey string) map[string]string

CloneAndRemoveLabel clones the given map and returns a new map with the given key removed. Returns the given map, if labelKey is empty.

func CloneSelectorAndAddLabel

func CloneSelectorAndAddLabel(selector *metav1.LabelSelector, labelKey, labelValue string) *metav1.LabelSelector

Clones the given selector and returns a new selector with the given key and value added. Returns the given selector, if labelKey is empty.

func DefaultCoreLabels

func DefaultCoreLabels(instance *EMQX) map[string]string

func DefaultLabels

func DefaultLabels(instance *EMQX) map[string]string

func DefaultReplicantLabels

func DefaultReplicantLabels(instance *EMQX) map[string]string

func GetDashboardPortMap

func GetDashboardPortMap(hoconString string) (map[string]int32, error)

func GetDashboardServicePort

func GetDashboardServicePort(hoconString string) ([]corev1.ServicePort, error)

func GetListenersServicePorts

func GetListenersServicePorts(hoconString string) ([]corev1.ServicePort, error)

func IsExistReplicant

func IsExistReplicant(instance *EMQX) bool

func MergeContainerPorts

func MergeContainerPorts(ports1, ports2 []corev1.ContainerPort) []corev1.ContainerPort

func MergeServicePorts

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

func TransServicePortsToContainerPorts

func TransServicePortsToContainerPorts(ports []corev1.ServicePort) []corev1.ContainerPort

Types

type BootstrapAPIKey

type BootstrapAPIKey struct {
	// +kubebuilder:validation:Pattern:=`^[a-zA-Z\d-_]+$`
	Key string `json:"key,omitempty"`
	// +kubebuilder:validation:MinLength:=3
	// +kubebuilder:validation:MaxLength:=128
	Secret    string     `json:"secret,omitempty"`
	SecretRef *SecretRef `json:"secretRef,omitempty"`
}

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 Config

type Config struct {
	//+kubebuilder:validation:Enum=Merge;Replace
	//+kubebuilder:default=Merge
	Mode string `json:"mode,omitempty"`
	// EMQX config, HOCON format, like etc/emqx.conf file
	Data string `json:"data,omitempty"`
}

func (*Config) DeepCopy

func (in *Config) DeepCopy() *Config

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

func (*Config) DeepCopyInto

func (in *Config) DeepCopyInto(out *Config)

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

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"`
}

+kubebuilder:object:root=true +kubebuilder:resource:shortName=emqx +kubebuilder:storageversion +kubebuilder:subresource:status +kubebuilder:subresource:scale:specpath=.spec.replicantTemplate.spec.replicas,statuspath=.status.replicantNodeReplicas +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.status==\"True\")].type" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" EMQX is the Schema for the emqxes API

func (*EMQX) BootstrapAPIKeyNamespacedName

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

func (*EMQX) ConfigsNamespacedName

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

func (*EMQX) CoreNamespacedName

func (instance *EMQX) CoreNamespacedName() 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) Hub

func (*EMQX) Hub()

func (*EMQX) ListenersServiceNamespacedName

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

func (*EMQX) NodeCookieNamespacedName

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

func (*EMQX) ReplicantNamespacedName

func (instance *EMQX) ReplicantNamespacedName() 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"`
}

+kubebuilder:object:root=true 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 {
	ControllerUID types.UID `json:"controllerUID,omitempty"`
	PodUID        types.UID `json:"podUID,omitempty"`
	// 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"`
	// In EMQX's API of `/api/v5/nodes`, the `connections` field means the number of MQTT session count,
	Session int64 `json:"connections,omitempty"`
	// In EMQX's API of `/api/v5/nodes`, the `live_connections` field means the number of connected MQTT clients.
	// THe `live_connections` just work in EMQX 5.1 or later.
	Connections int64 `json:"live_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 EMQXNodesStatus

type EMQXNodesStatus struct {
	Replicas      int32 `json:"replicas,omitempty"`
	ReadyReplicas int32 `json:"readyReplicas,omitempty"`

	CurrentRevision string `json:"currentRevision,omitempty"`
	CurrentReplicas int32  `json:"currentReplicas,omitempty"`

	UpdateRevision string `json:"updateRevision,omitempty"`
	UpdateReplicas int32  `json:"updateReplicas,omitempty"`

	CollisionCount *int32 `json:"collisionCount,omitempty"`
}

func (*EMQXNodesStatus) DeepCopy

func (in *EMQXNodesStatus) DeepCopy() *EMQXNodesStatus

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

func (*EMQXNodesStatus) DeepCopyInto

func (in *EMQXNodesStatus) DeepCopyInto(out *EMQXNodesStatus)

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/config/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/config/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 .
	// TODO: should use `tolerations` instead, this field just for compatible with old version, will delete in future.
	ToleRations []corev1.Toleration `json:"toleRations,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"`
	//// TopologySpreadConstraint specifies how to spread matching pods among the given topology.
	TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,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.
	// Defaults to 2.
	//+kubebuilder:default:=2
	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/config/manage-resources-containers/
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`
	// SecurityContext holds pod-level security attributes and common container settings.
	//+kubebuilder:default={runAsUser:1000,runAsGroup:1000,fsGroup:1000,fsGroupChangePolicy:Always,supplementalGroups: {1000}}
	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/
	//+kubebuilder:default={runAsUser:1000,runAsGroup:1000,runAsNonRoot:true}
	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
	//+kubebuilder:default={initialDelaySeconds:60,periodSeconds:30,failureThreshold:3,httpGet: {path:/status, port:"dashboard"}}
	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
	//+kubebuilder:default={initialDelaySeconds:10,periodSeconds:5,failureThreshold:12,httpGet: {path:/status, port:"dashboard"}}
	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"`
	// Image pull policy.
	// One of Always, Never, IfNotPresent.
	// Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
	// Cannot be updated.
	// More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
	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"`

	// Service Account Name
	// This associates the ReplicaSet or StatefulSet with the specified Service Account for authentication purposes.
	// More info: https://kubernetes.io/docs/concepts/security/service-accounts
	ServiceAccountName string `json:"serviceAccountName,omitempty"`

	// EMQX bootstrap user
	// Cannot be updated.
	BootstrapAPIKeys []BootstrapAPIKey `json:"bootstrapAPIKeys,omitempty"`

	// EMQX config
	Config Config `json:"config,omitempty"`

	//+kubebuilder:default:="cluster.local"
	ClusterDomain string `json:"clusterDomain,omitempty"`

	// The number of old ReplicaSets, old StatefulSet and old PersistentVolumeClaim to retain to allow rollback.
	// This is a pointer to distinguish between explicit zero and not specified.
	// Defaults to 3.
	// +kubebuilder:default:=3
	RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`

	// UpdateStrategy is the object that describes the EMQX blue-green update strategy
	//+kubebuilder:default={type:Recreate,initialDelaySeconds:10,evacuationStrategy:{waitTakeover:10,connEvictRate:1000,sessEvictRate:1000}}
	UpdateStrategy UpdateStrategy `json:"updateStrategy,omitempty"`

	// CoreTemplate is the object that describes the EMQX core node that will be created
	//+kubebuilder:default={spec:{replicas:2}}
	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 *ServiceTemplate `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 *ServiceTemplate `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 {
	// Represents the latest available observations of a EMQX Custom Resource current state.
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	CoreNodes       []EMQXNode      `json:"coreNodes,omitempty"`
	CoreNodesStatus EMQXNodesStatus `json:"coreNodesStatus,omitempty"`

	ReplicantNodes       []EMQXNode      `json:"replicantNodes,omitempty"`
	ReplicantNodesStatus EMQXNodesStatus `json:"replicantNodesStatus,omitempty"`

	NodeEvacuationsStatus []NodeEvacuationStatus `json:"nodEvacuationsStatus,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) GetCondition

func (s *EMQXStatus) GetCondition(conditionType string) (int, *metav1.Condition)

func (*EMQXStatus) GetLastTrueCondition

func (s *EMQXStatus) GetLastTrueCondition() *metav1.Condition

func (*EMQXStatus) IsConditionTrue

func (s *EMQXStatus) IsConditionTrue(conditionType string) bool

func (*EMQXStatus) RemoveCondition

func (s *EMQXStatus) RemoveCondition(conditionType string)

func (*EMQXStatus) SetCondition

func (s *EMQXStatus) SetCondition(c metav1.Condition)

type EvacuationStrategy

type EvacuationStrategy struct {
	//+kubebuilder:validation:Minimum=0
	WaitTakeover int32 `json:"waitTakeover,omitempty"`
	// Just work in EMQX Enterprise.
	//+kubebuilder:validation:Minimum=1
	//+kubebuilder:default=1000
	ConnEvictRate int32 `json:"connEvictRate,omitempty"`
	// Just work in EMQX Enterprise.
	//+kubebuilder:validation:Minimum=1
	//+kubebuilder:default=1000
	SessEvictRate int32 `json:"sessEvictRate,omitempty"`
}

func (*EvacuationStrategy) DeepCopy

func (in *EvacuationStrategy) DeepCopy() *EvacuationStrategy

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

func (*EvacuationStrategy) DeepCopyInto

func (in *EvacuationStrategy) DeepCopyInto(out *EvacuationStrategy)

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

type KeyRef

type KeyRef struct {
	SecretName string `json:"secretName"`
	// +kubebuilder:validation:Pattern:=`^[a-zA-Z\d-_]+$`
	SecretKey string `json:"secretKey"`
}

func (*KeyRef) DeepCopy

func (in *KeyRef) DeepCopy() *KeyRef

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

func (*KeyRef) DeepCopyInto

func (in *KeyRef) DeepCopyInto(out *KeyRef)

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

type NodeEvacuationStats

type NodeEvacuationStats struct {
	InitialSessions  *int32 `json:"initial_sessions,omitempty"`
	InitialConnected *int32 `json:"initial_connected,omitempty"`
	CurrentSessions  *int32 `json:"current_sessions,omitempty"`
	CurrentConnected *int32 `json:"current_connected,omitempty"`
}

func (*NodeEvacuationStats) DeepCopy

func (in *NodeEvacuationStats) DeepCopy() *NodeEvacuationStats

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

func (*NodeEvacuationStats) DeepCopyInto

func (in *NodeEvacuationStats) DeepCopyInto(out *NodeEvacuationStats)

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

type NodeEvacuationStatus

type NodeEvacuationStatus struct {
	Node                   string              `json:"node,omitempty"`
	Stats                  NodeEvacuationStats `json:"stats,omitempty"`
	State                  string              `json:"state,omitempty"`
	SessionRecipients      []string            `json:"session_recipients,omitempty"`
	SessionGoal            int32               `json:"session_goal,omitempty"`
	SessionEvictionRate    int32               `json:"session_eviction_rate,omitempty"`
	ConnectionGoal         int32               `json:"connection_goal,omitempty"`
	ConnectionEvictionRate int32               `json:"connection_eviction_rate,omitempty"`
}

func (*NodeEvacuationStatus) DeepCopy

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

func (*NodeEvacuationStatus) DeepCopyInto

func (in *NodeEvacuationStatus) DeepCopyInto(out *NodeEvacuationStatus)

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

type Rebalance

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

	Spec   RebalanceSpec   `json:"spec,omitempty"`
	Status RebalanceStatus `json:"status,omitempty"`
}

+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:storageversion +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" Rebalance is the Schema for the rebalances API

func (*Rebalance) DeepCopy

func (in *Rebalance) DeepCopy() *Rebalance

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

func (*Rebalance) DeepCopyInto

func (in *Rebalance) DeepCopyInto(out *Rebalance)

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

func (*Rebalance) DeepCopyObject

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

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

func (*Rebalance) Hub

func (*Rebalance) Hub()

func (*Rebalance) SetupWebhookWithManager

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

func (*Rebalance) ValidateCreate

func (r *Rebalance) ValidateCreate() (admission.Warnings, error)

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

func (*Rebalance) ValidateDelete

func (r *Rebalance) ValidateDelete() (admission.Warnings, error)

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

func (*Rebalance) ValidateUpdate

func (r *Rebalance) ValidateUpdate(old runtime.Object) (admission.Warnings, error)

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

type RebalanceCondition

type RebalanceCondition struct {
	// Status of rebalance condition type. one of Processing, Complete, Failed.
	Type RebalanceConditionType `json:"type"`
	// Status of the condition, one of True, False, Unknown.
	Status corev1.ConditionStatus `json:"status"`
	// The last time this condition was updated.
	LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
	// Last time the condition transitioned from one status to another.
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
	// 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"`
}

RebalanceCondition describes current state of a EMQX rebalancing job.

func (*RebalanceCondition) DeepCopy

func (in *RebalanceCondition) DeepCopy() *RebalanceCondition

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

func (*RebalanceCondition) DeepCopyInto

func (in *RebalanceCondition) DeepCopyInto(out *RebalanceCondition)

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

type RebalanceConditionType

type RebalanceConditionType string
const (
	RebalanceConditionProcessing RebalanceConditionType = "Processing"
	RebalanceConditionCompleted  RebalanceConditionType = "Completed"
	RebalanceConditionFailed     RebalanceConditionType = "Failed"
)

These are built-in conditions of a EMQX rebalancing job.

type RebalanceList

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

RebalanceList contains a list of Rebalance

func (*RebalanceList) DeepCopy

func (in *RebalanceList) DeepCopy() *RebalanceList

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

func (*RebalanceList) DeepCopyInto

func (in *RebalanceList) DeepCopyInto(out *RebalanceList)

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

func (*RebalanceList) DeepCopyObject

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

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

type RebalancePhase

type RebalancePhase string
const (
	RebalancePhaseProcessing RebalancePhase = "Processing"
	RebalancePhaseCompleted  RebalancePhase = "Completed"
	RebalancePhaseFailed     RebalancePhase = "Failed"
)

type RebalanceSpec

type RebalanceSpec struct {
	// InstanceKind is used to distinguish between EMQX and EMQXEnterprise.
	// When it is set to "EMQX", it means that the EMQX CR is v2beta1,
	// and when it is set to "EmqxEnterprise", it means that the EmqxEnterprise CR is v1beta4.
	//+kubebuilder:default:="EMQX"
	InstanceKind string `json:"instanceKind"`
	// InstanceName represents the name of EMQX CR, just work for EMQX Enterprise
	// +kubebuilder:validation:Required
	InstanceName string `json:"instanceName"`
	// RebalanceStrategy represents the strategy of EMQX rebalancing
	// More info: https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing
	// +kubebuilder:validation:Required
	RebalanceStrategy RebalanceStrategy `json:"rebalanceStrategy"`
}

RebalanceSpec defines the desired state of Rebalance

func (*RebalanceSpec) DeepCopy

func (in *RebalanceSpec) DeepCopy() *RebalanceSpec

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

func (*RebalanceSpec) DeepCopyInto

func (in *RebalanceSpec) DeepCopyInto(out *RebalanceSpec)

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

type RebalanceState

type RebalanceState struct {
	// State represents the state of emqx cluster rebalancing.
	State string `json:"state,omitempty"`
	// SessionEvictionRate represents the node session evacuation rate per second.
	SessionEvictionRate int32 `json:"session_eviction_rate,omitempty"`
	// Recipients represent the target node for rebalancing.
	Recipients []string `json:"recipients,omitempty"`
	// Node represents the rebalancing scheduling node.
	Node string `json:"node,omitempty"`
	// Donors represent the source nodes for rebalancing.
	Donors []string `json:"donors,omitempty"`
	// CoordinatorNode represents the node currently undergoing rebalancing.
	CoordinatorNode string `json:"coordinator_node,omitempty"`
	// ConnectionEvictionRate represents the node session evacuation rate per second.
	ConnectionEvictionRate int32 `json:"connection_eviction_rate,omitempty"`
}

Rebalance defines the observed Rebalancing state of EMQX

func (*RebalanceState) DeepCopy

func (in *RebalanceState) DeepCopy() *RebalanceState

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

func (*RebalanceState) DeepCopyInto

func (in *RebalanceState) DeepCopyInto(out *RebalanceState)

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

type RebalanceStatus

type RebalanceStatus struct {
	// The latest available observations of an object's current state.
	// When Rebalance fails, the condition will have type "Failed" and status false.
	// When Rebalance is in processing, the condition will have a type "Processing" and status true.
	// When Rebalance is completed, the condition will have a type "Complete" and status true.
	Conditions []RebalanceCondition `json:"conditions,omitempty"`
	// Phase represents the phase of Rebalance.
	Phase           RebalancePhase   `json:"phase,omitempty"`
	RebalanceStates []RebalanceState `json:"rebalanceStates,omitempty"`
	// StartedTime Represents the time when rebalance job start.
	StartedTime metav1.Time `json:"startedTime,omitempty"`
	// CompletedTime Represents the time when the rebalance job was completed.
	CompletedTime metav1.Time `json:"completedTime,omitempty"`
}

RebalanceStatus represents the current state of Rebalance

func (*RebalanceStatus) DeepCopy

func (in *RebalanceStatus) DeepCopy() *RebalanceStatus

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

func (*RebalanceStatus) DeepCopyInto

func (in *RebalanceStatus) DeepCopyInto(out *RebalanceStatus)

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

func (*RebalanceStatus) SetCompleted

func (s *RebalanceStatus) SetCompleted(condition RebalanceCondition) error

func (*RebalanceStatus) SetCondition

func (s *RebalanceStatus) SetCondition(condition RebalanceCondition)

func (*RebalanceStatus) SetFailed

func (s *RebalanceStatus) SetFailed(condition RebalanceCondition) error

func (*RebalanceStatus) SetProcessing

func (s *RebalanceStatus) SetProcessing(condition RebalanceCondition) error

type RebalanceStrategy

type RebalanceStrategy struct {
	// ConnEvictRate represents the source node client disconnect rate per second.
	// same to conn-evict-rate in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing)
	// The value must be greater than 0
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Minimum=1
	ConnEvictRate int32 `json:"connEvictRate"`
	// SessEvictRate represents the source node session evacuation rate per second.
	// same to sess-evict-rate in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing)
	// The value must be greater than 0
	// Defaults to 500.
	// +kubebuilder:default:=500
	SessEvictRate int32 `json:"sessEvictRate,omitempty"`
	// WaitTakeover represents the time in seconds to wait for a client to
	// reconnect to take over the session after all connections are disconnected.
	// same to wait-takeover in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing)
	// The value must be greater than 0
	// Defaults to 60 seconds.
	// +kubebuilder:default:=60
	WaitTakeover int32 `json:"waitTakeover,omitempty"`
	// WaitHealthCheck represents the time (in seconds) to wait for the LB to
	// remove the source node from the list of active backend nodes. After the
	// specified waiting time is exceeded,the rebalancing task will start.
	// same to wait-health-check in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing)
	// The value must be greater than 0
	// Defaults to 60 seconds.
	// +kubebuilder:default:=60
	WaitHealthCheck int32 `json:"waitHealthCheck,omitempty"`
	// AbsConnThreshold represents the absolute threshold for checking connection balance.
	// same to abs-conn-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing)
	// The value must be greater than 0
	// Defaults to 1000.
	// +kubebuilder:default:=1000
	AbsConnThreshold int32 `json:"absConnThreshold,omitempty"`
	// RelConnThreshold represents the relative threshold for checkin connection balance.
	// same to rel-conn-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing)
	// the usage of float highly discouraged, as support for them varies across languages.
	// So we define the RelConnThreshold field as string type and you not float type
	// The value must be greater than "1.0"
	// Defaults to "1.1".
	// +kubebuilder:default:="1.1"
	RelConnThreshold string `json:"relConnThreshold,omitempty"`
	// AbsSessThreshold represents the absolute threshold for checking session connection balance.
	// same to abs-sess-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing)
	// The value must be greater than 0
	// Default to 1000.
	// +kubebuilder:default:=1000
	AbsSessThreshold int32 `json:"absSessThreshold,omitempty"`
	// RelSessThreshold represents the relative threshold for checking session connection balance.
	// same to rel-sess-threshold in [EMQX Rebalancing](https://docs.emqx.com/en/enterprise/v4.4/advanced/rebalancing.html#rebalancing)
	// the usage of float highly discouraged, as support for them varies across languages.
	// So we define the RelSessThreshold field as string type and you not float type
	// The value must be greater than "1.0"
	// Defaults to "1.1".
	// +kubebuilder:default:="1.1"
	RelSessThreshold string `json:"relSessThreshold,omitempty"`
}

RebalanceStrategy represents the strategy of EMQX rebalancing

func (*RebalanceStrategy) DeepCopy

func (in *RebalanceStrategy) DeepCopy() *RebalanceStrategy

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

func (*RebalanceStrategy) DeepCopyInto

func (in *RebalanceStrategy) DeepCopyInto(out *RebalanceStrategy)

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

type SecretRef

type SecretRef struct {
	Key    KeyRef `json:"key"`
	Secret KeyRef `json:"secret"`
}

func (*SecretRef) DeepCopy

func (in *SecretRef) DeepCopy() *SecretRef

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

func (*SecretRef) DeepCopyInto

func (in *SecretRef) DeepCopyInto(out *SecretRef)

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

type ServiceTemplate

type ServiceTemplate struct {
	// EMQX Operator will create a service for EMQX nodes.
	// This is a pointer to distinguish between `false` and not specified.
	//+kubebuilder:default:=true
	Enabled *bool `json:"enabled,omitempty"`
	// 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.

type UpdateStrategy

type UpdateStrategy struct {
	//+kubebuilder:validation:Enum=Recreate
	//+kubebuilder:default=Recreate
	Type string `json:"type,omitempty"`
	// Number of seconds before evacuation connection start.
	InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`
	// Number of seconds before evacuation connection timeout.
	EvacuationStrategy EvacuationStrategy `json:"evacuationStrategy,omitempty"`
}

func (*UpdateStrategy) DeepCopy

func (in *UpdateStrategy) DeepCopy() *UpdateStrategy

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

func (*UpdateStrategy) DeepCopyInto

func (in *UpdateStrategy) DeepCopyInto(out *UpdateStrategy)

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