Skip to content

Commit

Permalink
Merge pull request red-hat-storage#84 from rewantsoni/csi-addons
Browse files Browse the repository at this point in the history
csi: add csi-addon sidecar to the rbd provisioner deployment
  • Loading branch information
openshift-merge-bot[bot] authored Feb 28, 2024
2 parents 1b9b7fb + 944e1ef commit 4f444bf
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/csi/rbddeployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ func GetRBDDeployment(namespace string) *appsv1.Deployment {
)
snapshotter.Image = sidecarImages.ContainerImages.SnapshotterImageURL

csiAddons := templates.CSIAddonsContainer.DeepCopy()
csiAddons.Args = append(csiAddons.Args,
fmt.Sprintf("--leader-election-namespace=%s", namespace),
)
csiAddons.Image = sidecarImages.ContainerImages.CSIADDONSImageURL

return &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: RBDDeploymentName,
Expand All @@ -84,6 +90,7 @@ func GetRBDDeployment(namespace string) *appsv1.Deployment {
*attacher,
*resizer,
*snapshotter,
*csiAddons,
v1.Container{
Name: "csi-rbdplugin",
Image: sidecarImages.ContainerImages.CephCSIImageURL,
Expand All @@ -95,6 +102,7 @@ func GetRBDDeployment(namespace string) *appsv1.Deployment {
"--pidlimit=-1",
"--type=rbd",
"--controllerserver=true",
fmt.Sprintf("--csi-addons-endpoint=%s", templates.DefaultCSIAddonsSocketPath),
fmt.Sprintf("--drivername=%s", GetRBDDriverName()),
},
Resources: templates.RBDPluginResourceRequirements,
Expand Down
61 changes: 61 additions & 0 deletions pkg/templates/csisidecars.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,67 @@ var SnapshotterContainer = &corev1.Container{
},
}

var CSIAddonsContainer = &corev1.Container{
Name: "csi-addons",
Args: []string{
"--node-id=$(NODE_ID)",
"--v=5",
fmt.Sprintf("--csi-addons-address=%s", DefaultCSIAddonsSocketPath),
fmt.Sprintf("--controller-port=%v", DefaultCSIAddonsContainerPort),
"--pod=$(POD_NAME)",
"--namespace=$(POD_NAMESPACE)",
"--pod-uid=$(POD_UID)",
fmt.Sprintf("--stagingpath=%s", DefaultStagingPath),
},
Ports: []corev1.ContainerPort{
{
ContainerPort: DefaultCSIAddonsContainerPort,
},
},
EnvFrom: nil,
Env: []corev1.EnvVar{
{
Name: "NODE_ID",
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "spec.nodeName",
},
},
},
{
Name: "POD_UID",
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "metadata.uid",
},
},
},
{
Name: "POD_NAME",
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "metadata.name",
},
},
},
{
Name: "POD_NAMESPACE",
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "metadata.namespace",
},
},
},
},
VolumeMounts: []corev1.VolumeMount{
{
Name: "socket-dir",
MountPath: DefaultSocketDir,
},
},
ImagePullPolicy: corev1.PullIfNotPresent,
}

var DriverRegistrar = &corev1.Container{
Name: "csi-driver-registrar",
ImagePullPolicy: corev1.PullIfNotPresent,
Expand Down
5 changes: 5 additions & 0 deletions pkg/templates/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ const (
DefaultKubeletDirPath = "/var/lib/kubelet"
DefaultProvisionerSocketPath = "unix:///csi/csi-provisioner.sock"
DefaultPluginSocketPath = "unix:///csi/csi.sock"
DefaultCSIAddonsSocketPath = "unix:///csi/csi-addons.sock"
DefaultSocketDir = "/csi"
DefaultStagingPath = "/var/lib/kubelet/plugins/kubernetes.io/csi/"

// configmap names
MonConfigMapName = "ceph-csi-configs"
EncryptionConfigMapName = "ceph-csi-kms-config"

// default port numbers
DefaultCSIAddonsContainerPort = int32(9070)
)

0 comments on commit 4f444bf

Please sign in to comment.