-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provider-server: send info of kernelMountOptions for cephfs to client when encryption in transit is enabled #2707
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package util | ||
|
||
import ( | ||
ocsv1 "github.com/red-hat-storage/ocs-operator/api/v4/v1" | ||
) | ||
|
||
// GetCephFSKernelMountOptions returns the kernel mount options for CephFS based on the spec on the StorageCluster | ||
func GetCephFSKernelMountOptions(sc *ocsv1.StorageCluster) string { | ||
// If Encryption is enabled, Always use secure mode | ||
if sc.Spec.Network != nil && sc.Spec.Network.Connections != nil && | ||
sc.Spec.Network.Connections.Encryption != nil && sc.Spec.Network.Connections.Encryption.Enabled { | ||
return "ms_mode=secure" | ||
} | ||
|
||
// If Encryption is not enabled, but Compression or RequireMsgr2 is enabled, use prefer-crc mode | ||
if sc.Spec.Network != nil && sc.Spec.Network.Connections != nil && | ||
((sc.Spec.Network.Connections.Compression != nil && sc.Spec.Network.Connections.Compression.Enabled) || | ||
sc.Spec.Network.Connections.RequireMsgr2) { | ||
return "ms_mode=prefer-crc" | ||
} | ||
|
||
// Network spec always has higher precedence even in the External or Provider cluster. so they are checked first above | ||
|
||
// None of Encryption, Compression, RequireMsgr2 are enabled on the StorageCluster | ||
// If it's an External or Provider cluster, We don't require msgr2 by default so no mount options are needed | ||
if sc.Spec.ExternalStorage.Enable || sc.Spec.AllowRemoteStorageConsumers { | ||
return "ms_mode=legacy" | ||
} | ||
// If none of the above cases apply, We set RequireMsgr2 true by default on the cephcluster | ||
// so we need to set the mount options to prefer-crc | ||
return "ms_mode=prefer-crc" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,3 +61,10 @@ rules: | |
verbs: | ||
- get | ||
- list | ||
- apiGroups: | ||
- ocs.openshift.io | ||
resources: | ||
- storageclusters | ||
verbs: | ||
- get | ||
- list |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,3 +61,10 @@ rules: | |
verbs: | ||
- get | ||
- list | ||
- apiGroups: | ||
- ocs.openshift.io | ||
resources: | ||
- storageclusters | ||
verbs: | ||
- get | ||
- list |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ import ( | |
|
||
"github.com/blang/semver/v4" | ||
quotav1 "github.com/openshift/api/quota/v1" | ||
ocsv1 "github.com/red-hat-storage/ocs-operator/api/v4/v1" | ||
"github.com/red-hat-storage/ocs-operator/api/v4/v1alpha1" | ||
ocsv1alpha1 "github.com/red-hat-storage/ocs-operator/api/v4/v1alpha1" | ||
controllers "github.com/red-hat-storage/ocs-operator/v4/controllers/storageconsumer" | ||
|
@@ -55,8 +56,10 @@ const ( | |
) | ||
|
||
const ( | ||
monConfigMap = "rook-ceph-mon-endpoints" | ||
monSecret = "rook-ceph-mon" | ||
monConfigMap = "rook-ceph-mon-endpoints" | ||
monSecret = "rook-ceph-mon" | ||
kernelMountOptionsKey = "kernelmountoptions" | ||
kernelMountOptionSecure = "ms_mode=secure" | ||
) | ||
|
||
type OCSProviderServer struct { | ||
|
@@ -238,6 +241,10 @@ func newClient() (client.Client, error) { | |
if err != nil { | ||
return nil, fmt.Errorf("failed to add operatorsv1alpha1 to scheme. %v", err) | ||
} | ||
err = ocsv1.AddToScheme(scheme) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to add ocsv1 to scheme. %v", err) | ||
} | ||
|
||
config, err := config.GetConfig() | ||
if err != nil { | ||
|
@@ -687,6 +694,15 @@ func (s *OCSProviderServer) GetStorageClaimConfig(ctx context.Context, req *pb.S | |
"csi.storage.k8s.io/controller-expand-secret-name": provisionerSecretName, | ||
} | ||
|
||
storageClusters, err := util.GetStorageClustersInNamespace(ctx, s.client, s.namespace) | ||
if err != nil || len(storageClusters.Items) == 0 { | ||
return nil, status.Errorf(codes.Internal, "failed to get storage cluster %v", err) | ||
} | ||
kernelMountOptions := util.GetCephFSKernelMountOptions(&storageClusters.Items[0]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how are you getting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes if |
||
if kernelMountOptions == kernelMountOptionSecure { | ||
cephfsStorageClassData[kernelMountOptionsKey] = kernelMountOptionSecure | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not piggyback csi config info onto the storage class resource. |
||
} | ||
|
||
extR = append(extR, | ||
&pb.ExternalResource{ | ||
Name: "cephfs", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2707 (comment)
continuing the discussion on PR rather than as a comment. So, does the kernel client on client cluster continues to offer services for PVCs which were created before enabling EiT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for 4.17 deployments the decision to use EiT will be taken when the provider is deployed right and we don't have to worry about clients connecting on unsecure port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, rather than asking the specifics, let me put it this way, w/ this PR does the PVCs created on 4.16 still work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, It won't work
4.16-based deployments will not support EiT even after they upgrade to 4.17 right?