Skip to content

Commit

Permalink
Implement REST clients for formatting and listing devices (#651)
Browse files Browse the repository at this point in the history
Also, implements signv4 authorization flow

* Create secrets from the provided config or ENVs
* Implement an auth middleware which verifies the request using signV4
* The auth middleware fetches the secrets and verifies the access and secret key with the incoming signV4 header
  • Loading branch information
Praveenrajmani committed Sep 29, 2022
1 parent 84d4bf9 commit 4970e4d
Show file tree
Hide file tree
Showing 32 changed files with 1,642 additions and 98 deletions.
4 changes: 4 additions & 0 deletions cmd/kubectl-directpv/install.go
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
"os"
"path"

"github.com/fatih/color"
"github.com/minio/directpv/pkg/consts"
Expand Down Expand Up @@ -48,6 +49,7 @@ var (
apparmorProfile = ""
auditInstall = "install"
imagePullSecrets = []string{}
configFile = path.Join(os.Getenv("HOME"), consts.ConfigFileSuffix)
)

func init() {
Expand All @@ -62,6 +64,7 @@ func init() {
installCmd.PersistentFlags().StringSliceVarP(&tolerationParameters, "tolerations", "t", tolerationParameters, "Tolerations parameters")
installCmd.PersistentFlags().StringVarP(&seccompProfile, "seccomp-profile", "", seccompProfile, "Set Seccomp profile")
installCmd.PersistentFlags().StringVarP(&apparmorProfile, "apparmor-profile", "", apparmorProfile, "Set Apparmor profile")
installCmd.PersistentFlags().StringVarP(&configFile, fmt.Sprintf("%s-config", consts.AppName), "", configFile, fmt.Sprintf("Specify %s config file path", consts.AppPrettyName))
}

func install(ctx context.Context, args []string) (err error) {
Expand Down Expand Up @@ -100,6 +103,7 @@ func install(ctx context.Context, args []string) (err error) {
DryRun: dryRun,
AuditFile: file,
ImagePullSecrets: imagePullSecrets,
ConfigFile: configFile,
}

if err = installer.Install(ctx, installConfig); err == nil && !dryRun {
Expand Down
29 changes: 10 additions & 19 deletions go.mod
Expand Up @@ -4,22 +4,20 @@ go 1.17

require (
github.com/container-storage-interface/spec v1.3.0
github.com/docker/distribution v2.8.1+incompatible
github.com/dustin/go-humanize v1.0.0
github.com/fatih/color v1.12.0
github.com/google/uuid v1.1.2
github.com/google/uuid v1.3.0
github.com/hashicorp/errwrap v1.1.0
github.com/jedib0t/go-pretty v4.3.0+incompatible
github.com/jedib0t/go-pretty/v6 v6.0.5
github.com/jedib0t/go-pretty/v6 v6.3.9
github.com/kubernetes-csi/csi-lib-utils v0.7.0
github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4
github.com/minio/minio-go/v7 v7.0.36
github.com/minio/sha256-simd v1.0.0
github.com/mitchellh/go-homedir v1.1.0
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
github.com/prometheus/client_golang v1.12.2
github.com/prometheus/client_model v0.2.0
github.com/spf13/cobra v1.4.0
github.com/spf13/viper v1.8.1
go.uber.org/multierr v1.6.0
golang.org/x/sys v0.0.0-20220913175220-63ea55921009
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
google.golang.org/grpc v1.40.0
Expand All @@ -28,7 +26,6 @@ require (
k8s.io/apiextensions-apiserver v0.24.3
k8s.io/apimachinery v0.24.3
k8s.io/client-go v0.24.3
k8s.io/klog v1.0.0
k8s.io/klog/v2 v2.60.1
k8s.io/kube-openapi v0.0.0-20220627174259-011e075b9cb8
sigs.k8s.io/yaml v1.2.0
Expand Down Expand Up @@ -65,19 +62,17 @@ require (
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20190328170749-bb2674552d8f // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.0.4 // indirect
github.com/klauspost/cpuid/v2 v2.1.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -88,30 +83,26 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/smartystreets/assertions v1.1.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/yuin/goldmark v1.4.14 // indirect
go.mongodb.org/mongo-driver v1.9.1 // indirect
go.uber.org/atomic v1.7.0 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.12 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
Expand Down

0 comments on commit 4970e4d

Please sign in to comment.