Skip to content

Commit

Permalink
Merge pull request #834 from antrema/internalMountPropagation
Browse files Browse the repository at this point in the history
mountPropagation option for internal mounts (#833)
  • Loading branch information
benjaminhuo committed Jul 17, 2023
2 parents 1630d7b + 3a06298 commit 74e6640
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 9 deletions.
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

0 comments on commit 74e6640

Please sign in to comment.