2020-07-26 22:10:35 +00:00
/ *
2020-08-02 06:27:46 +00:00
2020-07-26 22:10:35 +00:00
Licensed under the Apache License , Version 2.0 ( the "License" ) ;
you may not use this file except in compliance with the License .
You may obtain a copy of the License at
http : //www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing , software
distributed under the License is distributed on an "AS IS" BASIS ,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
See the License for the specific language governing permissions and
limitations under the License .
* /
2020-08-02 06:27:46 +00:00
package v1
2020-07-26 22:10:35 +00:00
import (
2020-10-28 05:06:25 +00:00
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
2020-07-26 22:10:35 +00:00
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2020-08-02 06:27:46 +00:00
// SeaweedSpec defines the desired state of Seaweed
type SeaweedSpec struct {
2020-07-26 22:10:35 +00:00
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
2020-07-26 22:26:27 +00:00
// MetricsAddress is Prometheus gateway address
MetricsAddress string ` json:"metricsAddress,omitempty" `
2020-08-05 05:13:36 +00:00
2020-10-17 09:25:23 +00:00
// Image
Image string ` json:"image,omitempty" `
2020-10-28 05:06:25 +00:00
// Version
Version string ` json:"version,omitempty" `
// Master
Master * MasterSpec ` json:"master,omitempty" `
// Volume
Volume * VolumeSpec ` json:"volume,omitempty" `
// Filer
Filer * FilerSpec ` json:"filer,omitempty" `
2020-08-05 05:13:36 +00:00
// VolumeServerCount is the number of volume servers, default to 1
2020-10-28 05:06:25 +00:00
VolumeServerCount int32 ` json:"volumeServerCount,omitempty" `
VolumeServerDiskCount int32 ` json:"volumeServerDiskCount,omitempty" `
2020-10-20 07:17:14 +00:00
VolumeServerDiskSizeInGiB int32 ` json:"volumeServerDiskSizeInGiB,omitempty" `
2020-08-06 04:11:40 +00:00
// FilerCount is the number of filers, default to 1
2020-10-17 06:25:46 +00:00
FilerCount int32 ` json:"filerCount,omitempty" `
2020-10-18 07:12:33 +00:00
// ingress
Hosts [ ] string ` json:"hosts" `
2020-07-26 22:10:35 +00:00
}
2020-08-02 06:27:46 +00:00
// SeaweedStatus defines the observed state of Seaweed
type SeaweedStatus struct {
2020-07-26 22:10:35 +00:00
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}
2020-10-28 05:06:25 +00:00
// MasterSpec is the spec for masters
type MasterSpec struct {
ComponentSpec ` json:",inline" `
corev1 . ResourceRequirements ` json:",inline" `
// The desired ready replicas
// +kubebuilder:validation:Minimum=1
Replicas int32 ` json:"replicas" `
}
// VolumeSpec is the spec for volume servers
type VolumeSpec struct {
ComponentSpec ` json:",inline" `
corev1 . ResourceRequirements ` json:",inline" `
// The desired ready replicas
// +kubebuilder:validation:Minimum=1
Replicas int32 ` json:"replicas" `
}
// FilerSpec is the spec for filers
type FilerSpec struct {
ComponentSpec ` json:",inline" `
corev1 . ResourceRequirements ` json:",inline" `
// The desired ready replicas
// +kubebuilder:validation:Minimum=0
Replicas int32 ` json:"replicas" `
}
// ComponentSpec is the base spec of each component, the fields should always accessed by the Basic<Component>Spec() method to respect the cluster-level properties
type ComponentSpec struct {
// Version of the component. Override the cluster-level version if non-empty
Version * string ` json:"version,omitempty" `
// ImagePullPolicy of the component. Override the cluster-level imagePullPolicy if present
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.
ImagePullSecrets [ ] corev1 . LocalObjectReference ` json:"imagePullSecrets,omitempty" `
// Whether Hostnetwork of the component is enabled. Override the cluster-level setting if present
HostNetwork * bool ` json:"hostNetwork,omitempty" `
// Affinity of the component. Override the cluster-level one if present
Affinity * corev1 . Affinity ` json:"affinity,omitempty" `
// PriorityClassName of the component. Override the cluster-level one if present
PriorityClassName * string ` json:"priorityClassName,omitempty" `
// SchedulerName of the component. Override the cluster-level one if present
SchedulerName * string ` json:"schedulerName,omitempty" `
// NodeSelector of the component. Merged into the cluster-level nodeSelector if non-empty
NodeSelector map [ string ] string ` json:"nodeSelector,omitempty" `
// Annotations of the component. Merged into the cluster-level annotations if non-empty
Annotations map [ string ] string ` json:"annotations,omitempty" `
// Tolerations of the component. Override the cluster-level tolerations if non-empty
Tolerations [ ] corev1 . Toleration ` json:"tolerations,omitempty" `
// List of environment variables to set in the container, like
// v1.Container.Env.
// Note that following env names cannot be used and may be overrided by
// tidb-operator built envs.
// - NAMESPACE
// - TZ
// - SERVICE_NAME
// - PEER_SERVICE_NAME
// - HEADLESS_SERVICE_NAME
// - SET_NAME
// - HOSTNAME
// - CLUSTER_NAME
// - POD_NAME
Env [ ] corev1 . EnvVar ` json:"env,omitempty" `
// Additional containers of the component.
AdditionalContainers [ ] corev1 . Container ` json:"additionalContainers,omitempty" `
// Additional volumes of component pod. Currently this only
// supports additional volume mounts for sidecar containers.
AdditionalVolumes [ ] corev1 . Volume ` json:"additionalVolumes,omitempty" `
// Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
// Value must be non-negative integer. The value zero indicates delete immediately.
// If this value is nil, the default grace period will be used instead.
// The grace period is the duration in seconds after the processes running in the pod are sent
// a termination signal and the time when the processes are forcibly halted with a kill signal.
// Set this value longer than the expected cleanup time for your process.
// Defaults to 30 seconds.
TerminationGracePeriodSeconds * int64 ` json:"terminationGracePeriodSeconds,omitempty" `
// StatefulSetUpdateStrategy indicates the StatefulSetUpdateStrategy that will be
// employed to update Pods in the StatefulSet when a revision is made to
// Template.
StatefulSetUpdateStrategy appsv1 . StatefulSetUpdateStrategyType ` json:"statefulSetUpdateStrategy,omitempty" `
}
2020-07-26 22:10:35 +00:00
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
2020-08-02 06:27:46 +00:00
// Seaweed is the Schema for the seaweeds API
type Seaweed struct {
2020-07-26 22:10:35 +00:00
metav1 . TypeMeta ` json:",inline" `
metav1 . ObjectMeta ` json:"metadata,omitempty" `
2020-08-02 06:27:46 +00:00
Spec SeaweedSpec ` json:"spec,omitempty" `
Status SeaweedStatus ` json:"status,omitempty" `
2020-07-26 22:10:35 +00:00
}
// +kubebuilder:object:root=true
2020-08-02 06:27:46 +00:00
// SeaweedList contains a list of Seaweed
type SeaweedList struct {
2020-07-26 22:10:35 +00:00
metav1 . TypeMeta ` json:",inline" `
metav1 . ListMeta ` json:"metadata,omitempty" `
2020-08-02 06:27:46 +00:00
Items [ ] Seaweed ` json:"items" `
2020-07-26 22:10:35 +00:00
}
func init ( ) {
2020-08-02 06:27:46 +00:00
SchemeBuilder . Register ( & Seaweed { } , & SeaweedList { } )
2020-07-26 22:10:35 +00:00
}