Skip to content

Commit

Permalink
Merge branch 'master' into patch
Browse files Browse the repository at this point in the history
  • Loading branch information
soniasingla authored May 6, 2021
2 parents 55f68c9 + 84ac251 commit b0f84dd
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 89 deletions.
2 changes: 1 addition & 1 deletion build/volume-manager/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# cstor-volume-mgmt releases.
#

FROM ubuntu:16.04
FROM ubuntu:18.04
RUN apt-get update; exit 0
RUN apt-get -y install rsyslog

Expand Down
2 changes: 1 addition & 1 deletion build/volume-manager/volume-manager.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ COPY . .

RUN make buildx.volume-manager

FROM ubuntu:16.04
FROM ubuntu:18.04

ARG DBUILD_DATE
ARG DBUILD_REPO_URL
Expand Down
1 change: 0 additions & 1 deletion cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
)

var (
masterURL string
kubeconfig string
)

Expand Down
5 changes: 0 additions & 5 deletions pkg/controllers/cspc-controller/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ func (f *fixture) expectListCSPIAction(cspc *cstor.CStorPoolCluster) {
f.actions = append(f.actions, action)
}

func (f *fixture) expectGetBDAction(cspc *cstor.CStorPoolCluster, bdName string) {
action := core.NewGetAction(schema.GroupVersionResource{Resource: "blockdevices"}, cspc.Namespace, bdName)
f.actions = append(f.actions, action)
}

func (f *fixture) FakeDiskCreator(totalDisk, totalNode int) {
// Create some fake block device objects over nodes.
var key, diskLabel string
Expand Down
3 changes: 0 additions & 3 deletions pkg/controllers/cspi-controller/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,8 @@ type fixture struct {
// Objects to put in the store.
cspiLister []*cstor.CStorPoolInstance

ignoreActionExpectations bool

// Actions expected to happen on the client. Objects from here are also
// preloaded into NewSimpleFake.
actions []core.Action
k8sObjects []runtime.Object
openebsObjects []runtime.Object
}
Expand Down
10 changes: 1 addition & 9 deletions pkg/controllers/cstorvolumeconfig/controller_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ type CVCController struct {

cvrLister listers.CStorVolumeReplicaLister

cvrSynced cache.InformerSynced
cspiLister listers.CStorPoolInstanceLister
cvrSynced cache.InformerSynced
// cvcSynced is used for caches sync to get populated
cvcSynced cache.InformerSynced

Expand Down Expand Up @@ -140,13 +139,6 @@ func (cb *CVCControllerBuilder) withCVRInformerSync(sl informers.SharedInformerF
return cb
}

// withCSPLister fills csp lister to controller object.
func (cb *CVCControllerBuilder) withCSPLister(sl informers.SharedInformerFactory) *CVCControllerBuilder {
cspiInformer := sl.Cstor().V1().CStorPoolInstances()
cb.CVCController.cspiLister = cspiInformer.Lister()
return cb
}

// withCVCLister returns a Store implemented simply with a map and a lock.
func (cb *CVCControllerBuilder) withCVCStore() *CVCControllerBuilder {
cb.CVCController.cvcStore = cache.NewStore(cache.DeletionHandlingMetaNamespaceKeyFunc)
Expand Down
26 changes: 0 additions & 26 deletions pkg/controllers/cstorvolumeconfig/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
k8serror "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/rand"
"k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/kubernetes/scheme"
Expand All @@ -44,7 +43,6 @@ import (

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
core "k8s.io/client-go/testing"
)

var (
Expand All @@ -67,19 +65,14 @@ type fixture struct {
cvrLister []*apis.CStorVolumeReplica
cvLister []*apis.CStorVolume

ignoreActionExpectations bool

// Actions expected to happen on the client. Objects from here are also
// preloaded into NewSimpleFake.
actions []core.Action
k8sObjects []runtime.Object
openebsObjects []runtime.Object
}

// testConfig contains the extra information required to run the test
type testConfig struct {
// isDay2OperationNeedToPerform is set then above operations will be performed
isDay2OperationNeedToPerform bool
// loopCount times reconcile function will be called
loopCount int
// time interval to trigger reconciliation
Expand All @@ -103,25 +96,6 @@ func (f *fixture) SetFakeClient() {
f.openebsClient = openebsFakeClientset.NewSimpleClientset(f.openebsObjects...)
}

func (f *fixture) expectUpdateCVCAction(cvc *apis.CStorVolumeConfig) {
action := core.NewUpdateAction(schema.GroupVersionResource{Resource: "cstorvolumeconfigs"}, cvc.Namespace, cvc)
f.actions = append(f.actions, action)
}

func (f *fixture) expectListCVRAction(cvc *apis.CStorVolumeConfig) {
action := core.NewListAction(schema.GroupVersionResource{Resource: "cstorvolumereplicas"},
schema.GroupVersionKind{Kind: "cstorvolumereplicas"}, cvc.Namespace, metav1.ListOptions{})
f.actions = append(f.actions, action)
}

func (f *fixture) run(cvcName string) {
testConfig := testConfig{
loopCount: 1,
loopDelay: time.Second * 0,
}
f.run_(cvcName, true, false, testConfig)
}

func (f *fixture) run_(cvcName string, startInformers bool, expectError bool, testConfig testConfig) {
c, informers, recorder, err := f.newCVCController()
if err != nil {
Expand Down
22 changes: 0 additions & 22 deletions pkg/controllers/cstorvolumeconfig/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,28 +130,6 @@ func getDeployOwnerReference(volume *apis.CStorVolume) []metav1.OwnerReference {
return OwnerReference
}

// getDeployTemplateAffinity returns affinities
// for target deployement
func getDeployTemplateAffinity() *corev1.Affinity {
return &corev1.Affinity{
PodAffinity: &corev1.PodAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{
corev1.PodAffinityTerm{
LabelSelector: &metav1.LabelSelector{
MatchExpressions: []metav1.LabelSelectorRequirement{
metav1.LabelSelectorRequirement{
Key: "statefulset.kubernetes.io/pod-name",
Operator: metav1.LabelSelectorOpIn,
Values: []string{},
},
},
},
},
},
},
}
}

// getTargetTemplateAffinity returns affinities for target deployement
func getTargetTemplateAffinity(policySpec *apis.CStorVolumePolicySpec) *corev1.Affinity {
if policySpec.Target.PodAffinity == nil {
Expand Down
3 changes: 0 additions & 3 deletions pkg/controllers/cstorvolumeconfig/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,13 @@ var (
// Command line flags
var (
kubeconfig = flag.String("kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
resyncPeriod = flag.Duration("resync-period", 60*time.Second, "Resync interval of the controller.")
leaderElection = flag.Bool("leader-election", false, "Enables leader election.")
leaderElectionNamespace = flag.String("leader-election-namespace", "", "The namespace where the leader election resource exists. Defaults to the pod namespace if not set.")
bindAddr = flag.String("bind", "", "IP Address to bind for CVC-Operator Server")
)

// ServerOptions holds information to start the CVC server
type ServerOptions struct {
// Address on which CVC server will serve the requests
bindAddress string
// httpServer holds the CVC Server configurations
httpServer *cvcserver.HTTPServer
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/controllers/testutil/zcmd/zpool/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,3 @@ func (poolMocker *PoolMocker) SetProperty(cmd string) ([]byte, error) {
// Add fields in PoolMocker for setting the property
return []byte{}, nil
}

func setPropertyError(cmd string) ([]byte, error) {
return []byte("fake error cann't set value"), errors.Errorf("exit status 1")
}
2 changes: 0 additions & 2 deletions pkg/controllers/volume-mgmt/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ import (
informers "github.com/openebs/api/v2/pkg/client/informers/externalversions"
)

const volumeControllerName = "CStorVolume"

// CStorVolumeController is the controller implementation for CStorVolume resources.
type CStorVolumeController struct {
// kubeclientset is a standard kubernetes clientset
Expand Down
3 changes: 0 additions & 3 deletions pkg/controllers/volume-mgmt/volume/volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,6 @@ func TestCheckValidVolume(t *testing.T) {
}

func TestExtractReplicaStatusFromJSON(t *testing.T) {
type args struct {
str string
}
tests := map[string]struct {
str string
resp *apis.CVStatus
Expand Down
7 changes: 0 additions & 7 deletions pkg/cspc/algorithm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ func NewBuilder() *Builder {
}
}

// WithNameSpace sets the Namespace field of config object with provided value.
func (b *Builder) withDefaults() *Builder {
b.ConfigObj.GetSpec = b.ConfigObj.GetCSPISpec
b.ConfigObj.Select = b.ConfigObj.SelectNode
return b
}

// WithNameSpace sets the Namespace field of config object with provided value.
func (b *Builder) WithNameSpace(ns string) *Builder {
if len(ns) == 0 {
Expand Down
5 changes: 3 additions & 2 deletions pkg/snapshot/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"encoding/json"
"fmt"
"net"
"strings"

v1proto "github.com/openebs/api/v2/pkg/proto"
Expand Down Expand Up @@ -48,7 +49,7 @@ type SnapClient struct{}
//CreateSnapshot creates snapshot by executing gRPC call
func (s *SnapClient) CreateSnapshot(ip, volName, snapName string) (*v1proto.VolumeSnapCreateResponse, error) {
var conn *grpc.ClientConn
conn, err := grpc.Dial(fmt.Sprintf("%s:%d", ip, VolumeGrpcListenPort), grpc.WithInsecure())
conn, err := grpc.Dial(net.JoinHostPort(ip, fmt.Sprintf("%d", VolumeGrpcListenPort)), grpc.WithInsecure())
if err != nil {
return nil, errors.Errorf("Unable to dial gRPC server on port %d error : %s", VolumeGrpcListenPort, err)
}
Expand Down Expand Up @@ -80,7 +81,7 @@ func (s *SnapClient) CreateSnapshot(ip, volName, snapName string) (*v1proto.Volu
//DestroySnapshot destroys snapshots by executing gRPC calls
func (s *SnapClient) DestroySnapshot(ip, volName, snapName string) (*v1proto.VolumeSnapDeleteResponse, error) {
var conn *grpc.ClientConn
conn, err := grpc.Dial(fmt.Sprintf("%s:%d", ip, VolumeGrpcListenPort), grpc.WithInsecure())
conn, err := grpc.Dial(net.JoinHostPort(ip, fmt.Sprintf("%d", VolumeGrpcListenPort)), grpc.WithInsecure())
if err != nil {
return nil, errors.Errorf("Unable to dial gRPC server on port error : %s", err)
}
Expand Down

0 comments on commit b0f84dd

Please sign in to comment.