Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
)

const (
bvCsiDriver = "BV"
lustreCsiDriver = "Lustre"
bvCsiDriver = "BV"
lustreCsiDriver = "Lustre"
)

// StartControllerDriver main function to start CSI Controller Driver
Expand Down
74 changes: 36 additions & 38 deletions cmd/oci-csi-controller-driver/csioptions/csioptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import (
)

const (
fssAddressSuffix = "-fss.sock"
fssVolumeNameAppendedPrefix = "-fss"
fssAddressSuffix = "-fss.sock"
fssVolumeNameAppendedPrefix = "-fss"

lustreAddressSuffix = "-lustre.sock"
lustreVolumeNameAppendedPrefix = "-lustre"

CrossNamespaceVolumeDataSource = "CrossNamespaceVolumeDataSource"
VolumeAttributesClass = "VolumeAttributesClass"
VolumeAttributesClass = "VolumeAttributesClass"
)

// CSIOptions structure which contains flag values
Expand All @@ -43,9 +43,9 @@ type CSIOptions struct {
FssEndpoint string
VolumeNamePrefix string
FssVolumeNamePrefix string
LustreCsiAddress string
LustreEndpoint string
LustreVolumeNamePrefix string
LustreCsiAddress string
LustreEndpoint string
LustreVolumeNamePrefix string
VolumeNameUUIDLength int
ShowVersion bool
RetryIntervalStart time.Duration
Expand All @@ -71,44 +71,42 @@ type CSIOptions struct {
DefaultFSType string
GroupSnapshotNamePrefix string
GroupSnapshotNameUUIDLength int

}

// NewCSIOptions initializes the flag
func NewCSIOptions() *CSIOptions {
csioptions := CSIOptions{
Master: *flag.String("master", "", "kube master"),
Kubeconfig: *flag.String("kubeconfig", "", "cluster kube config"),
CsiAddress: *flag.String("csi-address", "/run/csi/socket", "Address of the CSI BV driver socket."),
Endpoint: *flag.String("csi-endpoint", "unix://tmp/csi.sock", "CSI BV endpoint"),
FssCsiAddress: *flag.String("fss-csi-address", "/run/fss/socket", "Address of the CSI FSS driver socket."),
FssEndpoint: *flag.String("fss-csi-endpoint", "unix://tmp/csi-fss.sock", "CSI FSS endpoint"),
VolumeNamePrefix: *flag.String("csi-volume-name-prefix", "pvc", "Prefix to apply to the name of a created volume."),
FssVolumeNamePrefix: *flag.String("fss-csi-volume-name-prefix", "pvc", "Prefix to apply to the name of a volume created for FSS."),
LustreCsiAddress: *flag.String("lustre-csi-address", "/run/lustre/socket", "Address of the CSI Lustre driver socket."),
LustreEndpoint: *flag.String("lustre-csi-endpoint", "unix://tmp/csi-lustre.sock", "CSI Lustre endpoint"),
LustreVolumeNamePrefix: *flag.String("lustre-csi-volume-name-prefix", "pvc", "Prefix to apply to the name of a volume created for Lustre."),
VolumeNameUUIDLength: *flag.Int("csi-volume-name-uuid-length", -1, "Truncates generated UUID of a created volume to this length. Defaults behavior is to NOT truncate."),
ShowVersion: *flag.Bool("csi-version", false, "Show version."),
RetryIntervalStart: *flag.Duration("csi-retry-interval-start", time.Second, "Initial retry interval of failed provisioning or deletion. It doubles with each failure, up to retry-interval-max."),
RetryIntervalMax: *flag.Duration("csi-retry-interval-max", 5*time.Minute, "Maximum retry interval of failed provisioning or deletion."),
WorkerThreads: *flag.Uint("csi-worker-threads", 100, "Number of provisioner worker threads, in other words nr. of simultaneous CSI calls."),
OperationTimeout: *flag.Duration("csi-op-timeout", 10*time.Second, "Timeout for waiting for creation or deletion of a volume"),
EnableLeaderElection: *flag.Bool("csi-enable-leader-election", false, "Enables leader election. If leader election is enabled, additional RBAC rules are required. Please refer to the Kubernetes CSI documentation for instructions on setting up these RBAC rules."),
LeaderElectionType: *flag.String("csi-leader-election-type", "endpoints", "the type of leader election, options are 'endpoints' (default) or 'leases' (strongly recommended). The 'endpoints' option is deprecated in favor of 'leases'."),
LeaderElectionNamespace: *flag.String("csi-leader-election-namespace", "", "Namespace where the leader election resource lives. Defaults to the pod namespace if not set."),
StrictTopology: *flag.Bool("csi-strict-topology", false, "Passes only selected node topology to CreateVolume Request, unlike default behavior of passing aggregated cluster topologies that match with topology keys of the selected node."),
Resync: *flag.Duration("csi-resync", 10*time.Minute, "Resync interval of the controller."),
Timeout: *flag.Duration("csi-timeout", 15*time.Second, "Timeout for waiting for attaching or detaching the volume."),
FinalizerThreads: *flag.Uint("cloning-protection-threads", 1, "Number of simultaniously running threads, handling cloning finalizer removal"),
MetricsAddress: *flag.String("metrics-address", "", "The TCP network address where the prometheus metrics endpoint will listen (example: `:8080`). The default is empty string, which means metrics endpoint is disabled."),
MetricsPath: *flag.String("metrics-path", "/metrics", "The HTTP path where prometheus metrics will be exposed. Default is `/metrics`."),
ExtraCreateMetadata: *flag.Bool("extra-create-metadata", false, "If set, add pv/pvc metadata to plugin create requests as parameters."),
ReconcileSync: *flag.Duration("reconcile-sync", 1*time.Minute, "Resync interval of the VolumeAttachment reconciler."),
EnableResizer: *flag.Bool("csi-bv-expansion-enabled", false, "Enables go routine csi-resizer."),
GroupSnapshotNamePrefix: *flag.String("groupsnapshot-name-prefix", "groupsnapshot", "Prefix to apply to the name of a created group snapshot"),
Master: *flag.String("master", "", "kube master"),
Kubeconfig: *flag.String("kubeconfig", "", "cluster kube config"),
CsiAddress: *flag.String("csi-address", "/run/csi/socket", "Address of the CSI BV driver socket."),
Endpoint: *flag.String("csi-endpoint", "unix://tmp/csi.sock", "CSI BV endpoint"),
FssCsiAddress: *flag.String("fss-csi-address", "/run/fss/socket", "Address of the CSI FSS driver socket."),
FssEndpoint: *flag.String("fss-csi-endpoint", "unix://tmp/csi-fss.sock", "CSI FSS endpoint"),
VolumeNamePrefix: *flag.String("csi-volume-name-prefix", "pvc", "Prefix to apply to the name of a created volume."),
FssVolumeNamePrefix: *flag.String("fss-csi-volume-name-prefix", "pvc", "Prefix to apply to the name of a volume created for FSS."),
LustreCsiAddress: *flag.String("lustre-csi-address", "/run/lustre/socket", "Address of the CSI Lustre driver socket."),
LustreEndpoint: *flag.String("lustre-csi-endpoint", "unix://tmp/csi-lustre.sock", "CSI Lustre endpoint"),
LustreVolumeNamePrefix: *flag.String("lustre-csi-volume-name-prefix", "pvc", "Prefix to apply to the name of a volume created for Lustre."),
VolumeNameUUIDLength: *flag.Int("csi-volume-name-uuid-length", -1, "Truncates generated UUID of a created volume to this length. Defaults behavior is to NOT truncate."),
ShowVersion: *flag.Bool("csi-version", false, "Show version."),
RetryIntervalStart: *flag.Duration("csi-retry-interval-start", time.Second, "Initial retry interval of failed provisioning or deletion. It doubles with each failure, up to retry-interval-max."),
RetryIntervalMax: *flag.Duration("csi-retry-interval-max", 5*time.Minute, "Maximum retry interval of failed provisioning or deletion."),
WorkerThreads: *flag.Uint("csi-worker-threads", 100, "Number of provisioner worker threads, in other words nr. of simultaneous CSI calls."),
OperationTimeout: *flag.Duration("csi-op-timeout", 10*time.Second, "Timeout for waiting for creation or deletion of a volume"),
EnableLeaderElection: *flag.Bool("csi-enable-leader-election", false, "Enables leader election. If leader election is enabled, additional RBAC rules are required. Please refer to the Kubernetes CSI documentation for instructions on setting up these RBAC rules."),
LeaderElectionType: *flag.String("csi-leader-election-type", "endpoints", "the type of leader election, options are 'endpoints' (default) or 'leases' (strongly recommended). The 'endpoints' option is deprecated in favor of 'leases'."),
LeaderElectionNamespace: *flag.String("csi-leader-election-namespace", "", "Namespace where the leader election resource lives. Defaults to the pod namespace if not set."),
StrictTopology: *flag.Bool("csi-strict-topology", false, "Passes only selected node topology to CreateVolume Request, unlike default behavior of passing aggregated cluster topologies that match with topology keys of the selected node."),
Resync: *flag.Duration("csi-resync", 10*time.Minute, "Resync interval of the controller."),
Timeout: *flag.Duration("csi-timeout", 15*time.Second, "Timeout for waiting for attaching or detaching the volume."),
FinalizerThreads: *flag.Uint("cloning-protection-threads", 1, "Number of simultaniously running threads, handling cloning finalizer removal"),
MetricsAddress: *flag.String("metrics-address", "", "The TCP network address where the prometheus metrics endpoint will listen (example: `:8080`). The default is empty string, which means metrics endpoint is disabled."),
MetricsPath: *flag.String("metrics-path", "/metrics", "The HTTP path where prometheus metrics will be exposed. Default is `/metrics`."),
ExtraCreateMetadata: *flag.Bool("extra-create-metadata", false, "If set, add pv/pvc metadata to plugin create requests as parameters."),
ReconcileSync: *flag.Duration("reconcile-sync", 1*time.Minute, "Resync interval of the VolumeAttachment reconciler."),
EnableResizer: *flag.Bool("csi-bv-expansion-enabled", false, "Enables go routine csi-resizer."),
GroupSnapshotNamePrefix: *flag.String("groupsnapshot-name-prefix", "groupsnapshot", "Prefix to apply to the name of a created group snapshot"),
GroupSnapshotNameUUIDLength: *flag.Int("groupsnapshot-name-uuid-length", -1, "Length in characters for the generated uuid of a created group snapshot. Defaults behavior is to NOT truncate."),

}
return &csioptions
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/oci-csi-node-driver/nodedriver/nodedriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"go.uber.org/zap"
)

//RunNodeDriver main function to start node driver
// RunNodeDriver main function to start node driver
func RunNodeDriver(nodeOptions nodedriveroptions.NodeOptions, stopCh <-chan struct{}) error {
logger := logging.Logger().Sugar()
logger.Sync()
Expand Down
6 changes: 3 additions & 3 deletions cmd/oci-csi-node-driver/nodedriveroptions/nodecsioptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@

package nodedriveroptions

//NodeCSIOptions contains details about the flag
// NodeCSIOptions contains details about the flag
type NodeCSIOptions struct {
Endpoint string // Used for Block Volume CSI driver
NodeID string
LogLevel string
Master string
Kubeconfig string

EnableFssDriver bool
FssEndpoint string
EnableFssDriver bool
FssEndpoint string
LustreCsiAddress string
LustreKubeletRegistrationPath string
LustreEndpoint string
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloudprovider/providers/oci/load_balancer_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
api "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/oracle/oci-cloud-controller-manager/pkg/oci/client"
"github.com/oracle/oci-go-sdk/v65/common"
"github.com/oracle/oci-go-sdk/v65/loadbalancer"
"github.com/oracle/oci-cloud-controller-manager/pkg/oci/client"
"github.com/stretchr/testify/assert"
)

Expand Down
16 changes: 8 additions & 8 deletions pkg/csi-util/lustre_lnet_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ type Parameter map[string]interface{}
/*
ValidateLustreVolumeId takes lustreVolumeId as input and returns if its valid or not along with lnetLabel
Ex. volume handle : 10.112.10.6@tcp1:/fsname
volume handle : <MGS NID>[:<MGS NID>]:/<fsname>

volume handle : <MGS NID>[:<MGS NID>]:/<fsname>
*/
func ValidateLustreVolumeId(lusterVolumeId string) (bool, string) {
const minNumOfParamsFromVolumeHandle = 2
Expand Down Expand Up @@ -91,9 +92,9 @@ type LnetService struct {

type OCILnetConfigurator struct{}

func NewLnetService() *LnetService{
func NewLnetService() *LnetService {
return &LnetService{
Configurator: &OCILnetConfigurator{},
Configurator: &OCILnetConfigurator{},
}
}

Expand Down Expand Up @@ -331,7 +332,7 @@ func (ls *LnetService) IsLnetActive(logger *zap.SugaredLogger, lnetLabel string)
}

func (olc *OCILnetConfigurator) ExecuteCommandOnWorkerNode(args ...string) (string, error) {

command := exec.Command("chroot-bash", args...)

output, err := command.CombinedOutput()
Expand Down Expand Up @@ -374,15 +375,15 @@ func isValidShellInput(input string) bool {
return false
}
// List of forbidden characters
forbiddenChars := []string{";", "&", "|", "<", ">", "(", ")", "`", "'", "\"","$","!"}
forbiddenChars := []string{";", "&", "|", "<", ">", "(", ")", "`", "'", "\"", "$", "!"}
for _, char := range forbiddenChars {
if strings.Contains(input, char) {
return false
}
}
return true
}
func ValidateLustreParameters(logger *zap.SugaredLogger, lustreParamsJson string) error {
func ValidateLustreParameters(logger *zap.SugaredLogger, lustreParamsJson string) error {
if lustreParamsJson == "" {
logger.Debug("No lustre parameters specified.")
return nil
Expand All @@ -401,7 +402,7 @@ func ValidateLustreParameters(logger *zap.SugaredLogger, lustreParamsJson strin
for key, value := range param {
logger.Infof("Validating lustre param %s=%s", key, fmt.Sprintf("%v", value))
if !isValidShellInput(key) || !isValidShellInput(fmt.Sprintf("%v", value)) {
invalidParams = append(invalidParams, fmt.Sprintf("%v=%v",key, value))
invalidParams = append(invalidParams, fmt.Sprintf("%v=%v", key, value))
}
}
}
Expand All @@ -411,4 +412,3 @@ func ValidateLustreParameters(logger *zap.SugaredLogger, lustreParamsJson strin
logger.Infof("Successfully validated lustre parameters.")
return nil
}

Loading
Loading