diff --git a/api/v1/storagecluster_types.go b/api/v1/storagecluster_types.go index 00c569e71d..ffb69615a7 100644 --- a/api/v1/storagecluster_types.go +++ b/api/v1/storagecluster_types.go @@ -237,6 +237,7 @@ type ManageCephObjectStores struct { DisableStorageClass bool `json:"disableStorageClass,omitempty"` GatewayInstances int `json:"gatewayInstances,omitempty"` DisableRoute bool `json:"disableRoute,omitempty"` + HostNetwork *bool `json:"hostNetwork,omitempty"` // StorageClassName specifies the name of the storage class created for ceph obc's // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index c22e74c4c3..be7bda50af 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -344,6 +344,11 @@ func (in *ManageCephObjectStoreUsers) DeepCopy() *ManageCephObjectStoreUsers { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ManageCephObjectStores) DeepCopyInto(out *ManageCephObjectStores) { *out = *in + if in.HostNetwork != nil { + in, out := &in.HostNetwork, &out.HostNetwork + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManageCephObjectStores. @@ -395,7 +400,7 @@ func (in *ManagedResourcesSpec) DeepCopyInto(out *ManagedResourcesSpec) { out.CephBlockPools = in.CephBlockPools out.CephNonResilientPools = in.CephNonResilientPools out.CephFilesystems = in.CephFilesystems - out.CephObjectStores = in.CephObjectStores + in.CephObjectStores.DeepCopyInto(&out.CephObjectStores) out.CephObjectStoreUsers = in.CephObjectStoreUsers out.CephToolbox = in.CephToolbox out.CephRBDMirror = in.CephRBDMirror @@ -810,7 +815,7 @@ func (in *StorageClusterSpec) DeepCopyInto(out *StorageClusterSpec) { *out = new(ceph_rook_iov1.NetworkSpec) (*in).DeepCopyInto(*out) } - out.ManagedResources = in.ManagedResources + in.ManagedResources.DeepCopyInto(&out.ManagedResources) if in.NodeTopologies != nil { in, out := &in.NodeTopologies, &out.NodeTopologies *out = new(NodeTopologyMap) diff --git a/config/crd/bases/ocs.openshift.io_storageclusters.yaml b/config/crd/bases/ocs.openshift.io_storageclusters.yaml index 80dbf3aca6..f9e94fb57d 100644 --- a/config/crd/bases/ocs.openshift.io_storageclusters.yaml +++ b/config/crd/bases/ocs.openshift.io_storageclusters.yaml @@ -757,6 +757,8 @@ spec: type: boolean gatewayInstances: type: integer + hostNetwork: + type: boolean reconcileStrategy: type: string storageClassName: diff --git a/controllers/storagecluster/cephobjectstores.go b/controllers/storagecluster/cephobjectstores.go index d1b4d459eb..42456daf02 100644 --- a/controllers/storagecluster/cephobjectstores.go +++ b/controllers/storagecluster/cephobjectstores.go @@ -198,6 +198,11 @@ func (r *StorageClusterReconciler) newCephObjectStoreInstances(initData *ocsv1.S r.Log.Error(err, "Failed to set ControllerReference for CephObjectStore.", "CephObjectStore", klog.KRef(obj.Namespace, obj.Name)) return nil, err } + + if initData.Spec.ManagedResources.CephObjectStores.HostNetwork != nil { + obj.Spec.Gateway.HostNetwork = initData.Spec.ManagedResources.CephObjectStores.HostNetwork + } + // if kmsConfig is not 'nil', add the KMS details to ObjectStore spec if kmsConfigMap != nil { diff --git a/deploy/csv-templates/crds/ocs/ocs.openshift.io_storageclusters.yaml b/deploy/csv-templates/crds/ocs/ocs.openshift.io_storageclusters.yaml index 80dbf3aca6..f9e94fb57d 100644 --- a/deploy/csv-templates/crds/ocs/ocs.openshift.io_storageclusters.yaml +++ b/deploy/csv-templates/crds/ocs/ocs.openshift.io_storageclusters.yaml @@ -757,6 +757,8 @@ spec: type: boolean gatewayInstances: type: integer + hostNetwork: + type: boolean reconcileStrategy: type: string storageClassName: diff --git a/deploy/ocs-operator/manifests/storagecluster.crd.yaml b/deploy/ocs-operator/manifests/storagecluster.crd.yaml index 91db08badd..0cf20f5844 100644 --- a/deploy/ocs-operator/manifests/storagecluster.crd.yaml +++ b/deploy/ocs-operator/manifests/storagecluster.crd.yaml @@ -756,6 +756,8 @@ spec: type: boolean gatewayInstances: type: integer + hostNetwork: + type: boolean reconcileStrategy: type: string storageClassName: