v1

package
v0.0.0-...-b49765e Latest Latest
Warning

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

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

Documentation

Overview

Package v1 contains API Schema definitions for the database v1 API group +kubebuilder:object:generate=true +groupName=database.erda.cloud

Index

Constants

View Source
const (
	Red    = "red"
	Yellow = "yellow"
	Green  = "green"
)
View Source
const (
	ModeClassic = "Classic"
	ModeSingle  = "Single"
	ModeMulti   = "Multi"
)
View Source
const (
	MinPatchVersion57 = 38
	MinPatchVersion80 = 29
)
View Source
const HeadlessSuffix = "x"

Variables

View Source
var (
	Namespace = "default"
	NodeName  = os.Getenv("NODE_NAME")
	PodName   = os.Getenv("POD_NAME")
	HostIp    = os.Getenv("HOST_IP")
	PodIp     = os.Getenv("POD_IP")

	ErdaWorkspace = os.Getenv("ERDA_WORKSPACE")
	ErdaCluster   = os.Getenv("ERDA_CLUSTER")
	ErdaOrg       = os.Getenv("ERDA_ORG")
	ErdaProject   = os.Getenv("ERDA_PROJECT")
	ErdaApp       = os.Getenv("ERDA_APP")
)
View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "database.erda.cloud", 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
)

Functions

func Between

func Between(i, min, max int) bool

func GeneratePassword

func GeneratePassword(n int) string

func HasEqual

func HasEqual(a ...int) bool

func HasQuote

func HasQuote(a ...string) bool

func SplitHostPort

func SplitHostPort(addr string) (host string, port string)

func WriteByte

func WriteByte(w io.Writer, b byte) (n int, err error)

func WriteInt

func WriteInt(w io.Writer, i int) (n int, err error)

func WriteString

func WriteString(w io.Writer, s string) (n int, err error)

Types

type Mysql

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

	Spec   MysqlSpec   `json:"spec,omitempty"`
	Status MysqlStatus `json:"status,omitempty"`
}

Mysql is the Schema for the mysqls API

func (*Mysql) BuildName

func (r *Mysql) BuildName(suffix string) string

func (*Mysql) DeepCopy

func (in *Mysql) DeepCopy() *Mysql

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

func (*Mysql) DeepCopyInto

func (in *Mysql) DeepCopyInto(out *Mysql)

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

func (*Mysql) DeepCopyObject

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

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

func (*Mysql) Default

func (r *Mysql) Default()

func (*Mysql) GroupReplicationGroupSeeds

func (r *Mysql) GroupReplicationGroupSeeds() string

func (*Mysql) NamespacedName

func (r *Mysql) NamespacedName() types.NamespacedName

func (*Mysql) NewLabels

func (r *Mysql) NewLabels() map[string]string

func (*Mysql) NormalizeSolo

func (r *Mysql) NormalizeSolo(id int) (s MysqlSolo, err error)

func (*Mysql) SoloHost

func (r *Mysql) SoloHost(id int) string

func (*Mysql) SoloName

func (r *Mysql) SoloName(id int) string

func (*Mysql) SoloShortHost

func (r *Mysql) SoloShortHost(id int) string

func (*Mysql) Validate

func (r *Mysql) Validate() (err error)

type MysqlList

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

MysqlList contains a list of Mysql

func (*MysqlList) DeepCopy

func (in *MysqlList) DeepCopy() *MysqlList

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

func (*MysqlList) DeepCopyInto

func (in *MysqlList) DeepCopyInto(out *MysqlList)

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

func (*MysqlList) DeepCopyObject

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

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

type MysqlSolo

type MysqlSolo struct {
	//+optional
	Spec MysqlSoloSpec `json:"spec,omitempty"`

	//+optional
	Status MysqlSoloStatus `json:"status,omitempty"`
}

func (*MysqlSolo) DeepCopy

func (in *MysqlSolo) DeepCopy() *MysqlSolo

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

func (*MysqlSolo) DeepCopyInto

func (in *MysqlSolo) DeepCopyInto(out *MysqlSolo)

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

func (MysqlSolo) GroupReplicationLocalAddress

func (s MysqlSolo) GroupReplicationLocalAddress() string

type MysqlSoloSpec

type MysqlSoloSpec struct {
	//+optional
	Id int `json:"id,omitempty"`
	//+optional
	SourceId *int `json:"sourceId,omitempty"`

	//+optional
	Port int `json:"port,omitempty"`
	//+optional
	MyletPort int `json:"myletPort,omitempty"`

	//+optional
	GroupPort int `json:"groupPort,omitempty"`
	//+optional
	ExporterPort int `json:"exporterPort,omitempty"`

	//+optional
	Mydir string `json:"mydir,omitempty"`
	//+optional
	Host string `json:"host,omitempty"`

	//+optional
	Name string `json:"name,omitempty"`
	//+optional
	ServerId int `json:"serverId,omitempty"`
}

func (*MysqlSoloSpec) DeepCopy

func (in *MysqlSoloSpec) DeepCopy() *MysqlSoloSpec

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

func (*MysqlSoloSpec) DeepCopyInto

func (in *MysqlSoloSpec) DeepCopyInto(out *MysqlSoloSpec)

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

type MysqlSoloStatus

type MysqlSoloStatus struct {
	//+optional
	Color string `json:"color,omitempty"`

	//+optional
	Hang int `json:"hang,omitempty"`
}

func (*MysqlSoloStatus) DeepCopy

func (in *MysqlSoloStatus) DeepCopy() *MysqlSoloStatus

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

func (*MysqlSoloStatus) DeepCopyInto

func (in *MysqlSoloStatus) DeepCopyInto(out *MysqlSoloStatus)

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

type MysqlSpec

type MysqlSpec struct {

	//+kubebuilder:validation:Enum=v5.7;v8.0
	//+kubebuilder:default=v5.7
	//+optional
	Version string `json:"version,omitempty"`

	//+kubebuilder:validation:Enum=Classic;Single;Multi
	//+kubebuilder:default=Classic
	//+optional
	PrimaryMode string `json:"primaryMode,omitempty"`

	//+kubebuilder:validation:Minimum=1
	//+kubebuilder:validation:Maximum=9
	//+kubebuilder:default=1
	//+optional
	Primaries int `json:"primaries,omitempty"`

	//+kubebuilder:validation:Minimum=0
	//+kubebuilder:validation:Maximum=9
	//+optional
	Replicas *int `json:"replicas,omitempty"`

	//+optional
	PrimaryId *int `json:"primaryId,omitempty"`

	//+optional
	AutoSwitch *bool `json:"autoSwitch,omitempty"`

	//+kubebuilder:default=root
	//+optional
	LocalUsername string `json:"localUsername,omitempty"`
	//+optional
	LocalPassword string `json:"localPassword,omitempty"`
	//+kubebuilder:default=repl
	//+optional
	ReplicaUsername string `json:"replicaUsername,omitempty"`
	//+optional
	ReplicaPassword string `json:"replicaPassword,omitempty"`

	//+kubebuilder:default=standard
	//+optional
	StorageClassName string `json:"storageClassName,omitempty"`
	//+kubebuilder:default="10Gi"
	//+optional
	StorageSize resource.Quantity `json:"storageSize,omitempty"`

	//+optional
	Image string `json:"image,omitempty"`
	//+kubebuilder:default=IfNotPresent
	//+optional
	ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`

	//+kubebuilder:default=3306
	//+optional
	Port int `json:"port,omitempty"`
	//+kubebuilder:default=33080
	//+optional
	MyletPort int `json:"myletPort,omitempty"`

	//+kubebuilder:default=/mydir
	//+optional
	Mydir string `json:"mydir,omitempty"`
	//+optional
	MyctlAddr string `json:"myctlAddr,omitempty"`
	//+optional
	HeadlessHost string `json:"headlessHost,omitempty"`
	//+optional
	ShortHeadlessHost string `json:"shortHeadlessHost,omitempty"`

	//+optional
	Solos []MysqlSoloSpec `json:"solos,omitempty"`

	//+optional
	//+kubebuilder:default=false
	EnableExporter bool `json:"enableExporter,omitempty"`
	//+kubebuilder:default=9104
	ExporterPort int `json:"exporterPort,omitempty"`
	//+optional
	ExporterFlags []string `json:"exporterFlags,omitempty"`
	//+optional
	ExporterImage string `json:"exporterImage,omitempty"`
	//+kubebuilder:default=exporter
	//+optional
	ExporterUsername string `json:"exporterUsername,omitempty"`
	//+optional
	ExporterPassword string `json:"exporterPassword,omitempty"`

	//+kubebuilder:default=33061
	//+optional
	GroupPort int `json:"groupPort,omitempty"`
	//+optional
	GroupName string `json:"groupName,omitempty"`

	// Map of string keys and values that can be used to organize and categorize
	// (scope and select) objects. May match selectors of replication controllers
	// and services.
	// More info: http://kubernetes.io/docs/user-guide/labels
	// +optional
	Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,11,rep,name=labels"`

	// Annotations is an unstructured key value map stored with a resource that may be
	// set by external tools to store and retrieve arbitrary metadata. They are not
	// queryable and should be preserved when modifying objects.
	// More info: http://kubernetes.io/docs/user-guide/annotations
	// +optional
	Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"`

	// If specified, the pod's scheduling constraints
	// +optional
	Affinity *corev1.Affinity `json:"affinity,omitempty" protobuf:"bytes,18,opt,name=affinity"`

	// Resources are not allowed for ephemeral containers. Ephemeral containers use spare resources
	// already allocated to the pod.
	// +optional
	Resources corev1.ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,8,opt,name=resources"`

	// 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.
	// +optional
	EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty" protobuf:"bytes,19,rep,name=envFrom"`
	// List of environment variables to set in the container.
	// Cannot be updated.
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge
	Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,7,rep,name=env"`
}

MysqlSpec defines the desired state of Mysql

func (*MysqlSpec) DeepCopy

func (in *MysqlSpec) DeepCopy() *MysqlSpec

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

func (*MysqlSpec) DeepCopyInto

func (in *MysqlSpec) DeepCopyInto(out *MysqlSpec)

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

func (*MysqlSpec) Size

func (spec *MysqlSpec) Size() int

type MysqlStatus

type MysqlStatus struct {

	//+optional
	Version MysqlVersion `json:"version,omitempty"`
	//+optional
	Solos []MysqlSolo `json:"solos,omitempty"`
	//+optional
	MysqlSoloStatus `json:",inline,omitempty"`

	//+optional
	WriteId *int `json:"writeId,omitempty"`
	//+optional
	ReadId *int `json:"readId,omitempty"`
}

MysqlStatus defines the observed state of Mysql

func (*MysqlStatus) DeepCopy

func (in *MysqlStatus) DeepCopy() *MysqlStatus

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

func (*MysqlStatus) DeepCopyInto

func (in *MysqlStatus) DeepCopyInto(out *MysqlStatus)

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

type MysqlVersion

type MysqlVersion struct {
	Major   int  `json:"major,omitempty"`
	Minor   int  `json:"minor,omitempty"`
	NoPatch bool `json:"noPatch,omitempty"`
	Patch   int  `json:"patch,omitempty"`
}

func ParseVersion

func ParseVersion(s string) (v MysqlVersion, err error)

func (*MysqlVersion) DeepCopy

func (in *MysqlVersion) DeepCopy() *MysqlVersion

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

func (*MysqlVersion) DeepCopyInto

func (in *MysqlVersion) DeepCopyInto(out *MysqlVersion)

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

func (MysqlVersion) LT

func (v MysqlVersion) LT(major, minor, patch int) bool

func (MysqlVersion) ValidateMasterHost

func (v MysqlVersion) ValidateMasterHost(s string) bool

Jump to

Keyboard shortcuts

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