add config

Signed-off-by: Howard Lau <howardlau1999@hotmail.com>
This commit is contained in:
Howard Lau 2020-10-30 06:42:00 +00:00
parent 5bc96e22b1
commit a8c8fd65bc
No known key found for this signature in database
GPG Key ID: 5CCC55849E3CF8E2
4 changed files with 81 additions and 0 deletions

View File

@ -122,6 +122,7 @@ type MasterSpec struct {
// Config in raw toml string
Config *string `json:"config,omitempty"`
// Master-specific settings
VolumePreallocate *bool `json:"volumePreallocate,omitempty"`
VolumeSizeLimitMB *int32 `json:"volumeSizeLimitMB,omitempty"`
GarbageThreshold *string `json:"garbageThreshold,omitempty"`
@ -138,6 +139,17 @@ type VolumeSpec struct {
// +kubebuilder:validation:Minimum=1
Replicas int32 `json:"replicas"`
Service *ServiceSpec `json:"service,omitempty"`
StorageClassName *string `json:"storageClassName,omitempty"`
// Volume-specific settings
CompactionMBps *int32 `json:"compactionMBps,omitempty"`
FileSizeLimitMB *int32 `json:"fileSizeLimitMB,omitempty"`
FixJpgOrientation *bool `json:"fixJpgOrientation,omitempty"`
IdleTimeout *int32 `json:"idleTimeout,omitempty"`
MaxVolumeCounts *int32 `json:"maxVolumeCounts,omitempty"`
MinFreeSpacePercent *int32 `json:"minFreeSpacePercent,omitempty"`
}
// FilerSpec is the spec for filers
@ -149,8 +161,13 @@ type FilerSpec struct {
// +kubebuilder:validation:Minimum=1
Replicas int32 `json:"replicas"`
Service *ServiceSpec `json:"service,omitempty"`
// Config in raw toml string
Config *string `json:"config,omitempty"`
// Filer-specific settings
MaxMB *int32 `json:"maxMB,omitempty"`
}
// 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

View File

@ -137,6 +137,11 @@ func (in *FilerSpec) DeepCopyInto(out *FilerSpec) {
*out = new(string)
**out = **in
}
if in.MaxMB != nil {
in, out := &in.MaxMB, &out.MaxMB
*out = new(int32)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FilerSpec.
@ -398,6 +403,41 @@ func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) {
*out = new(ServiceSpec)
(*in).DeepCopyInto(*out)
}
if in.StorageClassName != nil {
in, out := &in.StorageClassName, &out.StorageClassName
*out = new(string)
**out = **in
}
if in.CompactionMBps != nil {
in, out := &in.CompactionMBps, &out.CompactionMBps
*out = new(int32)
**out = **in
}
if in.FileSizeLimitMB != nil {
in, out := &in.FileSizeLimitMB, &out.FileSizeLimitMB
*out = new(int32)
**out = **in
}
if in.FixJpgOrientation != nil {
in, out := &in.FixJpgOrientation, &out.FixJpgOrientation
*out = new(bool)
**out = **in
}
if in.IdleTimeout != nil {
in, out := &in.IdleTimeout, &out.IdleTimeout
*out = new(int32)
**out = **in
}
if in.MaxVolumeCounts != nil {
in, out := &in.MaxVolumeCounts, &out.MaxVolumeCounts
*out = new(int32)
**out = **in
}
if in.MinFreeSpacePercent != nil {
in, out := &in.MinFreeSpacePercent, &out.MinFreeSpacePercent
*out = new(int32)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSpec.

View File

@ -3669,6 +3669,9 @@ spec:
description: 'Limits describes the maximum amount of compute resources
allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
maxMB:
format: int32
type: integer
nodeSelector:
additionalProperties:
type: string
@ -6982,6 +6985,7 @@ spec:
version if non-empty
type: string
volumePreallocate:
description: Master-specific settings
type: boolean
volumeSizeLimitMB:
format: int32
@ -9960,6 +9964,9 @@ spec:
description: Annotations of the component. Merged into the cluster-level
annotations if non-empty
type: object
compactionMBps:
format: int32
type: integer
env:
description: List of environment variables to set in the container,
like v1.Container.Env. Note that following env names cannot be
@ -10069,10 +10076,18 @@ spec:
- name
type: object
type: array
fileSizeLimitMB:
format: int32
type: integer
fixJpgOrientation:
type: boolean
hostNetwork:
description: Whether Hostnetwork of the component is enabled. Override
the cluster-level setting if present
type: boolean
idleTimeout:
format: int32
type: integer
imagePullPolicy:
description: ImagePullPolicy of the component. Override the cluster-level
imagePullPolicy if present
@ -10101,6 +10116,12 @@ spec:
description: 'Limits describes the maximum amount of compute resources
allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
maxVolumeCounts:
format: int32
type: integer
minFreeSpacePercent:
format: int32
type: integer
nodeSelector:
additionalProperties:
type: string
@ -10156,6 +10177,8 @@ spec:
that will be employed to update Pods in the StatefulSet when a
revision is made to Template.
type: string
storageClassName:
type: string
terminationGracePeriodSeconds:
description: Optional duration in seconds the pod needs to terminate
gracefully. May be decreased in delete request. Value must be

View File

@ -59,6 +59,7 @@ func (r *SeaweedReconciler) createVolumeServerStatefulSet(m *seaweedv1.Seaweed)
Name: fmt.Sprintf("mount%d", i),
},
Spec: corev1.PersistentVolumeClaimSpec{
StorageClassName: m.Spec.Volume.StorageClassName,
AccessModes: []corev1.PersistentVolumeAccessMode{
corev1.ReadWriteOnce,
},