edgefs: Replace NetworkSpec with rookv1alpha2 version
edgefs: Change IsHost and IsMultus network func signature edgefs: Reorder mgr annotations declaration edgefs: Update cluster CRD docs and example for NetworkSpec Signed-off-by: giovanism <giovanism@outlook.co.id>
This commit is contained in:
24 files changed
+140
-192
No files matched your search
@@ -73,9 +73,7 @@ If this value is empty, each pod will get an ephemeral directory to store their
|
||||
- `dataVolumeSize`: Alternative to `dataDirHostPath`. If defined then Cluster CRD operator will disregard `dataDirHostPath` setting and instead will automatically claim persistent volume. If `storage` settings not provided then provisioned volume will also be used as a storage device for Target pods (automatic provisioning via `rtlfs`).
|
||||
- `dashboard`: This specification may be used to override and enable additional [EdgeFS UI Dashboard](edgefs-ui.md) functionality.
|
||||
- `localAddr`: Specifies local IP address to be used as Kubernetes external IP.
|
||||
- `network`: If defined then host network will be enabled for the cluster and services. This is optional and if not defined then `eth0` will be used to construct cluster bucket network.
|
||||
- `serverIfName`: Specifies data daemon networking interface name. If not defined then `eth0` is assumed.
|
||||
- `brokerIfName`: Specifies broker daemon networking interface name. If not defined then `eth0` is assumed.
|
||||
- `network`: [network configuration settings](#network-configuration-settings)
|
||||
- `devicesResurrectMode`: When enabled, this mode attempts to recreate cluster based on previous CRD definition. If this flag set to one of the parameters, then operator will only adjust networking. Often used when clean up of old devices is needed. Only applicable when used with `dataDirHostPath`.
|
||||
- `restore`: Attempt to restart and restore previously enabled cluster CRD.
|
||||
- `restoreZap`: Attempt to re-initialize previously selected `devices` prior to restore. By default cluster assumes that selected devices have no logical partitions and considered empty.
|
||||
@@ -160,6 +158,16 @@ A Placement configuration is specified (according to the Kubernetes PodSpec) as:
|
||||
|
||||
The `mgr` pod does not allow `Pod` affinity or anti-affinity. This is because of the mgrs having built-in anti-affinity with each other through the operator. The operator chooses which nodes are to run a mgr on. Each mgr is then tied to a node with a node selector using a hostname.
|
||||
|
||||
### Network Configuration Settings
|
||||
Configure the network that will be enabled for the cluster and services. This is optional and if not defined then the cluster default network's `eth0` will be used to construct cluster bucket network.
|
||||
- `provider`: Specifies the network provider that will be used to connect the network interface. You can choose between `host`, and `multus`.
|
||||
- `selectors`: List the network selector that will be used associated by a key. The available keys are `server` and `broker`.
|
||||
- `server`: Specifies data daemon host's networking interface name or multus's network attachment selection annotation.
|
||||
- `broker`: Specifies broker daemon host's networking interface name or multus's network attachment selection annotation.
|
||||
|
||||
For `multus` network provider, an already working cluster with multus networking is required. Network attachment definition that later will be attached to the cluster needs to be created before the Cluster CRD.
|
||||
You can add the multus network attachment selection annotation selecting the created network attachment definition on `selectors`. Make sure to define the interface name that will be assigned by multus and choose only one syntax either the short or JSON form to define all the available keys.
|
||||
|
||||
### Cluster-wide Resources Configuration Settings
|
||||
Resources should be specified so that the rook components are handled after [Kubernetes Pod Quality of Service classes](https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/).
|
||||
This allows to keep rook components running when for example a node runs out of memory and the rook components are not killed depending on their Quality of Service class.
|
||||
@@ -305,6 +313,26 @@ spec:
|
||||
memory: "4096Mi"
|
||||
```
|
||||
|
||||
### Network Configuration: Multus network
|
||||
An example on how to configure the cluster network to use multus network. Here, a NetworkAttachmentDefinition named flannel on rook-edgefs namespace is assumed.
|
||||
|
||||
```yaml
|
||||
apiVersion: edgefs.rook.io/v1beta1
|
||||
kind: Cluster
|
||||
metadata:
|
||||
name: rook-edgefs
|
||||
namespace: rook-edgefs
|
||||
spec:
|
||||
edgefsImageName: edgefs/edgefs:1.2.31
|
||||
dataDirHostPath: /var/lib/rook
|
||||
serviceAccount: rook-edgefs-cluster
|
||||
network:
|
||||
provider: multus
|
||||
selectors:
|
||||
server: flannel@net1
|
||||
broker: flannel@net2
|
||||
```
|
||||
|
||||
## Common Cluster Resources
|
||||
Each EdgeFS cluster must be created in a namespace and also give access to the Rook operator to manage the cluster in the namespace. Creating the namespace and these controls must be added to each of the examples previously shown.
|
||||
|
||||
|
||||
@@ -135,9 +135,11 @@ spec:
|
||||
#devicesResurrectMode: "restoreZapWait"
|
||||
#dashboard:
|
||||
# localAddr: 10.3.30.75
|
||||
#network: # cluster level networking configuration aka "host network"
|
||||
# serverIfName: "enp2s0f0"
|
||||
# brokerIfName: "enp2s0f0"
|
||||
#network: # cluster level networking configuration
|
||||
# provider: host
|
||||
# selectors:
|
||||
# server: "enp2s0f0"
|
||||
# broker: "enp2s0f0"
|
||||
#skipHostPrepare: true
|
||||
#maxContainerCapacity: 132Ti
|
||||
#trlogProcessingInterval: 2 # set transaction log processing interval to 2s to speed up ISGW Link delivery
|
||||
|
||||
@@ -16,8 +16,6 @@ limitations under the License.
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
@@ -60,7 +58,7 @@ type ClusterSpec struct {
|
||||
Annotations rook.AnnotationsSpec `json:"annotations,omitempty"`
|
||||
// The placement-related configuration to pass to kubernetes (affinity, node selector, tolerations).
|
||||
Placement rook.PlacementSpec `json:"placement,omitempty"`
|
||||
Network NetworkSpec `json:"network,omitempty"`
|
||||
Network rook.NetworkSpec `json:"network,omitempty"`
|
||||
Dashboard DashboardSpec `json:"dashboard,omitempty"`
|
||||
// Resources set resource requests and limits
|
||||
Resources v1.ResourceRequirements `json:"resources,omitempty"`
|
||||
@@ -83,61 +81,6 @@ type DashboardSpec struct {
|
||||
LocalAddr string `json:"localAddr"`
|
||||
}
|
||||
|
||||
type NetworkSelector string
|
||||
|
||||
type NetworkSpec struct {
|
||||
Provider string `json:"provider"`
|
||||
ServerIfName string `json:"serverIfName"`
|
||||
BrokerIfName string `json:"brokerIfName"`
|
||||
Selectors map[string]NetworkSelector `json:"selectors"`
|
||||
}
|
||||
|
||||
func IsHostNetworkDefined(networkSpec NetworkSpec) bool {
|
||||
// backward compat
|
||||
if len(networkSpec.Provider) == 0 && len(networkSpec.ServerIfName) > 0 {
|
||||
return true
|
||||
}
|
||||
if len(networkSpec.Provider) > 0 && networkSpec.Provider == "host" && len(networkSpec.ServerIfName) > 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsMultusNetworkDefined(networkSpec NetworkSpec) bool {
|
||||
return !IsHostNetworkDefined(networkSpec) && networkSpec.Provider == "multus"
|
||||
}
|
||||
|
||||
func GetMultusIfName(multusSelector NetworkSelector) string {
|
||||
nameAtInterface := string(multusSelector)
|
||||
var ifName string
|
||||
multusNameComponents := strings.Split(nameAtInterface, "@")
|
||||
if len(multusNameComponents) == 2 {
|
||||
ifName = multusNameComponents[1]
|
||||
} else {
|
||||
ifName = "net1"
|
||||
}
|
||||
return ifName
|
||||
}
|
||||
|
||||
func ApplyMultus(networkSpec NetworkSpec, objectMeta *metav1.ObjectMeta) {
|
||||
v := make([]string, 0, 2)
|
||||
if serverSelector, exist := networkSpec.Selectors["server"]; exist {
|
||||
v = append(v, string(serverSelector))
|
||||
}
|
||||
if brokerSelector, exist := networkSpec.Selectors["broker"]; exist {
|
||||
brokerSelectorStr := string(brokerSelector)
|
||||
|
||||
// no duplicated selection annotation
|
||||
if len(v) == 0 || v[0] != brokerSelectorStr {
|
||||
v = append(v, brokerSelectorStr)
|
||||
}
|
||||
}
|
||||
t := rook.Annotations{
|
||||
"k8s.v1.cni.cncf.io/networks": strings.Join(v, ", "),
|
||||
}
|
||||
t.ApplyToObjectMeta(objectMeta)
|
||||
}
|
||||
|
||||
type ClusterState string
|
||||
|
||||
const (
|
||||
|
||||
@@ -631,29 +631,6 @@ func (in *NFSSpec) DeepCopy() *NFSSpec {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) {
|
||||
*out = *in
|
||||
if in.Selectors != nil {
|
||||
in, out := &in.Selectors, &out.Selectors
|
||||
*out = make(map[string]NetworkSelector, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec.
|
||||
func (in *NetworkSpec) DeepCopy() *NetworkSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NetworkSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RTDevice) DeepCopyInto(out *RTDevice) {
|
||||
*out = *in
|
||||
|
||||
@@ -112,7 +112,7 @@ func (c *cluster) needPrivelege(deploymentType string) bool {
|
||||
|
||||
needPriveleges := false
|
||||
// Set privileges==true in case of HostNetwork
|
||||
if len(c.Spec.Network.ServerIfName) > 0 || len(c.Spec.Network.BrokerIfName) > 0 {
|
||||
if c.Spec.Network.IsHost() {
|
||||
needPriveleges = true
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"encoding/json"
|
||||
|
||||
edgefsv1beta1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1beta1"
|
||||
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
|
||||
"github.com/rook/rook/pkg/operator/edgefs/cluster/target"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@@ -48,44 +49,33 @@ func (c *cluster) createClusterConfigMap(deploymentConfig edgefsv1beta1.ClusterD
|
||||
|
||||
serverIfName := defaultServerIfName
|
||||
brokerIfName := defaultBrokerIfName
|
||||
if edgefsv1beta1.IsHostNetworkDefined(c.Spec.Network) {
|
||||
if len(c.Spec.Network.ServerIfName) > 0 && len(c.Spec.Network.BrokerIfName) > 0 {
|
||||
serverIfName = c.Spec.Network.ServerIfName
|
||||
brokerIfName = c.Spec.Network.BrokerIfName
|
||||
} else if len(c.Spec.Network.ServerIfName) > 0 {
|
||||
serverIfName = c.Spec.Network.ServerIfName
|
||||
brokerIfName = c.Spec.Network.ServerIfName
|
||||
} else if len(c.Spec.Network.BrokerIfName) > 0 {
|
||||
serverIfName = c.Spec.Network.BrokerIfName
|
||||
brokerIfName = c.Spec.Network.BrokerIfName
|
||||
} else {
|
||||
serverSelector, serverDefined := c.Spec.Network.Selectors["server"]
|
||||
brokerSelector, brokerDefined := c.Spec.Network.Selectors["broker"]
|
||||
|
||||
if serverDefined && brokerDefined {
|
||||
serverIfName = string(serverSelector)
|
||||
brokerIfName = string(brokerSelector)
|
||||
} else if serverDefined {
|
||||
serverIfName = string(serverSelector)
|
||||
brokerIfName = string(serverSelector)
|
||||
} else if brokerDefined {
|
||||
serverIfName = string(brokerSelector)
|
||||
brokerIfName = string(brokerSelector)
|
||||
}
|
||||
}
|
||||
} else if edgefsv1beta1.IsMultusNetworkDefined(c.Spec.Network) {
|
||||
if c.Spec.Network.IsHost() {
|
||||
serverSelector, serverDefined := c.Spec.Network.Selectors["server"]
|
||||
brokerSelector, brokerDefined := c.Spec.Network.Selectors["broker"]
|
||||
|
||||
if serverDefined && brokerDefined {
|
||||
serverIfName = edgefsv1beta1.GetMultusIfName(serverSelector)
|
||||
brokerIfName = edgefsv1beta1.GetMultusIfName(brokerSelector)
|
||||
serverIfName = string(serverSelector)
|
||||
brokerIfName = string(brokerSelector)
|
||||
} else if serverDefined {
|
||||
serverIfName = edgefsv1beta1.GetMultusIfName(serverSelector)
|
||||
brokerIfName = edgefsv1beta1.GetMultusIfName(serverSelector)
|
||||
serverIfName = string(serverSelector)
|
||||
brokerIfName = string(serverSelector)
|
||||
} else if brokerDefined {
|
||||
serverIfName = edgefsv1beta1.GetMultusIfName(brokerSelector)
|
||||
brokerIfName = edgefsv1beta1.GetMultusIfName(brokerSelector)
|
||||
serverIfName = string(brokerSelector)
|
||||
brokerIfName = string(brokerSelector)
|
||||
}
|
||||
} else if c.Spec.Network.IsMultus() {
|
||||
serverSelector, serverDefined := c.Spec.Network.Selectors["server"]
|
||||
brokerSelector, brokerDefined := c.Spec.Network.Selectors["broker"]
|
||||
|
||||
if serverDefined && brokerDefined {
|
||||
serverIfName = rookalpha.GetMultusIfName(serverSelector)
|
||||
brokerIfName = rookalpha.GetMultusIfName(brokerSelector)
|
||||
} else if serverDefined {
|
||||
serverIfName = rookalpha.GetMultusIfName(serverSelector)
|
||||
brokerIfName = rookalpha.GetMultusIfName(serverSelector)
|
||||
} else if brokerDefined {
|
||||
serverIfName = rookalpha.GetMultusIfName(brokerSelector)
|
||||
brokerIfName = rookalpha.GetMultusIfName(brokerSelector)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ type Cluster struct {
|
||||
annotations rookalpha.Annotations
|
||||
placement rookalpha.Placement
|
||||
context *clusterd.Context
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec
|
||||
NetworkSpec rookalpha.NetworkSpec
|
||||
dashboardSpec edgefsv1beta1.DashboardSpec
|
||||
resources v1.ResourceRequirements
|
||||
resourceProfile string
|
||||
@@ -82,7 +82,7 @@ func New(
|
||||
dataVolumeSize resource.Quantity,
|
||||
annotations rookalpha.Annotations,
|
||||
placement rookalpha.Placement,
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec,
|
||||
NetworkSpec rookalpha.NetworkSpec,
|
||||
dashboardSpec edgefsv1beta1.DashboardSpec,
|
||||
resources v1.ResourceRequirements,
|
||||
resourceProfile string,
|
||||
@@ -330,21 +330,23 @@ func (c *Cluster) makeDeployment(name, clusterName, rookImage string, replicas i
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
Volumes: volumes,
|
||||
HostIPC: true,
|
||||
HostNetwork: edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec),
|
||||
HostNetwork: c.NetworkSpec.IsHost(),
|
||||
NodeSelector: map[string]string{c.Namespace: "cluster"},
|
||||
},
|
||||
}
|
||||
if edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec) {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
}
|
||||
|
||||
// Add the prometheus.io scrape annoations by default
|
||||
podSpec.ObjectMeta.Annotations = map[string]string{
|
||||
"prometheus.io/scrape": "true",
|
||||
"prometheus.io/port": strconv.Itoa(defaultMetricsPort),
|
||||
}
|
||||
if edgefsv1beta1.IsMultusNetworkDefined(c.NetworkSpec) {
|
||||
edgefsv1beta1.ApplyMultus(c.NetworkSpec, &podSpec.ObjectMeta)
|
||||
|
||||
if c.NetworkSpec.IsHost() {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
} else if c.NetworkSpec.IsMultus() {
|
||||
rookalpha.ApplyMultus(c.NetworkSpec, &podSpec.ObjectMeta)
|
||||
}
|
||||
|
||||
c.annotations.ApplyToObjectMeta(&podSpec.ObjectMeta)
|
||||
c.placement.ApplyToPodSpec(&podSpec.Spec)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
testop "github.com/rook/rook/pkg/operator/test"
|
||||
exectest "github.com/rook/rook/pkg/util/exec/test"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@@ -46,7 +46,7 @@ func TestStartMGR(t *testing.T) {
|
||||
ConfigDir: configDir,
|
||||
Clientset: testop.New(3)}
|
||||
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
|
||||
c := New(context, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{}, edgefsv1beta1.NetworkSpec{},
|
||||
c := New(context, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{}, rookalpha.NetworkSpec{},
|
||||
edgefsv1beta1.DashboardSpec{}, v1.ResourceRequirements{}, "", metav1.OwnerReference{}, false)
|
||||
|
||||
// start a basic service
|
||||
@@ -67,7 +67,7 @@ func validateStart(t *testing.T, c *Cluster) {
|
||||
func TestPodSpec(t *testing.T) {
|
||||
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
|
||||
c := New(&clusterd.Context{Clientset: testop.New(1)}, "ns", "rook/rook:myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{},
|
||||
edgefsv1beta1.NetworkSpec{}, edgefsv1beta1.DashboardSpec{}, v1.ResourceRequirements{
|
||||
rookalpha.NetworkSpec{}, edgefsv1beta1.DashboardSpec{}, v1.ResourceRequirements{
|
||||
Limits: v1.ResourceList{
|
||||
v1.ResourceCPU: *resource.NewQuantity(100.0, resource.BinarySI),
|
||||
},
|
||||
@@ -109,7 +109,7 @@ func TestPodSpec(t *testing.T) {
|
||||
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{},
|
||||
rookalpha.NetworkSpec{}, edgefsv1beta1.DashboardSpec{}, v1.ResourceRequirements{},
|
||||
"", metav1.OwnerReference{}, false)
|
||||
|
||||
s := c.makeMgrService("rook-edgefs-mgr")
|
||||
@@ -120,8 +120,14 @@ func TestServiceSpec(t *testing.T) {
|
||||
|
||||
func TestHostNetwork(t *testing.T) {
|
||||
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
|
||||
net := rookalpha.NetworkSpec{
|
||||
Provider: "host",
|
||||
Selectors: map[string]rookalpha.NetworkSelector{
|
||||
"server": "eth0",
|
||||
},
|
||||
}
|
||||
c := New(&clusterd.Context{Clientset: testop.New(1)}, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{},
|
||||
edgefsv1beta1.NetworkSpec{ServerIfName: "eth0"}, edgefsv1beta1.DashboardSpec{}, v1.ResourceRequirements{},
|
||||
net, edgefsv1beta1.DashboardSpec{}, v1.ResourceRequirements{},
|
||||
"", metav1.OwnerReference{}, false)
|
||||
|
||||
d := c.makeDeployment("mgr-a", "a", "edgefs", 1)
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
edgefsv1beta1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1beta1"
|
||||
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
|
||||
"github.com/rook/rook/pkg/operator/edgefs/cluster/target/config"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
@@ -361,7 +362,7 @@ func (c *Cluster) createPodSpec(rookImage string, dro edgefsv1beta1.DevicesResur
|
||||
terminationGracePeriodSeconds := int64(60)
|
||||
|
||||
DNSPolicy := v1.DNSClusterFirst
|
||||
if edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec) {
|
||||
if c.NetworkSpec.IsHost() {
|
||||
DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
}
|
||||
|
||||
@@ -510,7 +511,7 @@ func (c *Cluster) createPodSpec(rookImage string, dro edgefsv1beta1.DevicesResur
|
||||
DNSPolicy: DNSPolicy,
|
||||
HostIPC: true,
|
||||
HostPID: true,
|
||||
HostNetwork: edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec),
|
||||
HostNetwork: c.NetworkSpec.IsHost(),
|
||||
Volumes: volumes,
|
||||
}
|
||||
}
|
||||
@@ -563,13 +564,11 @@ func (c *Cluster) makeStatefulSet(replicas int32, rookImage string, dro edgefsv1
|
||||
|
||||
k8sutil.SetOwnerRef(&statefulSet.ObjectMeta, &c.ownerRef)
|
||||
|
||||
if edgefsv1beta1.IsMultusNetworkDefined(c.NetworkSpec) {
|
||||
edgefsv1beta1.ApplyMultus(c.NetworkSpec, &statefulSet.ObjectMeta)
|
||||
if c.NetworkSpec.IsMultus() {
|
||||
rookalpha.ApplyMultus(c.NetworkSpec, &statefulSet.ObjectMeta)
|
||||
rookalpha.ApplyMultus(c.NetworkSpec, &statefulSet.Spec.Template.ObjectMeta)
|
||||
}
|
||||
c.annotations.ApplyToObjectMeta(&statefulSet.ObjectMeta)
|
||||
if edgefsv1beta1.IsMultusNetworkDefined(c.NetworkSpec) {
|
||||
edgefsv1beta1.ApplyMultus(c.NetworkSpec, &statefulSet.Spec.Template.ObjectMeta)
|
||||
}
|
||||
c.annotations.ApplyToObjectMeta(&statefulSet.Spec.Template.ObjectMeta)
|
||||
c.placement.ApplyToPodSpec(&statefulSet.Spec.Template.Spec)
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ func TestStorageSpecConfig(t *testing.T) {
|
||||
deploymentConfig := edgefsv1beta1.ClusterDeploymentConfig{}
|
||||
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),
|
||||
rookalpha.Annotations{}, rookalpha.Placement{}, rookalpha.NetworkSpec{}, v1.ResourceRequirements{}, "", *resource.NewQuantity(0.0, resource.BinarySI),
|
||||
metav1.OwnerReference{}, deploymentConfig, false)
|
||||
|
||||
n := c.Storage.ResolveNode(storageSpec.Nodes[0].Name)
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -55,7 +55,7 @@ type Cluster struct {
|
||||
Storage rookalpha.StorageScopeSpec
|
||||
dataDirHostPath string
|
||||
dataVolumeSize resource.Quantity
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec
|
||||
NetworkSpec rookalpha.NetworkSpec
|
||||
Privileged bool
|
||||
resources v1.ResourceRequirements
|
||||
resourceProfile string
|
||||
@@ -77,7 +77,7 @@ func New(
|
||||
dataVolumeSize resource.Quantity,
|
||||
annotations rookalpha.Annotations,
|
||||
placement rookalpha.Placement,
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec,
|
||||
NetworkSpec rookalpha.NetworkSpec,
|
||||
resources v1.ResourceRequirements,
|
||||
resourceProfile string,
|
||||
chunkCacheSize resource.Quantity,
|
||||
@@ -102,7 +102,7 @@ func New(
|
||||
dataDirHostPath: dataDirHostPath,
|
||||
dataVolumeSize: dataVolumeSize,
|
||||
NetworkSpec: NetworkSpec,
|
||||
Privileged: (edgefsv1beta1.IsHostNetworkDefined(NetworkSpec) || os.Getenv("ROOK_HOSTPATH_REQUIRES_PRIVILEGED") == "true"),
|
||||
Privileged: (NetworkSpec.IsHost() || os.Getenv("ROOK_HOSTPATH_REQUIRES_PRIVILEGED") == "true"),
|
||||
resources: resources,
|
||||
resourceProfile: resourceProfile,
|
||||
chunkCacheSize: chunkCacheSize,
|
||||
|
||||
@@ -180,7 +180,7 @@ func (c *cluster) retrieveDeploymentConfig() (edgefsv1beta1.ClusterDeploymentCon
|
||||
}
|
||||
|
||||
// Set privileges==true in case of HostNetwork
|
||||
if edgefsv1beta1.IsHostNetworkDefined(c.Spec.Network) {
|
||||
if c.Spec.Network.IsHost() {
|
||||
deploymentConfig.NeedPrivileges = true
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ type ISCSIController struct {
|
||||
context *clusterd.Context
|
||||
namespace string
|
||||
rookImage string
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec
|
||||
NetworkSpec rookalpha.NetworkSpec
|
||||
dataDirHostPath string
|
||||
dataVolumeSize resource.Quantity
|
||||
placement rookalpha.Placement
|
||||
@@ -72,7 +72,7 @@ func NewISCSIController(
|
||||
context *clusterd.Context,
|
||||
namespace string,
|
||||
rookImage string,
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec,
|
||||
NetworkSpec rookalpha.NetworkSpec,
|
||||
dataDirHostPath string,
|
||||
dataVolumeSize resource.Quantity,
|
||||
placement rookalpha.Placement,
|
||||
|
||||
@@ -22,10 +22,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
edgefsv1beta1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1beta1"
|
||||
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@@ -167,17 +168,16 @@ func (c *ISCSIController) makeDeployment(svcname, namespace, rookImage string, i
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
Volumes: volumes,
|
||||
HostIPC: true,
|
||||
HostNetwork: edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec),
|
||||
HostNetwork: c.NetworkSpec.IsHost(),
|
||||
NodeSelector: map[string]string{namespace: "cluster"},
|
||||
ServiceAccountName: serviceAccountName,
|
||||
},
|
||||
}
|
||||
if edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec) {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
}
|
||||
|
||||
if edgefsv1beta1.IsMultusNetworkDefined(c.NetworkSpec) {
|
||||
edgefsv1beta1.ApplyMultus(c.NetworkSpec, &podSpec.ObjectMeta)
|
||||
if c.NetworkSpec.IsHost() {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
} else if c.NetworkSpec.IsMultus() {
|
||||
rookalpha.ApplyMultus(c.NetworkSpec, &podSpec.ObjectMeta)
|
||||
}
|
||||
|
||||
iscsiSpec.Annotations.ApplyToObjectMeta(&podSpec.ObjectMeta)
|
||||
|
||||
@@ -56,7 +56,7 @@ type ISGWController struct {
|
||||
context *clusterd.Context
|
||||
namespace string
|
||||
rookImage string
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec
|
||||
NetworkSpec rookalpha.NetworkSpec
|
||||
dataDirHostPath string
|
||||
dataVolumeSize resource.Quantity
|
||||
annotations rookalpha.Annotations
|
||||
@@ -72,7 +72,7 @@ func NewISGWController(
|
||||
context *clusterd.Context,
|
||||
namespace string,
|
||||
rookImage string,
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec,
|
||||
NetworkSpec rookalpha.NetworkSpec,
|
||||
dataDirHostPath string,
|
||||
dataVolumeSize resource.Quantity,
|
||||
placement rookalpha.Placement,
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@@ -219,12 +219,13 @@ func (c *ISGWController) makeDeployment(svcname, namespace, rookImage string, is
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
Volumes: volumes,
|
||||
HostIPC: true,
|
||||
HostNetwork: edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec),
|
||||
HostNetwork: c.NetworkSpec.IsHost(),
|
||||
NodeSelector: map[string]string{namespace: "cluster"},
|
||||
ServiceAccountName: serviceAccountName,
|
||||
},
|
||||
}
|
||||
if edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec) {
|
||||
|
||||
if c.NetworkSpec.IsHost() {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ type NFSController struct {
|
||||
context *clusterd.Context
|
||||
namespace string
|
||||
rookImage string
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec
|
||||
NetworkSpec rookalpha.NetworkSpec
|
||||
dataDirHostPath string
|
||||
dataVolumeSize resource.Quantity
|
||||
annotations rookalpha.Annotations
|
||||
@@ -72,7 +72,7 @@ func NewNFSController(
|
||||
context *clusterd.Context,
|
||||
namespace string,
|
||||
rookImage string,
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec,
|
||||
NetworkSpec rookalpha.NetworkSpec,
|
||||
dataDirHostPath string,
|
||||
dataVolumeSize resource.Quantity,
|
||||
placement rookalpha.Placement,
|
||||
|
||||
@@ -21,10 +21,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
edgefsv1beta1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1beta1"
|
||||
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@@ -171,17 +172,16 @@ func (c *NFSController) makeDeployment(svcname, namespace, rookImage string, nfs
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
Volumes: volumes,
|
||||
HostIPC: true,
|
||||
HostNetwork: edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec),
|
||||
HostNetwork: c.NetworkSpec.IsHost(),
|
||||
NodeSelector: map[string]string{namespace: "cluster"},
|
||||
ServiceAccountName: serviceAccountName,
|
||||
},
|
||||
}
|
||||
if edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec) {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
}
|
||||
|
||||
if edgefsv1beta1.IsMultusNetworkDefined(c.NetworkSpec) {
|
||||
edgefsv1beta1.ApplyMultus(c.NetworkSpec, &podSpec.ObjectMeta)
|
||||
if c.NetworkSpec.IsHost() {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
} else if c.NetworkSpec.IsMultus() {
|
||||
rookalpha.ApplyMultus(c.NetworkSpec, &podSpec.ObjectMeta)
|
||||
}
|
||||
nfsSpec.Annotations.ApplyToObjectMeta(&podSpec.ObjectMeta)
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ type S3Controller struct {
|
||||
context *clusterd.Context
|
||||
namespace string
|
||||
rookImage string
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec
|
||||
NetworkSpec rookalpha.NetworkSpec
|
||||
dataDirHostPath string
|
||||
dataVolumeSize resource.Quantity
|
||||
annotations rookalpha.Annotations
|
||||
@@ -72,7 +72,7 @@ func NewS3Controller(
|
||||
context *clusterd.Context,
|
||||
namespace string,
|
||||
rookImage string,
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec,
|
||||
NetworkSpec rookalpha.NetworkSpec,
|
||||
dataDirHostPath string,
|
||||
dataVolumeSize resource.Quantity,
|
||||
placement rookalpha.Placement,
|
||||
|
||||
@@ -22,10 +22,11 @@ import (
|
||||
"strings"
|
||||
|
||||
edgefsv1beta1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1beta1"
|
||||
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@@ -236,17 +237,16 @@ func (c *S3Controller) makeDeployment(svcname, namespace, rookImage, imageArgs s
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
Volumes: volumes,
|
||||
HostIPC: true,
|
||||
HostNetwork: edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec),
|
||||
HostNetwork: c.NetworkSpec.IsHost(),
|
||||
NodeSelector: map[string]string{namespace: "cluster"},
|
||||
ServiceAccountName: serviceAccountName,
|
||||
},
|
||||
}
|
||||
if edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec) {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
}
|
||||
|
||||
if edgefsv1beta1.IsMultusNetworkDefined(c.NetworkSpec) {
|
||||
edgefsv1beta1.ApplyMultus(c.NetworkSpec, &podSpec.ObjectMeta)
|
||||
if c.NetworkSpec.IsHost() {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
} else if c.NetworkSpec.IsMultus() {
|
||||
rookalpha.ApplyMultus(c.NetworkSpec, &podSpec.ObjectMeta)
|
||||
}
|
||||
|
||||
// apply current S3 CRD options to pod's specification
|
||||
|
||||
@@ -56,7 +56,7 @@ type S3XController struct {
|
||||
context *clusterd.Context
|
||||
namespace string
|
||||
rookImage string
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec
|
||||
NetworkSpec rookalpha.NetworkSpec
|
||||
dataDirHostPath string
|
||||
dataVolumeSize resource.Quantity
|
||||
annotations rookalpha.Annotations
|
||||
@@ -72,7 +72,7 @@ func NewS3XController(
|
||||
context *clusterd.Context,
|
||||
namespace string,
|
||||
rookImage string,
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec,
|
||||
NetworkSpec rookalpha.NetworkSpec,
|
||||
dataDirHostPath string,
|
||||
dataVolumeSize resource.Quantity,
|
||||
placement rookalpha.Placement,
|
||||
|
||||
@@ -22,10 +22,11 @@ import (
|
||||
"strings"
|
||||
|
||||
edgefsv1beta1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1beta1"
|
||||
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@@ -220,17 +221,16 @@ func (c *S3XController) makeDeployment(svcname, namespace, rookImage string, s3x
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
Volumes: volumes,
|
||||
HostIPC: true,
|
||||
HostNetwork: edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec),
|
||||
HostNetwork: c.NetworkSpec.IsHost(),
|
||||
NodeSelector: map[string]string{namespace: "cluster"},
|
||||
ServiceAccountName: serviceAccountName,
|
||||
},
|
||||
}
|
||||
if edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec) {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
}
|
||||
|
||||
if edgefsv1beta1.IsMultusNetworkDefined(c.NetworkSpec) {
|
||||
edgefsv1beta1.ApplyMultus(c.NetworkSpec, &podSpec.ObjectMeta)
|
||||
if c.NetworkSpec.IsHost() {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
} else if c.NetworkSpec.IsMultus() {
|
||||
rookalpha.ApplyMultus(c.NetworkSpec, &podSpec.ObjectMeta)
|
||||
}
|
||||
|
||||
// apply current S3X CRD options to pod's specification
|
||||
|
||||
@@ -56,7 +56,7 @@ type SWIFTController struct {
|
||||
context *clusterd.Context
|
||||
namespace string
|
||||
rookImage string
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec
|
||||
NetworkSpec rookalpha.NetworkSpec
|
||||
dataDirHostPath string
|
||||
dataVolumeSize resource.Quantity
|
||||
placement rookalpha.Placement
|
||||
@@ -71,7 +71,7 @@ func NewSWIFTController(
|
||||
context *clusterd.Context,
|
||||
namespace string,
|
||||
rookImage string,
|
||||
NetworkSpec edgefsv1beta1.NetworkSpec,
|
||||
NetworkSpec rookalpha.NetworkSpec,
|
||||
dataDirHostPath string,
|
||||
dataVolumeSize resource.Quantity,
|
||||
placement rookalpha.Placement,
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@@ -225,12 +225,12 @@ func (c *SWIFTController) makeDeployment(svcname, namespace, rookImage, imageArg
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
Volumes: volumes,
|
||||
HostIPC: true,
|
||||
HostNetwork: edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec),
|
||||
HostNetwork: c.NetworkSpec.IsHost(),
|
||||
NodeSelector: map[string]string{namespace: "cluster"},
|
||||
ServiceAccountName: serviceAccountName,
|
||||
},
|
||||
}
|
||||
if edgefsv1beta1.IsHostNetworkDefined(c.NetworkSpec) {
|
||||
if c.NetworkSpec.IsHost() {
|
||||
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user