Add useHostLocalTime option

Signed-off-by: Anton Skriptsov <sabbotagge@gmail.com>
This commit is contained in:
Anton Skriptsov committed 2019-08-14 11:26:42 -07:00
1 parent 799bcecce6
commit e99df703c5
24 files changed
+328 -182

No files matched your search

+1
View File
@@ -96,6 +96,7 @@ If this value is empty, each pod will get an ephemeral directory to store their
- `trlogProcessingInterval`: Controls for how many seconds cluster would aggregate object modifications prior to processing it by accounting, bucket updates, ISGW Links and notifications components. Has to be defined in seconds and must be composite of 60, i.e. 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30. Default is 10. Recommended range is 2 - 20. This is cluster wide setting and cannot be easily changed after cluster is created. Any new node added has to reflect exactly the same setting.
- `trlogKeepDays`: Controls for how many days cluster need to keep transaction log interval batches with version manifest references. If you planning to have cluster disconnected from ISGW downlinks for longer period time, consider to increase this value. Default is 7. This is cluster wide setting and cannot be easily changed after cluster is created.
- `maxContainerCapacity`: Overrides default total disks capacity per target container. Default is "132Ti".
- `useHostLocalTime`: Force usage of the host's /etc/localtime inside EdgeFS containers. Default is `false`.
#### Node Updates
Nodes can be added and removed over time by updating the Cluster CRD, for example with `kubectl -n rook-edgefs edit cluster.edgefs.rook.io rook-edgefs`.
This will bring up your default text editor and allow you to add and remove storage nodes from the cluster.
@@ -128,7 +128,7 @@ metadata:
name: rook-edgefs
namespace: rook-edgefs
spec:
edgefsImageName: edgefs/edgefs:1.2.43 # specify version here, i.e. edgefs/edgefs:1.1.0 etc
edgefsImageName: edgefs/edgefs:1.2.46 # specify version here, i.e. edgefs/edgefs:1.1.0 etc
serviceAccount: rook-edgefs-cluster
dataDirHostPath: /var/lib/edgefs
#dataVolumeSize: 10Gi
@@ -142,6 +142,7 @@ spec:
#maxContainerCapacity: 132Ti
#trlogProcessingInterval: 2 # set transaction log processing interval to 2s to speed up ISGW Link delivery
#trlogKeepDays: 2 # keep up to 2 days of transaction log interval batches to reduce local storage overhead
#useHostLocalTime: true
storage: # cluster level storage configuration and selection
useAllNodes: true
# directories:
@@ -22,6 +22,7 @@ package v1
import (
v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
corev1 "k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@@ -478,7 +479,7 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
(*out)[key] = *val.DeepCopy()
}
}
out.Mon = in.Mon
in.Mon.DeepCopyInto(&out.Mon)
out.RBDMirroring = in.RBDMirroring
in.Dashboard.DeepCopyInto(&out.Dashboard)
out.Monitoring = in.Monitoring
@@ -670,6 +671,11 @@ func (in *MetadataServerSpec) DeepCopy() *MetadataServerSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MonSpec) DeepCopyInto(out *MonSpec) {
*out = *in
if in.VolumeClaimTemplate != nil {
in, out := &in.VolumeClaimTemplate, &out.VolumeClaimTemplate
*out = new(corev1.PersistentVolumeClaim)
(*in).DeepCopyInto(*out)
}
return
}
@@ -25,6 +25,9 @@ import (
const (
ResourcesKeyMgr = "mgr"
ResourcesKeyTarget = "target"
hostLocalTimeVolName = "host-local-time"
hostLocalTimePath = "/etc/localtime"
)
// GetMgrResources returns the placement for the MGR service
@@ -114,3 +117,22 @@ func GetInitiatorEnvArr(svctype string, embedded bool, chunkCacheSize resource.Q
return retArr
}
func GetHostLocalTimeVolumeMount() v1.VolumeMount {
return v1.VolumeMount{
Name: hostLocalTimeVolName,
MountPath: hostLocalTimePath,
ReadOnly: true,
}
}
func GetHostLocalTimeVolume() v1.Volume {
return v1.Volume{
Name: hostLocalTimeVolName,
VolumeSource: v1.VolumeSource{
HostPath: &v1.HostPathVolumeSource{
Path: hostLocalTimePath,
},
},
}
}
+1
View File
@@ -74,6 +74,7 @@ type ClusterSpec struct {
TrlogProcessingInterval int `json:"trlogProcessingInterval,omitempty"`
TrlogKeepDays int `json:"trlogKeepDays,omitempty"`
MaxContainerCapacity resource.Quantity `json:"maxContainerCapacity,omitempty"`
UseHostLocalTime bool `json:"useHostLocalTime,omitempty"`
}
type DashboardSpec struct {
+2 -2
View File
@@ -186,7 +186,7 @@ func (c *cluster) createInstance(rookImage string, isClusterUpdate bool) error {
if !(isClusterUpdate && dro.NeedToResurrect) {
c.targets = target.New(c.context, c.Namespace, "latest", c.Spec.ServiceAccount, c.Spec.Storage, c.Spec.DataDirHostPath, c.Spec.DataVolumeSize,
edgefsv1beta1.GetTargetAnnotations(c.Spec.Annotations), edgefsv1beta1.GetTargetPlacement(c.Spec.Placement), c.Spec.Network,
c.Spec.Resources, c.Spec.ResourceProfile, c.Spec.ChunkCacheSize, c.ownerRef, clusterReconfiguration.DeploymentConfig)
c.Spec.Resources, c.Spec.ResourceProfile, c.Spec.ChunkCacheSize, c.ownerRef, clusterReconfiguration.DeploymentConfig, c.Spec.UseHostLocalTime)
err = c.targets.Start(rookImage, clusterNodes, dro)
if err != nil {
@@ -199,7 +199,7 @@ func (c *cluster) createInstance(rookImage string, isClusterUpdate bool) error {
//
c.mgrs = mgr.New(c.context, c.Namespace, "latest", c.Spec.ServiceAccount, c.Spec.DataDirHostPath, c.Spec.DataVolumeSize,
edgefsv1beta1.GetMgrAnnotations(c.Spec.Annotations), edgefsv1beta1.GetMgrPlacement(c.Spec.Placement), c.Spec.Network, c.Spec.Dashboard,
v1.ResourceRequirements{}, c.Spec.ResourceProfile, c.ownerRef)
v1.ResourceRequirements{}, c.Spec.ResourceProfile, c.ownerRef, c.Spec.UseHostLocalTime)
err = c.mgrs.Start(rookImage)
if err != nil {
+13 -8
View File
@@ -79,8 +79,7 @@ func NewClusterController(context *clusterd.Context, containerImage string) *Clu
return &ClusterController{
context: context,
containerImage: containerImage,
//createInitRetryInterval: createInitRetryIntervalDefault,
clusterMap: make(map[string]*cluster),
clusterMap: make(map[string]*cluster),
}
}
@@ -173,7 +172,8 @@ func (c *ClusterController) onAdd(obj interface{}) {
edgefsv1beta1.GetTargetPlacement(cluster.Spec.Placement),
cluster.Spec.Resources,
cluster.Spec.ResourceProfile,
cluster.ownerRef)
cluster.ownerRef,
cluster.Spec.UseHostLocalTime)
NFSController.StartWatch(cluster.stopCh)
// Start S3 service CRD watcher
@@ -185,7 +185,8 @@ func (c *ClusterController) onAdd(obj interface{}) {
edgefsv1beta1.GetTargetPlacement(cluster.Spec.Placement),
cluster.Spec.Resources,
cluster.Spec.ResourceProfile,
cluster.ownerRef)
cluster.ownerRef,
cluster.Spec.UseHostLocalTime)
S3Controller.StartWatch(cluster.stopCh)
// Start SWIFT service CRD watcher
@@ -197,7 +198,8 @@ func (c *ClusterController) onAdd(obj interface{}) {
edgefsv1beta1.GetTargetPlacement(cluster.Spec.Placement),
cluster.Spec.Resources,
cluster.Spec.ResourceProfile,
cluster.ownerRef)
cluster.ownerRef,
cluster.Spec.UseHostLocalTime)
SWIFTController.StartWatch(cluster.stopCh)
// Start S3X service CRD watcher
@@ -209,7 +211,8 @@ func (c *ClusterController) onAdd(obj interface{}) {
edgefsv1beta1.GetTargetPlacement(cluster.Spec.Placement),
cluster.Spec.Resources,
cluster.Spec.ResourceProfile,
cluster.ownerRef)
cluster.ownerRef,
cluster.Spec.UseHostLocalTime)
S3XController.StartWatch(cluster.stopCh)
// Start ISCSI service CRD watcher
@@ -221,7 +224,8 @@ func (c *ClusterController) onAdd(obj interface{}) {
edgefsv1beta1.GetTargetPlacement(cluster.Spec.Placement),
cluster.Spec.Resources,
cluster.Spec.ResourceProfile,
cluster.ownerRef)
cluster.ownerRef,
cluster.Spec.UseHostLocalTime)
ISCSIController.StartWatch(cluster.stopCh)
// Start ISGW service CRD watcher
@@ -233,7 +237,8 @@ func (c *ClusterController) onAdd(obj interface{}) {
edgefsv1beta1.GetTargetPlacement(cluster.Spec.Placement),
cluster.Spec.Resources,
cluster.Spec.ResourceProfile,
cluster.ownerRef)
cluster.ownerRef,
cluster.Spec.UseHostLocalTime)
ISGWController.StartWatch(cluster.stopCh)
cluster.childControllers = []childController{
+50 -28
View File
@@ -57,20 +57,21 @@ const (
// Cluster is the edgefs mgr manager
type Cluster struct {
Namespace string
Version string
serviceAccount string
Replicas int
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
context *clusterd.Context
hostNetworkSpec edgefsv1beta1.NetworkSpec
dashboardSpec edgefsv1beta1.DashboardSpec
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
Namespace string
Version string
serviceAccount string
Replicas int
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
context *clusterd.Context
hostNetworkSpec edgefsv1beta1.NetworkSpec
dashboardSpec edgefsv1beta1.DashboardSpec
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
useHostLocalTime bool
}
// New creates an instance of the mgr
@@ -86,6 +87,7 @@ func New(
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
useHostLocalTime bool,
) *Cluster {
if serviceAccount == "" {
@@ -95,20 +97,21 @@ func New(
}
return &Cluster{
context: context,
Namespace: namespace,
serviceAccount: serviceAccount,
annotations: annotations,
placement: placement,
Version: version,
Replicas: 1,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
hostNetworkSpec: hostNetworkSpec,
dashboardSpec: dashboardSpec,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
context: context,
Namespace: namespace,
serviceAccount: serviceAccount,
annotations: annotations,
placement: placement,
Version: version,
Replicas: 1,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
hostNetworkSpec: hostNetworkSpec,
dashboardSpec: dashboardSpec,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
useHostLocalTime: useHostLocalTime,
}
}
@@ -292,6 +295,11 @@ func (c *Cluster) makeUIService(name string) *v1.Service {
func (c *Cluster) makeDeployment(name, clusterName, rookImage string, replicas int32) *apps.Deployment {
volumes := []v1.Volume{}
if c.useHostLocalTime {
volumes = append(volumes, edgefsv1beta1.GetHostLocalTimeVolume())
}
if c.dataVolumeSize.Value() > 0 {
// dataVolume case
volumes = append(volumes, v1.Volume{
@@ -375,6 +383,11 @@ func (c *Cluster) uiContainer(name string, containerImage string) v1.Container {
ReadOnlyRootFilesystem: &readOnlyRootFilesystem,
}
volumeMounts := []v1.VolumeMount{}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
return v1.Container{
Name: name,
Image: containerImage,
@@ -412,6 +425,7 @@ func (c *Cluster) uiContainer(name string, containerImage string) v1.Container {
Protocol: v1.ProtocolTCP,
},
},
VolumeMounts: volumeMounts,
}
}
@@ -440,6 +454,10 @@ func (c *Cluster) restApiContainer(name string, containerImage string) v1.Contai
},
}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
cont := v1.Container{
Name: name,
Image: containerImage,
@@ -532,6 +550,10 @@ func (c *Cluster) grpcProxyContainer(name string, containerImage string) v1.Cont
},
}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
cont := v1.Container{
Name: name,
Image: containerImage,
+4 -4
View File
@@ -47,7 +47,7 @@ func TestStartMGR(t *testing.T) {
Clientset: testop.New(3)}
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
c := New(context, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{}, edgefsv1beta1.NetworkSpec{},
edgefsv1beta1.DashboardSpec{}, v1.ResourceRequirements{}, "", metav1.OwnerReference{})
edgefsv1beta1.DashboardSpec{}, v1.ResourceRequirements{}, "", metav1.OwnerReference{}, false)
// start a basic service
err := c.Start("edgefs")
@@ -74,7 +74,7 @@ func TestPodSpec(t *testing.T) {
Requests: v1.ResourceList{
v1.ResourceMemory: *resource.NewQuantity(1337.0, resource.BinarySI),
},
}, "", metav1.OwnerReference{})
}, "", metav1.OwnerReference{}, false)
d := c.makeDeployment("mgr-a", "rook-edgefs", "edgefs", 1)
assert.NotNil(t, d)
@@ -110,7 +110,7 @@ func TestServiceSpec(t *testing.T) {
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
c := New(&clusterd.Context{}, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{},
edgefsv1beta1.NetworkSpec{}, edgefsv1beta1.DashboardSpec{}, v1.ResourceRequirements{},
"", metav1.OwnerReference{})
"", metav1.OwnerReference{}, false)
s := c.makeMgrService("rook-edgefs-mgr")
assert.NotNil(t, s)
@@ -122,7 +122,7 @@ func TestHostNetwork(t *testing.T) {
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
c := New(&clusterd.Context{Clientset: testop.New(1)}, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{},
edgefsv1beta1.NetworkSpec{ServerIfName: "eth0"}, edgefsv1beta1.DashboardSpec{}, v1.ResourceRequirements{},
"", metav1.OwnerReference{})
"", metav1.OwnerReference{}, false)
d := c.makeDeployment("mgr-a", "a", "edgefs", 1)
assert.NotNil(t, d)
+17
View File
@@ -81,6 +81,10 @@ func (c *Cluster) makeCorosyncContainer(containerImage string) v1.Container {
},
}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
return v1.Container{
Name: "corosync",
Image: containerImage,
@@ -129,6 +133,10 @@ func (c *Cluster) makeAuditdContainer(containerImage string) v1.Container {
},
}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
return v1.Container{
Name: "auditd",
Image: containerImage,
@@ -204,6 +212,11 @@ func (c *Cluster) makeDaemonContainer(containerImage string, dro edgefsv1beta1.D
SubPath: stateVolumeFolderVar,
},
}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
if containerSlaveIndex > 0 {
volumeMounts = append(volumeMounts, []v1.VolumeMount{
{
@@ -386,6 +399,10 @@ func (c *Cluster) createPodSpec(rookImage string, dro edgefsv1beta1.DevicesResur
},
}
if c.useHostLocalTime {
volumes = append(volumes, edgefsv1beta1.GetHostLocalTimeVolume())
}
hostPathDirectoryOrCreate := v1.HostPathDirectoryOrCreate
if c.dataVolumeSize.Value() > 0 {
// dataVolume case
@@ -67,7 +67,7 @@ func TestStorageSpecConfig(t *testing.T) {
c := New(&clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "rook/rook:myversion", "",
storageSpec, "", *resource.NewQuantity(100000.0, resource.BinarySI),
rookalpha.Annotations{}, rookalpha.Placement{}, edgefsv1beta1.NetworkSpec{}, v1.ResourceRequirements{}, "", *resource.NewQuantity(0.0, resource.BinarySI),
metav1.OwnerReference{}, deploymentConfig)
metav1.OwnerReference{}, deploymentConfig, false)
n := c.Storage.ResolveNode(storageSpec.Nodes[0].Name)
storeConfig := config.ToStoreConfig(storageSpec.Nodes[0].Config)
@@ -63,6 +63,7 @@ type Cluster struct {
ownerRef metav1.OwnerReference
serviceAccount string
deploymentConfig edgefsv1beta1.ClusterDeploymentConfig
useHostLocalTime bool
}
// New creates an instance of the Target manager
@@ -82,6 +83,7 @@ func New(
chunkCacheSize resource.Quantity,
ownerRef metav1.OwnerReference,
deploymentConfig edgefsv1beta1.ClusterDeploymentConfig,
useHostLocalTime bool,
) *Cluster {
if serviceAccount == "" {
@@ -106,6 +108,7 @@ func New(
chunkCacheSize: chunkCacheSize,
ownerRef: ownerRef,
deploymentConfig: deploymentConfig,
useHostLocalTime: useHostLocalTime,
}
}
+24 -21
View File
@@ -53,17 +53,18 @@ var ISCSIResource = opkit.CustomResource{
// ISCSIController represents a controller object for iscsi custom resources
type ISCSIController struct {
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
placement rookalpha.Placement
annotations rookalpha.Annotations
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
placement rookalpha.Placement
annotations rookalpha.Annotations
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
useHostLocalTime bool
}
// NewISCSIController create controller for watching ISCSI custom resources created
@@ -78,18 +79,20 @@ func NewISCSIController(
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
useHostLocalTime bool,
) *ISCSIController {
return &ISCSIController{
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
useHostLocalTime: useHostLocalTime,
}
}
+8
View File
@@ -131,6 +131,10 @@ func (c *ISCSIController) makeDeployment(svcname, namespace, rookImage string, i
name := instanceName(svcname)
volumes := []v1.Volume{}
if c.useHostLocalTime {
volumes = append(volumes, edgefsv1beta1.GetHostLocalTimeVolume())
}
if c.dataVolumeSize.Value() > 0 {
// dataVolume case
volumes = append(volumes, v1.Volume{
@@ -220,6 +224,10 @@ func (c *ISCSIController) iscsiContainer(svcname, name, containerImage string, i
},
}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
cont := v1.Container{
Name: name,
Image: containerImage,
+24 -21
View File
@@ -53,17 +53,18 @@ var ISGWResource = opkit.CustomResource{
// ISGWController represents a controller object for isgw custom resources
type ISGWController struct {
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
useHostLocalTime bool
}
// NewISGWController create controller for watching ISGW custom resources created
@@ -78,18 +79,20 @@ func NewISGWController(
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
useHostLocalTime bool,
) *ISGWController {
return &ISGWController{
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
useHostLocalTime: useHostLocalTime,
}
}
+8
View File
@@ -183,6 +183,10 @@ func (c *ISGWController) makeDeployment(svcname, namespace, rookImage string, is
name := instanceName(svcname)
volumes := []v1.Volume{}
if c.useHostLocalTime {
volumes = append(volumes, edgefsv1beta1.GetHostLocalTimeVolume())
}
if c.dataVolumeSize.Value() > 0 {
// dataVolume case
volumes = append(volumes, v1.Volume{
@@ -287,6 +291,10 @@ func (c *ISGWController) isgwContainer(svcname, name, containerImage string, isg
},
}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
cont := v1.Container{
Name: name,
Image: containerImage,
+24 -21
View File
@@ -53,17 +53,18 @@ var NFSResource = opkit.CustomResource{
// NFSController represents a controller object for nfs custom resources
type NFSController struct {
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
useHostLocalTime bool
}
// NewNFSController create controller for watching nfs custom resources created
@@ -78,18 +79,20 @@ func NewNFSController(
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
useHostLocalTime bool,
) *NFSController {
return &NFSController{
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
useHostLocalTime: useHostLocalTime,
}
}
+22 -12
View File
@@ -135,6 +135,10 @@ func (c *NFSController) makeDeployment(svcname, namespace, rookImage string, nfs
name := instanceName(svcname)
volumes := []v1.Volume{}
if c.useHostLocalTime {
volumes = append(volumes, edgefsv1beta1.GetHostLocalTimeVolume())
}
if c.dataVolumeSize.Value() > 0 {
// dataVolume case
volumes = append(volumes, v1.Volume{
@@ -209,6 +213,23 @@ func (c *NFSController) nfsContainer(svcname, name, containerImage string, nfsSp
},
}
volumeMounts := []v1.VolumeMount{
{
Name: dataVolumeName,
MountPath: "/opt/nedge/etc.target",
SubPath: etcVolumeFolder,
},
{
Name: dataVolumeName,
MountPath: "/opt/nedge/var/run",
SubPath: stateVolumeFolder,
},
}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
cont := v1.Container{
Name: name,
Image: containerImage,
@@ -257,18 +278,7 @@ func (c *NFSController) nfsContainer(svcname, name, containerImage string, nfsSp
{Name: "rquotad-tcp", ContainerPort: 875, Protocol: v1.ProtocolTCP},
{Name: "rquotad-udp", ContainerPort: 875, Protocol: v1.ProtocolUDP},
},
VolumeMounts: []v1.VolumeMount{
{
Name: dataVolumeName,
MountPath: "/opt/nedge/etc.target",
SubPath: etcVolumeFolder,
},
{
Name: dataVolumeName,
MountPath: "/opt/nedge/var/run",
SubPath: stateVolumeFolder,
},
},
VolumeMounts: volumeMounts,
}
if nfsSpec.RelaxedDirUpdates {
+24 -21
View File
@@ -53,17 +53,18 @@ var S3Resource = opkit.CustomResource{
// S3Controller represents a controller object for s3 custom resources
type S3Controller struct {
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
useHostLocalTime bool
}
// NewS3Controller create controller for watching S3 custom resources created
@@ -78,18 +79,20 @@ func NewS3Controller(
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
useHostLocalTime bool,
) *S3Controller {
return &S3Controller{
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
useHostLocalTime: useHostLocalTime,
}
}
+8
View File
@@ -178,6 +178,10 @@ func (c *S3Controller) makeDeployment(svcname, namespace, rookImage, imageArgs s
name := instanceName(svcname)
volumes := []v1.Volume{}
if c.useHostLocalTime {
volumes = append(volumes, edgefsv1beta1.GetHostLocalTimeVolume())
}
// add ssl certificate volume if defined
if len(s3Spec.SSLCertificateRef) > 0 {
volumes = append(volumes, v1.Volume{
@@ -287,6 +291,10 @@ func (c *S3Controller) s3Container(svcname, name, containerImage, args string, s
},
}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
if len(s3Spec.SSLCertificateRef) > 0 {
volumeMounts = append(volumeMounts, v1.VolumeMount{Name: sslCertVolumeName, MountPath: sslMountPath})
}
+24 -21
View File
@@ -53,17 +53,18 @@ var S3XResource = opkit.CustomResource{
// S3XController represents a controller object for s3x custom resources
type S3XController struct {
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
useHostLocalTime bool
}
// NewS3XController create controller for watching S3X custom resources created
@@ -78,18 +79,20 @@ func NewS3XController(
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
useHostLocalTime bool,
) *S3XController {
return &S3XController{
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
useHostLocalTime: useHostLocalTime,
}
}
+8
View File
@@ -154,6 +154,10 @@ func (c *S3XController) makeDeployment(svcname, namespace, rookImage string, s3x
name := instanceName(svcname)
volumes := []v1.Volume{}
if c.useHostLocalTime {
volumes = append(volumes, edgefsv1beta1.GetHostLocalTimeVolume())
}
// add ssl certificate volume if defined
if len(s3xSpec.SSLCertificateRef) > 0 {
volumes = append(volumes, v1.Volume{
@@ -271,6 +275,10 @@ func (c *S3XController) s3xContainer(svcname, name, containerImage string, s3xSp
},
}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
if len(s3xSpec.SSLCertificateRef) > 0 {
volumeMounts = append(volumeMounts, v1.VolumeMount{Name: sslCertVolumeName, MountPath: sslMountPath})
}
+23 -20
View File
@@ -53,16 +53,17 @@ var SWIFTResource = opkit.CustomResource{
// SWIFTController represents a controller object for swift custom resources
type SWIFTController struct {
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
context *clusterd.Context
namespace string
rookImage string
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
useHostLocalTime bool
}
// NewSWIFTController create controller for watching SWIFT custom resources created
@@ -77,18 +78,20 @@ func NewSWIFTController(
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
useHostLocalTime bool,
) *SWIFTController {
return &SWIFTController{
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
context: context,
namespace: namespace,
rookImage: rookImage,
hostNetwork: hostNetwork,
dataDirHostPath: dataDirHostPath,
dataVolumeSize: dataVolumeSize,
placement: placement,
resources: resources,
resourceProfile: resourceProfile,
ownerRef: ownerRef,
useHostLocalTime: useHostLocalTime,
}
}
+8
View File
@@ -167,6 +167,10 @@ func (c *SWIFTController) makeDeployment(svcname, namespace, rookImage, imageArg
name := instanceName(svcname)
volumes := []v1.Volume{}
if c.useHostLocalTime {
volumes = append(volumes, edgefsv1beta1.GetHostLocalTimeVolume())
}
// add ssl certificate volume if defined
if len(swiftSpec.SSLCertificateRef) > 0 {
volumes = append(volumes, v1.Volume{
@@ -274,6 +278,10 @@ func (c *SWIFTController) swiftContainer(svcname, name, containerImage, args str
},
}
if c.useHostLocalTime {
volumeMounts = append(volumeMounts, edgefsv1beta1.GetHostLocalTimeVolumeMount())
}
if len(swiftSpec.SSLCertificateRef) > 0 {
volumeMounts = append(volumeMounts, v1.VolumeMount{Name: sslCertVolumeName, MountPath: sslMountPath})
}