Skip to content

Commit 20b3ba6

Browse files
committed
Add optional Volume mounting for Client containers
1 parent 2606b87 commit 20b3ba6

File tree

8 files changed

+3743
-3
lines changed

8 files changed

+3743
-3
lines changed

api/v1/nbroutingpeer_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ type NBRoutingPeerSpec struct {
2020
NodeSelector map[string]string `json:"nodeSelector"`
2121
// +optional
2222
Tolerations []corev1.Toleration `json:"tolerations"`
23+
// +optional
24+
Volumes []corev1.Volume `json:"volumes"`
25+
// +optional
26+
VolumeMounts []corev1.VolumeMount `json:"volumeMounts"`
2327
}
2428

2529
// NBRoutingPeerStatus defines the observed state of NBRoutingPeer.

api/v1/nbsetupkey_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ type NBSetupKeySpec struct {
3636
SecretKeyRef corev1.SecretKeySelector `json:"secretKeyRef"`
3737
// ManagementURL optional, override operator management URL
3838
ManagementURL string `json:"managementURL,omitempty"`
39+
// Volumes optional, additional volumes for NetBird container
40+
// +optional
41+
Volumes []corev1.Volume `json:"volumes,omitempty"`
42+
// VolumeMounts optional, additional volumeMounts for NetBird container
43+
// +optional
44+
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
3945
}
4046

4147
// NBSetupKeyStatus defines the observed state of NBSetupKey.

api/v1/zz_generated.deepcopy.go

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

helm/kubernetes-operator/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: kubernetes-operator
33
description: NetBird Kubernetes Operator
44
type: application
5-
version: 0.1.12
6-
appVersion: "0.1.3"
5+
version: 0.1.13
6+
appVersion: "0.1.4"

helm/kubernetes-operator/crds/netbird.io_nbroutingpeers.yaml

Lines changed: 1846 additions & 0 deletions
Large diffs are not rendered by default.

helm/kubernetes-operator/crds/netbird.io_nbsetupkeys.yaml

Lines changed: 1849 additions & 0 deletions
Large diffs are not rendered by default.

internal/controller/nbroutingpeer_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,11 @@ func (r *NBRoutingPeerReconciler) handleDeployment(ctx context.Context, req ctrl
188188
},
189189
},
190190
},
191-
Resources: nbrp.Spec.Resources,
191+
Resources: nbrp.Spec.Resources,
192+
VolumeMounts: nbrp.Spec.VolumeMounts,
192193
},
193194
},
195+
Volumes: nbrp.Spec.Volumes,
194196
},
195197
},
196198
},
@@ -231,6 +233,7 @@ func (r *NBRoutingPeerReconciler) handleDeployment(ctx context.Context, req ctrl
231233
}
232234
updatedDeployment.Spec.Template.Spec.Tolerations = nbrp.Spec.Tolerations
233235
updatedDeployment.Spec.Template.Spec.NodeSelector = nbrp.Spec.NodeSelector
236+
updatedDeployment.Spec.Template.Spec.Volumes = nbrp.Spec.Volumes
234237
updatedDeployment.Spec.Template.ObjectMeta.Labels = map[string]string{
235238
"app.kubernetes.io/name": "netbird-router",
236239
}
@@ -264,6 +267,7 @@ func (r *NBRoutingPeerReconciler) handleDeployment(ctx context.Context, req ctrl
264267
},
265268
}
266269
updatedDeployment.Spec.Template.Spec.Containers[0].Resources = nbrp.Spec.Resources
270+
updatedDeployment.Spec.Template.Spec.Containers[0].VolumeMounts = nbrp.Spec.VolumeMounts
267271

268272
patch := client.StrategicMergeFrom(&routingPeerDeployment)
269273
bs, _ := patch.Data(updatedDeployment)

internal/webhook/v1/pod_webhook.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ func (d *PodNetbirdInjector) Default(ctx context.Context, obj runtime.Object) er
133133
Add: []corev1.Capability{"NET_ADMIN"},
134134
},
135135
},
136+
VolumeMounts: nbSetupKey.Spec.VolumeMounts,
136137
})
137138

139+
pod.Spec.Volumes = append(pod.Spec.Volumes, nbSetupKey.Spec.Volumes...)
140+
138141
return nil
139142
}

0 commit comments

Comments
 (0)