Skip to content
Merged

EIT #31

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
fd3ac83
ENI support
prankulmahajan Dec 4, 2023
00f4b32
ENI support
sameshai Jan 23, 2023
4efbae1
ENI support
sameshai Jan 31, 2023
0a86d6d
Review comments
sameshai May 18, 2023
3718310
Review comments
sameshai May 19, 2023
18e0fad
Review comments
sameshai May 19, 2023
8bffa63
Review Comments
sameshai May 29, 2023
7b778e7
Review Comments
sameshai Jun 1, 2023
3caf1f4
Review Comments
sameshai Jun 1, 2023
6b7e82e
Review Comments
sameshai Jun 2, 2023
93e535e
Review Comments
sameshai Jun 2, 2023
6e87cf4
Review Comments
sameshai Jun 7, 2023
2f8bd11
Review Comments
sameshai Jun 8, 2023
4718df0
Review Comments
sameshai Jun 8, 2023
03c2d37
Review Comments
sameshai Jun 14, 2023
bd71302
Review Comments
sameshai Jun 19, 2023
dd68a43
Review Comments
sameshai Jul 5, 2023
5893883
Review Comments
sameshai Jul 5, 2023
64a5e7c
Review Comments
sameshai Jul 5, 2023
3d831b8
Review Comments
sameshai Jul 5, 2023
69fca17
Review Comments
sameshai Jul 5, 2023
ac164cb
Review Comments
sameshai Jul 5, 2023
55b72ce
Review Comments
sameshai Jul 5, 2023
a3fc481
Review Comments
sameshai Jul 13, 2023
c852a2a
Rebase master
sameshai Jul 24, 2023
77c7d62
Rebase master
sameshai Jul 24, 2023
8fd237d
Rebase master
sameshai Jul 24, 2023
fef3f39
Review Comments
sameshai Jul 24, 2023
203e0eb
initial code
prankulmahajan Aug 16, 2023
3aa06ff
ref
prankulmahajan Aug 17, 2023
8275018
Add statusCode check
prankulmahajan Aug 20, 2023
73bce1f
fix payload
prankulmahajan Aug 21, 2023
9d12bac
remove maturity=beta flag
prankulmahajan Aug 22, 2023
cff1655
Add eit-mount-helper service
prankulmahajan Aug 22, 2023
4ee4e0c
Call mountEIT from common
prankulmahajan Sep 3, 2023
a38dace
update setup.sh
prankulmahajan Sep 3, 2023
95a0bd8
Add new error msg
prankulmahajan Sep 4, 2023
bd9ce39
improve logging
prankulmahajan Sep 7, 2023
11a0e75
Add err msgs
prankulmahajan Oct 5, 2023
140cf49
Handle if container service is not available
prankulmahajan Oct 5, 2023
42a7ca2
Run mount-container via setup.sh -- revert
prankulmahajan Oct 13, 2023
29e3f0b
add logging
prankulmahajan Oct 18, 2023
4deb166
ref mount errors logic
prankulmahajan Oct 18, 2023
f0283a9
update common
prankulmahajan Dec 4, 2023
b187fd5
update common
prankulmahajan Dec 4, 2023
b7a9277
update deps
prankulmahajan Dec 5, 2023
2bda550
volume param handle eit
prankulmahajan Dec 5, 2023
df08fa8
update interface
prankulmahajan Dec 5, 2023
d980b88
add eit in volumeaccesspoint request
prankulmahajan Dec 5, 2023
2e01512
Update lib
prankulmahajan Dec 5, 2023
4bad181
update volumeContext label for EIT
prankulmahajan Dec 5, 2023
1159b13
add logging
prankulmahajan Dec 6, 2023
2cd8aff
update common
prankulmahajan Dec 6, 2023
e276ceb
fix- return correct error code in case of non-eit
prankulmahajan Dec 12, 2023
da39595
Merge branch 'master' into eit
prankulmahajan Feb 7, 2024
694541e
update lib -- 8th Feb
prankulmahajan Feb 7, 2024
0102a49
fix fmt issue
prankulmahajan Feb 7, 2024
31fb99c
update ubuntu image
prankulmahajan Feb 7, 2024
3e21e24
Remove logic to start mount helper container service from container
prankulmahajan Feb 7, 2024
e9f9bf3
naming change
prankulmahajan Feb 12, 2024
51e82e1
add UT
prankulmahajan Mar 9, 2024
6ba9067
add regexp to match error
prankulmahajan Mar 9, 2024
5af4006
update node server yaml
prankulmahajan Mar 9, 2024
873d66b
fix regex issue
prankulmahajan Mar 10, 2024
35c63a7
Add response of errored mount command
prankulmahajan Mar 13, 2024
e7fa45a
Add eit SC
prankulmahajan Mar 13, 2024
e960533
Remove mount propogation from deployment
prankulmahajan Mar 13, 2024
eb9bf95
review comments
prankulmahajan Apr 4, 2024
46b0cac
update common
prankulmahajan Apr 17, 2024
ce4d718
fix travis
prankulmahajan Apr 17, 2024
fac1952
fix travis2
prankulmahajan Apr 17, 2024
5204a80
revert to go 1.19
prankulmahajan Apr 17, 2024
6a76519
update common
prankulmahajan Apr 18, 2024
01c43ad
review comments
prankulmahajan Apr 18, 2024
e359e8e
Remove else condition
prankulmahajan Apr 22, 2024
ef120e9
Add warning in PVC describe case EIT is enabled
prankulmahajan May 6, 2024
44e0acb
update sc
prankulmahajan May 8, 2024
6b66a5b
update lib
prankulmahajan May 13, 2024
45549ca
review comments
prankulmahajan May 13, 2024
f4f221f
cover ut for node_helper
prankulmahajan May 13, 2024
d34d299
Merge branch 'master' into eit
prankulmahajan May 14, 2024
32eb623
update socket name
prankulmahajan May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 0 additions & 125 deletions dependency-check/suppression-file.xml

This file was deleted.

13 changes: 13 additions & 0 deletions deploy/kubernetes/driver/kubernetes/manifests/node-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SOCKET_PATH
value: "/var/lib/ibmshare.sock"
resources:
limits:
cpu: 200m
Expand Down Expand Up @@ -132,6 +134,10 @@ spec:
- name: cluster-info
readOnly: true
mountPath: /etc/storage_ibmc/cluster_info
- mountPath: /var/lib
name: libpath
- mountPath: /tmp/mount-helper
name: mh-logs
- name: liveness-probe
image: MUSTPATCHWITHKUSTOMIZE
securityContext:
Expand Down Expand Up @@ -219,3 +225,10 @@ spec:
- serviceAccountToken:
path: vault-token
expirationSeconds: 600
- name: libpath
hostPath:
path: /var/lib
type: Directory
- name: mh-logs
hostPath:
path: /opt/ibm/mount-ibmshare/
27 changes: 27 additions & 0 deletions deploy/kubernetes/storageclass/ibmc-vpc-file-eit-StorageClass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ibmc-vpc-file-eit
provisioner: vpc.file.csi.ibm.io
parameters:
profile: "dp2" # The VPC Storage profile used. /docs/vpc?topic=vpc-block-storage-profiles&interface=ui#tiers-beta
iops: "200" # Default IOPS. User can override from secrets
billingType: "hourly" # The default billing policy used. User can override this default
encrypted: "false" # By default, all PVC using this class will only be provider managed encrypted. The user can override this default
encryptionKey: "" # If encrypted is true, then a user must specify the encryption key used associated KP instance
resourceGroup: "" # Use resource group if specified here. else use the one mentioned in storage-secrete-store
zone: "" # By default, the storage vpc driver will select a zone. The user can override this default
tags: "" # A list of tags "a, b, c" that will be created when the volume is created. This can be overidden by user
classVersion: "1"
uid: "0" # The initial user identifier for the file share.
gid: "0" # The initial group identifier for the file share.
isENIEnabled: "true" # VPC File Share will use the ENI/VNI feature
isEITEnabled: "true" # VPC File Share will have EIT enabled.
securityGroupIDs: "" # Give command separated list of security group ids.Use whatever given else default security group will be used
subnetID: "" # Give subnetID in which the ENI/VNI will be created. If not provided lets use the subnet-id available in the VPC zone same as the one part of the cluster.
region: ""
zone: "" # By default, the storage vpc driver will select a zone. The user can override this default
primaryIPID: "" # Existing ID of reserved IP from the same subnet as the file share zone.Subnet-id is not mandatory for this
primaryIPAddress: "" # IPAddress for ENI/VNI to be created in the respective subnet of the zone. Subnet-id is mandatory for this.
reclaimPolicy: "Delete"
allowVolumeExpansion: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ibmc-vpc-file-eit-retain
provisioner: vpc.file.csi.ibm.io
parameters:
profile: "dp2" # The VPC Storage profile used. /docs/vpc?topic=vpc-block-storage-profiles&interface=ui#tiers-beta
iops: "200" # Default IOPS. User can override from secrets
billingType: "hourly" # The default billing policy used. User can override this default
encrypted: "false" # By default, all PVC using this class will only be provider managed encrypted. The user can override this default
encryptionKey: "" # If encrypted is true, then a user must specify the encryption key used associated KP instance
resourceGroup: "" # Use resource group if specified here. else use the one mentioned in storage-secrete-store
zone: "" # By default, the storage vpc driver will select a zone. The user can override this default
tags: "" # A list of tags "a, b, c" that will be created when the volume is created. This can be overidden by user
classVersion: "1"
uid: "0" # The initial user identifier for the file share.
gid: "0" # The initial group identifier for the file share.
isENIEnabled: "true" # VPC File Share will use the ENI/VNI feature
isEITEnabled: "true" # VPC File Share will have EIT enabled.
securityGroupIDs: "" # Give command separated list of security group ids.Use whatever given else default security group will be used
subnetID: "" # Give subnetID in which the ENI/VNI will be created. If not provided lets use the subnet-id available in the VPC zone same as the one part of the cluster.
region: ""
zone: "" # By default, the storage vpc driver will select a zone. The user can override this default
primaryIPID: "" # Existing ID of reserved IP from the same subnet as the file share zone.Subnet-id is not mandatory for this
primaryIPAddress: "" # IPAddress for ENI/VNI to be created in the respective subnet of the zone. Subnet-id is mandatory for this.
reclaimPolicy: "Retain"
allowVolumeExpansion: true
6 changes: 6 additions & 0 deletions pkg/ibmcsidriver/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,18 @@ const (
// SecurityGroup
SecurityGroup = "security_group"

// EncryptionTransitMode
EncryptionTransitMode = "user_managed"

// VPC
VPC = "vpc"

// IsENIEnabled
IsENIEnabled = "isENIEnabled"

// IsEITEnabled
IsEITEnabled = "isEITEnabled"

// SecurityGroupIDs
SecurityGroupIDs = "securityGroupIDs"

Expand Down
1 change: 1 addition & 0 deletions pkg/ibmcsidriver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ func (csiCS *CSIControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
ctxLogger.Info("VolumeAccessPoint is in stable state", zap.Reflect("Volume Access Point", volumeAccessPointObj.AccessPointID))

volumeObj.AccessControlMode = requestedVolume.AccessControlMode
volumeObj.TransitEncryption = requestedVolume.TransitEncryption

// return csi volume object
return createCSIVolumeResponse(*volumeObj, *volumeAccessPointObj, int64(*(requestedVolume.Capacity)*utils.GB), nil, csiCS.CSIProvider.GetClusterID()), nil
Expand Down
38 changes: 34 additions & 4 deletions pkg/ibmcsidriver/controller_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
volume.VPCVolume.SubnetID = value
}
case IsENIEnabled:
err = setISENIEnabled(volume, key, strings.ToLower(value))
err = checkAndSetISENIEnabled(volume, key, strings.ToLower(value))
case IsEITEnabled:
err = checkAndSetISEITEnabled(volume, key, strings.ToLower(value))
case ResourceGroup:
if len(value) > ResourceGroupIDMaxLen {
err = fmt.Errorf("%s:<%v> exceeds %d chars", key, value, ResourceGroupIDMaxLen)
Expand Down Expand Up @@ -318,6 +320,13 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
}
}

// For enabling EIT, check if ENI is enabled or not. If not, fail with error as to enable encryption in transit, accessControlMode must be set to security_group.
if volume.VPCVolume.TransitEncryption == EncryptionTransitMode && volume.VPCVolume.AccessControlMode != SecurityGroup {
err = fmt.Errorf("ENI must be enabled i.e accessControlMode must be set to security_group for creating EIT enabled fileShare. Set 'isENIEnabled' to 'true' in storage class parameters")
logger.Error("getVolumeParameters", zap.NamedError("InvalidParameter", err))
return volume, err
}

//TODO port the code from VPC BLOCK to find region if zone is given

//If the zone is not provided in storage class parameters then we pick from the Topology
Expand Down Expand Up @@ -346,8 +355,8 @@ func setSecurityGroupList(volume *provider.Volume, value string) {
volume.VPCVolume.SecurityGroups = &securityGroups
}

// setISENIEnabled
func setISENIEnabled(volume *provider.Volume, key string, value string) error {
// checkAndSetISENIEnabled
func checkAndSetISENIEnabled(volume *provider.Volume, key string, value string) error {
var err error
if value != TrueStr && value != FalseStr {
err = fmt.Errorf("'<%v>' is invalid, value of '%s' should be [true|false]", value, key)
Expand All @@ -362,6 +371,19 @@ func setISENIEnabled(volume *provider.Volume, key string, value string) error {
return err
}

// checkAndSetISEITEnabled
func checkAndSetISEITEnabled(volume *provider.Volume, key string, value string) error {
var err error
if value != TrueStr && value != FalseStr {
err = fmt.Errorf("'<%v>' is invalid, value of '%s' should be [true|false]", value, key)
return err
}
if value == TrueStr {
volume.VPCVolume.TransitEncryption = EncryptionTransitMode
}
return nil
}

// setPrimaryIPID
func setPrimaryIPID(volume *provider.Volume, key string, value string) error {
//We are failing in case PrimaryIPAddress is already set.
Expand Down Expand Up @@ -501,7 +523,9 @@ func overrideParams(logger *zap.Logger, req *csi.CreateVolumeRequest, config *co
volume.VPCVolume.SubnetID = value
}
case IsENIEnabled:
err = setISENIEnabled(volume, key, strings.ToLower(value))
err = checkAndSetISENIEnabled(volume, key, strings.ToLower(value))
case IsEITEnabled:
err = checkAndSetISEITEnabled(volume, key, strings.ToLower(value))
default:
err = fmt.Errorf("<%s> is an invalid parameter", key)
}
Expand Down Expand Up @@ -585,6 +609,11 @@ func createCSIVolumeResponse(vol provider.Volume, volAccessPointResponse provide

labels[NFSServerPath] = volAccessPointResponse.MountPath

// Update label in case EIT is enabled
if vol.TransitEncryption == EncryptionTransitMode {
labels[IsEITEnabled] = TrueStr
}

// Create csi volume response
//Volume ID is in format volumeID:volumeAccessPointID, to assist the deletion of access point in delete volume
volResp := &csi.CreateVolumeResponse{
Expand All @@ -595,6 +624,7 @@ func createCSIVolumeResponse(vol provider.Volume, volAccessPointResponse provide
AccessibleTopology: []*csi.Topology{topology},
},
}

return volResp
}

Expand Down
Loading