Skip to content

Commit

Permalink
Merge pull request #2515 from thotz/odf-vhost-rgw
Browse files Browse the repository at this point in the history
rgw: add vhost style support for rgw in ocs-op
openshift-merge-bot[bot] authored Mar 21, 2024
2 parents 6db2c5d + 1098627 commit cc415e7
Showing 8 changed files with 49 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/v1/storagecluster_types.go
Original file line number Diff line number Diff line change
@@ -253,7 +253,8 @@ type ManageCephObjectStores struct {
// 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])?)*$
StorageClassName string `json:"storageClassName,omitempty"`
StorageClassName string `json:"storageClassName,omitempty"`
VirtualHostnames []string `json:"virtualHostnames,omitempty"`
}

// ManageCephObjectStoreUsers defines how to reconcile CephObjectStoreUsers
5 changes: 5 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions config/crd/bases/ocs.openshift.io_storageclusters.yaml
Original file line number Diff line number Diff line change
@@ -1752,6 +1752,10 @@ spec:
maxLength: 253
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
virtualHostnames:
items:
type: string
type: array
type: object
cephRBDMirror:
description: ManageCephRBDMirror defines how to reconcile Ceph
23 changes: 23 additions & 0 deletions controllers/storagecluster/cephobjectstores.go
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import (
"context"
"fmt"

routev1 "github.com/openshift/api/route/v1"
ocsv1 "github.com/red-hat-storage/ocs-operator/api/v4/v1"
"github.com/red-hat-storage/ocs-operator/v4/controllers/defaults"
"github.com/red-hat-storage/ocs-operator/v4/controllers/platform"
@@ -201,6 +202,28 @@ func (r *StorageClusterReconciler) newCephObjectStoreInstances(initData *ocsv1.S
return nil, err
}

if len(initData.Spec.ManagedResources.CephObjectStores.VirtualHostnames) > 0 {
obj.Spec.Hosting.DNSNames = initData.Spec.ManagedResources.CephObjectStores.VirtualHostnames
route := &routev1.Route{}
err := r.Client.Get(context.TODO(), types.NamespacedName{Name: obj.Name, Namespace: obj.Namespace}, route)
if err != nil {
if errors.IsNotFound(err) {
r.Log.Info("Ceph RGW Route not found.", "CephRGWRoute", klog.KRef(obj.Namespace, obj.Name))
}
} else {
obj.Spec.Hosting.DNSNames = append(obj.Spec.Hosting.DNSNames, route.Spec.Host)
}
secureRoute := &routev1.Route{}
err = r.Client.Get(context.TODO(), types.NamespacedName{Name: obj.Name + "-secure", Namespace: obj.Namespace}, secureRoute)
if err != nil {
if errors.IsNotFound(err) {
r.Log.Info("Ceph RGW Route not found.", "CephRGWRoute", klog.KRef(obj.Namespace, obj.Name+"-secure"))
}
} else {
obj.Spec.Hosting.DNSNames = append(obj.Spec.Hosting.DNSNames, secureRoute.Spec.Host)
}
}

if initData.Spec.ManagedResources.CephObjectStores.HostNetwork != nil {
obj.Spec.Gateway.HostNetwork = initData.Spec.ManagedResources.CephObjectStores.HostNetwork
}
Original file line number Diff line number Diff line change
@@ -1752,6 +1752,10 @@ spec:
maxLength: 253
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
virtualHostnames:
items:
type: string
type: array
type: object
cephRBDMirror:
description: ManageCephRBDMirror defines how to reconcile Ceph
4 changes: 4 additions & 0 deletions deploy/ocs-operator/manifests/storagecluster.crd.yaml
Original file line number Diff line number Diff line change
@@ -1751,6 +1751,10 @@ spec:
maxLength: 253
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
virtualHostnames:
items:
type: string
type: array
type: object
cephRBDMirror:
description: ManageCephRBDMirror defines how to reconcile Ceph

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cc415e7

Please sign in to comment.