Skip to content

Commit

Permalink
Merge pull request #1375 from cw-Guo/feat/rollout
Browse files Browse the repository at this point in the history
feat: support rollout restart for daemonset and statefulset
  • Loading branch information
benjaminhuo authored Oct 17, 2024
2 parents bc8a756 + b219783 commit dbb6848
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
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 |

0 comments on commit dbb6848

Please sign in to comment.