Skip to content

Commit

Permalink
✨ feat(identity): Implement GetPluginInfo (#27)
Browse files Browse the repository at this point in the history
Signed-off-by: Mriyam Tamuli <mbtamuli@gmail.com>
  • Loading branch information
mbtamuli authored Dec 27, 2023
1 parent 0903762 commit f240bf1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
7 changes: 4 additions & 3 deletions emptyDirClone/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ kind-load: ## Load docker image with the plugin, into Kind cluster targeted by t

.PHONY: deploy
deploy: ## Deploy the plugin to the K8s cluster specified in $KUBECONFIG.

kubectl apply --file deploy
@kubectl apply --filename deploy \
|| { sleep 1; kubectl apply --filename deploy; }

.PHONY: undeploy
undeploy: ## Undeploy the plugin from the K8s cluster specified in $KUBECONFIG.
kubectl delete --file deploy
@kubectl delete --filename deploy \
|| sleep 1

## Helpers

Expand Down
4 changes: 3 additions & 1 deletion emptyDirClone/internal/emptydirclone/emptydirclone.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import (
)

type Config struct {
Endpoint string
Name string
Endpoint string
VendorVersion string
}

type emptyDirClone struct {
Expand Down
5 changes: 4 additions & 1 deletion emptyDirClone/internal/emptydirclone/identityserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import (
)

func (e *emptyDirClone) GetPluginInfo(context.Context, *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
return &csi.GetPluginInfoResponse{}, nil
return &csi.GetPluginInfoResponse{
Name: e.config.Name,
VendorVersion: e.config.VendorVersion,
}, nil
}

func (e *emptyDirClone) GetPluginCapabilities(context.Context, *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
Expand Down
8 changes: 6 additions & 2 deletions emptyDirClone/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (
var version string

func main() {
const (
pluginname = "emptydirclone.mriyam.dev"
)
var endpoint string

flag.StringVar(&endpoint, "endpoint", "unix:/csi/csi.sock", "Endpoint for the gRPC server to listen on. Default: \"unix:/csi/csi.sock\"")
flag.Parse()

Expand All @@ -19,7 +21,9 @@ func main() {
}

cfg := emptydirclone.Config{
Endpoint: endpoint,
Name: pluginname,
Endpoint: endpoint,
VendorVersion: version,
}

emptydirclone := emptydirclone.New(cfg)
Expand Down

0 comments on commit f240bf1

Please sign in to comment.