Skip to content

Commit

Permalink
Added extra args to logging fluentd and pass it to config check
Browse files Browse the repository at this point in the history
  • Loading branch information
petergvizd authored and ahma committed Jul 20, 2022
1 parent 6f1e3e6 commit 5d5e282
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3687,6 +3687,10 @@ spec:
- name
type: object
type: array
extraArgs:
items:
type: string
type: array
extraVolumes:
items:
properties:
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/logging.banzaicloud.io_loggings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3687,6 +3687,10 @@ spec:
- name
type: object
type: array
extraArgs:
items:
type: string
type: array
extraVolumes:
items:
properties:
Expand Down
17 changes: 12 additions & 5 deletions pkg/resources/fluentd/appconfigmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ func (r *Reconciler) newCheckOutputSecret(hashKey string) (*corev1.Secret, error
}

func (r *Reconciler) newCheckPod(hashKey string) *corev1.Pod {
containerArgs := []string{
"fluentd", "-c",
fmt.Sprintf("/fluentd/etc/%s", ConfigKey),
"--dry-run",
}

if len(r.Logging.Spec.FluentdSpec.ExtraArgs) != 0 {
containerArgs = append(containerArgs, r.Logging.Spec.FluentdSpec.ExtraArgs...)
}

pod := &corev1.Pod{
ObjectMeta: r.FluentdObjectMeta(fmt.Sprintf("fluentd-configcheck-%s", hashKey), ComponentConfigCheck),
Spec: corev1.PodSpec{
Expand Down Expand Up @@ -247,11 +257,8 @@ func (r *Reconciler) newCheckPod(hashKey string) *corev1.Pod {
Name: "fluentd",
Image: r.Logging.Spec.FluentdSpec.Image.RepositoryWithTag(),
ImagePullPolicy: corev1.PullPolicy(r.Logging.Spec.FluentdSpec.Image.PullPolicy),
Args: []string{
"fluentd", "-c",
fmt.Sprintf("/fluentd/etc/%s", ConfigKey),
"--dry-run",
},
Args: containerArgs,
Env: r.Logging.Spec.FluentdSpec.EnvVars,
VolumeMounts: []corev1.VolumeMount{
{
Name: "config",
Expand Down
4 changes: 4 additions & 0 deletions pkg/resources/fluentd/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ func fluentContainer(spec *v1beta1.FluentdSpec) corev1.Container {
}
}

if len(spec.ExtraArgs) != 0 {
container.Args = append(container.Args, spec.ExtraArgs...)
}

return container
}

Expand Down
1 change: 1 addition & 0 deletions pkg/sdk/logging/api/v1beta1/fluentd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type FluentdSpec struct {
ServiceAccountOverrides *typeoverride.ServiceAccount `json:"serviceAccount,omitempty"`
DNSPolicy corev1.DNSPolicy `json:"dnsPolicy,omitempty"`
DNSConfig *corev1.PodDNSConfig `json:"dnsConfig,omitempty"`
ExtraArgs []string `json:"extraArgs,omitempty"`
}

// +kubebuilder:object:generate=true
Expand Down
5 changes: 5 additions & 0 deletions pkg/sdk/logging/api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/sdk/static/gen/crds/generated.go

Large diffs are not rendered by default.

0 comments on commit 5d5e282

Please sign in to comment.