Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use default socket paths from topolvm project #39

Merged
merged 2 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rules:
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
Expand All @@ -26,7 +27,6 @@ rules:
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
Expand Down
6 changes: 6 additions & 0 deletions controllers/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package controllers

import (
"os"

"github.com/topolvm/topolvm"
)

var (
Expand Down Expand Up @@ -93,6 +95,10 @@ var (
TopolvmNodeMemLimit = "250Mi"
TopolvmNodeCPURequest = "250m"
TopolvmNodeCPULimit = "250m"

// Defaults from topolvm project
TopolvmCSISockPath = topolvm.DefaultCSISocket
LVMdSocketPath = topolvm.DefaultLVMdSocket
)

func GetEnvOrDefault(env string) string {
Expand Down
15 changes: 8 additions & 7 deletions controllers/topolvm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package controllers
import (
"context"
"fmt"
"path/filepath"

lvmv1alpha1 "github.com/red-hat-storage/lvm-operator/api/v1alpha1"
appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -199,7 +200,7 @@ func getControllerContainer() *corev1.Container {
}

volumeMounts := []corev1.VolumeMount{
{Name: "socket-dir", MountPath: "/run/topolvm"},
{Name: "socket-dir", MountPath: filepath.Dir(TopolvmCSISockPath)},
{Name: "certs", MountPath: "/certs"},
}

Expand Down Expand Up @@ -247,7 +248,7 @@ func getCsiProvisionerContainer() *corev1.Container {

// csi provisioner container
command := []string{"/csi-provisioner",
"--csi-address=/run/topolvm/csi-topolvm.sock",
fmt.Sprintf("--csi-address=%s", TopolvmCSISockPath),
"--enable-capacity",
"--capacity-ownerref-level=2",
"--capacity-poll-interval=30s",
Expand All @@ -266,7 +267,7 @@ func getCsiProvisionerContainer() *corev1.Container {
}

volumeMounts := []corev1.VolumeMount{
{Name: "socket-dir", MountPath: "/run/topolvm"},
{Name: "socket-dir", MountPath: filepath.Dir(TopolvmCSISockPath)},
}

env := []corev1.EnvVar{
Expand Down Expand Up @@ -304,11 +305,11 @@ func getCsiResizerContainer() *corev1.Container {
// csi resizer container
command := []string{
"/csi-resizer",
"--csi-address=/run/topolvm/csi-topolvm.sock",
fmt.Sprintf("--csi-address=%s", TopolvmCSISockPath),
}

volumeMounts := []corev1.VolumeMount{
{Name: "socket-dir", MountPath: "/run/topolvm"},
{Name: "socket-dir", MountPath: filepath.Dir(TopolvmCSISockPath)},
}

csiResizer := &corev1.Container{
Expand All @@ -325,11 +326,11 @@ func getLivenessProbeContainer() *corev1.Container {
// csi liveness probe container
command := []string{
"/livenessprobe",
"--csi-address=/run/topolvm/csi-topolvm.sock",
fmt.Sprintf("--csi-address=%s", TopolvmCSISockPath),
}

volumeMounts := []corev1.VolumeMount{
{Name: "socket-dir", MountPath: "/run/topolvm"},
{Name: "socket-dir", MountPath: filepath.Dir(TopolvmCSISockPath)},
}

livenessProbe := &corev1.Container{
Expand Down
26 changes: 14 additions & 12 deletions controllers/topolvm_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (n topolvmNode) ensureCreated(r *LVMClusterReconciler, ctx context.Context,
if dsTemplate.Spec.Template.Spec.Affinity != nil {
setDaemonsetNodeSelector(dsTemplate.Spec.Template.Spec.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution, ds)
}

return nil
})

Expand Down Expand Up @@ -174,7 +174,7 @@ func getNodeDaemonSet(lvmCluster *lvmv1alpha1.LVMCluster) *appsv1.DaemonSet {
topolvmNodeTolerations = tolerations
}
labels := map[string]string{
"app": topolvmNodeName,
"app": topolvmNodeName,
}
nodeDaemonSet := &appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -218,7 +218,8 @@ func getNodeInitContainer() *corev1.Container {
}

volumeMounts := []corev1.VolumeMount{
{Name: "lvmd-config-dir", MountPath: "/etc/topolvm"}}
{Name: "lvmd-config-dir", MountPath: filepath.Dir(lvmdConfigFile)},
}

fileChecker := &corev1.Container{
Name: "file-checker",
Expand Down Expand Up @@ -249,8 +250,9 @@ func getLvmdContainer() *corev1.Container {
}

volumeMounts := []corev1.VolumeMount{
{Name: "lvmd-socket-dir", MountPath: "/run/topolvm"},
{Name: "lvmd-config-dir", MountPath: "/etc/topolvm"}}
{Name: "lvmd-socket-dir", MountPath: filepath.Dir(LVMdSocketPath)},
{Name: "lvmd-config-dir", MountPath: filepath.Dir(lvmdConfigFile)},
}

privilege := true
runUser := int64(0)
Expand All @@ -274,7 +276,7 @@ func getNodeContainer() *corev1.Container {

command := []string{
"/topolvm-node",
"--lvmd-socket=/run/lvmd/lvmd.sock",
fmt.Sprintf("--lvmd-socket=%s", LVMdSocketPath),
}

requirements := corev1.ResourceRequirements{
Expand All @@ -291,8 +293,8 @@ func getNodeContainer() *corev1.Container {
mountPropagationMode := corev1.MountPropagationBidirectional

volumeMounts := []corev1.VolumeMount{
{Name: "node-plugin-dir", MountPath: "/run/topolvm"},
{Name: "lvmd-socket-dir", MountPath: "/run/lvmd"},
// parent dir for both csi and lvm sock file is same
{Name: "node-plugin-dir", MountPath: filepath.Dir(TopolvmCSISockPath)},
{Name: "pod-volumes-dir",
MountPath: fmt.Sprintf("%spods", getAbsoluteKubeletPath(CSIKubeletRootDir)),
MountPropagation: &mountPropagationMode},
Expand Down Expand Up @@ -336,12 +338,12 @@ func getNodeContainer() *corev1.Container {
func getCsiRegistrarContainer() *corev1.Container {
command := []string{
"/csi-node-driver-registrar",
"--csi-address=/run/topolvm/csi-topolvm.sock",
fmt.Sprintf("--csi-address=%s", TopolvmCSISockPath),
fmt.Sprintf("--kubelet-registration-path=%splugins/topolvm.cybozu.com/node/csi-topolvm.sock", getAbsoluteKubeletPath(CSIKubeletRootDir)),
}

volumeMounts := []corev1.VolumeMount{
{Name: "node-plugin-dir", MountPath: "/run/topolvm"},
{Name: "node-plugin-dir", MountPath: filepath.Dir(TopolvmCSISockPath)},
{Name: "registration-dir", MountPath: "/registration"},
}

Expand All @@ -364,11 +366,11 @@ func getCsiRegistrarContainer() *corev1.Container {
func getNodeLivenessProbeContainer() *corev1.Container {
command := []string{
"/livenessprobe",
"--csi-address=/run/topolvm/csi-topolvm.sock",
fmt.Sprintf("--csi-address=%s", TopolvmCSISockPath),
}

volumeMounts := []corev1.VolumeMount{
{Name: "node-plugin-dir", MountPath: "/run/topolvm"},
{Name: "node-plugin-dir", MountPath: filepath.Dir(TopolvmCSISockPath)},
}

liveness := &corev1.Container{
Expand Down
1 change: 0 additions & 1 deletion controllers/vgmanager_daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,3 @@ func newVGManagerDaemonset(lvmCluster lvmv1alpha1.LVMCluster) appsv1.DaemonSet {
setDaemonsetNodeSelector(nodeSelector, &ds)
return ds
}

9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ require (
github.com/go-logr/logr v0.4.0
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.15.0
github.com/topolvm/topolvm v0.10.3
gotest.tools/v3 v3.0.3
k8s.io/api v0.22.1
k8s.io/apimachinery v0.22.1
k8s.io/client-go v0.22.1
sigs.k8s.io/controller-runtime v0.10.0
k8s.io/api v0.22.2
k8s.io/apimachinery v0.22.2
k8s.io/client-go v0.22.2
sigs.k8s.io/controller-runtime v0.10.2
)
Loading