@@ -71,6 +71,48 @@ func defaultObjectRestarter(obj runtime.Object) ([]byte, error) {
71
71
obj .Spec .Template .ObjectMeta .Annotations ["kubectl.kubernetes.io/restartedAt" ] = time .Now ().Format (time .RFC3339 )
72
72
return runtime .Encode (scheme .Codecs .LegacyCodec (appsv1beta1 .SchemeGroupVersion ), obj )
73
73
74
+ case * extensionsv1beta1.DaemonSet :
75
+ if obj .Spec .Template .ObjectMeta .Annotations == nil {
76
+ obj .Spec .Template .ObjectMeta .Annotations = make (map [string ]string )
77
+ }
78
+ obj .Spec .Template .ObjectMeta .Annotations ["kubectl.kubernetes.io/restartedAt" ] = time .Now ().Format (time .RFC3339 )
79
+ return runtime .Encode (scheme .Codecs .LegacyCodec (extensionsv1beta1 .SchemeGroupVersion ), obj )
80
+
81
+ case * appsv1.DaemonSet :
82
+ if obj .Spec .Template .ObjectMeta .Annotations == nil {
83
+ obj .Spec .Template .ObjectMeta .Annotations = make (map [string ]string )
84
+ }
85
+ obj .Spec .Template .ObjectMeta .Annotations ["kubectl.kubernetes.io/restartedAt" ] = time .Now ().Format (time .RFC3339 )
86
+ return runtime .Encode (scheme .Codecs .LegacyCodec (appsv1 .SchemeGroupVersion ), obj )
87
+
88
+ case * appsv1beta2.DaemonSet :
89
+ if obj .Spec .Template .ObjectMeta .Annotations == nil {
90
+ obj .Spec .Template .ObjectMeta .Annotations = make (map [string ]string )
91
+ }
92
+ obj .Spec .Template .ObjectMeta .Annotations ["kubectl.kubernetes.io/restartedAt" ] = time .Now ().Format (time .RFC3339 )
93
+ return runtime .Encode (scheme .Codecs .LegacyCodec (appsv1beta2 .SchemeGroupVersion ), obj )
94
+
95
+ case * appsv1.StatefulSet :
96
+ if obj .Spec .Template .ObjectMeta .Annotations == nil {
97
+ obj .Spec .Template .ObjectMeta .Annotations = make (map [string ]string )
98
+ }
99
+ obj .Spec .Template .ObjectMeta .Annotations ["kubectl.kubernetes.io/restartedAt" ] = time .Now ().Format (time .RFC3339 )
100
+ return runtime .Encode (scheme .Codecs .LegacyCodec (appsv1 .SchemeGroupVersion ), obj )
101
+
102
+ case * appsv1beta1.StatefulSet :
103
+ if obj .Spec .Template .ObjectMeta .Annotations == nil {
104
+ obj .Spec .Template .ObjectMeta .Annotations = make (map [string ]string )
105
+ }
106
+ obj .Spec .Template .ObjectMeta .Annotations ["kubectl.kubernetes.io/restartedAt" ] = time .Now ().Format (time .RFC3339 )
107
+ return runtime .Encode (scheme .Codecs .LegacyCodec (appsv1beta1 .SchemeGroupVersion ), obj )
108
+
109
+ case * appsv1beta2.StatefulSet :
110
+ if obj .Spec .Template .ObjectMeta .Annotations == nil {
111
+ obj .Spec .Template .ObjectMeta .Annotations = make (map [string ]string )
112
+ }
113
+ obj .Spec .Template .ObjectMeta .Annotations ["kubectl.kubernetes.io/restartedAt" ] = time .Now ().Format (time .RFC3339 )
114
+ return runtime .Encode (scheme .Codecs .LegacyCodec (appsv1beta2 .SchemeGroupVersion ), obj )
115
+
74
116
default :
75
117
return nil , fmt .Errorf ("restarting is not supported" )
76
118
}
0 commit comments