feat(crds): change api group name
change api group name to seaweedfs.com
This commit is contained in:
parent
b4c0822298
commit
f8c94e43bb
6
Makefile
6
Makefile
@ -8,7 +8,7 @@ install: ## Install all resources (CR/CRD's, RBCA and Operator)
|
||||
@echo ....... Creating namespace .......
|
||||
- kubectl create namespace ${NAMESPACE}
|
||||
@echo ....... Applying CRDS and Operator .......
|
||||
- kubectl apply -f deploy/crds/cluster.seaweedfs.com_seaweedfsclusters_crd.yaml -n ${NAMESPACE}
|
||||
- kubectl apply -f deploy/crds/seaweedfs.com_seaweedfsclusters_crd.yaml -n ${NAMESPACE}
|
||||
@echo ....... Applying Rules and Service Account .......
|
||||
- kubectl apply -f deploy/role.yaml -n ${NAMESPACE}
|
||||
- kubectl apply -f deploy/role_binding.yaml -n ${NAMESPACE}
|
||||
@ -16,12 +16,12 @@ install: ## Install all resources (CR/CRD's, RBCA and Operator)
|
||||
@echo ....... Applying Operator .......
|
||||
- kubectl apply -f deploy/operator.yaml -n ${NAMESPACE}
|
||||
@echo ....... Creating the Database .......
|
||||
- kubectl apply -f deploy/crds/cluster.seaweedfs.com_v1alpha1_seaweedfscluster_cr.yaml -n ${NAMESPACE}
|
||||
- kubectl apply -f deploy/crds/seaweedfs.com_v1alpha1_seaweedfscluster_cr.yaml -n ${NAMESPACE}
|
||||
|
||||
uninstall: ## Uninstall all that all performed in the $ make install
|
||||
@echo ....... Uninstalling .......
|
||||
@echo ....... Deleting CRDs.......
|
||||
- kubectl delete -f deploy/crds/cluster.seaweedfs.com_seaweedfsclusters_crd.yaml -n ${NAMESPACE}
|
||||
- kubectl delete -f deploy/crds/seaweedfs.com_seaweedfsclusters_crd.yaml -n ${NAMESPACE}
|
||||
@echo ....... Deleting Rules and Service Account .......
|
||||
- kubectl delete -f deploy/role.yaml -n ${NAMESPACE}
|
||||
- kubectl delete -f deploy/role_binding.yaml -n ${NAMESPACE}
|
||||
|
@ -1,9 +1,9 @@
|
||||
apiVersion: apiextensions.k8s.io/v1beta1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: seaweedfsclusters.cluster.seaweedfs.com
|
||||
name: seaweedfsclusters.seaweedfs.com
|
||||
spec:
|
||||
group: cluster.seaweedfs.com
|
||||
group: seaweedfs.com
|
||||
names:
|
||||
kind: SeaweedfsCluster
|
||||
listKind: SeaweedfsClusterList
|
||||
@ -32,14 +32,14 @@ spec:
|
||||
description: SeaweedfsClusterSpec defines the desired state of SeaweedfsCluster
|
||||
properties:
|
||||
filer:
|
||||
description: SeaweedfsFilerSpec defines the desired state of filer server
|
||||
in cluster
|
||||
description: FilerSpec defines the desired state of filer server in
|
||||
cluster
|
||||
properties:
|
||||
dir_list_limit:
|
||||
dirListLimit:
|
||||
description: DirListLimit limit sub dir listing size, default 100000
|
||||
format: int32
|
||||
type: integer
|
||||
disable_dir_listing:
|
||||
disableDirListing:
|
||||
description: DisableDirListing turn off directory listing
|
||||
type: boolean
|
||||
max_mb:
|
||||
@ -56,14 +56,14 @@ spec:
|
||||
type: integer
|
||||
type: object
|
||||
master:
|
||||
description: SeaweedfsMasterSpec defines the desired state of master
|
||||
server in cluster
|
||||
description: MasterSpec defines the desired state of master server in
|
||||
cluster
|
||||
properties:
|
||||
default_replication:
|
||||
description: DefaultReplication set the data replication policy
|
||||
in volumes. default "000"
|
||||
type: string
|
||||
disable_http:
|
||||
disableHttp:
|
||||
description: DisableHTTP if disable http proto, only gRPC operations
|
||||
are allowed. GRPC port is http port + 10000
|
||||
type: boolean
|
||||
@ -72,7 +72,7 @@ spec:
|
||||
is 9333 Master servers also use it identify each other.
|
||||
format: int32
|
||||
type: integer
|
||||
replication_size:
|
||||
replicas:
|
||||
description: Replicas a size of a raft cluster. The master servers
|
||||
are coordinated by Raft protocol, to elect a leader.
|
||||
format: int32
|
||||
@ -82,15 +82,15 @@ spec:
|
||||
type: string
|
||||
volumes:
|
||||
items:
|
||||
description: SeaweedfsVolumeSpec defines the desired state of volume
|
||||
servers in cluster
|
||||
description: VolumeSpec defines the desired state of volume servers
|
||||
in cluster
|
||||
properties:
|
||||
compaction_mbps:
|
||||
description: CompactionMbps limit background compaction or copying
|
||||
speed in mega bytes per second
|
||||
format: int32
|
||||
type: integer
|
||||
data_center:
|
||||
dataCenter:
|
||||
description: DataCenter current volume server's data center name
|
||||
type: string
|
||||
max:
|
@ -1,4 +1,4 @@
|
||||
apiVersion: cluster.seaweedfs.com/v1alpha1
|
||||
apiVersion: seaweedfs.com/v1alpha1
|
||||
kind: SeaweedfsCluster
|
||||
metadata:
|
||||
name: example-seaweedfscluster
|
@ -54,7 +54,7 @@ rules:
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- cluster.seaweedfs.com
|
||||
- seaweedfs.com
|
||||
resources:
|
||||
- '*'
|
||||
- seaweedfsclusters
|
||||
|
2
go.mod
2
go.mod
@ -2,7 +2,7 @@ module github.com/seaweedfs/seaweedfs-operator
|
||||
|
||||
require (
|
||||
github.com/go-openapi/spec v0.17.2
|
||||
github.com/operator-framework/operator-sdk v0.11.1-0.20191027213559-041ec5463883
|
||||
github.com/operator-framework/operator-sdk v0.12.1-0.20191119193908-3b2f6845f05b
|
||||
github.com/spf13/pflag v1.0.3
|
||||
k8s.io/api v0.0.0-20190918155943-95b840bb6a1f
|
||||
k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655
|
||||
|
@ -1,7 +1,7 @@
|
||||
package apis
|
||||
|
||||
import (
|
||||
"github.com/seaweedfs/seaweedfs-operator/pkg/apis/cluster/v1alpha1"
|
||||
"github.com/seaweedfs/seaweedfs-operator/pkg/apis/seaweedfs/v1alpha1"
|
||||
)
|
||||
|
||||
func init() {
|
@ -1,6 +0,0 @@
|
||||
// Package cluster contains cluster API versions.
|
||||
//
|
||||
// This file ensures Go source parsers acknowledge the cluster package
|
||||
// and any child packages. It can be removed if any other Go source files are
|
||||
// added to this package.
|
||||
package cluster
|
@ -1,4 +0,0 @@
|
||||
// Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +groupName=cluster.seaweedfs.com
|
||||
package v1alpha1
|
6
pkg/apis/seaweedfs/group.go
Normal file
6
pkg/apis/seaweedfs/group.go
Normal file
@ -0,0 +1,6 @@
|
||||
// Package seaweedfs contains seaweedfs API versions.
|
||||
//
|
||||
// This file ensures Go source parsers acknowledge the seaweedfs package
|
||||
// and any child packages. It can be removed if any other Go source files are
|
||||
// added to this package.
|
||||
package seaweedfs
|
4
pkg/apis/seaweedfs/v1alpha1/doc.go
Normal file
4
pkg/apis/seaweedfs/v1alpha1/doc.go
Normal file
@ -0,0 +1,4 @@
|
||||
// Package v1alpha1 contains API Schema definitions for the seaweedfs v1alpha1 API group
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +groupName=seaweedfs.com
|
||||
package v1alpha1
|
@ -1,8 +1,8 @@
|
||||
// NOTE: Boilerplate only. Ignore this file.
|
||||
|
||||
// Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group
|
||||
// Package v1alpha1 contains API Schema definitions for the seaweedfs v1alpha1 API group
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +groupName=cluster.seaweedfs.com
|
||||
// +groupName=seaweedfs.com
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
@ -12,7 +12,7 @@ import (
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: "cluster.seaweedfs.com", Version: "v1alpha1"}
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: "seaweedfs.com", Version: "v1alpha1"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
@ -1,37 +1,38 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// SeaweedfsClusterSpec defines the desired state of SeaweedfsCluster
|
||||
// +k8s:openapi-gen=true
|
||||
type SeaweedfsClusterSpec struct {
|
||||
Version string `json:"version,omitempty"`
|
||||
Master SeaweedfsMasterSpec `json:"master,omitempty"`
|
||||
Volumes []SeaweedfsVolumeSpec `json:"volumes,omitempty"`
|
||||
Filer SeaweedfsFilerSpec `json:"filer,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Master MasterSpec `json:"master,omitempty"`
|
||||
Volumes []VolumeSpec `json:"volumes,omitempty"`
|
||||
Filer FilerSpec `json:"filer,omitempty"`
|
||||
}
|
||||
|
||||
// SeaweedfsMasterSpec defines the desired state of master server in cluster
|
||||
// MasterSpec defines the desired state of master server in cluster
|
||||
// +k8s:openapi-gen=true
|
||||
type SeaweedfsMasterSpec struct {
|
||||
type MasterSpec struct {
|
||||
// Replicas a size of a raft cluster.
|
||||
// The master servers are coordinated by Raft protocol, to elect a leader.
|
||||
Replicas int32 `json:"replication_size,omitempty"`
|
||||
Replicas int32 `json:"replicas,omitempty"`
|
||||
// Port set master server http api service port. default is 9333
|
||||
// Master servers also use it identify each other.
|
||||
Port int32 `json:"port,omitempty"`
|
||||
// DisableHTTP if disable http proto, only gRPC operations are allowed.
|
||||
// GRPC port is http port + 10000
|
||||
DisableHTTP bool `json:"disable_http,omitempty"`
|
||||
DisableHTTP bool `json:"disableHttp,omitempty"`
|
||||
// DefaultReplication set the data replication policy in volumes. default "000"
|
||||
DefaultReplication string `json:"default_replication,omitempty"`
|
||||
}
|
||||
|
||||
// SeaweedfsVolumeSpec defines the desired state of volume servers in cluster
|
||||
// VolumeSpec defines the desired state of volume servers in cluster
|
||||
// +k8s:openapi-gen=true
|
||||
type SeaweedfsVolumeSpec struct {
|
||||
type VolumeSpec struct {
|
||||
// Max set the maximum numbers of volumes management by this server.
|
||||
// Each volume is a 30G size file in under layer filesystem. Default is 7
|
||||
Max int32 `json:"max,omitempty"`
|
||||
@ -40,20 +41,20 @@ type SeaweedfsVolumeSpec struct {
|
||||
//Rack current volume server's rack name
|
||||
Rack string `json:"rack,omitempty"`
|
||||
// DataCenter current volume server's data center name
|
||||
DataCenter string `json:"data_center,omitempty"`
|
||||
DataCenter string `json:"dataCenter,omitempty"`
|
||||
// Port volume server api http listen port
|
||||
Port int32 `json:"port,omitempty"`
|
||||
}
|
||||
|
||||
// SeaweedfsFilerSpec defines the desired state of filer server in cluster
|
||||
// FilerSpec defines the desired state of filer server in cluster
|
||||
// +k8s:openapi-gen=true
|
||||
type SeaweedfsFilerSpec struct {
|
||||
type FilerSpec struct {
|
||||
// Replicas a size of filer replications
|
||||
Replicas int32 `json:"replicas,omitempty"`
|
||||
// DirListLimit limit sub dir listing size, default 100000
|
||||
DirListLimit int32 `json:"dir_list_limit,omitempty"`
|
||||
DirListLimit int32 `json:"dirListLimit,omitempty"`
|
||||
// DisableDirListing turn off directory listing
|
||||
DisableDirListing bool `json:"disable_dir_listing,omitempty"`
|
||||
DisableDirListing bool `json:"disableDirListing,omitempty"`
|
||||
// MaxMB split files larger than the limit, default 32
|
||||
MaxMB int32 `json:"max_mb,omitempty"`
|
||||
// Port filer server http listen port
|
||||
@ -63,9 +64,49 @@ type SeaweedfsFilerSpec struct {
|
||||
// SeaweedfsClusterStatus defines the observed state of SeaweedfsCluster
|
||||
// +k8s:openapi-gen=true
|
||||
type SeaweedfsClusterStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
|
||||
// Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
|
||||
ClusterID string
|
||||
Master MasterStatus
|
||||
Volumes []VolumesStatus
|
||||
Filer FilerStatus
|
||||
}
|
||||
|
||||
// MasterStatus defines the observed state of SeaweedfsCluster master server
|
||||
// +k8s:openapi-gen=true
|
||||
type MasterStatus struct {
|
||||
// +k8s:openapi-gen=false
|
||||
ContainerSpec
|
||||
Replicas int32 `json:"replicas"`
|
||||
}
|
||||
|
||||
type VolumesStatus struct {
|
||||
// +k8s:openapi-gen=false
|
||||
ContainerSpec
|
||||
}
|
||||
|
||||
type FilerStatus struct {
|
||||
// +k8s:openapi-gen=false
|
||||
ContainerSpec
|
||||
Replicas int32 `json:"replicas"`
|
||||
}
|
||||
|
||||
// ContainerSpec is the container spec of a pod
|
||||
// +k8s:openapi-gen=false
|
||||
type ContainerSpec struct {
|
||||
Image string `json:"image"`
|
||||
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
|
||||
Requests *ResourceRequirement `json:"requests,omitempty"`
|
||||
Limits *ResourceRequirement `json:"limits,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceRequirement is resource requirements for a pod
|
||||
// +k8s:openapi-gen=true
|
||||
type ResourceRequirement struct {
|
||||
// CPU is how many cores a pod requires
|
||||
CPU string `json:"cpu,omitempty"`
|
||||
// Memory is how much memory a pod requires
|
||||
Memory string `json:"memory,omitempty"`
|
||||
// Storage is storage size a pod requires
|
||||
Storage string `json:"storage,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
@ -8,13 +8,121 @@ import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ContainerSpec) DeepCopyInto(out *ContainerSpec) {
|
||||
*out = *in
|
||||
if in.Requests != nil {
|
||||
in, out := &in.Requests, &out.Requests
|
||||
*out = new(ResourceRequirement)
|
||||
**out = **in
|
||||
}
|
||||
if in.Limits != nil {
|
||||
in, out := &in.Limits, &out.Limits
|
||||
*out = new(ResourceRequirement)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerSpec.
|
||||
func (in *ContainerSpec) DeepCopy() *ContainerSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ContainerSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FilerSpec) DeepCopyInto(out *FilerSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FilerSpec.
|
||||
func (in *FilerSpec) DeepCopy() *FilerSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FilerSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FilerStatus) DeepCopyInto(out *FilerStatus) {
|
||||
*out = *in
|
||||
in.ContainerSpec.DeepCopyInto(&out.ContainerSpec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FilerStatus.
|
||||
func (in *FilerStatus) DeepCopy() *FilerStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FilerStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MasterSpec) DeepCopyInto(out *MasterSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MasterSpec.
|
||||
func (in *MasterSpec) DeepCopy() *MasterSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MasterSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MasterStatus) DeepCopyInto(out *MasterStatus) {
|
||||
*out = *in
|
||||
in.ContainerSpec.DeepCopyInto(&out.ContainerSpec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MasterStatus.
|
||||
func (in *MasterStatus) DeepCopy() *MasterStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MasterStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceRequirement) DeepCopyInto(out *ResourceRequirement) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRequirement.
|
||||
func (in *ResourceRequirement) DeepCopy() *ResourceRequirement {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceRequirement)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SeaweedfsCluster) DeepCopyInto(out *SeaweedfsCluster) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
@ -75,7 +183,7 @@ func (in *SeaweedfsClusterSpec) DeepCopyInto(out *SeaweedfsClusterSpec) {
|
||||
out.Master = in.Master
|
||||
if in.Volumes != nil {
|
||||
in, out := &in.Volumes, &out.Volumes
|
||||
*out = make([]SeaweedfsVolumeSpec, len(*in))
|
||||
*out = make([]VolumeSpec, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.Filer = in.Filer
|
||||
@ -95,6 +203,15 @@ func (in *SeaweedfsClusterSpec) DeepCopy() *SeaweedfsClusterSpec {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SeaweedfsClusterStatus) DeepCopyInto(out *SeaweedfsClusterStatus) {
|
||||
*out = *in
|
||||
in.Master.DeepCopyInto(&out.Master)
|
||||
if in.Volumes != nil {
|
||||
in, out := &in.Volumes, &out.Volumes
|
||||
*out = make([]VolumesStatus, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
in.Filer.DeepCopyInto(&out.Filer)
|
||||
return
|
||||
}
|
||||
|
||||
@ -109,49 +226,34 @@ func (in *SeaweedfsClusterStatus) DeepCopy() *SeaweedfsClusterStatus {
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SeaweedfsFilerSpec) DeepCopyInto(out *SeaweedfsFilerSpec) {
|
||||
func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SeaweedfsFilerSpec.
|
||||
func (in *SeaweedfsFilerSpec) DeepCopy() *SeaweedfsFilerSpec {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSpec.
|
||||
func (in *VolumeSpec) DeepCopy() *VolumeSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SeaweedfsFilerSpec)
|
||||
out := new(VolumeSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SeaweedfsMasterSpec) DeepCopyInto(out *SeaweedfsMasterSpec) {
|
||||
func (in *VolumesStatus) DeepCopyInto(out *VolumesStatus) {
|
||||
*out = *in
|
||||
in.ContainerSpec.DeepCopyInto(&out.ContainerSpec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SeaweedfsMasterSpec.
|
||||
func (in *SeaweedfsMasterSpec) DeepCopy() *SeaweedfsMasterSpec {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumesStatus.
|
||||
func (in *VolumesStatus) DeepCopy() *VolumesStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SeaweedfsMasterSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SeaweedfsVolumeSpec) DeepCopyInto(out *SeaweedfsVolumeSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SeaweedfsVolumeSpec.
|
||||
func (in *SeaweedfsVolumeSpec) DeepCopy() *SeaweedfsVolumeSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SeaweedfsVolumeSpec)
|
||||
out := new(VolumesStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
@ -11,16 +11,161 @@ import (
|
||||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
|
||||
return map[string]common.OpenAPIDefinition{
|
||||
"./pkg/apis/cluster/v1alpha1.SeaweedfsCluster": schema_pkg_apis_cluster_v1alpha1_SeaweedfsCluster(ref),
|
||||
"./pkg/apis/cluster/v1alpha1.SeaweedfsClusterSpec": schema_pkg_apis_cluster_v1alpha1_SeaweedfsClusterSpec(ref),
|
||||
"./pkg/apis/cluster/v1alpha1.SeaweedfsClusterStatus": schema_pkg_apis_cluster_v1alpha1_SeaweedfsClusterStatus(ref),
|
||||
"./pkg/apis/cluster/v1alpha1.SeaweedfsFilerSpec": schema_pkg_apis_cluster_v1alpha1_SeaweedfsFilerSpec(ref),
|
||||
"./pkg/apis/cluster/v1alpha1.SeaweedfsMasterSpec": schema_pkg_apis_cluster_v1alpha1_SeaweedfsMasterSpec(ref),
|
||||
"./pkg/apis/cluster/v1alpha1.SeaweedfsVolumeSpec": schema_pkg_apis_cluster_v1alpha1_SeaweedfsVolumeSpec(ref),
|
||||
"./pkg/apis/seaweedfs/v1alpha1.FilerSpec": schema_pkg_apis_seaweedfs_v1alpha1_FilerSpec(ref),
|
||||
"./pkg/apis/seaweedfs/v1alpha1.MasterSpec": schema_pkg_apis_seaweedfs_v1alpha1_MasterSpec(ref),
|
||||
"./pkg/apis/seaweedfs/v1alpha1.MasterStatus": schema_pkg_apis_seaweedfs_v1alpha1_MasterStatus(ref),
|
||||
"./pkg/apis/seaweedfs/v1alpha1.ResourceRequirement": schema_pkg_apis_seaweedfs_v1alpha1_ResourceRequirement(ref),
|
||||
"./pkg/apis/seaweedfs/v1alpha1.SeaweedfsCluster": schema_pkg_apis_seaweedfs_v1alpha1_SeaweedfsCluster(ref),
|
||||
"./pkg/apis/seaweedfs/v1alpha1.SeaweedfsClusterSpec": schema_pkg_apis_seaweedfs_v1alpha1_SeaweedfsClusterSpec(ref),
|
||||
"./pkg/apis/seaweedfs/v1alpha1.SeaweedfsClusterStatus": schema_pkg_apis_seaweedfs_v1alpha1_SeaweedfsClusterStatus(ref),
|
||||
"./pkg/apis/seaweedfs/v1alpha1.VolumeSpec": schema_pkg_apis_seaweedfs_v1alpha1_VolumeSpec(ref),
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_cluster_v1alpha1_SeaweedfsCluster(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_seaweedfs_v1alpha1_FilerSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "FilerSpec defines the desired state of filer server in cluster",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"replicas": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Replicas a size of filer replications",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
"dirListLimit": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DirListLimit limit sub dir listing size, default 100000",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
"disableDirListing": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DisableDirListing turn off directory listing",
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"max_mb": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "MaxMB split files larger than the limit, default 32",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
"port": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Port filer server http listen port",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_seaweedfs_v1alpha1_MasterSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "MasterSpec defines the desired state of master server in cluster",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"replicas": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Replicas a size of a raft cluster. The master servers are coordinated by Raft protocol, to elect a leader.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
"port": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Port set master server http api service port. default is 9333 Master servers also use it identify each other.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
"disableHttp": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DisableHTTP if disable http proto, only gRPC operations are allowed. GRPC port is http port + 10000",
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"default_replication": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DefaultReplication set the data replication policy in volumes. default \"000\"",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_seaweedfs_v1alpha1_MasterStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "MasterStatus defines the observed state of SeaweedfsCluster master server",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"replicas": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"replicas"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_seaweedfs_v1alpha1_ResourceRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ResourceRequirement is resource requirements for a pod",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"cpu": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "CPU is how many cores a pod requires",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"memory": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Memory is how much memory a pod requires",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"storage": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Storage is storage size a pod requires",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_seaweedfs_v1alpha1_SeaweedfsCluster(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@ -48,23 +193,23 @@ func schema_pkg_apis_cluster_v1alpha1_SeaweedfsCluster(ref common.ReferenceCallb
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("./pkg/apis/cluster/v1alpha1.SeaweedfsClusterSpec"),
|
||||
Ref: ref("./pkg/apis/seaweedfs/v1alpha1.SeaweedfsClusterSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("./pkg/apis/cluster/v1alpha1.SeaweedfsClusterStatus"),
|
||||
Ref: ref("./pkg/apis/seaweedfs/v1alpha1.SeaweedfsClusterStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"./pkg/apis/cluster/v1alpha1.SeaweedfsClusterSpec", "./pkg/apis/cluster/v1alpha1.SeaweedfsClusterStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
"./pkg/apis/seaweedfs/v1alpha1.SeaweedfsClusterSpec", "./pkg/apis/seaweedfs/v1alpha1.SeaweedfsClusterStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_cluster_v1alpha1_SeaweedfsClusterSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_seaweedfs_v1alpha1_SeaweedfsClusterSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@ -79,7 +224,7 @@ func schema_pkg_apis_cluster_v1alpha1_SeaweedfsClusterSpec(ref common.ReferenceC
|
||||
},
|
||||
"master": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("./pkg/apis/cluster/v1alpha1.SeaweedfsMasterSpec"),
|
||||
Ref: ref("./pkg/apis/seaweedfs/v1alpha1.MasterSpec"),
|
||||
},
|
||||
},
|
||||
"volumes": {
|
||||
@ -88,7 +233,7 @@ func schema_pkg_apis_cluster_v1alpha1_SeaweedfsClusterSpec(ref common.ReferenceC
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("./pkg/apis/cluster/v1alpha1.SeaweedfsVolumeSpec"),
|
||||
Ref: ref("./pkg/apis/seaweedfs/v1alpha1.VolumeSpec"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -96,122 +241,66 @@ func schema_pkg_apis_cluster_v1alpha1_SeaweedfsClusterSpec(ref common.ReferenceC
|
||||
},
|
||||
"filer": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("./pkg/apis/cluster/v1alpha1.SeaweedfsFilerSpec"),
|
||||
Ref: ref("./pkg/apis/seaweedfs/v1alpha1.FilerSpec"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"./pkg/apis/cluster/v1alpha1.SeaweedfsFilerSpec", "./pkg/apis/cluster/v1alpha1.SeaweedfsMasterSpec", "./pkg/apis/cluster/v1alpha1.SeaweedfsVolumeSpec"},
|
||||
"./pkg/apis/seaweedfs/v1alpha1.FilerSpec", "./pkg/apis/seaweedfs/v1alpha1.MasterSpec", "./pkg/apis/seaweedfs/v1alpha1.VolumeSpec"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_cluster_v1alpha1_SeaweedfsClusterStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_seaweedfs_v1alpha1_SeaweedfsClusterStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "SeaweedfsClusterStatus defines the observed state of SeaweedfsCluster",
|
||||
Type: []string{"object"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_cluster_v1alpha1_SeaweedfsFilerSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "SeaweedfsFilerSpec defines the desired state of filer server in cluster",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"replicas": {
|
||||
"ClusterID": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Replicas a size of filer replications",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"dir_list_limit": {
|
||||
"Master": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DirListLimit limit sub dir listing size, default 100000",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
Ref: ref("./pkg/apis/seaweedfs/v1alpha1.MasterStatus"),
|
||||
},
|
||||
},
|
||||
"disable_dir_listing": {
|
||||
"Volumes": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DisableDirListing turn off directory listing",
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("./pkg/apis/seaweedfs/v1alpha1.VolumesStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"max_mb": {
|
||||
"Filer": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "MaxMB split files larger than the limit, default 32",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
"port": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Port filer server http listen port",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
Ref: ref("./pkg/apis/seaweedfs/v1alpha1.FilerStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"ClusterID", "Master", "Volumes", "Filer"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"./pkg/apis/seaweedfs/v1alpha1.FilerStatus", "./pkg/apis/seaweedfs/v1alpha1.MasterStatus", "./pkg/apis/seaweedfs/v1alpha1.VolumesStatus"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_cluster_v1alpha1_SeaweedfsMasterSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_seaweedfs_v1alpha1_VolumeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "SeaweedfsMasterSpec defines the desired state of master server in cluster",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"replication_size": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Replicas a size of a raft cluster. The master servers are coordinated by Raft protocol, to elect a leader.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
"port": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Port set master server http api service port. default is 9333 Master servers also use it identify each other.",
|
||||
Type: []string{"integer"},
|
||||
Format: "int32",
|
||||
},
|
||||
},
|
||||
"disable_http": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DisableHTTP if disable http proto, only gRPC operations are allowed. GRPC port is http port + 10000",
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"default_replication": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DefaultReplication set the data replication policy in volumes. default \"000\"",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_cluster_v1alpha1_SeaweedfsVolumeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "SeaweedfsVolumeSpec defines the desired state of volume servers in cluster",
|
||||
Description: "VolumeSpec defines the desired state of volume servers in cluster",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"max": {
|
||||
@ -235,7 +324,7 @@ func schema_pkg_apis_cluster_v1alpha1_SeaweedfsVolumeSpec(ref common.ReferenceCa
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"data_center": {
|
||||
"dataCenter": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DataCenter current volume server's data center name",
|
||||
Type: []string{"string"},
|
@ -3,7 +3,7 @@ package seaweedfscluster
|
||||
import (
|
||||
"context"
|
||||
|
||||
clusterv1alpha1 "github.com/seaweedfs/seaweedfs-operator/pkg/apis/cluster/v1alpha1"
|
||||
seaweedfsv1alpha1 "github.com/seaweedfs/seaweedfs-operator/pkg/apis/seaweedfs/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -46,7 +46,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
|
||||
}
|
||||
|
||||
// Watch for changes to primary resource SeaweedfsCluster
|
||||
err = c.Watch(&source.Kind{Type: &clusterv1alpha1.SeaweedfsCluster{}}, &handler.EnqueueRequestForObject{})
|
||||
err = c.Watch(&source.Kind{Type: &seaweedfsv1alpha1.SeaweedfsCluster{}}, &handler.EnqueueRequestForObject{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -55,7 +55,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
|
||||
// Watch for changes to secondary resource Pods and requeue the owner SeaweedfsCluster
|
||||
err = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{
|
||||
IsController: true,
|
||||
OwnerType: &clusterv1alpha1.SeaweedfsCluster{},
|
||||
OwnerType: &seaweedfsv1alpha1.SeaweedfsCluster{},
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@ -87,7 +87,7 @@ func (r *ReconcileSeaweedfsCluster) Reconcile(request reconcile.Request) (reconc
|
||||
reqLogger.Info("Reconciling SeaweedfsCluster")
|
||||
|
||||
// Fetch the SeaweedfsCluster instance
|
||||
instance := &clusterv1alpha1.SeaweedfsCluster{}
|
||||
instance := &seaweedfsv1alpha1.SeaweedfsCluster{}
|
||||
err := r.client.Get(context.TODO(), request.NamespacedName, instance)
|
||||
if err != nil {
|
||||
if errors.IsNotFound(err) {
|
||||
@ -130,7 +130,7 @@ func (r *ReconcileSeaweedfsCluster) Reconcile(request reconcile.Request) (reconc
|
||||
}
|
||||
|
||||
// newPodForCR returns a busybox pod with the same name/namespace as the cr
|
||||
func newPodForCR(cr *clusterv1alpha1.SeaweedfsCluster) *corev1.Pod {
|
||||
func newPodForCR(cr *seaweedfsv1alpha1.SeaweedfsCluster) *corev1.Pod {
|
||||
labels := map[string]string{
|
||||
"app": cr.Name,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user