Skip to content

Commit

Permalink
dd a hostNetwork setting to the Driver and ControllerPlugin Specs
Browse files Browse the repository at this point in the history
This bool setting can be added to the controllerPlugin section of the
Driver Spec.

It will be propagated to all controller plugin pods.

This implements the following design:

https://github.com/ceph/ceph-csi-operator/blob/main/docs/design/hostNetwork.md

Signed-off-by: Michael Adam <[email protected]>
  • Loading branch information
obnoxxx committed Nov 21, 2024
1 parent 47aebb6 commit 6472287
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/v1alpha1/driver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ type ControllerPluginResourcesSpec struct {
}

type ControllerPluginSpec struct {
// hostNetwork setting to be propagated to CSI controller plugin pods
HostNetwork *bool `json:"hostNetwork,omitempty"`
// Embedded common pods spec
PodCommonSpec `json:",inline"`

Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

4 changes: 4 additions & 0 deletions config/crd/bases/csi.ceph.io_drivers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,10 @@ spec:
Default is RollingUpdate.
type: string
type: object
hostNetwork:
description: hostNetwork setting to be propagated to CSI controller
plugin pods
type: boolean
imagePullPolicy:
description: To indicate the image pull policy to be applied to
all the containers in the csi driver pods.
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/csi.ceph.io_operatorconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,10 @@ spec:
"RollingUpdate". Default is RollingUpdate.
type: string
type: object
hostNetwork:
description: hostNetwork setting to be propagated to CSI controller
plugin pods
type: boolean
imagePullPolicy:
description: To indicate the image pull policy to be applied
to all the containers in the csi driver pods.
Expand Down
2 changes: 2 additions & 0 deletions internal/controller/driver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ func (r *driverReconcile) reconcileControllerPluginDeployment() error {
Strategy: ptr.Deref(pluginSpec.DeploymentStrategy, defaultDeploymentStrategy),
Template: corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{

Labels: utils.Call(func() map[string]string {
podLabels := map[string]string{}
maps.Copy(podLabels, pluginSpec.Labels)
Expand All @@ -575,6 +576,7 @@ func (r *driverReconcile) reconcileControllerPluginDeployment() error {
Spec: corev1.PodSpec{
ServiceAccountName: serviceAccountName,
PriorityClassName: ptr.Deref(pluginSpec.PrioritylClassName, ""),
HostNetwork: ptr.Deref(pluginSpec.HostNetwork, false),
Affinity: getControllerPluginPodAffinity(pluginSpec, &appSelector),
Tolerations: pluginSpec.Tolerations,
Containers: utils.Call(func() []corev1.Container {
Expand Down

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

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

0 comments on commit 6472287

Please sign in to comment.