Skip to content

feat: support rollout restart for daemonset and statefulset #1375

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

Merged
merged 1 commit into from
Oct 17, 2024
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
24 changes: 24 additions & 0 deletions controllers/fluent_controller_finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,20 @@ func (r *FluentdReconciler) mutate(obj client.Object, fd *fluentdv1alpha1.Fluent
expected := operator.MakeStatefulSet(*fd)

return func() error {
// Preserve the kubectl.kubernetes.io/restartedAt annotation
restartedAt := o.Spec.Template.Annotations["kubectl.kubernetes.io/restartedAt"]

o.Labels = expected.Labels
o.Spec = expected.Spec

// Restore the kubectl.kubernetes.io/restartedAt annotation if it existed
if restartedAt != "" {
if o.Spec.Template.Annotations == nil {
o.Spec.Template.Annotations = make(map[string]string)
}
o.Spec.Template.Annotations["kubectl.kubernetes.io/restartedAt"] = restartedAt
}

if err := ctrl.SetControllerReference(fd, o, r.Scheme); err != nil {
return err
}
Expand All @@ -153,8 +165,20 @@ func (r *FluentdReconciler) mutate(obj client.Object, fd *fluentdv1alpha1.Fluent
case *appsv1.DaemonSet:
expected := operator.MakeFluentdDaemonSet(*fd)
return func() error {
// Preserve the kubectl.kubernetes.io/restartedAt annotation
restartedAt := o.Spec.Template.Annotations["kubectl.kubernetes.io/restartedAt"]

o.Labels = expected.Labels
o.Spec = expected.Spec

// Restore the kubectl.kubernetes.io/restartedAt annotation if it existed
if restartedAt != "" {
if o.Spec.Template.Annotations == nil {
o.Spec.Template.Annotations = make(map[string]string)
}
o.Spec.Template.Annotations["kubectl.kubernetes.io/restartedAt"] = restartedAt
}

if err := ctrl.SetControllerReference(fd, o, r.Scheme); err != nil {
return err
}
Expand Down
12 changes: 12 additions & 0 deletions controllers/fluentbit_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,21 @@ func (r *FluentBitReconciler) mutate(obj client.Object, fb *fluentbitv1alpha2.Fl
expected := operator.MakeDaemonSet(*fb, logPath)

return func() error {
// Preserve the kubectl.kubernetes.io/restartedAt annotation
restartedAt := o.Spec.Template.Annotations["kubectl.kubernetes.io/restartedAt"]

o.Labels = expected.Labels
o.Annotations = expected.Annotations
o.Spec = expected.Spec

// Restore the kubectl.kubernetes.io/restartedAt annotation if it existed
if restartedAt != "" {
if o.Spec.Template.Annotations == nil {
o.Spec.Template.Annotations = make(map[string]string)
}
o.Spec.Template.Annotations["kubectl.kubernetes.io/restartedAt"] = restartedAt
}

if err := ctrl.SetControllerReference(fb, o, r.Scheme); err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions docs/plugins/fluentbit/output/azure_log_analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ Azure Log Analytics is the Azure Log Analytics output plugin, allows you to inge
| customerID | Customer ID or Workspace ID | *[plugins.Secret](../secret.md) |
| sharedKey | Specify the primary or the secondary client authentication key | *[plugins.Secret](../secret.md) |
| logType | Name of the event type. | string |
| logTypeKey | Set a record key that will populate 'logtype'. If the key is found, it will have precedence | string |
| timeKey | Specify the name of the key where the timestamp is stored. | string |
| timeGenerated | If set, overrides the timeKey value with the `time-generated-field` HTTP header value. | *bool |
Loading