mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 10:49:15 +00:00
Add optional Volume mounting for Client containers
This commit is contained in:
@@ -20,6 +20,10 @@ type NBRoutingPeerSpec struct {
|
||||
NodeSelector map[string]string `json:"nodeSelector"`
|
||||
// +optional
|
||||
Tolerations []corev1.Toleration `json:"tolerations"`
|
||||
// +optional
|
||||
Volumes []corev1.Volume `json:"volumes"`
|
||||
// +optional
|
||||
VolumeMounts []corev1.VolumeMount `json:"volumeMounts"`
|
||||
}
|
||||
|
||||
// NBRoutingPeerStatus defines the observed state of NBRoutingPeer.
|
||||
|
||||
@@ -36,6 +36,12 @@ type NBSetupKeySpec struct {
|
||||
SecretKeyRef corev1.SecretKeySelector `json:"secretKeyRef"`
|
||||
// ManagementURL optional, override operator management URL
|
||||
ManagementURL string `json:"managementURL,omitempty"`
|
||||
// Volumes optional, additional volumes for NetBird container
|
||||
// +optional
|
||||
Volumes []corev1.Volume `json:"volumes,omitempty"`
|
||||
// VolumeMounts optional, additional volumeMounts for NetBird container
|
||||
// +optional
|
||||
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
|
||||
}
|
||||
|
||||
// NBSetupKeyStatus defines the observed state of NBSetupKey.
|
||||
|
||||
@@ -525,6 +525,20 @@ func (in *NBRoutingPeerSpec) DeepCopyInto(out *NBRoutingPeerSpec) {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Volumes != nil {
|
||||
in, out := &in.Volumes, &out.Volumes
|
||||
*out = make([]corev1.Volume, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.VolumeMounts != nil {
|
||||
in, out := &in.VolumeMounts, &out.VolumeMounts
|
||||
*out = make([]corev1.VolumeMount, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NBRoutingPeerSpec.
|
||||
@@ -637,6 +651,20 @@ func (in *NBSetupKeyList) DeepCopyObject() runtime.Object {
|
||||
func (in *NBSetupKeySpec) DeepCopyInto(out *NBSetupKeySpec) {
|
||||
*out = *in
|
||||
in.SecretKeyRef.DeepCopyInto(&out.SecretKeyRef)
|
||||
if in.Volumes != nil {
|
||||
in, out := &in.Volumes, &out.Volumes
|
||||
*out = make([]corev1.Volume, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.VolumeMounts != nil {
|
||||
in, out := &in.VolumeMounts, &out.VolumeMounts
|
||||
*out = make([]corev1.VolumeMount, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NBSetupKeySpec.
|
||||
|
||||
@@ -2,5 +2,5 @@ apiVersion: v2
|
||||
name: kubernetes-operator
|
||||
description: NetBird Kubernetes Operator
|
||||
type: application
|
||||
version: 0.1.12
|
||||
appVersion: "0.1.3"
|
||||
version: 0.1.13
|
||||
appVersion: "0.1.4"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -188,9 +188,11 @@ func (r *NBRoutingPeerReconciler) handleDeployment(ctx context.Context, req ctrl
|
||||
},
|
||||
},
|
||||
},
|
||||
Resources: nbrp.Spec.Resources,
|
||||
Resources: nbrp.Spec.Resources,
|
||||
VolumeMounts: nbrp.Spec.VolumeMounts,
|
||||
},
|
||||
},
|
||||
Volumes: nbrp.Spec.Volumes,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -231,6 +233,7 @@ func (r *NBRoutingPeerReconciler) handleDeployment(ctx context.Context, req ctrl
|
||||
}
|
||||
updatedDeployment.Spec.Template.Spec.Tolerations = nbrp.Spec.Tolerations
|
||||
updatedDeployment.Spec.Template.Spec.NodeSelector = nbrp.Spec.NodeSelector
|
||||
updatedDeployment.Spec.Template.Spec.Volumes = nbrp.Spec.Volumes
|
||||
updatedDeployment.Spec.Template.ObjectMeta.Labels = map[string]string{
|
||||
"app.kubernetes.io/name": "netbird-router",
|
||||
}
|
||||
@@ -264,6 +267,7 @@ func (r *NBRoutingPeerReconciler) handleDeployment(ctx context.Context, req ctrl
|
||||
},
|
||||
}
|
||||
updatedDeployment.Spec.Template.Spec.Containers[0].Resources = nbrp.Spec.Resources
|
||||
updatedDeployment.Spec.Template.Spec.Containers[0].VolumeMounts = nbrp.Spec.VolumeMounts
|
||||
|
||||
patch := client.StrategicMergeFrom(&routingPeerDeployment)
|
||||
bs, _ := patch.Data(updatedDeployment)
|
||||
|
||||
@@ -133,7 +133,10 @@ func (d *PodNetbirdInjector) Default(ctx context.Context, obj runtime.Object) er
|
||||
Add: []corev1.Capability{"NET_ADMIN"},
|
||||
},
|
||||
},
|
||||
VolumeMounts: nbSetupKey.Spec.VolumeMounts,
|
||||
})
|
||||
|
||||
pod.Spec.Volumes = append(pod.Spec.Volumes, nbSetupKey.Spec.Volumes...)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user