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

Fluentd add volumes & volumeClaimTemplates #633

Merged
merged 1 commit into from
Mar 23, 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
10 changes: 10 additions & 0 deletions apis/fluentd/v1alpha1/fluentd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ type FluentdSpec struct {
PriorityClassName string `json:"priorityClassName,omitempty"`
// RBACRules represents additional rbac rules which will be applied to the fluentd clusterrole.
RBACRules []rbacv1.PolicyRule `json:"rbacRules,omitempty"`
// List of volumes that can be mounted by containers belonging to the pod.
Volumes []corev1.Volume `json:"volumes,omitempty"`
// Pod volumes to mount into the container's filesystem. Cannot be updated.
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
// volumeClaimTemplates is a list of claims that pods are allowed to reference.
// The StatefulSet controller is responsible for mapping network identities to
// claims in a way that maintains the identity of a pod. Every claim in
// this list must have at least one matching (by name) volumeMount in one
// container in the template.
VolumeClaimTemplates []corev1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"`
}

type BufferVolume struct {
Expand Down
1,962 changes: 1,962 additions & 0 deletions charts/fluent-operator/crds/fluentd.fluent.io_fluentds.yaml

Large diffs are not rendered by default.

1,962 changes: 1,962 additions & 0 deletions config/crd/bases/fluentd.fluent.io_fluentds.yaml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions docs/fluentd.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ FluentdSpec defines the desired state of Fluentd
| runtimeClassName | RuntimeClassName represents the container runtime configuration. | string |
| priorityClassName | PriorityClassName represents the pod's priority class. | string |
| rbacRules | RBACRules represents additional rbac rules which will be applied to the fluentd clusterrole. | []rbacv1.PolicyRule |
| volumes | List of volumes that can be mounted by containers belonging to the pod. | []corev1.Volume |
| volumeMounts | Pod volumes to mount into the container's filesystem. Cannot be updated. | []corev1.VolumeMount |
| volumeClaimTemplates | volumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. | []corev1.PersistentVolumeClaim |

[Back to TOC](#table-of-contents)
# FluentdStatus
Expand Down
1,962 changes: 1,962 additions & 0 deletions manifests/setup/fluent-operator-crd.yaml

Large diffs are not rendered by default.

1,962 changes: 1,962 additions & 0 deletions manifests/setup/setup.yaml

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions pkg/operator/sts.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ func MakeStatefulset(fd fluentdv1alpha1.Fluentd) appsv1.StatefulSet {
sts.Spec.Template.Spec.PriorityClassName = fd.Spec.PriorityClassName
}

if fd.Spec.Volumes != nil {
sts.Spec.Template.Spec.Volumes = append(sts.Spec.Template.Spec.Volumes, fd.Spec.Volumes...)
}

if fd.Spec.VolumeMounts != nil {
sts.Spec.Template.Spec.Containers[0].VolumeMounts = append(sts.Spec.Template.Spec.Containers[0].VolumeMounts, fd.Spec.VolumeMounts...)
}

if fd.Spec.VolumeClaimTemplates != nil {
sts.Spec.VolumeClaimTemplates = append(sts.Spec.VolumeClaimTemplates, fd.Spec.VolumeClaimTemplates...)
}

// Mount host or emptydir VolumeSource
if fd.Spec.BufferVolume != nil && !fd.Spec.BufferVolume.DisableBufferVolume {
bufferVolName := fmt.Sprintf("%s-buffer", fd.Name)
Expand Down