Skip to content

Commit 21eca80

Browse files
Merge pull request oracle#173 in OKE/oci-cloud-controller-manager from task/OKE-16774 to internal
* commit 'b53bb3c4abc113be229c65b17e0567109a0c8972': OKE-16774: Adding error condition when in transit is on and attachment type is iscsi
2 parents 19bdf56 + b53bb3c commit 21eca80

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pkg/csi/driver/controller.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,13 @@ func (d *ControllerDriver) ControllerPublishVolume(ctx context.Context, req *csi
315315
metrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), csiMetricDimension, req.VolumeId)
316316
return nil, status.Errorf(codes.Unknown, "failed to get the attachment options. error : %s", err)
317317
}
318+
//in transit encryption is not supported for other attachment type than paravirtualized
319+
if volumeAttachmentOptions.enableInTransitEncryption && !volumeAttachmentOptions.useParavirtualizedAttachment {
320+
log.Error("node %s has in transit encryption enabled, but attachment type is not paravirtualized. invalid input", id)
321+
csiMetricDimension = util.GetMetricDimensionForComponent(util.ErrValidation, util.CSIStorageType)
322+
metrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), csiMetricDimension, req.VolumeId)
323+
return nil, status.Errorf(codes.InvalidArgument, "node %s has in transit encryption enabled, but attachment type is not paravirtualized. invalid input", id)
324+
}
318325

319326
compartmentID, err := util.LookupNodeCompartment(d.KubeClient, req.NodeId)
320327
if err != nil {
@@ -737,7 +744,6 @@ func getAttachmentOptions(ctx context.Context, client client.ComputeInterface, a
737744
}
738745
if *instance.LaunchOptions.IsPvEncryptionInTransitEnabled {
739746
volumeAttachmentOption.enableInTransitEncryption = true
740-
volumeAttachmentOption.useParavirtualizedAttachment = true
741747
}
742748
return volumeAttachmentOption, nil
743749
}

pkg/csi/driver/controller_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ func TestGetAttachmentOptions(t *testing.T) {
774774
instanceID: "inTransitEnabled",
775775
volumeAttachmentOption: VolumeAttachmentOption{
776776
enableInTransitEncryption: true,
777-
useParavirtualizedAttachment: true,
777+
useParavirtualizedAttachment: false,
778778
},
779779
wantErr: false,
780780
},

0 commit comments

Comments
 (0)