Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Initial code dump for the Scality COSI driver
Browse files Browse the repository at this point in the history
Issue: S3C-9223
  • Loading branch information
anurag4DSB committed Sep 11, 2024
1 parent 0eeaf2e commit f9b93bd
Show file tree
Hide file tree
Showing 21 changed files with 450 additions and 868 deletions.
26 changes: 0 additions & 26 deletions CONTRIBUTING.md

This file was deleted.

35 changes: 0 additions & 35 deletions Dockerfile

This file was deleted.

31 changes: 0 additions & 31 deletions Makefile

This file was deleted.

10 changes: 0 additions & 10 deletions OWNERS

This file was deleted.

17 changes: 1 addition & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1 @@
# cosi-driver-sample

Sample Driver that provides reference implementation for Container Object Storage Interface (COSI) API

## Community, discussion, contribution, and support

Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/).

You can reach the maintainers of this project at:

- [Slack](https://kubernetes.slack.com/messages/sig-storage)
- [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-storage)

### Code of conduct

Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).
# Scality COSI driver
9 changes: 0 additions & 9 deletions RELEASE.md

This file was deleted.

22 changes: 0 additions & 22 deletions SECURITY.md

This file was deleted.

18 changes: 0 additions & 18 deletions SECURITY_CONTACTS

This file was deleted.

87 changes: 0 additions & 87 deletions cmd/sample-cosi-driver/cmd.go

This file was deleted.

45 changes: 0 additions & 45 deletions cmd/sample-cosi-driver/main.go

This file was deleted.

69 changes: 69 additions & 0 deletions cmd/scality-cosi-driver/cmd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
Copyright 2024 Scality, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
"context"
"flag"
"fmt"

"github.com/scality/cosi/pkg/driver"
"k8s.io/klog/v2"

"sigs.k8s.io/container-object-storage-interface-provisioner-sidecar/pkg/provisioner"
)

const (
provisionerName = "scality.com"
defaultDriverPrefix = "cosi"
)

var (
driverAddress = flag.String("driver-address", "unix:///var/lib/cosi/cosi.sock", "driver address for the socket")
driverPrefix = flag.String("driver-prefix", "", "prefix for COSI driver, e.g. <prefix>.scality.com")
)

func init() {
klog.InitFlags(nil)
if err := flag.Set("logtostderr", "true"); err != nil {
klog.Exitf("Failed to set logtostderr flag: %v", err)
}
flag.Parse()

if *driverPrefix == "" {
*driverPrefix = defaultDriverPrefix
klog.Warning("No driver prefix provided, using default prefix")
}

klog.InfoS("COSI driver startup configuration", "driverAddress", *driverAddress, "driverPrefix", *driverPrefix)
}

func run(ctx context.Context) error {
driverName := *driverPrefix + "." + provisionerName

identityServer, bucketProvisioner, err := driver.CreateDriver(ctx, driverName)
if err != nil {
return fmt.Errorf("failed to initialize Scality driver: %w", err)
}

server, err := provisioner.NewDefaultCOSIProvisionerServer(*driverAddress, identityServer, bucketProvisioner)
if err != nil {
return fmt.Errorf("failed to start the provisioner server: %w", err)
}

return server.Run(ctx)
}
Loading

0 comments on commit f9b93bd

Please sign in to comment.