diff --git a/deploy/charts/rook-ceph/templates/resources.yaml b/deploy/charts/rook-ceph/templates/resources.yaml index 4806394ae..60c9b6851 100644 --- a/deploy/charts/rook-ceph/templates/resources.yaml +++ b/deploy/charts/rook-ceph/templates/resources.yaml @@ -7632,6 +7632,11 @@ spec: type: object nullable: true type: array + hostNetwork: + description: Whether host networking is enabled for the rgw daemon. If not set, the network settings from the cluster CR will be applied. + nullable: true + type: boolean + x-kubernetes-preserve-unknown-fields: true instances: description: The number of pods in the rgw replicaset. format: int32 @@ -8577,11 +8582,6 @@ spec: type: object type: object type: object - hostNetwork: - description: Whether host networking is enabled for the rgw daemon. If not set, the network settings from the cluster CR will be applied. - nullable: true - type: boolean - x-kubernetes-preserve-unknown-fields: true metadataPool: description: The metadata pool settings nullable: true diff --git a/deploy/examples/crds.yaml b/deploy/examples/crds.yaml index 133360c03..e1c36e73a 100644 --- a/deploy/examples/crds.yaml +++ b/deploy/examples/crds.yaml @@ -7624,6 +7624,11 @@ spec: type: object nullable: true type: array + hostNetwork: + description: Whether host networking is enabled for the rgw daemon. If not set, the network settings from the cluster CR will be applied. + nullable: true + type: boolean + x-kubernetes-preserve-unknown-fields: true instances: description: The number of pods in the rgw replicaset. format: int32 @@ -8569,11 +8574,6 @@ spec: type: object type: object type: object - hostNetwork: - description: Whether host networking is enabled for the rgw daemon. If not set, the network settings from the cluster CR will be applied. - nullable: true - type: boolean - x-kubernetes-preserve-unknown-fields: true metadataPool: description: The metadata pool settings nullable: true diff --git a/pkg/apis/ceph.rook.io/v1/object.go b/pkg/apis/ceph.rook.io/v1/object.go index 3d815df80..c8ce342cc 100644 --- a/pkg/apis/ceph.rook.io/v1/object.go +++ b/pkg/apis/ceph.rook.io/v1/object.go @@ -50,8 +50,8 @@ func (s *ObjectStoreSpec) IsExternal() bool { } func (s *ObjectStoreSpec) IsHostNetwork(c *ClusterSpec) bool { - if s.HostNetwork != nil { - return *s.HostNetwork + if s.Gateway.HostNetwork != nil { + return *s.Gateway.HostNetwork } return c.Network.IsHost() } diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go index f18b4124f..2b676f94f 100755 --- a/pkg/apis/ceph.rook.io/v1/types.go +++ b/pkg/apis/ceph.rook.io/v1/types.go @@ -1325,12 +1325,6 @@ type ObjectStoreSpec struct { // +optional // +nullable Security *SecuritySpec `json:"security,omitempty"` - - // Whether host networking is enabled for the rgw daemon. If not set, the network settings from the cluster CR will be applied. - // +kubebuilder:pruning:PreserveUnknownFields - // +nullable - // +optional - HostNetwork *bool `json:"hostNetwork,omitempty"` } // BucketHealthCheckSpec represents the health check of an object store @@ -1421,6 +1415,12 @@ type GatewaySpec struct { // +optional // +nullable Service *RGWServiceSpec `json:"service,omitempty"` + + // Whether host networking is enabled for the rgw daemon. If not set, the network settings from the cluster CR will be applied. + // +kubebuilder:pruning:PreserveUnknownFields + // +nullable + // +optional + HostNetwork *bool `json:"hostNetwork,omitempty"` } // ZoneSpec represents a Ceph Object Store Gateway Zone specification diff --git a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go index ce3fa95d2..c779f6460 100644 --- a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go @@ -2363,6 +2363,11 @@ func (in *GatewaySpec) DeepCopyInto(out *GatewaySpec) { *out = new(RGWServiceSpec) (*in).DeepCopyInto(*out) } + if in.HostNetwork != nil { + in, out := &in.HostNetwork, &out.HostNetwork + *out = new(bool) + **out = **in + } return } @@ -2993,11 +2998,6 @@ func (in *ObjectStoreSpec) DeepCopyInto(out *ObjectStoreSpec) { *out = new(SecuritySpec) (*in).DeepCopyInto(*out) } - if in.HostNetwork != nil { - in, out := &in.HostNetwork, &out.HostNetwork - *out = new(bool) - **out = **in - } return } diff --git a/pkg/operator/ceph/object/spec_test.go b/pkg/operator/ceph/object/spec_test.go index 31fa47d8f..a8ba97ddc 100644 --- a/pkg/operator/ceph/object/spec_test.go +++ b/pkg/operator/ceph/object/spec_test.go @@ -633,15 +633,15 @@ func TestMakeRGWPodSpec(t *testing.T) { t.Run(tt.name, func(t *testing.T) { if tt.isSet { if tt.enabled { - c.store.Spec.HostNetwork = func(hostNetwork bool) *bool { return &hostNetwork }(true) + c.store.Spec.Gateway.HostNetwork = func(hostNetwork bool) *bool { return &hostNetwork }(true) } else { - c.store.Spec.HostNetwork = new(bool) + c.store.Spec.Gateway.HostNetwork = new(bool) } } podTemplateSpec, _ := c.makeRGWPodSpec(rgwConfig) if tt.isSet { - assert.Equal(t, *c.store.Spec.HostNetwork, podTemplateSpec.Spec.HostNetwork) + assert.Equal(t, *c.store.Spec.Gateway.HostNetwork, podTemplateSpec.Spec.HostNetwork) } else { assert.Equal(t, c.clusterSpec.Network.IsHost(), podTemplateSpec.Spec.HostNetwork) }