mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
refact(csi): use common lib-csi imports (#263)
Signed-off-by: shubham <shubham.bajpai@mayadata.io>
This commit is contained in:
parent
48e6a19d7c
commit
2906d39d94
55 changed files with 271 additions and 611 deletions
9
go.mod
9
go.mod
|
|
@ -8,25 +8,19 @@ require (
|
||||||
github.com/docker/go-units v0.4.0
|
github.com/docker/go-units v0.4.0
|
||||||
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
|
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
|
||||||
github.com/ghodss/yaml v1.0.0
|
github.com/ghodss/yaml v1.0.0
|
||||||
github.com/gogo/protobuf v1.3.0 // indirect
|
|
||||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
|
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
|
||||||
github.com/golang/protobuf v1.3.2
|
github.com/golang/protobuf v1.3.2
|
||||||
github.com/googleapis/gnostic v0.3.1 // indirect
|
|
||||||
github.com/hashicorp/golang-lru v0.5.3 // indirect
|
github.com/hashicorp/golang-lru v0.5.3 // indirect
|
||||||
github.com/imdario/mergo v0.3.7 // indirect
|
|
||||||
github.com/jpillora/go-ogle-analytics v0.0.0-20161213085824-14b04e0594ef
|
github.com/jpillora/go-ogle-analytics v0.0.0-20161213085824-14b04e0594ef
|
||||||
github.com/json-iterator/go v1.1.8 // indirect
|
|
||||||
github.com/kubernetes-csi/csi-lib-utils v0.6.1
|
github.com/kubernetes-csi/csi-lib-utils v0.6.1
|
||||||
github.com/onsi/ginkgo v1.10.3
|
github.com/onsi/ginkgo v1.10.3
|
||||||
github.com/onsi/gomega v1.7.1
|
github.com/onsi/gomega v1.7.1
|
||||||
|
github.com/openebs/lib-csi v0.0.0-20201218144414-a64be5d4731e
|
||||||
github.com/pkg/errors v0.8.1
|
github.com/pkg/errors v0.8.1
|
||||||
github.com/spf13/cobra v0.0.5
|
github.com/spf13/cobra v0.0.5
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
|
||||||
github.com/stretchr/testify v1.5.1
|
github.com/stretchr/testify v1.5.1
|
||||||
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 // indirect
|
|
||||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9
|
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9
|
||||||
golang.org/x/sys v0.0.0-20190902133755-9109b7679e13
|
golang.org/x/sys v0.0.0-20190902133755-9109b7679e13
|
||||||
google.golang.org/appengine v1.6.2 // indirect
|
|
||||||
google.golang.org/grpc v1.23.1
|
google.golang.org/grpc v1.23.1
|
||||||
k8s.io/api v0.15.12
|
k8s.io/api v0.15.12
|
||||||
k8s.io/apimachinery v0.15.12
|
k8s.io/apimachinery v0.15.12
|
||||||
|
|
@ -36,7 +30,6 @@ require (
|
||||||
k8s.io/klog v1.0.0
|
k8s.io/klog v1.0.0
|
||||||
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a // indirect
|
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a // indirect
|
||||||
k8s.io/kubernetes v1.15.12
|
k8s.io/kubernetes v1.15.12
|
||||||
k8s.io/utils v0.0.0-20191114184206-e782cd3c129f // indirect
|
|
||||||
sigs.k8s.io/controller-runtime v0.2.0
|
sigs.k8s.io/controller-runtime v0.2.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
2
go.sum
2
go.sum
|
|
@ -283,6 +283,8 @@ github.com/opencontainers/image-spec v0.0.0-20170604055404-372ad780f634/go.mod h
|
||||||
github.com/opencontainers/runc v0.0.0-20181113202123-f000fe11ece1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
|
github.com/opencontainers/runc v0.0.0-20181113202123-f000fe11ece1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
|
||||||
github.com/opencontainers/runtime-spec v1.0.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
github.com/opencontainers/runtime-spec v1.0.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||||
github.com/opencontainers/selinux v0.0.0-20170621221121-4a2974bf1ee9/go.mod h1:+BLncwf63G4dgOzykXAxcmnFlUaOlkDdmw/CqsW6pjs=
|
github.com/opencontainers/selinux v0.0.0-20170621221121-4a2974bf1ee9/go.mod h1:+BLncwf63G4dgOzykXAxcmnFlUaOlkDdmw/CqsW6pjs=
|
||||||
|
github.com/openebs/lib-csi v0.0.0-20201218144414-a64be5d4731e h1:40mLG8RrhwHYSS3InWsWiYVcASRgGbLWrwJkP7TS0rA=
|
||||||
|
github.com/openebs/lib-csi v0.0.0-20201218144414-a64be5d4731e/go.mod h1:RqhCQqpcbFcAeNg54v9IOqLbY0/7S00WUa24ozC7cjI=
|
||||||
github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
|
github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
|
||||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||||
github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ limitations under the License.
|
||||||
package bkpbuilder
|
package bkpbuilder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder is the builder object for ZFSBackup
|
// Builder is the builder object for ZFSBackup
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ package bkpbuilder
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
|
||||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||||
client "github.com/openebs/zfs-localpv/pkg/common/kubernetes/client"
|
|
||||||
clientset "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset"
|
clientset "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ limitations under the License.
|
||||||
package restorebuilder
|
package restorebuilder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder is the builder object for ZFSRestore
|
// Builder is the builder object for ZFSRestore
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ package restorebuilder
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
|
||||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||||
client "github.com/openebs/zfs-localpv/pkg/common/kubernetes/client"
|
|
||||||
clientset "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset"
|
clientset "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ limitations under the License.
|
||||||
package snapbuilder
|
package snapbuilder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder is the builder object for ZFSSnapshot
|
// Builder is the builder object for ZFSSnapshot
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ package snapbuilder
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
|
||||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||||
client "github.com/openebs/zfs-localpv/pkg/common/kubernetes/client"
|
|
||||||
clientset "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset"
|
clientset "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ limitations under the License.
|
||||||
package volbuilder
|
package volbuilder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder is the builder object for ZFSVolume
|
// Builder is the builder object for ZFSVolume
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ package volbuilder
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
|
||||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||||
client "github.com/openebs/zfs-localpv/pkg/common/kubernetes/client"
|
|
||||||
clientset "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset"
|
clientset "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2020 The OpenEBS Authors
|
|
||||||
|
|
||||||
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 v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestClientsetGet(t *testing.T) {
|
|
||||||
tests := map[string]struct {
|
|
||||||
iserr bool
|
|
||||||
}{
|
|
||||||
"101": {true},
|
|
||||||
}
|
|
||||||
|
|
||||||
for name, mock := range tests {
|
|
||||||
t.Run(name, func(t *testing.T) {
|
|
||||||
_, err := Clientset().Get()
|
|
||||||
if !mock.iserr && err != nil {
|
|
||||||
t.Fatalf("Test '%s' failed: expected no error: actual '%s'", name, err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2020 The OpenEBS Authors
|
|
||||||
|
|
||||||
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 v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/env"
|
|
||||||
"os"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
// test if configFromENV implements ConfigGetter interface
|
|
||||||
var _ ConfigGetter = &configFromENV{}
|
|
||||||
|
|
||||||
// test if configFromREST implements ConfigGetter interface
|
|
||||||
var _ ConfigGetter = &configFromREST{}
|
|
||||||
|
|
||||||
// test if ConfigGetters implements ConfigGetter interface
|
|
||||||
var _ ConfigGetter = ConfigGetters{}
|
|
||||||
|
|
||||||
func TestConfigFromENV(t *testing.T) {
|
|
||||||
tests := map[string]struct {
|
|
||||||
masterip string
|
|
||||||
kubeconfig string
|
|
||||||
iserr bool
|
|
||||||
}{
|
|
||||||
"101": {"", "", true},
|
|
||||||
"102": {"", "/etc/config/kubeconfig", true},
|
|
||||||
"103": {"0.0.0.0", "", false},
|
|
||||||
"104": {"0.0.0.0", "/etc/config/config", true},
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sub tests is not used here as env key is set & unset to test. Since env
|
|
||||||
// is a global setting, the tests should run serially
|
|
||||||
for name, mock := range tests {
|
|
||||||
masterip := os.Getenv(string(env.KubeMaster))
|
|
||||||
defer os.Setenv(string(env.KubeMaster), masterip)
|
|
||||||
|
|
||||||
kubeconfig := os.Getenv(string(env.KubeConfig))
|
|
||||||
defer os.Setenv(string(env.KubeConfig), kubeconfig)
|
|
||||||
|
|
||||||
err := os.Setenv(string(env.KubeMaster), mock.masterip)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Test '%s' failed: %s", name, err)
|
|
||||||
}
|
|
||||||
err = os.Setenv(string(env.KubeConfig), mock.kubeconfig)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Test '%s' failed: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &configFromENV{}
|
|
||||||
config, err := c.Get()
|
|
||||||
|
|
||||||
if !mock.iserr && config == nil {
|
|
||||||
t.Fatalf("Test '%s' failed: expected config: actual nil config", name)
|
|
||||||
}
|
|
||||||
if !mock.iserr && err != nil {
|
|
||||||
t.Fatalf("Test '%s' failed: expected no error: actual %s", name, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2020 The OpenEBS Authors
|
|
||||||
|
|
||||||
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 v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
// test if configmap implements ConfigMapGetter interface
|
|
||||||
var _ ConfigMapGetter = &Configmap{}
|
|
||||||
|
|
||||||
func TestConfigMapGet(t *testing.T) {
|
|
||||||
tests := map[string]struct {
|
|
||||||
namespace string
|
|
||||||
name string
|
|
||||||
options metav1.GetOptions
|
|
||||||
iserr bool
|
|
||||||
}{
|
|
||||||
"101": {"", "", metav1.GetOptions{}, true},
|
|
||||||
"102": {"default", "", metav1.GetOptions{}, true},
|
|
||||||
"103": {"default", "myconf", metav1.GetOptions{}, true},
|
|
||||||
}
|
|
||||||
|
|
||||||
for name, mock := range tests {
|
|
||||||
t.Run(name, func(t *testing.T) {
|
|
||||||
_, err := ConfigMap(mock.namespace, mock.name).Get(mock.options)
|
|
||||||
if !mock.iserr && err != nil {
|
|
||||||
t.Fatalf("Test '%s' failed: expected no error: actual '%s'", name, err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2020 The OpenEBS Authors
|
|
||||||
|
|
||||||
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 v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
// test if dynamic implements DynamicProvider interface
|
|
||||||
var _ DynamicProvider = &DynamicStruct{}
|
|
||||||
|
|
||||||
func TestDynamicProvider(t *testing.T) {
|
|
||||||
tests := map[string]struct {
|
|
||||||
iserr bool
|
|
||||||
}{
|
|
||||||
"101": {true},
|
|
||||||
}
|
|
||||||
|
|
||||||
for name, mock := range tests {
|
|
||||||
t.Run(name, func(t *testing.T) {
|
|
||||||
_, err := Dynamic().Provide()
|
|
||||||
if !mock.iserr && err != nil {
|
|
||||||
t.Fatalf("Test '%s' failed: expected no error: actual '%s'", name, err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2020 The OpenEBS Authors
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
// Move this file to pkg/k8sresource/v1alpha1
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
// verify if resource struct is an implementation of ResourceGetter
|
|
||||||
var _ ResourceGetter = &ResourceStruct{}
|
|
||||||
|
|
||||||
// verify if resource struct is an implementation of ResourceCreator
|
|
||||||
var _ ResourceCreator = &ResourceStruct{}
|
|
||||||
|
|
||||||
// verify if resource struct is an implementation of ResourceUpdater
|
|
||||||
var _ ResourceUpdater = &ResourceStruct{}
|
|
||||||
|
|
||||||
// verify if createOrUpdate struct is an implementation of ResourceApplier
|
|
||||||
var _ ResourceApplier = &ResourceCreateOrUpdater{}
|
|
||||||
|
|
@ -1,310 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2019 The OpenEBS Authors
|
|
||||||
|
|
||||||
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 v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"k8s.io/client-go/dynamic"
|
|
||||||
"k8s.io/client-go/kubernetes"
|
|
||||||
"k8s.io/client-go/rest"
|
|
||||||
)
|
|
||||||
|
|
||||||
func fakeGetClientsetOk(c *rest.Config) (*kubernetes.Clientset, error) {
|
|
||||||
return &kubernetes.Clientset{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeGetClientsetErr(c *rest.Config) (*kubernetes.Clientset, error) {
|
|
||||||
return nil, errors.New("fake error")
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeInClusterConfigOk() (*rest.Config, error) {
|
|
||||||
return &rest.Config{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeInClusterConfigErr() (*rest.Config, error) {
|
|
||||||
return nil, errors.New("fake error")
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeBuildConfigFromFlagsOk(kubemaster string, kubeconfig string) (*rest.Config, error) {
|
|
||||||
return &rest.Config{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeBuildConfigFromFlagsErr(kubemaster string, kubeconfig string) (*rest.Config, error) {
|
|
||||||
return nil, errors.New("fake error")
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeGetKubeConfigPathOk(e string) string {
|
|
||||||
return "fake"
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeGetKubeConfigPathNil(e string) string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeGetKubeMasterIPOk(e string) string {
|
|
||||||
return "fake"
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeGetKubeMasterIPNil(e string) string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeGetDynamicClientSetOk(c *rest.Config) (dynamic.Interface, error) {
|
|
||||||
return dynamic.NewForConfig(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeGetDynamicClientSetNil(c *rest.Config) (dynamic.Interface, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func fakeGetDynamicClientSetErr(c *rest.Config) (dynamic.Interface, error) {
|
|
||||||
return nil, errors.New("fake error")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestNewInCluster(t *testing.T) {
|
|
||||||
c := New(InCluster())
|
|
||||||
if !c.IsInCluster {
|
|
||||||
t.Fatalf("test failed: expected IsInCluster as 'true' actual '%t'", c.IsInCluster)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestConfig(t *testing.T) {
|
|
||||||
tests := map[string]struct {
|
|
||||||
isInCluster bool
|
|
||||||
kubeConfigPath string
|
|
||||||
getInClusterConfig getInClusterConfigFunc
|
|
||||||
getKubeMasterIP getKubeMasterIPFunc
|
|
||||||
getKubeConfigPath getKubeConfigPathFunc
|
|
||||||
getConfigFromENV buildConfigFromFlagsFunc
|
|
||||||
isErr bool
|
|
||||||
}{
|
|
||||||
"t1": {true, "", fakeInClusterConfigOk, nil, nil, nil, false},
|
|
||||||
"t2": {true, "", fakeInClusterConfigErr, nil, nil, nil, true},
|
|
||||||
"t3": {false, "", fakeInClusterConfigErr, fakeGetKubeMasterIPNil, fakeGetKubeConfigPathNil, nil, true},
|
|
||||||
"t4": {false, "", fakeInClusterConfigOk, fakeGetKubeMasterIPNil, fakeGetKubeConfigPathNil, nil, false},
|
|
||||||
"t5": {false, "fakeKubeConfigPath", nil, fakeGetKubeMasterIPOk, fakeGetKubeConfigPathNil, fakeBuildConfigFromFlagsOk, false},
|
|
||||||
"t6": {false, "", nil, fakeGetKubeMasterIPNil, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsOk, false},
|
|
||||||
"t7": {false, "", nil, fakeGetKubeMasterIPOk, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsOk, false},
|
|
||||||
"t8": {false, "fakeKubeConfigPath", nil, fakeGetKubeMasterIPOk, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsErr, true},
|
|
||||||
"t9": {false, "fakeKubeConfigpath", nil, fakeGetKubeMasterIPOk, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsOk, false},
|
|
||||||
}
|
|
||||||
for name, mock := range tests {
|
|
||||||
name, mock := name, mock // pin It
|
|
||||||
t.Run(name, func(t *testing.T) {
|
|
||||||
c := &Client{
|
|
||||||
IsInCluster: mock.isInCluster,
|
|
||||||
KubeConfigPath: mock.kubeConfigPath,
|
|
||||||
getInClusterConfig: mock.getInClusterConfig,
|
|
||||||
getKubeMasterIP: mock.getKubeMasterIP,
|
|
||||||
getKubeConfigPath: mock.getKubeConfigPath,
|
|
||||||
buildConfigFromFlags: mock.getConfigFromENV,
|
|
||||||
}
|
|
||||||
_, err := c.Config()
|
|
||||||
if mock.isErr && err == nil {
|
|
||||||
t.Fatalf("test '%s' failed: expected no error actual '%s'", name, err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetConfigFromENV(t *testing.T) {
|
|
||||||
tests := map[string]struct {
|
|
||||||
getKubeMasterIP getKubeMasterIPFunc
|
|
||||||
getKubeConfigPath getKubeConfigPathFunc
|
|
||||||
getConfigFromENV buildConfigFromFlagsFunc
|
|
||||||
isErr bool
|
|
||||||
}{
|
|
||||||
"t1": {fakeGetKubeMasterIPNil, fakeGetKubeConfigPathNil, nil, true},
|
|
||||||
"t2": {fakeGetKubeMasterIPNil, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsOk, false},
|
|
||||||
"t3": {fakeGetKubeMasterIPOk, fakeGetKubeConfigPathNil, fakeBuildConfigFromFlagsOk, false},
|
|
||||||
"t4": {fakeGetKubeMasterIPOk, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsOk, false},
|
|
||||||
"t5": {fakeGetKubeMasterIPNil, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsErr, true},
|
|
||||||
"t6": {fakeGetKubeMasterIPOk, fakeGetKubeConfigPathNil, fakeBuildConfigFromFlagsErr, true},
|
|
||||||
"t7": {fakeGetKubeMasterIPOk, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsErr, true},
|
|
||||||
}
|
|
||||||
for name, mock := range tests {
|
|
||||||
name, mock := name, mock // pin It
|
|
||||||
t.Run(name, func(t *testing.T) {
|
|
||||||
c := &Client{
|
|
||||||
getKubeMasterIP: mock.getKubeMasterIP,
|
|
||||||
getKubeConfigPath: mock.getKubeConfigPath,
|
|
||||||
buildConfigFromFlags: mock.getConfigFromENV,
|
|
||||||
}
|
|
||||||
_, err := c.getConfigFromENV()
|
|
||||||
if mock.isErr && err == nil {
|
|
||||||
t.Fatalf("test '%s' failed: expected error actual no error", name)
|
|
||||||
}
|
|
||||||
if !mock.isErr && err != nil {
|
|
||||||
t.Fatalf("test '%s' failed: expected no error actual '%s'", name, err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetConfigFromPathOrDirect(t *testing.T) {
|
|
||||||
tests := map[string]struct {
|
|
||||||
kubeConfigPath string
|
|
||||||
getConfigFromFlags buildConfigFromFlagsFunc
|
|
||||||
getInClusterConfig getInClusterConfigFunc
|
|
||||||
isErr bool
|
|
||||||
}{
|
|
||||||
"T1": {"", fakeBuildConfigFromFlagsErr, fakeInClusterConfigOk, false},
|
|
||||||
"T2": {"fake-path", fakeBuildConfigFromFlagsOk, fakeInClusterConfigErr, false},
|
|
||||||
"T3": {"fake-path", fakeBuildConfigFromFlagsErr, fakeInClusterConfigOk, true},
|
|
||||||
"T4": {"", fakeBuildConfigFromFlagsOk, fakeInClusterConfigErr, true},
|
|
||||||
"T5": {"fake-path", fakeBuildConfigFromFlagsErr, fakeInClusterConfigErr, true},
|
|
||||||
}
|
|
||||||
for name, mock := range tests {
|
|
||||||
name, mock := name, mock // pin It
|
|
||||||
t.Run(name, func(t *testing.T) {
|
|
||||||
c := &Client{
|
|
||||||
KubeConfigPath: mock.kubeConfigPath,
|
|
||||||
buildConfigFromFlags: mock.getConfigFromFlags,
|
|
||||||
getInClusterConfig: mock.getInClusterConfig,
|
|
||||||
getKubeMasterIP: fakeGetKubeMasterIPNil,
|
|
||||||
getKubeConfigPath: fakeGetKubeConfigPathNil,
|
|
||||||
}
|
|
||||||
_, err := c.GetConfigForPathOrDirect()
|
|
||||||
if mock.isErr && err == nil {
|
|
||||||
t.Fatalf("test '%s' failed: expected error actual no error", name)
|
|
||||||
}
|
|
||||||
if !mock.isErr && err != nil {
|
|
||||||
t.Fatalf("test '%s' failed: expected no error actual '%s'", name, err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestClientset(t *testing.T) {
|
|
||||||
tests := map[string]struct {
|
|
||||||
isInCluster bool
|
|
||||||
kubeConfigPath string
|
|
||||||
getInClusterConfig getInClusterConfigFunc
|
|
||||||
getKubeMasterIP getKubeMasterIPFunc
|
|
||||||
getKubeConfigPath getKubeConfigPathFunc
|
|
||||||
getConfigFromENV buildConfigFromFlagsFunc
|
|
||||||
getKubernetesClientset getKubernetesClientsetFunc
|
|
||||||
isErr bool
|
|
||||||
}{
|
|
||||||
"t10": {true, "", fakeInClusterConfigOk, nil, nil, nil, fakeGetClientsetOk, false},
|
|
||||||
"t11": {true, "", fakeInClusterConfigOk, nil, nil, nil, fakeGetClientsetErr, true},
|
|
||||||
"t12": {true, "", fakeInClusterConfigErr, nil, nil, nil, fakeGetClientsetOk, true},
|
|
||||||
|
|
||||||
"t21": {false, "", nil, fakeGetKubeMasterIPOk, fakeGetKubeConfigPathNil, fakeBuildConfigFromFlagsOk, fakeGetClientsetOk, false},
|
|
||||||
"t22": {false, "", nil, fakeGetKubeMasterIPNil, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsOk, fakeGetClientsetOk, false},
|
|
||||||
"t23": {false, "", nil, fakeGetKubeMasterIPOk, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsOk, fakeGetClientsetOk, false},
|
|
||||||
"t24": {false, "fake-path", nil, fakeGetKubeMasterIPOk, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsErr, fakeGetClientsetOk, true},
|
|
||||||
"t25": {false, "", nil, fakeGetKubeMasterIPOk, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsOk, fakeGetClientsetErr, true},
|
|
||||||
"t26": {false, "fakePath", nil, fakeGetKubeMasterIPOk, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsErr, fakeGetClientsetOk, true},
|
|
||||||
|
|
||||||
"t30": {false, "", fakeInClusterConfigOk, fakeGetKubeMasterIPNil, fakeGetKubeConfigPathNil, nil, fakeGetClientsetOk, false},
|
|
||||||
"t31": {false, "", fakeInClusterConfigOk, fakeGetKubeMasterIPNil, fakeGetKubeConfigPathNil, nil, fakeGetClientsetErr, true},
|
|
||||||
"t32": {false, "", fakeInClusterConfigErr, fakeGetKubeMasterIPNil, fakeGetKubeConfigPathNil, nil, nil, true},
|
|
||||||
"t33": {false, "fakePath", nil, fakeGetKubeMasterIPOk, fakeGetKubeConfigPathOk, fakeBuildConfigFromFlagsOk, fakeGetClientsetOk, false},
|
|
||||||
}
|
|
||||||
for name, mock := range tests {
|
|
||||||
name, mock := name, mock // pin It
|
|
||||||
t.Run(name, func(t *testing.T) {
|
|
||||||
c := &Client{
|
|
||||||
IsInCluster: mock.isInCluster,
|
|
||||||
KubeConfigPath: mock.kubeConfigPath,
|
|
||||||
getInClusterConfig: mock.getInClusterConfig,
|
|
||||||
getKubeMasterIP: mock.getKubeMasterIP,
|
|
||||||
getKubeConfigPath: mock.getKubeConfigPath,
|
|
||||||
buildConfigFromFlags: mock.getConfigFromENV,
|
|
||||||
getKubernetesClientset: mock.getKubernetesClientset,
|
|
||||||
}
|
|
||||||
_, err := c.Clientset()
|
|
||||||
if mock.isErr && err == nil {
|
|
||||||
t.Fatalf("test '%s' failed: expected error actual no error", name)
|
|
||||||
}
|
|
||||||
if !mock.isErr && err != nil {
|
|
||||||
t.Fatalf("test '%s' failed: expected no error actual '%s'", name, err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestDynamic(t *testing.T) {
|
|
||||||
tests := map[string]struct {
|
|
||||||
getKubeMasterIP getKubeMasterIPFunc
|
|
||||||
getInClusterConfig getInClusterConfigFunc
|
|
||||||
getKubernetesDynamicClientSet getKubernetesDynamicClientFunc
|
|
||||||
kubeConfigPath string
|
|
||||||
getConfigFromENV buildConfigFromFlagsFunc
|
|
||||||
getKubeConfigPath getKubeConfigPathFunc
|
|
||||||
isErr bool
|
|
||||||
}{
|
|
||||||
"t1": {fakeGetKubeMasterIPNil, fakeInClusterConfigErr, fakeGetDynamicClientSetOk, "fake-path", fakeBuildConfigFromFlagsOk, fakeGetKubeConfigPathNil, false},
|
|
||||||
"t2": {fakeGetKubeMasterIPNil, fakeInClusterConfigErr, fakeGetDynamicClientSetErr, "fake-path", fakeBuildConfigFromFlagsOk, fakeGetKubeConfigPathOk, true},
|
|
||||||
"t3": {fakeGetKubeMasterIPNil, fakeInClusterConfigErr, fakeGetDynamicClientSetOk, "fake-path", fakeBuildConfigFromFlagsErr, fakeGetKubeConfigPathOk, true},
|
|
||||||
"t4": {fakeGetKubeMasterIPOk, fakeInClusterConfigOk, fakeGetDynamicClientSetOk, "", fakeBuildConfigFromFlagsOk, fakeGetKubeConfigPathOk, false},
|
|
||||||
"t5": {fakeGetKubeMasterIPOk, fakeInClusterConfigErr, fakeGetDynamicClientSetErr, "", fakeBuildConfigFromFlagsOk, fakeGetKubeConfigPathOk, true},
|
|
||||||
"t6": {fakeGetKubeMasterIPNil, fakeInClusterConfigOk, fakeGetDynamicClientSetErr, "", fakeBuildConfigFromFlagsErr, fakeGetKubeConfigPathNil, true},
|
|
||||||
"t7": {fakeGetKubeMasterIPNil, fakeInClusterConfigErr, fakeGetDynamicClientSetOk, "", fakeBuildConfigFromFlagsErr, fakeGetKubeConfigPathNil, true},
|
|
||||||
"t8": {fakeGetKubeMasterIPNil, fakeInClusterConfigErr, fakeGetDynamicClientSetErr, "", fakeBuildConfigFromFlagsErr, fakeGetKubeConfigPathNil, true},
|
|
||||||
}
|
|
||||||
for name, mock := range tests {
|
|
||||||
name, mock := name, mock // pin It
|
|
||||||
t.Run(name, func(t *testing.T) {
|
|
||||||
c := &Client{
|
|
||||||
getKubeMasterIP: mock.getKubeMasterIP,
|
|
||||||
KubeConfigPath: mock.kubeConfigPath,
|
|
||||||
getInClusterConfig: mock.getInClusterConfig,
|
|
||||||
buildConfigFromFlags: mock.getConfigFromENV,
|
|
||||||
getKubeConfigPath: mock.getKubeConfigPath,
|
|
||||||
getKubernetesDynamicClient: mock.getKubernetesDynamicClientSet,
|
|
||||||
}
|
|
||||||
_, err := c.Dynamic()
|
|
||||||
if mock.isErr && err == nil {
|
|
||||||
t.Fatalf("test '%s' failed: expected error actual no error", name)
|
|
||||||
}
|
|
||||||
if !mock.isErr && err != nil {
|
|
||||||
t.Fatalf("test '%s' failed: expected no error but got '%v'", name, err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestConfigForPath(t *testing.T) {
|
|
||||||
tests := map[string]struct {
|
|
||||||
kubeConfigPath string
|
|
||||||
getConfigFromPath buildConfigFromFlagsFunc
|
|
||||||
isErr bool
|
|
||||||
}{
|
|
||||||
"T1": {"", fakeBuildConfigFromFlagsErr, true},
|
|
||||||
"T2": {"fake-path", fakeBuildConfigFromFlagsOk, false},
|
|
||||||
}
|
|
||||||
for name, mock := range tests {
|
|
||||||
name, mock := name, mock // pin It
|
|
||||||
t.Run(name, func(t *testing.T) {
|
|
||||||
c := &Client{
|
|
||||||
KubeConfigPath: mock.kubeConfigPath,
|
|
||||||
buildConfigFromFlags: mock.getConfigFromPath,
|
|
||||||
}
|
|
||||||
_, err := c.ConfigForPath(mock.kubeConfigPath)
|
|
||||||
if mock.isErr && err == nil {
|
|
||||||
t.Fatalf("test '%s' failed: expected error actual no error", name)
|
|
||||||
}
|
|
||||||
if !mock.isErr && err != nil {
|
|
||||||
t.Fatalf("test '%s' failed: expected no error but got '%v'", name, err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -21,14 +21,14 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
|
k8sapi "github.com/openebs/lib-csi/pkg/client/k8s"
|
||||||
|
"github.com/openebs/lib-csi/pkg/mount"
|
||||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||||
"github.com/openebs/zfs-localpv/pkg/builder/volbuilder"
|
"github.com/openebs/zfs-localpv/pkg/builder/volbuilder"
|
||||||
k8sapi "github.com/openebs/zfs-localpv/pkg/client/k8s/v1alpha1"
|
|
||||||
"github.com/openebs/zfs-localpv/pkg/mgmt/backup"
|
"github.com/openebs/zfs-localpv/pkg/mgmt/backup"
|
||||||
"github.com/openebs/zfs-localpv/pkg/mgmt/restore"
|
"github.com/openebs/zfs-localpv/pkg/mgmt/restore"
|
||||||
"github.com/openebs/zfs-localpv/pkg/mgmt/snapshot"
|
"github.com/openebs/zfs-localpv/pkg/mgmt/snapshot"
|
||||||
"github.com/openebs/zfs-localpv/pkg/mgmt/volume"
|
"github.com/openebs/zfs-localpv/pkg/mgmt/volume"
|
||||||
"github.com/openebs/zfs-localpv/pkg/mount"
|
|
||||||
"github.com/openebs/zfs-localpv/pkg/zfs"
|
"github.com/openebs/zfs-localpv/pkg/zfs"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,12 @@ import (
|
||||||
k8serror "k8s.io/apimachinery/pkg/api/errors"
|
k8serror "k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
|
errors "github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
|
"github.com/openebs/lib-csi/pkg/common/helpers"
|
||||||
|
schd "github.com/openebs/lib-csi/pkg/scheduler"
|
||||||
"github.com/openebs/zfs-localpv/pkg/builder/snapbuilder"
|
"github.com/openebs/zfs-localpv/pkg/builder/snapbuilder"
|
||||||
"github.com/openebs/zfs-localpv/pkg/builder/volbuilder"
|
"github.com/openebs/zfs-localpv/pkg/builder/volbuilder"
|
||||||
errors "github.com/openebs/zfs-localpv/pkg/common/errors"
|
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/helpers"
|
|
||||||
csipayload "github.com/openebs/zfs-localpv/pkg/response"
|
csipayload "github.com/openebs/zfs-localpv/pkg/response"
|
||||||
schd "github.com/openebs/zfs-localpv/pkg/scheduler"
|
|
||||||
analytics "github.com/openebs/zfs-localpv/pkg/usage"
|
analytics "github.com/openebs/zfs-localpv/pkg/usage"
|
||||||
zfs "github.com/openebs/zfs-localpv/pkg/zfs"
|
zfs "github.com/openebs/zfs-localpv/pkg/zfs"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@ package usage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/env"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/openebs/lib-csi/pkg/common/env"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OpenEBSPingPeriod ping interval of volume io analytics
|
// OpenEBSPingPeriod ping interval of volume io analytics
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
package usage
|
package usage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
k8sapi "github.com/openebs/zfs-localpv/pkg/client/k8s/v1alpha1"
|
k8sapi "github.com/openebs/lib-csi/pkg/client/k8s"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Usage struct represents all information about a usage metric sent to
|
// Usage struct represents all information about a usage metric sent to
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ limitations under the License.
|
||||||
package usage
|
package usage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
k8sapi "github.com/openebs/zfs-localpv/pkg/client/k8s/v1alpha1"
|
k8sapi "github.com/openebs/lib-csi/pkg/client/k8s"
|
||||||
env "github.com/openebs/zfs-localpv/pkg/common/env"
|
env "github.com/openebs/lib-csi/pkg/common/env"
|
||||||
openebsversion "github.com/openebs/zfs-localpv/pkg/version"
|
openebsversion "github.com/openebs/zfs-localpv/pkg/version"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
||||||
|
mnt "github.com/openebs/lib-csi/pkg/mount"
|
||||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||||
mnt "github.com/openebs/zfs-localpv/pkg/mount"
|
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,13 @@ import (
|
||||||
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/openebs/lib-csi/pkg/btrfs"
|
||||||
|
"github.com/openebs/lib-csi/pkg/xfs"
|
||||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||||
"github.com/openebs/zfs-localpv/pkg/btrfs"
|
|
||||||
"github.com/openebs/zfs-localpv/pkg/xfs"
|
|
||||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// zfs related constants
|
// zfs related constants
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
package container
|
package container
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ limitations under the License.
|
||||||
package deploy
|
package deploy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
templatespec "github.com/openebs/zfs-localpv/tests/pts"
|
templatespec "github.com/openebs/zfs-localpv/tests/pts"
|
||||||
"github.com/openebs/zfs-localpv/tests/stringer"
|
"github.com/openebs/zfs-localpv/tests/stringer"
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
client "github.com/openebs/zfs-localpv/pkg/common/kubernetes/client"
|
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
package k8svolume
|
package k8svolume
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
package pod
|
package pod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
"github.com/openebs/zfs-localpv/tests/container"
|
"github.com/openebs/zfs-localpv/tests/container"
|
||||||
volume "github.com/openebs/zfs-localpv/tests/k8svolume"
|
volume "github.com/openebs/zfs-localpv/tests/k8svolume"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
client "github.com/openebs/zfs-localpv/pkg/common/kubernetes/client"
|
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
package pts
|
package pts
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
"github.com/openebs/zfs-localpv/tests/container"
|
"github.com/openebs/zfs-localpv/tests/container"
|
||||||
volume "github.com/openebs/zfs-localpv/tests/k8svolume"
|
volume "github.com/openebs/zfs-localpv/tests/k8svolume"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
package pvc
|
package pvc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
package pvc
|
package pvc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,11 @@ package pvc
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
client "github.com/openebs/zfs-localpv/pkg/common/kubernetes/client"
|
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
package sc
|
package sc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
storagev1 "k8s.io/api/storage/v1"
|
storagev1 "k8s.io/api/storage/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
package sc
|
package sc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
storagev1 "k8s.io/api/storage/v1"
|
storagev1 "k8s.io/api/storage/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ limitations under the License.
|
||||||
package sc
|
package sc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/errors"
|
"github.com/openebs/lib-csi/pkg/common/errors"
|
||||||
client "github.com/openebs/zfs-localpv/pkg/common/kubernetes/client"
|
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
|
||||||
storagev1 "k8s.io/api/storage/v1"
|
storagev1 "k8s.io/api/storage/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
|
|
|
||||||
201
vendor/github.com/openebs/lib-csi/LICENSE
generated
vendored
Normal file
201
vendor/github.com/openebs/lib-csi/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,201 @@
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
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.
|
||||||
0
pkg/btrfs/btrfs_util.go → vendor/github.com/openebs/lib-csi/pkg/btrfs/btrfs_util.go
generated
vendored
0
pkg/btrfs/btrfs_util.go → vendor/github.com/openebs/lib-csi/pkg/btrfs/btrfs_util.go
generated
vendored
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package v1alpha1
|
package k8s
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
@ -14,14 +14,15 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package v1alpha1
|
package k8s
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/common/env"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/openebs/lib-csi/pkg/common/env"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConfigGetter abstracts fetching of kubernetes client config
|
// ConfigGetter abstracts fetching of kubernetes client config
|
||||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package v1alpha1
|
package k8s
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package v1alpha1
|
package k8s
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package v1alpha1
|
package k8s
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package v1alpha1
|
package k8s
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package v1alpha1
|
package k8s
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
// TODO
|
// TODO
|
||||||
// Move this file to pkg/k8sresource/v1alpha1
|
// Move this file to pkg/k8sresource/v1alpha1
|
||||||
|
|
||||||
package v1alpha1
|
package k8s
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
@ -237,7 +237,7 @@ func NewResourceCreateOrUpdater(
|
||||||
// String implements Stringer interface
|
// String implements Stringer interface
|
||||||
func (r *ResourceCreateOrUpdater) String() string {
|
func (r *ResourceCreateOrUpdater) String() string {
|
||||||
if r.ResourceStruct == nil {
|
if r.ResourceStruct == nil {
|
||||||
return fmt.Sprint("ResourceCreateOrUpdater")
|
return "ResourceCreateOrUpdater"
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("ResourceCreateOrUpdater %s", r.ResourceStruct)
|
return fmt.Sprintf("ResourceCreateOrUpdater %s", r.ResourceStruct)
|
||||||
}
|
}
|
||||||
0
pkg/common/env/env.go → vendor/github.com/openebs/lib-csi/pkg/common/env/env.go
generated
vendored
0
pkg/common/env/env.go → vendor/github.com/openebs/lib-csi/pkg/common/env/env.go
generated
vendored
|
|
@ -14,13 +14,13 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package v1alpha1
|
package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
env "github.com/openebs/zfs-localpv/pkg/common/env"
|
env "github.com/openebs/lib-csi/pkg/common/env"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"k8s.io/client-go/dynamic"
|
"k8s.io/client-go/dynamic"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
|
|
@ -20,7 +20,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
k8sapi "github.com/openebs/zfs-localpv/pkg/client/k8s/v1alpha1"
|
k8sapi "github.com/openebs/lib-csi/pkg/client/k8s"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
@ -44,7 +44,7 @@ func getNodeList(topo *csi.TopologyRequirement) ([]string, error) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if nodeFiltered == false {
|
if !nodeFiltered {
|
||||||
nodelist = append(nodelist, node.Name)
|
nodelist = append(nodelist, node.Name)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
2
pkg/xfs/xfs_util.go → vendor/github.com/openebs/lib-csi/pkg/xfs/xfs_util.go
generated
vendored
2
pkg/xfs/xfs_util.go → vendor/github.com/openebs/lib-csi/pkg/xfs/xfs_util.go
generated
vendored
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
package xfs
|
package xfs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/mount"
|
"github.com/openebs/lib-csi/pkg/mount"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
19
vendor/modules.txt
vendored
19
vendor/modules.txt
vendored
|
|
@ -19,7 +19,6 @@ github.com/evanphx/json-patch
|
||||||
## explicit
|
## explicit
|
||||||
github.com/ghodss/yaml
|
github.com/ghodss/yaml
|
||||||
# github.com/gogo/protobuf v1.3.0
|
# github.com/gogo/protobuf v1.3.0
|
||||||
## explicit
|
|
||||||
github.com/gogo/protobuf/proto
|
github.com/gogo/protobuf/proto
|
||||||
github.com/gogo/protobuf/sortkeys
|
github.com/gogo/protobuf/sortkeys
|
||||||
# github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6
|
# github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6
|
||||||
|
|
@ -44,7 +43,6 @@ github.com/google/go-cmp/cmp/internal/value
|
||||||
# github.com/google/gofuzz v1.0.0
|
# github.com/google/gofuzz v1.0.0
|
||||||
github.com/google/gofuzz
|
github.com/google/gofuzz
|
||||||
# github.com/googleapis/gnostic v0.3.1
|
# github.com/googleapis/gnostic v0.3.1
|
||||||
## explicit
|
|
||||||
github.com/googleapis/gnostic/OpenAPIv2
|
github.com/googleapis/gnostic/OpenAPIv2
|
||||||
github.com/googleapis/gnostic/compiler
|
github.com/googleapis/gnostic/compiler
|
||||||
github.com/googleapis/gnostic/extensions
|
github.com/googleapis/gnostic/extensions
|
||||||
|
|
@ -59,7 +57,6 @@ github.com/hpcloud/tail/util
|
||||||
github.com/hpcloud/tail/watch
|
github.com/hpcloud/tail/watch
|
||||||
github.com/hpcloud/tail/winfile
|
github.com/hpcloud/tail/winfile
|
||||||
# github.com/imdario/mergo v0.3.7
|
# github.com/imdario/mergo v0.3.7
|
||||||
## explicit
|
|
||||||
github.com/imdario/mergo
|
github.com/imdario/mergo
|
||||||
# github.com/inconshreveable/mousetrap v1.0.0
|
# github.com/inconshreveable/mousetrap v1.0.0
|
||||||
github.com/inconshreveable/mousetrap
|
github.com/inconshreveable/mousetrap
|
||||||
|
|
@ -67,7 +64,6 @@ github.com/inconshreveable/mousetrap
|
||||||
## explicit
|
## explicit
|
||||||
github.com/jpillora/go-ogle-analytics
|
github.com/jpillora/go-ogle-analytics
|
||||||
# github.com/json-iterator/go v1.1.8
|
# github.com/json-iterator/go v1.1.8
|
||||||
## explicit
|
|
||||||
github.com/json-iterator/go
|
github.com/json-iterator/go
|
||||||
# github.com/kubernetes-csi/csi-lib-utils v0.6.1
|
# github.com/kubernetes-csi/csi-lib-utils v0.6.1
|
||||||
## explicit
|
## explicit
|
||||||
|
|
@ -110,6 +106,17 @@ github.com/onsi/gomega/matchers/support/goraph/edge
|
||||||
github.com/onsi/gomega/matchers/support/goraph/node
|
github.com/onsi/gomega/matchers/support/goraph/node
|
||||||
github.com/onsi/gomega/matchers/support/goraph/util
|
github.com/onsi/gomega/matchers/support/goraph/util
|
||||||
github.com/onsi/gomega/types
|
github.com/onsi/gomega/types
|
||||||
|
# github.com/openebs/lib-csi v0.0.0-20201218144414-a64be5d4731e
|
||||||
|
## explicit
|
||||||
|
github.com/openebs/lib-csi/pkg/btrfs
|
||||||
|
github.com/openebs/lib-csi/pkg/client/k8s
|
||||||
|
github.com/openebs/lib-csi/pkg/common/env
|
||||||
|
github.com/openebs/lib-csi/pkg/common/errors
|
||||||
|
github.com/openebs/lib-csi/pkg/common/helpers
|
||||||
|
github.com/openebs/lib-csi/pkg/common/kubernetes/client
|
||||||
|
github.com/openebs/lib-csi/pkg/mount
|
||||||
|
github.com/openebs/lib-csi/pkg/scheduler
|
||||||
|
github.com/openebs/lib-csi/pkg/xfs
|
||||||
# github.com/pkg/errors v0.8.1
|
# github.com/pkg/errors v0.8.1
|
||||||
## explicit
|
## explicit
|
||||||
github.com/pkg/errors
|
github.com/pkg/errors
|
||||||
|
|
@ -119,13 +126,11 @@ github.com/pmezard/go-difflib/difflib
|
||||||
## explicit
|
## explicit
|
||||||
github.com/spf13/cobra
|
github.com/spf13/cobra
|
||||||
# github.com/spf13/pflag v1.0.5
|
# github.com/spf13/pflag v1.0.5
|
||||||
## explicit
|
|
||||||
github.com/spf13/pflag
|
github.com/spf13/pflag
|
||||||
# github.com/stretchr/testify v1.5.1
|
# github.com/stretchr/testify v1.5.1
|
||||||
## explicit
|
## explicit
|
||||||
github.com/stretchr/testify/assert
|
github.com/stretchr/testify/assert
|
||||||
# golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472
|
# golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472
|
||||||
## explicit
|
|
||||||
golang.org/x/crypto/ssh/terminal
|
golang.org/x/crypto/ssh/terminal
|
||||||
# golang.org/x/net v0.0.0-20191004110552-13f9640d40b9
|
# golang.org/x/net v0.0.0-20191004110552-13f9640d40b9
|
||||||
## explicit
|
## explicit
|
||||||
|
|
@ -212,7 +217,6 @@ gonum.org/v1/gonum/lapack/gonum
|
||||||
gonum.org/v1/gonum/lapack/lapack64
|
gonum.org/v1/gonum/lapack/lapack64
|
||||||
gonum.org/v1/gonum/mat
|
gonum.org/v1/gonum/mat
|
||||||
# google.golang.org/appengine v1.6.2
|
# google.golang.org/appengine v1.6.2
|
||||||
## explicit
|
|
||||||
google.golang.org/appengine
|
google.golang.org/appengine
|
||||||
google.golang.org/appengine/internal
|
google.golang.org/appengine/internal
|
||||||
google.golang.org/appengine/internal/app_identity
|
google.golang.org/appengine/internal/app_identity
|
||||||
|
|
@ -569,7 +573,6 @@ k8s.io/kube-openapi/pkg/util/proto
|
||||||
## explicit
|
## explicit
|
||||||
k8s.io/kubernetes/pkg/util/mount
|
k8s.io/kubernetes/pkg/util/mount
|
||||||
# k8s.io/utils v0.0.0-20191114184206-e782cd3c129f
|
# k8s.io/utils v0.0.0-20191114184206-e782cd3c129f
|
||||||
## explicit
|
|
||||||
k8s.io/utils/buffer
|
k8s.io/utils/buffer
|
||||||
k8s.io/utils/exec
|
k8s.io/utils/exec
|
||||||
k8s.io/utils/integer
|
k8s.io/utils/integer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue