Skip to content

Commit f8c7317

Browse files
committed
modify constants
Signed-off-by: Ashima-Ashima1 <[email protected]>
1 parent 23bf1b4 commit f8c7317

File tree

6 files changed

+13
-6
lines changed

6 files changed

+13
-6
lines changed

controllers/ibmobjectcsi_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func (r *IBMObjectCSIReconciler) isNodeReady(node *appsv1.DaemonSet) bool {
279279
func (r *IBMObjectCSIReconciler) getNodeDaemonSet(instance *crutils.IBMObjectCSI) (*appsv1.DaemonSet, error) {
280280
node := &appsv1.DaemonSet{}
281281
err := r.Get(context.TODO(), types.NamespacedName{
282-
Name: oconfig.GetNameForResource(oconfig.CSINode, oconfig.DriverPrefix),
282+
Name: oconfig.CSIDaemonSetName,
283283
Namespace: instance.Namespace,
284284
}, node)
285285
return node, err

controllers/ibmobjectcsi_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ var (
156156

157157
csiNode = &appsv1.DaemonSet{
158158
ObjectMeta: metav1.ObjectMeta{
159-
Name: config.GetNameForResource(config.CSINode, config.DriverPrefix),
159+
Name: config.CSIDaemonSetName,
160160
Namespace: TestNamespace,
161161
Annotations: annotations,
162162
},

controllers/internal/crutils/ibmobjectcsi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (c *IBMObjectCSI) GetAnnotations() labels.Set {
7272

7373
// GetCSINodeSelectorLabels ...
7474
func (c *IBMObjectCSI) GetCSINodeSelectorLabels() labels.Set {
75-
return common.GetSelectorLabels(config.CSINode.String())
75+
return common.GetSelectorLabels(config.CSINode)
7676
}
7777

7878
// GetCSINodePodLabels ...

controllers/syncer/csi_node.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type csiNodeSyncer struct {
4343
func NewCSINodeSyncer(c client.Client, driver *crutils.IBMObjectCSI) syncer.Interface {
4444
obj := &appsv1.DaemonSet{
4545
ObjectMeta: metav1.ObjectMeta{
46-
Name: config.GetNameForResource(config.CSINode, config.DriverPrefix),
46+
Name: config.CSIDaemonSetName,
4747
Namespace: driver.Namespace,
4848
Annotations: driver.GetAnnotations(),
4949
Labels: driver.GetLabels(),
@@ -65,7 +65,7 @@ func NewCSINodeSyncer(c client.Client, driver *crutils.IBMObjectCSI) syncer.Inte
6565
obj: obj,
6666
}
6767

68-
return syncer.NewObjectSyncer(config.CSINode.String(), driver.Unwrap(), obj, c, func() error {
68+
return syncer.NewObjectSyncer(config.CSINode, driver.Unwrap(), obj, c, func() error {
6969
return sync.SyncFn()
7070
})
7171
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/onsi/gomega v1.33.1
1111
github.com/presslabs/controller-util v0.10.2
1212
github.com/stretchr/testify v1.9.0
13+
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
1314
k8s.io/api v0.30.1
1415
k8s.io/apimachinery v0.30.1
1516
k8s.io/client-go v0.30.1
@@ -54,7 +55,6 @@ require (
5455
github.com/spf13/pflag v1.0.5 // indirect
5556
go.uber.org/multierr v1.11.0 // indirect
5657
go.uber.org/zap v1.26.0 // indirect
57-
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
5858
golang.org/x/net v0.25.0 // indirect
5959
golang.org/x/oauth2 v0.12.0 // indirect
6060
golang.org/x/sys v0.20.0 // indirect

pkg/config/constants.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Package config ...
22
package config
33

4+
import "time"
5+
46
// Add a field here if it never changes, if it changes over time, put it to settings.go
57
const (
68
APIGroup = "objectdriver.csi.ibm.com"
@@ -43,6 +45,11 @@ const (
4345
NodeRegistrarSocketPath = "/var/lib/kubelet/plugins/cos.s3.csi.ibm.io/csi.sock"
4446
CSIEndpoint = "unix:///var/lib/csi/sockets/pluginproxy/csi.sock"
4547
CSINodeEndpoint = "unix:///csi/csi.sock"
48+
49+
DefaultLogTailLines = 300
50+
DefaultNamespace = "default"
51+
ReconcilationTime = 5 * time.Minute
52+
TransportEndpointError = "transport endpoint is not connected"
4653
)
4754

4855
var CommonCSIResourceLabels = map[string]string{

0 commit comments

Comments
 (0)