object: hostNetwork setting should be under spec.gateway instead of spec in the ObjectStore CRD

Signed-off-by: zhucan <zhucan.k8s@gmail.com>
This commit is contained in:
zhucan
2022-08-22 14:47:10 +08:00
parent 1da927e40e
commit 2011d9104d
3 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -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()
}
+6 -6
View File
@@ -1337,12 +1337,6 @@ type ObjectStoreSpec struct {
// +optional
// +nullable
Security *ObjectStoreSecuritySpec `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
@@ -1433,6 +1427,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
+3 -3
View File
@@ -753,15 +753,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)
}