This repository has been archived by the owner on Nov 20, 2024. It is now read-only.
forked from kubernetes-sigs/cosi-driver-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial code dump for the Scality COSI driver
Issue: S3C-9223
- Loading branch information
1 parent
0eeaf2e
commit f9b93bd
Showing
21 changed files
with
450 additions
and
868 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
Oops, something went wrong.