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

mountPropagation option for internal mounts (#833) #834

Merged
merged 1 commit into from
Jul 17, 2023
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
3 changes: 3 additions & 0 deletions apis/fluentbit/v1alpha2/fluentbit_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type FluentBitSpec struct {
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
// Fluent Bit image pull secret
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
// MountPropagation option for internal mounts
// +kubebuilder:validation:Enum:=None;HostToContainer;Bidirectional
InternalMountPropagation *corev1.MountPropagationMode `json:"internalMountPropagation,omitempty"`
// Storage for position db. You will use it if tail input is enabled.
PositionDB corev1.VolumeSource `json:"positionDB,omitempty"`
// Container log path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2434,6 +2434,13 @@ spec:
- name
type: object
type: array
internalMountPropagation:
description: MountPropagation option for internal mounts
enum:
- None
- HostToContainer
- Bidirectional
type: string
labels:
additionalProperties:
type: string
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/fluentbit.fluent.io_fluentbits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2434,6 +2434,13 @@ spec:
- name
type: object
type: array
internalMountPropagation:
description: MountPropagation option for internal mounts
enum:
- None
- HostToContainer
- Bidirectional
type: string
labels:
additionalProperties:
type: string
Expand Down
1 change: 1 addition & 0 deletions docs/fluentbit.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ FluentBitSpec defines the desired state of FluentBit
| command | Fluent Bit Watcher command. | []string |
| imagePullPolicy | Fluent Bit image pull policy. | corev1.PullPolicy |
| imagePullSecrets | Fluent Bit image pull secret | []corev1.LocalObjectReference |
| internalMountPropagation | MountPropagation option for internal mounts | *corev1.MountPropagationMode |
| positionDB | Storage for position db. You will use it if tail input is enabled. | [corev1.VolumeSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#volume-v1-core) |
| containerLogRealPath | Container log path | string |
| resources | Compute Resources required by container. | corev1.ResourceRequirements |
Expand Down
7 changes: 7 additions & 0 deletions manifests/setup/fluent-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13996,6 +13996,13 @@ spec:
- name
type: object
type: array
internalMountPropagation:
description: MountPropagation option for internal mounts
enum:
- None
- HostToContainer
- Bidirectional
type: string
labels:
additionalProperties:
type: string
Expand Down
7 changes: 7 additions & 0 deletions manifests/setup/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13996,6 +13996,13 @@ spec:
- name
type: object
type: array
internalMountPropagation:
description: MountPropagation option for internal mounts
enum:
- None
- HostToContainer
- Bidirectional
type: string
labels:
additionalProperties:
type: string
Expand Down
26 changes: 17 additions & 9 deletions pkg/operator/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ func MakeDaemonSet(fb fluentbitv1alpha2.FluentBit, logPath string) *appsv1.Daemo
metricsPort = 2020
}

internalMountPropagation := corev1.MountPropagationNone
if fb.Spec.InternalMountPropagation != nil {
internalMountPropagation = *fb.Spec.InternalMountPropagation
}

ds := appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Name: fb.Name,
Expand Down Expand Up @@ -115,24 +120,27 @@ func MakeDaemonSet(fb fluentbitv1alpha2.FluentBit, logPath string) *appsv1.Daemo
},
VolumeMounts: []corev1.VolumeMount{
{
Name: "varlibcontainers",
ReadOnly: true,
MountPath: logPath,
Name: "varlibcontainers",
ReadOnly: true,
MountPath: logPath,
MountPropagation: &internalMountPropagation,
},
{
Name: "config",
ReadOnly: true,
MountPath: "/fluent-bit/config",
},
{
Name: "varlogs",
ReadOnly: true,
MountPath: "/var/log/",
Name: "varlogs",
ReadOnly: true,
MountPath: "/var/log/",
MountPropagation: &internalMountPropagation,
},
{
Name: "systemd",
ReadOnly: true,
MountPath: "/var/log/journal",
Name: "systemd",
ReadOnly: true,
MountPath: "/var/log/journal",
MountPropagation: &internalMountPropagation,
},
},
Resources: fb.Spec.Resources,
Expand Down
Loading