Best Testkube code snippet using v1.Update
zz_generated.conversion.go
Source:zz_generated.conversion.go
...84 return Convert_apps_DaemonSetStatus_To_v1_DaemonSetStatus(a.(*apps.DaemonSetStatus), b.(*v1.DaemonSetStatus), scope)85 }); err != nil {86 return err87 }88 if err := s.AddGeneratedConversionFunc((*v1.DaemonSetUpdateStrategy)(nil), (*apps.DaemonSetUpdateStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error {89 return Convert_v1_DaemonSetUpdateStrategy_To_apps_DaemonSetUpdateStrategy(a.(*v1.DaemonSetUpdateStrategy), b.(*apps.DaemonSetUpdateStrategy), scope)90 }); err != nil {91 return err92 }93 if err := s.AddGeneratedConversionFunc((*apps.DaemonSetUpdateStrategy)(nil), (*v1.DaemonSetUpdateStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error {94 return Convert_apps_DaemonSetUpdateStrategy_To_v1_DaemonSetUpdateStrategy(a.(*apps.DaemonSetUpdateStrategy), b.(*v1.DaemonSetUpdateStrategy), scope)95 }); err != nil {96 return err97 }98 if err := s.AddGeneratedConversionFunc((*v1.DeploymentCondition)(nil), (*apps.DeploymentCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {99 return Convert_v1_DeploymentCondition_To_apps_DeploymentCondition(a.(*v1.DeploymentCondition), b.(*apps.DeploymentCondition), scope)100 }); err != nil {101 return err102 }103 if err := s.AddGeneratedConversionFunc((*apps.DeploymentCondition)(nil), (*v1.DeploymentCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {104 return Convert_apps_DeploymentCondition_To_v1_DeploymentCondition(a.(*apps.DeploymentCondition), b.(*v1.DeploymentCondition), scope)105 }); err != nil {106 return err107 }108 if err := s.AddGeneratedConversionFunc((*v1.DeploymentList)(nil), (*apps.DeploymentList)(nil), func(a, b interface{}, scope conversion.Scope) error {109 return Convert_v1_DeploymentList_To_apps_DeploymentList(a.(*v1.DeploymentList), b.(*apps.DeploymentList), scope)110 }); err != nil {111 return err112 }113 if err := s.AddGeneratedConversionFunc((*apps.DeploymentList)(nil), (*v1.DeploymentList)(nil), func(a, b interface{}, scope conversion.Scope) error {114 return Convert_apps_DeploymentList_To_v1_DeploymentList(a.(*apps.DeploymentList), b.(*v1.DeploymentList), scope)115 }); err != nil {116 return err117 }118 if err := s.AddGeneratedConversionFunc((*v1.DeploymentSpec)(nil), (*apps.DeploymentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {119 return Convert_v1_DeploymentSpec_To_apps_DeploymentSpec(a.(*v1.DeploymentSpec), b.(*apps.DeploymentSpec), scope)120 }); err != nil {121 return err122 }123 if err := s.AddGeneratedConversionFunc((*v1.DeploymentStatus)(nil), (*apps.DeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {124 return Convert_v1_DeploymentStatus_To_apps_DeploymentStatus(a.(*v1.DeploymentStatus), b.(*apps.DeploymentStatus), scope)125 }); err != nil {126 return err127 }128 if err := s.AddGeneratedConversionFunc((*apps.DeploymentStatus)(nil), (*v1.DeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {129 return Convert_apps_DeploymentStatus_To_v1_DeploymentStatus(a.(*apps.DeploymentStatus), b.(*v1.DeploymentStatus), scope)130 }); err != nil {131 return err132 }133 if err := s.AddGeneratedConversionFunc((*v1.DeploymentStrategy)(nil), (*apps.DeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error {134 return Convert_v1_DeploymentStrategy_To_apps_DeploymentStrategy(a.(*v1.DeploymentStrategy), b.(*apps.DeploymentStrategy), scope)135 }); err != nil {136 return err137 }138 if err := s.AddGeneratedConversionFunc((*apps.DeploymentStrategy)(nil), (*v1.DeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error {139 return Convert_apps_DeploymentStrategy_To_v1_DeploymentStrategy(a.(*apps.DeploymentStrategy), b.(*v1.DeploymentStrategy), scope)140 }); err != nil {141 return err142 }143 if err := s.AddGeneratedConversionFunc((*v1.ReplicaSet)(nil), (*apps.ReplicaSet)(nil), func(a, b interface{}, scope conversion.Scope) error {144 return Convert_v1_ReplicaSet_To_apps_ReplicaSet(a.(*v1.ReplicaSet), b.(*apps.ReplicaSet), scope)145 }); err != nil {146 return err147 }148 if err := s.AddGeneratedConversionFunc((*apps.ReplicaSet)(nil), (*v1.ReplicaSet)(nil), func(a, b interface{}, scope conversion.Scope) error {149 return Convert_apps_ReplicaSet_To_v1_ReplicaSet(a.(*apps.ReplicaSet), b.(*v1.ReplicaSet), scope)150 }); err != nil {151 return err152 }153 if err := s.AddGeneratedConversionFunc((*v1.ReplicaSetCondition)(nil), (*apps.ReplicaSetCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {154 return Convert_v1_ReplicaSetCondition_To_apps_ReplicaSetCondition(a.(*v1.ReplicaSetCondition), b.(*apps.ReplicaSetCondition), scope)155 }); err != nil {156 return err157 }158 if err := s.AddGeneratedConversionFunc((*apps.ReplicaSetCondition)(nil), (*v1.ReplicaSetCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {159 return Convert_apps_ReplicaSetCondition_To_v1_ReplicaSetCondition(a.(*apps.ReplicaSetCondition), b.(*v1.ReplicaSetCondition), scope)160 }); err != nil {161 return err162 }163 if err := s.AddGeneratedConversionFunc((*v1.ReplicaSetList)(nil), (*apps.ReplicaSetList)(nil), func(a, b interface{}, scope conversion.Scope) error {164 return Convert_v1_ReplicaSetList_To_apps_ReplicaSetList(a.(*v1.ReplicaSetList), b.(*apps.ReplicaSetList), scope)165 }); err != nil {166 return err167 }168 if err := s.AddGeneratedConversionFunc((*apps.ReplicaSetList)(nil), (*v1.ReplicaSetList)(nil), func(a, b interface{}, scope conversion.Scope) error {169 return Convert_apps_ReplicaSetList_To_v1_ReplicaSetList(a.(*apps.ReplicaSetList), b.(*v1.ReplicaSetList), scope)170 }); err != nil {171 return err172 }173 if err := s.AddGeneratedConversionFunc((*v1.ReplicaSetSpec)(nil), (*apps.ReplicaSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {174 return Convert_v1_ReplicaSetSpec_To_apps_ReplicaSetSpec(a.(*v1.ReplicaSetSpec), b.(*apps.ReplicaSetSpec), scope)175 }); err != nil {176 return err177 }178 if err := s.AddGeneratedConversionFunc((*apps.ReplicaSetSpec)(nil), (*v1.ReplicaSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {179 return Convert_apps_ReplicaSetSpec_To_v1_ReplicaSetSpec(a.(*apps.ReplicaSetSpec), b.(*v1.ReplicaSetSpec), scope)180 }); err != nil {181 return err182 }183 if err := s.AddGeneratedConversionFunc((*v1.ReplicaSetStatus)(nil), (*apps.ReplicaSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {184 return Convert_v1_ReplicaSetStatus_To_apps_ReplicaSetStatus(a.(*v1.ReplicaSetStatus), b.(*apps.ReplicaSetStatus), scope)185 }); err != nil {186 return err187 }188 if err := s.AddGeneratedConversionFunc((*apps.ReplicaSetStatus)(nil), (*v1.ReplicaSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {189 return Convert_apps_ReplicaSetStatus_To_v1_ReplicaSetStatus(a.(*apps.ReplicaSetStatus), b.(*v1.ReplicaSetStatus), scope)190 }); err != nil {191 return err192 }193 if err := s.AddGeneratedConversionFunc((*v1.RollingUpdateDaemonSet)(nil), (*apps.RollingUpdateDaemonSet)(nil), func(a, b interface{}, scope conversion.Scope) error {194 return Convert_v1_RollingUpdateDaemonSet_To_apps_RollingUpdateDaemonSet(a.(*v1.RollingUpdateDaemonSet), b.(*apps.RollingUpdateDaemonSet), scope)195 }); err != nil {196 return err197 }198 if err := s.AddGeneratedConversionFunc((*apps.RollingUpdateDaemonSet)(nil), (*v1.RollingUpdateDaemonSet)(nil), func(a, b interface{}, scope conversion.Scope) error {199 return Convert_apps_RollingUpdateDaemonSet_To_v1_RollingUpdateDaemonSet(a.(*apps.RollingUpdateDaemonSet), b.(*v1.RollingUpdateDaemonSet), scope)200 }); err != nil {201 return err202 }203 if err := s.AddGeneratedConversionFunc((*v1.RollingUpdateDeployment)(nil), (*apps.RollingUpdateDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error {204 return Convert_v1_RollingUpdateDeployment_To_apps_RollingUpdateDeployment(a.(*v1.RollingUpdateDeployment), b.(*apps.RollingUpdateDeployment), scope)205 }); err != nil {206 return err207 }208 if err := s.AddGeneratedConversionFunc((*apps.RollingUpdateDeployment)(nil), (*v1.RollingUpdateDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error {209 return Convert_apps_RollingUpdateDeployment_To_v1_RollingUpdateDeployment(a.(*apps.RollingUpdateDeployment), b.(*v1.RollingUpdateDeployment), scope)210 }); err != nil {211 return err212 }213 if err := s.AddGeneratedConversionFunc((*v1.RollingUpdateStatefulSetStrategy)(nil), (*apps.RollingUpdateStatefulSetStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error {214 return Convert_v1_RollingUpdateStatefulSetStrategy_To_apps_RollingUpdateStatefulSetStrategy(a.(*v1.RollingUpdateStatefulSetStrategy), b.(*apps.RollingUpdateStatefulSetStrategy), scope)215 }); err != nil {216 return err217 }218 if err := s.AddGeneratedConversionFunc((*apps.RollingUpdateStatefulSetStrategy)(nil), (*v1.RollingUpdateStatefulSetStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error {219 return Convert_apps_RollingUpdateStatefulSetStrategy_To_v1_RollingUpdateStatefulSetStrategy(a.(*apps.RollingUpdateStatefulSetStrategy), b.(*v1.RollingUpdateStatefulSetStrategy), scope)220 }); err != nil {221 return err222 }223 if err := s.AddGeneratedConversionFunc((*v1.StatefulSet)(nil), (*apps.StatefulSet)(nil), func(a, b interface{}, scope conversion.Scope) error {224 return Convert_v1_StatefulSet_To_apps_StatefulSet(a.(*v1.StatefulSet), b.(*apps.StatefulSet), scope)225 }); err != nil {226 return err227 }228 if err := s.AddGeneratedConversionFunc((*apps.StatefulSet)(nil), (*v1.StatefulSet)(nil), func(a, b interface{}, scope conversion.Scope) error {229 return Convert_apps_StatefulSet_To_v1_StatefulSet(a.(*apps.StatefulSet), b.(*v1.StatefulSet), scope)230 }); err != nil {231 return err232 }233 if err := s.AddGeneratedConversionFunc((*v1.StatefulSetCondition)(nil), (*apps.StatefulSetCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {234 return Convert_v1_StatefulSetCondition_To_apps_StatefulSetCondition(a.(*v1.StatefulSetCondition), b.(*apps.StatefulSetCondition), scope)235 }); err != nil {236 return err237 }238 if err := s.AddGeneratedConversionFunc((*apps.StatefulSetCondition)(nil), (*v1.StatefulSetCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {239 return Convert_apps_StatefulSetCondition_To_v1_StatefulSetCondition(a.(*apps.StatefulSetCondition), b.(*v1.StatefulSetCondition), scope)240 }); err != nil {241 return err242 }243 if err := s.AddGeneratedConversionFunc((*v1.StatefulSetList)(nil), (*apps.StatefulSetList)(nil), func(a, b interface{}, scope conversion.Scope) error {244 return Convert_v1_StatefulSetList_To_apps_StatefulSetList(a.(*v1.StatefulSetList), b.(*apps.StatefulSetList), scope)245 }); err != nil {246 return err247 }248 if err := s.AddGeneratedConversionFunc((*apps.StatefulSetList)(nil), (*v1.StatefulSetList)(nil), func(a, b interface{}, scope conversion.Scope) error {249 return Convert_apps_StatefulSetList_To_v1_StatefulSetList(a.(*apps.StatefulSetList), b.(*v1.StatefulSetList), scope)250 }); err != nil {251 return err252 }253 if err := s.AddGeneratedConversionFunc((*v1.StatefulSetStatus)(nil), (*apps.StatefulSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {254 return Convert_v1_StatefulSetStatus_To_apps_StatefulSetStatus(a.(*v1.StatefulSetStatus), b.(*apps.StatefulSetStatus), scope)255 }); err != nil {256 return err257 }258 if err := s.AddGeneratedConversionFunc((*apps.StatefulSetStatus)(nil), (*v1.StatefulSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {259 return Convert_apps_StatefulSetStatus_To_v1_StatefulSetStatus(a.(*apps.StatefulSetStatus), b.(*v1.StatefulSetStatus), scope)260 }); err != nil {261 return err262 }263 if err := s.AddGeneratedConversionFunc((*v1.StatefulSetUpdateStrategy)(nil), (*apps.StatefulSetUpdateStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error {264 return Convert_v1_StatefulSetUpdateStrategy_To_apps_StatefulSetUpdateStrategy(a.(*v1.StatefulSetUpdateStrategy), b.(*apps.StatefulSetUpdateStrategy), scope)265 }); err != nil {266 return err267 }268 if err := s.AddGeneratedConversionFunc((*apps.StatefulSetUpdateStrategy)(nil), (*v1.StatefulSetUpdateStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error {269 return Convert_apps_StatefulSetUpdateStrategy_To_v1_StatefulSetUpdateStrategy(a.(*apps.StatefulSetUpdateStrategy), b.(*v1.StatefulSetUpdateStrategy), scope)270 }); err != nil {271 return err272 }273 if err := s.AddConversionFunc((*apps.DaemonSetSpec)(nil), (*v1.DaemonSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {274 return Convert_apps_DaemonSetSpec_To_v1_DaemonSetSpec(a.(*apps.DaemonSetSpec), b.(*v1.DaemonSetSpec), scope)275 }); err != nil {276 return err277 }278 if err := s.AddConversionFunc((*apps.DaemonSet)(nil), (*v1.DaemonSet)(nil), func(a, b interface{}, scope conversion.Scope) error {279 return Convert_apps_DaemonSet_To_v1_DaemonSet(a.(*apps.DaemonSet), b.(*v1.DaemonSet), scope)280 }); err != nil {281 return err282 }283 if err := s.AddConversionFunc((*apps.DeploymentSpec)(nil), (*v1.DeploymentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {284 return Convert_apps_DeploymentSpec_To_v1_DeploymentSpec(a.(*apps.DeploymentSpec), b.(*v1.DeploymentSpec), scope)285 }); err != nil {286 return err287 }288 if err := s.AddConversionFunc((*apps.Deployment)(nil), (*v1.Deployment)(nil), func(a, b interface{}, scope conversion.Scope) error {289 return Convert_apps_Deployment_To_v1_Deployment(a.(*apps.Deployment), b.(*v1.Deployment), scope)290 }); err != nil {291 return err292 }293 if err := s.AddConversionFunc((*apps.StatefulSetSpec)(nil), (*v1.StatefulSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {294 return Convert_apps_StatefulSetSpec_To_v1_StatefulSetSpec(a.(*apps.StatefulSetSpec), b.(*v1.StatefulSetSpec), scope)295 }); err != nil {296 return err297 }298 if err := s.AddConversionFunc((*v1.DaemonSet)(nil), (*apps.DaemonSet)(nil), func(a, b interface{}, scope conversion.Scope) error {299 return Convert_v1_DaemonSet_To_apps_DaemonSet(a.(*v1.DaemonSet), b.(*apps.DaemonSet), scope)300 }); err != nil {301 return err302 }303 if err := s.AddConversionFunc((*v1.Deployment)(nil), (*apps.Deployment)(nil), func(a, b interface{}, scope conversion.Scope) error {304 return Convert_v1_Deployment_To_apps_Deployment(a.(*v1.Deployment), b.(*apps.Deployment), scope)305 }); err != nil {306 return err307 }308 if err := s.AddConversionFunc((*v1.StatefulSetSpec)(nil), (*apps.StatefulSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {309 return Convert_v1_StatefulSetSpec_To_apps_StatefulSetSpec(a.(*v1.StatefulSetSpec), b.(*apps.StatefulSetSpec), scope)310 }); err != nil {311 return err312 }313 return nil314}315func autoConvert_v1_ControllerRevision_To_apps_ControllerRevision(in *v1.ControllerRevision, out *apps.ControllerRevision, s conversion.Scope) error {316 out.ObjectMeta = in.ObjectMeta317 if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.Data, &out.Data, s); err != nil {318 return err319 }320 out.Revision = in.Revision321 return nil322}323// Convert_v1_ControllerRevision_To_apps_ControllerRevision is an autogenerated conversion function.324func Convert_v1_ControllerRevision_To_apps_ControllerRevision(in *v1.ControllerRevision, out *apps.ControllerRevision, s conversion.Scope) error {325 return autoConvert_v1_ControllerRevision_To_apps_ControllerRevision(in, out, s)326}327func autoConvert_apps_ControllerRevision_To_v1_ControllerRevision(in *apps.ControllerRevision, out *v1.ControllerRevision, s conversion.Scope) error {328 out.ObjectMeta = in.ObjectMeta329 if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.Data, &out.Data, s); err != nil {330 return err331 }332 out.Revision = in.Revision333 return nil334}335// Convert_apps_ControllerRevision_To_v1_ControllerRevision is an autogenerated conversion function.336func Convert_apps_ControllerRevision_To_v1_ControllerRevision(in *apps.ControllerRevision, out *v1.ControllerRevision, s conversion.Scope) error {337 return autoConvert_apps_ControllerRevision_To_v1_ControllerRevision(in, out, s)338}339func autoConvert_v1_ControllerRevisionList_To_apps_ControllerRevisionList(in *v1.ControllerRevisionList, out *apps.ControllerRevisionList, s conversion.Scope) error {340 out.ListMeta = in.ListMeta341 if in.Items != nil {342 in, out := &in.Items, &out.Items343 *out = make([]apps.ControllerRevision, len(*in))344 for i := range *in {345 if err := Convert_v1_ControllerRevision_To_apps_ControllerRevision(&(*in)[i], &(*out)[i], s); err != nil {346 return err347 }348 }349 } else {350 out.Items = nil351 }352 return nil353}354// Convert_v1_ControllerRevisionList_To_apps_ControllerRevisionList is an autogenerated conversion function.355func Convert_v1_ControllerRevisionList_To_apps_ControllerRevisionList(in *v1.ControllerRevisionList, out *apps.ControllerRevisionList, s conversion.Scope) error {356 return autoConvert_v1_ControllerRevisionList_To_apps_ControllerRevisionList(in, out, s)357}358func autoConvert_apps_ControllerRevisionList_To_v1_ControllerRevisionList(in *apps.ControllerRevisionList, out *v1.ControllerRevisionList, s conversion.Scope) error {359 out.ListMeta = in.ListMeta360 if in.Items != nil {361 in, out := &in.Items, &out.Items362 *out = make([]v1.ControllerRevision, len(*in))363 for i := range *in {364 if err := Convert_apps_ControllerRevision_To_v1_ControllerRevision(&(*in)[i], &(*out)[i], s); err != nil {365 return err366 }367 }368 } else {369 out.Items = nil370 }371 return nil372}373// Convert_apps_ControllerRevisionList_To_v1_ControllerRevisionList is an autogenerated conversion function.374func Convert_apps_ControllerRevisionList_To_v1_ControllerRevisionList(in *apps.ControllerRevisionList, out *v1.ControllerRevisionList, s conversion.Scope) error {375 return autoConvert_apps_ControllerRevisionList_To_v1_ControllerRevisionList(in, out, s)376}377func autoConvert_v1_DaemonSet_To_apps_DaemonSet(in *v1.DaemonSet, out *apps.DaemonSet, s conversion.Scope) error {378 out.ObjectMeta = in.ObjectMeta379 if err := Convert_v1_DaemonSetSpec_To_apps_DaemonSetSpec(&in.Spec, &out.Spec, s); err != nil {380 return err381 }382 if err := Convert_v1_DaemonSetStatus_To_apps_DaemonSetStatus(&in.Status, &out.Status, s); err != nil {383 return err384 }385 return nil386}387func autoConvert_apps_DaemonSet_To_v1_DaemonSet(in *apps.DaemonSet, out *v1.DaemonSet, s conversion.Scope) error {388 out.ObjectMeta = in.ObjectMeta389 if err := Convert_apps_DaemonSetSpec_To_v1_DaemonSetSpec(&in.Spec, &out.Spec, s); err != nil {390 return err391 }392 if err := Convert_apps_DaemonSetStatus_To_v1_DaemonSetStatus(&in.Status, &out.Status, s); err != nil {393 return err394 }395 return nil396}397func autoConvert_v1_DaemonSetCondition_To_apps_DaemonSetCondition(in *v1.DaemonSetCondition, out *apps.DaemonSetCondition, s conversion.Scope) error {398 out.Type = apps.DaemonSetConditionType(in.Type)399 out.Status = core.ConditionStatus(in.Status)400 out.LastTransitionTime = in.LastTransitionTime401 out.Reason = in.Reason402 out.Message = in.Message403 return nil404}405// Convert_v1_DaemonSetCondition_To_apps_DaemonSetCondition is an autogenerated conversion function.406func Convert_v1_DaemonSetCondition_To_apps_DaemonSetCondition(in *v1.DaemonSetCondition, out *apps.DaemonSetCondition, s conversion.Scope) error {407 return autoConvert_v1_DaemonSetCondition_To_apps_DaemonSetCondition(in, out, s)408}409func autoConvert_apps_DaemonSetCondition_To_v1_DaemonSetCondition(in *apps.DaemonSetCondition, out *v1.DaemonSetCondition, s conversion.Scope) error {410 out.Type = v1.DaemonSetConditionType(in.Type)411 out.Status = corev1.ConditionStatus(in.Status)412 out.LastTransitionTime = in.LastTransitionTime413 out.Reason = in.Reason414 out.Message = in.Message415 return nil416}417// Convert_apps_DaemonSetCondition_To_v1_DaemonSetCondition is an autogenerated conversion function.418func Convert_apps_DaemonSetCondition_To_v1_DaemonSetCondition(in *apps.DaemonSetCondition, out *v1.DaemonSetCondition, s conversion.Scope) error {419 return autoConvert_apps_DaemonSetCondition_To_v1_DaemonSetCondition(in, out, s)420}421func autoConvert_v1_DaemonSetList_To_apps_DaemonSetList(in *v1.DaemonSetList, out *apps.DaemonSetList, s conversion.Scope) error {422 out.ListMeta = in.ListMeta423 if in.Items != nil {424 in, out := &in.Items, &out.Items425 *out = make([]apps.DaemonSet, len(*in))426 for i := range *in {427 if err := Convert_v1_DaemonSet_To_apps_DaemonSet(&(*in)[i], &(*out)[i], s); err != nil {428 return err429 }430 }431 } else {432 out.Items = nil433 }434 return nil435}436// Convert_v1_DaemonSetList_To_apps_DaemonSetList is an autogenerated conversion function.437func Convert_v1_DaemonSetList_To_apps_DaemonSetList(in *v1.DaemonSetList, out *apps.DaemonSetList, s conversion.Scope) error {438 return autoConvert_v1_DaemonSetList_To_apps_DaemonSetList(in, out, s)439}440func autoConvert_apps_DaemonSetList_To_v1_DaemonSetList(in *apps.DaemonSetList, out *v1.DaemonSetList, s conversion.Scope) error {441 out.ListMeta = in.ListMeta442 if in.Items != nil {443 in, out := &in.Items, &out.Items444 *out = make([]v1.DaemonSet, len(*in))445 for i := range *in {446 if err := Convert_apps_DaemonSet_To_v1_DaemonSet(&(*in)[i], &(*out)[i], s); err != nil {447 return err448 }449 }450 } else {451 out.Items = nil452 }453 return nil454}455// Convert_apps_DaemonSetList_To_v1_DaemonSetList is an autogenerated conversion function.456func Convert_apps_DaemonSetList_To_v1_DaemonSetList(in *apps.DaemonSetList, out *v1.DaemonSetList, s conversion.Scope) error {457 return autoConvert_apps_DaemonSetList_To_v1_DaemonSetList(in, out, s)458}459func autoConvert_v1_DaemonSetSpec_To_apps_DaemonSetSpec(in *v1.DaemonSetSpec, out *apps.DaemonSetSpec, s conversion.Scope) error {460 out.Selector = (*metav1.LabelSelector)(unsafe.Pointer(in.Selector))461 if err := apiscorev1.Convert_v1_PodTemplateSpec_To_core_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {462 return err463 }464 if err := Convert_v1_DaemonSetUpdateStrategy_To_apps_DaemonSetUpdateStrategy(&in.UpdateStrategy, &out.UpdateStrategy, s); err != nil {465 return err466 }467 out.MinReadySeconds = in.MinReadySeconds468 out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit))469 return nil470}471// Convert_v1_DaemonSetSpec_To_apps_DaemonSetSpec is an autogenerated conversion function.472func Convert_v1_DaemonSetSpec_To_apps_DaemonSetSpec(in *v1.DaemonSetSpec, out *apps.DaemonSetSpec, s conversion.Scope) error {473 return autoConvert_v1_DaemonSetSpec_To_apps_DaemonSetSpec(in, out, s)474}475func autoConvert_apps_DaemonSetSpec_To_v1_DaemonSetSpec(in *apps.DaemonSetSpec, out *v1.DaemonSetSpec, s conversion.Scope) error {476 out.Selector = (*metav1.LabelSelector)(unsafe.Pointer(in.Selector))477 if err := apiscorev1.Convert_core_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {478 return err479 }480 if err := Convert_apps_DaemonSetUpdateStrategy_To_v1_DaemonSetUpdateStrategy(&in.UpdateStrategy, &out.UpdateStrategy, s); err != nil {481 return err482 }483 out.MinReadySeconds = in.MinReadySeconds484 // WARNING: in.TemplateGeneration requires manual conversion: does not exist in peer-type485 out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit))486 return nil487}488func autoConvert_v1_DaemonSetStatus_To_apps_DaemonSetStatus(in *v1.DaemonSetStatus, out *apps.DaemonSetStatus, s conversion.Scope) error {489 out.CurrentNumberScheduled = in.CurrentNumberScheduled490 out.NumberMisscheduled = in.NumberMisscheduled491 out.DesiredNumberScheduled = in.DesiredNumberScheduled492 out.NumberReady = in.NumberReady493 out.ObservedGeneration = in.ObservedGeneration494 out.UpdatedNumberScheduled = in.UpdatedNumberScheduled495 out.NumberAvailable = in.NumberAvailable496 out.NumberUnavailable = in.NumberUnavailable497 out.CollisionCount = (*int32)(unsafe.Pointer(in.CollisionCount))498 out.Conditions = *(*[]apps.DaemonSetCondition)(unsafe.Pointer(&in.Conditions))499 return nil500}501// Convert_v1_DaemonSetStatus_To_apps_DaemonSetStatus is an autogenerated conversion function.502func Convert_v1_DaemonSetStatus_To_apps_DaemonSetStatus(in *v1.DaemonSetStatus, out *apps.DaemonSetStatus, s conversion.Scope) error {503 return autoConvert_v1_DaemonSetStatus_To_apps_DaemonSetStatus(in, out, s)504}505func autoConvert_apps_DaemonSetStatus_To_v1_DaemonSetStatus(in *apps.DaemonSetStatus, out *v1.DaemonSetStatus, s conversion.Scope) error {506 out.CurrentNumberScheduled = in.CurrentNumberScheduled507 out.NumberMisscheduled = in.NumberMisscheduled508 out.DesiredNumberScheduled = in.DesiredNumberScheduled509 out.NumberReady = in.NumberReady510 out.ObservedGeneration = in.ObservedGeneration511 out.UpdatedNumberScheduled = in.UpdatedNumberScheduled512 out.NumberAvailable = in.NumberAvailable513 out.NumberUnavailable = in.NumberUnavailable514 out.CollisionCount = (*int32)(unsafe.Pointer(in.CollisionCount))515 out.Conditions = *(*[]v1.DaemonSetCondition)(unsafe.Pointer(&in.Conditions))516 return nil517}518// Convert_apps_DaemonSetStatus_To_v1_DaemonSetStatus is an autogenerated conversion function.519func Convert_apps_DaemonSetStatus_To_v1_DaemonSetStatus(in *apps.DaemonSetStatus, out *v1.DaemonSetStatus, s conversion.Scope) error {520 return autoConvert_apps_DaemonSetStatus_To_v1_DaemonSetStatus(in, out, s)521}522func autoConvert_v1_DaemonSetUpdateStrategy_To_apps_DaemonSetUpdateStrategy(in *v1.DaemonSetUpdateStrategy, out *apps.DaemonSetUpdateStrategy, s conversion.Scope) error {523 out.Type = apps.DaemonSetUpdateStrategyType(in.Type)524 if in.RollingUpdate != nil {525 in, out := &in.RollingUpdate, &out.RollingUpdate526 *out = new(apps.RollingUpdateDaemonSet)527 if err := Convert_v1_RollingUpdateDaemonSet_To_apps_RollingUpdateDaemonSet(*in, *out, s); err != nil {528 return err529 }530 } else {531 out.RollingUpdate = nil532 }533 return nil534}535// Convert_v1_DaemonSetUpdateStrategy_To_apps_DaemonSetUpdateStrategy is an autogenerated conversion function.536func Convert_v1_DaemonSetUpdateStrategy_To_apps_DaemonSetUpdateStrategy(in *v1.DaemonSetUpdateStrategy, out *apps.DaemonSetUpdateStrategy, s conversion.Scope) error {537 return autoConvert_v1_DaemonSetUpdateStrategy_To_apps_DaemonSetUpdateStrategy(in, out, s)538}539func autoConvert_apps_DaemonSetUpdateStrategy_To_v1_DaemonSetUpdateStrategy(in *apps.DaemonSetUpdateStrategy, out *v1.DaemonSetUpdateStrategy, s conversion.Scope) error {540 out.Type = v1.DaemonSetUpdateStrategyType(in.Type)541 if in.RollingUpdate != nil {542 in, out := &in.RollingUpdate, &out.RollingUpdate543 *out = new(v1.RollingUpdateDaemonSet)544 if err := Convert_apps_RollingUpdateDaemonSet_To_v1_RollingUpdateDaemonSet(*in, *out, s); err != nil {545 return err546 }547 } else {548 out.RollingUpdate = nil549 }550 return nil551}552// Convert_apps_DaemonSetUpdateStrategy_To_v1_DaemonSetUpdateStrategy is an autogenerated conversion function.553func Convert_apps_DaemonSetUpdateStrategy_To_v1_DaemonSetUpdateStrategy(in *apps.DaemonSetUpdateStrategy, out *v1.DaemonSetUpdateStrategy, s conversion.Scope) error {554 return autoConvert_apps_DaemonSetUpdateStrategy_To_v1_DaemonSetUpdateStrategy(in, out, s)555}556func autoConvert_v1_Deployment_To_apps_Deployment(in *v1.Deployment, out *apps.Deployment, s conversion.Scope) error {557 out.ObjectMeta = in.ObjectMeta558 if err := Convert_v1_DeploymentSpec_To_apps_DeploymentSpec(&in.Spec, &out.Spec, s); err != nil {559 return err560 }561 if err := Convert_v1_DeploymentStatus_To_apps_DeploymentStatus(&in.Status, &out.Status, s); err != nil {562 return err563 }564 return nil565}566func autoConvert_apps_Deployment_To_v1_Deployment(in *apps.Deployment, out *v1.Deployment, s conversion.Scope) error {567 out.ObjectMeta = in.ObjectMeta568 if err := Convert_apps_DeploymentSpec_To_v1_DeploymentSpec(&in.Spec, &out.Spec, s); err != nil {569 return err570 }571 if err := Convert_apps_DeploymentStatus_To_v1_DeploymentStatus(&in.Status, &out.Status, s); err != nil {572 return err573 }574 return nil575}576func autoConvert_v1_DeploymentCondition_To_apps_DeploymentCondition(in *v1.DeploymentCondition, out *apps.DeploymentCondition, s conversion.Scope) error {577 out.Type = apps.DeploymentConditionType(in.Type)578 out.Status = core.ConditionStatus(in.Status)579 out.LastUpdateTime = in.LastUpdateTime580 out.LastTransitionTime = in.LastTransitionTime581 out.Reason = in.Reason582 out.Message = in.Message583 return nil584}585// Convert_v1_DeploymentCondition_To_apps_DeploymentCondition is an autogenerated conversion function.586func Convert_v1_DeploymentCondition_To_apps_DeploymentCondition(in *v1.DeploymentCondition, out *apps.DeploymentCondition, s conversion.Scope) error {587 return autoConvert_v1_DeploymentCondition_To_apps_DeploymentCondition(in, out, s)588}589func autoConvert_apps_DeploymentCondition_To_v1_DeploymentCondition(in *apps.DeploymentCondition, out *v1.DeploymentCondition, s conversion.Scope) error {590 out.Type = v1.DeploymentConditionType(in.Type)591 out.Status = corev1.ConditionStatus(in.Status)592 out.LastUpdateTime = in.LastUpdateTime593 out.LastTransitionTime = in.LastTransitionTime594 out.Reason = in.Reason595 out.Message = in.Message596 return nil597}598// Convert_apps_DeploymentCondition_To_v1_DeploymentCondition is an autogenerated conversion function.599func Convert_apps_DeploymentCondition_To_v1_DeploymentCondition(in *apps.DeploymentCondition, out *v1.DeploymentCondition, s conversion.Scope) error {600 return autoConvert_apps_DeploymentCondition_To_v1_DeploymentCondition(in, out, s)601}602func autoConvert_v1_DeploymentList_To_apps_DeploymentList(in *v1.DeploymentList, out *apps.DeploymentList, s conversion.Scope) error {603 out.ListMeta = in.ListMeta604 if in.Items != nil {605 in, out := &in.Items, &out.Items606 *out = make([]apps.Deployment, len(*in))607 for i := range *in {608 if err := Convert_v1_Deployment_To_apps_Deployment(&(*in)[i], &(*out)[i], s); err != nil {609 return err610 }611 }612 } else {613 out.Items = nil614 }615 return nil616}617// Convert_v1_DeploymentList_To_apps_DeploymentList is an autogenerated conversion function.618func Convert_v1_DeploymentList_To_apps_DeploymentList(in *v1.DeploymentList, out *apps.DeploymentList, s conversion.Scope) error {619 return autoConvert_v1_DeploymentList_To_apps_DeploymentList(in, out, s)620}621func autoConvert_apps_DeploymentList_To_v1_DeploymentList(in *apps.DeploymentList, out *v1.DeploymentList, s conversion.Scope) error {622 out.ListMeta = in.ListMeta623 if in.Items != nil {624 in, out := &in.Items, &out.Items625 *out = make([]v1.Deployment, len(*in))626 for i := range *in {627 if err := Convert_apps_Deployment_To_v1_Deployment(&(*in)[i], &(*out)[i], s); err != nil {628 return err629 }630 }631 } else {632 out.Items = nil633 }634 return nil635}636// Convert_apps_DeploymentList_To_v1_DeploymentList is an autogenerated conversion function.637func Convert_apps_DeploymentList_To_v1_DeploymentList(in *apps.DeploymentList, out *v1.DeploymentList, s conversion.Scope) error {638 return autoConvert_apps_DeploymentList_To_v1_DeploymentList(in, out, s)639}640func autoConvert_v1_DeploymentSpec_To_apps_DeploymentSpec(in *v1.DeploymentSpec, out *apps.DeploymentSpec, s conversion.Scope) error {641 if err := metav1.Convert_Pointer_int32_To_int32(&in.Replicas, &out.Replicas, s); err != nil {642 return err643 }644 out.Selector = (*metav1.LabelSelector)(unsafe.Pointer(in.Selector))645 if err := apiscorev1.Convert_v1_PodTemplateSpec_To_core_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {646 return err647 }648 if err := Convert_v1_DeploymentStrategy_To_apps_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil {649 return err650 }651 out.MinReadySeconds = in.MinReadySeconds652 out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit))653 out.Paused = in.Paused654 out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds))655 return nil656}657// Convert_v1_DeploymentSpec_To_apps_DeploymentSpec is an autogenerated conversion function.658func Convert_v1_DeploymentSpec_To_apps_DeploymentSpec(in *v1.DeploymentSpec, out *apps.DeploymentSpec, s conversion.Scope) error {659 return autoConvert_v1_DeploymentSpec_To_apps_DeploymentSpec(in, out, s)660}661func autoConvert_apps_DeploymentSpec_To_v1_DeploymentSpec(in *apps.DeploymentSpec, out *v1.DeploymentSpec, s conversion.Scope) error {662 if err := metav1.Convert_int32_To_Pointer_int32(&in.Replicas, &out.Replicas, s); err != nil {663 return err664 }665 out.Selector = (*metav1.LabelSelector)(unsafe.Pointer(in.Selector))666 if err := apiscorev1.Convert_core_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {667 return err668 }669 if err := Convert_apps_DeploymentStrategy_To_v1_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil {670 return err671 }672 out.MinReadySeconds = in.MinReadySeconds673 out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit))674 out.Paused = in.Paused675 // WARNING: in.RollbackTo requires manual conversion: does not exist in peer-type676 out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds))677 return nil678}679func autoConvert_v1_DeploymentStatus_To_apps_DeploymentStatus(in *v1.DeploymentStatus, out *apps.DeploymentStatus, s conversion.Scope) error {680 out.ObservedGeneration = in.ObservedGeneration681 out.Replicas = in.Replicas682 out.UpdatedReplicas = in.UpdatedReplicas683 out.ReadyReplicas = in.ReadyReplicas684 out.AvailableReplicas = in.AvailableReplicas685 out.UnavailableReplicas = in.UnavailableReplicas686 out.Conditions = *(*[]apps.DeploymentCondition)(unsafe.Pointer(&in.Conditions))687 out.CollisionCount = (*int32)(unsafe.Pointer(in.CollisionCount))688 return nil689}690// Convert_v1_DeploymentStatus_To_apps_DeploymentStatus is an autogenerated conversion function.691func Convert_v1_DeploymentStatus_To_apps_DeploymentStatus(in *v1.DeploymentStatus, out *apps.DeploymentStatus, s conversion.Scope) error {692 return autoConvert_v1_DeploymentStatus_To_apps_DeploymentStatus(in, out, s)693}694func autoConvert_apps_DeploymentStatus_To_v1_DeploymentStatus(in *apps.DeploymentStatus, out *v1.DeploymentStatus, s conversion.Scope) error {695 out.ObservedGeneration = in.ObservedGeneration696 out.Replicas = in.Replicas697 out.UpdatedReplicas = in.UpdatedReplicas698 out.ReadyReplicas = in.ReadyReplicas699 out.AvailableReplicas = in.AvailableReplicas700 out.UnavailableReplicas = in.UnavailableReplicas701 out.Conditions = *(*[]v1.DeploymentCondition)(unsafe.Pointer(&in.Conditions))702 out.CollisionCount = (*int32)(unsafe.Pointer(in.CollisionCount))703 return nil704}705// Convert_apps_DeploymentStatus_To_v1_DeploymentStatus is an autogenerated conversion function.706func Convert_apps_DeploymentStatus_To_v1_DeploymentStatus(in *apps.DeploymentStatus, out *v1.DeploymentStatus, s conversion.Scope) error {707 return autoConvert_apps_DeploymentStatus_To_v1_DeploymentStatus(in, out, s)708}709func autoConvert_v1_DeploymentStrategy_To_apps_DeploymentStrategy(in *v1.DeploymentStrategy, out *apps.DeploymentStrategy, s conversion.Scope) error {710 out.Type = apps.DeploymentStrategyType(in.Type)711 if in.RollingUpdate != nil {712 in, out := &in.RollingUpdate, &out.RollingUpdate713 *out = new(apps.RollingUpdateDeployment)714 if err := Convert_v1_RollingUpdateDeployment_To_apps_RollingUpdateDeployment(*in, *out, s); err != nil {715 return err716 }717 } else {718 out.RollingUpdate = nil719 }720 return nil721}722// Convert_v1_DeploymentStrategy_To_apps_DeploymentStrategy is an autogenerated conversion function.723func Convert_v1_DeploymentStrategy_To_apps_DeploymentStrategy(in *v1.DeploymentStrategy, out *apps.DeploymentStrategy, s conversion.Scope) error {724 return autoConvert_v1_DeploymentStrategy_To_apps_DeploymentStrategy(in, out, s)725}726func autoConvert_apps_DeploymentStrategy_To_v1_DeploymentStrategy(in *apps.DeploymentStrategy, out *v1.DeploymentStrategy, s conversion.Scope) error {727 out.Type = v1.DeploymentStrategyType(in.Type)728 if in.RollingUpdate != nil {729 in, out := &in.RollingUpdate, &out.RollingUpdate730 *out = new(v1.RollingUpdateDeployment)731 if err := Convert_apps_RollingUpdateDeployment_To_v1_RollingUpdateDeployment(*in, *out, s); err != nil {732 return err733 }734 } else {735 out.RollingUpdate = nil736 }737 return nil738}739// Convert_apps_DeploymentStrategy_To_v1_DeploymentStrategy is an autogenerated conversion function.740func Convert_apps_DeploymentStrategy_To_v1_DeploymentStrategy(in *apps.DeploymentStrategy, out *v1.DeploymentStrategy, s conversion.Scope) error {741 return autoConvert_apps_DeploymentStrategy_To_v1_DeploymentStrategy(in, out, s)742}743func autoConvert_v1_ReplicaSet_To_apps_ReplicaSet(in *v1.ReplicaSet, out *apps.ReplicaSet, s conversion.Scope) error {744 out.ObjectMeta = in.ObjectMeta745 if err := Convert_v1_ReplicaSetSpec_To_apps_ReplicaSetSpec(&in.Spec, &out.Spec, s); err != nil {746 return err747 }748 if err := Convert_v1_ReplicaSetStatus_To_apps_ReplicaSetStatus(&in.Status, &out.Status, s); err != nil {749 return err750 }751 return nil752}753// Convert_v1_ReplicaSet_To_apps_ReplicaSet is an autogenerated conversion function.754func Convert_v1_ReplicaSet_To_apps_ReplicaSet(in *v1.ReplicaSet, out *apps.ReplicaSet, s conversion.Scope) error {755 return autoConvert_v1_ReplicaSet_To_apps_ReplicaSet(in, out, s)756}757func autoConvert_apps_ReplicaSet_To_v1_ReplicaSet(in *apps.ReplicaSet, out *v1.ReplicaSet, s conversion.Scope) error {758 out.ObjectMeta = in.ObjectMeta759 if err := Convert_apps_ReplicaSetSpec_To_v1_ReplicaSetSpec(&in.Spec, &out.Spec, s); err != nil {760 return err761 }762 if err := Convert_apps_ReplicaSetStatus_To_v1_ReplicaSetStatus(&in.Status, &out.Status, s); err != nil {763 return err764 }765 return nil766}767// Convert_apps_ReplicaSet_To_v1_ReplicaSet is an autogenerated conversion function.768func Convert_apps_ReplicaSet_To_v1_ReplicaSet(in *apps.ReplicaSet, out *v1.ReplicaSet, s conversion.Scope) error {769 return autoConvert_apps_ReplicaSet_To_v1_ReplicaSet(in, out, s)770}771func autoConvert_v1_ReplicaSetCondition_To_apps_ReplicaSetCondition(in *v1.ReplicaSetCondition, out *apps.ReplicaSetCondition, s conversion.Scope) error {772 out.Type = apps.ReplicaSetConditionType(in.Type)773 out.Status = core.ConditionStatus(in.Status)774 out.LastTransitionTime = in.LastTransitionTime775 out.Reason = in.Reason776 out.Message = in.Message777 return nil778}779// Convert_v1_ReplicaSetCondition_To_apps_ReplicaSetCondition is an autogenerated conversion function.780func Convert_v1_ReplicaSetCondition_To_apps_ReplicaSetCondition(in *v1.ReplicaSetCondition, out *apps.ReplicaSetCondition, s conversion.Scope) error {781 return autoConvert_v1_ReplicaSetCondition_To_apps_ReplicaSetCondition(in, out, s)782}783func autoConvert_apps_ReplicaSetCondition_To_v1_ReplicaSetCondition(in *apps.ReplicaSetCondition, out *v1.ReplicaSetCondition, s conversion.Scope) error {784 out.Type = v1.ReplicaSetConditionType(in.Type)785 out.Status = corev1.ConditionStatus(in.Status)786 out.LastTransitionTime = in.LastTransitionTime787 out.Reason = in.Reason788 out.Message = in.Message789 return nil790}791// Convert_apps_ReplicaSetCondition_To_v1_ReplicaSetCondition is an autogenerated conversion function.792func Convert_apps_ReplicaSetCondition_To_v1_ReplicaSetCondition(in *apps.ReplicaSetCondition, out *v1.ReplicaSetCondition, s conversion.Scope) error {793 return autoConvert_apps_ReplicaSetCondition_To_v1_ReplicaSetCondition(in, out, s)794}795func autoConvert_v1_ReplicaSetList_To_apps_ReplicaSetList(in *v1.ReplicaSetList, out *apps.ReplicaSetList, s conversion.Scope) error {796 out.ListMeta = in.ListMeta797 if in.Items != nil {798 in, out := &in.Items, &out.Items799 *out = make([]apps.ReplicaSet, len(*in))800 for i := range *in {801 if err := Convert_v1_ReplicaSet_To_apps_ReplicaSet(&(*in)[i], &(*out)[i], s); err != nil {802 return err803 }804 }805 } else {806 out.Items = nil807 }808 return nil809}810// Convert_v1_ReplicaSetList_To_apps_ReplicaSetList is an autogenerated conversion function.811func Convert_v1_ReplicaSetList_To_apps_ReplicaSetList(in *v1.ReplicaSetList, out *apps.ReplicaSetList, s conversion.Scope) error {812 return autoConvert_v1_ReplicaSetList_To_apps_ReplicaSetList(in, out, s)813}814func autoConvert_apps_ReplicaSetList_To_v1_ReplicaSetList(in *apps.ReplicaSetList, out *v1.ReplicaSetList, s conversion.Scope) error {815 out.ListMeta = in.ListMeta816 if in.Items != nil {817 in, out := &in.Items, &out.Items818 *out = make([]v1.ReplicaSet, len(*in))819 for i := range *in {820 if err := Convert_apps_ReplicaSet_To_v1_ReplicaSet(&(*in)[i], &(*out)[i], s); err != nil {821 return err822 }823 }824 } else {825 out.Items = nil826 }827 return nil828}829// Convert_apps_ReplicaSetList_To_v1_ReplicaSetList is an autogenerated conversion function.830func Convert_apps_ReplicaSetList_To_v1_ReplicaSetList(in *apps.ReplicaSetList, out *v1.ReplicaSetList, s conversion.Scope) error {831 return autoConvert_apps_ReplicaSetList_To_v1_ReplicaSetList(in, out, s)832}833func autoConvert_v1_ReplicaSetSpec_To_apps_ReplicaSetSpec(in *v1.ReplicaSetSpec, out *apps.ReplicaSetSpec, s conversion.Scope) error {834 if err := metav1.Convert_Pointer_int32_To_int32(&in.Replicas, &out.Replicas, s); err != nil {835 return err836 }837 out.MinReadySeconds = in.MinReadySeconds838 out.Selector = (*metav1.LabelSelector)(unsafe.Pointer(in.Selector))839 if err := apiscorev1.Convert_v1_PodTemplateSpec_To_core_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {840 return err841 }842 return nil843}844// Convert_v1_ReplicaSetSpec_To_apps_ReplicaSetSpec is an autogenerated conversion function.845func Convert_v1_ReplicaSetSpec_To_apps_ReplicaSetSpec(in *v1.ReplicaSetSpec, out *apps.ReplicaSetSpec, s conversion.Scope) error {846 return autoConvert_v1_ReplicaSetSpec_To_apps_ReplicaSetSpec(in, out, s)847}848func autoConvert_apps_ReplicaSetSpec_To_v1_ReplicaSetSpec(in *apps.ReplicaSetSpec, out *v1.ReplicaSetSpec, s conversion.Scope) error {849 if err := metav1.Convert_int32_To_Pointer_int32(&in.Replicas, &out.Replicas, s); err != nil {850 return err851 }852 out.MinReadySeconds = in.MinReadySeconds853 out.Selector = (*metav1.LabelSelector)(unsafe.Pointer(in.Selector))854 if err := apiscorev1.Convert_core_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {855 return err856 }857 return nil858}859// Convert_apps_ReplicaSetSpec_To_v1_ReplicaSetSpec is an autogenerated conversion function.860func Convert_apps_ReplicaSetSpec_To_v1_ReplicaSetSpec(in *apps.ReplicaSetSpec, out *v1.ReplicaSetSpec, s conversion.Scope) error {861 return autoConvert_apps_ReplicaSetSpec_To_v1_ReplicaSetSpec(in, out, s)862}863func autoConvert_v1_ReplicaSetStatus_To_apps_ReplicaSetStatus(in *v1.ReplicaSetStatus, out *apps.ReplicaSetStatus, s conversion.Scope) error {864 out.Replicas = in.Replicas865 out.FullyLabeledReplicas = in.FullyLabeledReplicas866 out.ReadyReplicas = in.ReadyReplicas867 out.AvailableReplicas = in.AvailableReplicas868 out.ObservedGeneration = in.ObservedGeneration869 out.Conditions = *(*[]apps.ReplicaSetCondition)(unsafe.Pointer(&in.Conditions))870 return nil871}872// Convert_v1_ReplicaSetStatus_To_apps_ReplicaSetStatus is an autogenerated conversion function.873func Convert_v1_ReplicaSetStatus_To_apps_ReplicaSetStatus(in *v1.ReplicaSetStatus, out *apps.ReplicaSetStatus, s conversion.Scope) error {874 return autoConvert_v1_ReplicaSetStatus_To_apps_ReplicaSetStatus(in, out, s)875}876func autoConvert_apps_ReplicaSetStatus_To_v1_ReplicaSetStatus(in *apps.ReplicaSetStatus, out *v1.ReplicaSetStatus, s conversion.Scope) error {877 out.Replicas = in.Replicas878 out.FullyLabeledReplicas = in.FullyLabeledReplicas879 out.ReadyReplicas = in.ReadyReplicas880 out.AvailableReplicas = in.AvailableReplicas881 out.ObservedGeneration = in.ObservedGeneration882 out.Conditions = *(*[]v1.ReplicaSetCondition)(unsafe.Pointer(&in.Conditions))883 return nil884}885// Convert_apps_ReplicaSetStatus_To_v1_ReplicaSetStatus is an autogenerated conversion function.886func Convert_apps_ReplicaSetStatus_To_v1_ReplicaSetStatus(in *apps.ReplicaSetStatus, out *v1.ReplicaSetStatus, s conversion.Scope) error {887 return autoConvert_apps_ReplicaSetStatus_To_v1_ReplicaSetStatus(in, out, s)888}889func autoConvert_v1_RollingUpdateDaemonSet_To_apps_RollingUpdateDaemonSet(in *v1.RollingUpdateDaemonSet, out *apps.RollingUpdateDaemonSet, s conversion.Scope) error {890 if err := metav1.Convert_Pointer_intstr_IntOrString_To_intstr_IntOrString(&in.MaxUnavailable, &out.MaxUnavailable, s); err != nil {891 return err892 }893 return nil894}895// Convert_v1_RollingUpdateDaemonSet_To_apps_RollingUpdateDaemonSet is an autogenerated conversion function.896func Convert_v1_RollingUpdateDaemonSet_To_apps_RollingUpdateDaemonSet(in *v1.RollingUpdateDaemonSet, out *apps.RollingUpdateDaemonSet, s conversion.Scope) error {897 return autoConvert_v1_RollingUpdateDaemonSet_To_apps_RollingUpdateDaemonSet(in, out, s)898}899func autoConvert_apps_RollingUpdateDaemonSet_To_v1_RollingUpdateDaemonSet(in *apps.RollingUpdateDaemonSet, out *v1.RollingUpdateDaemonSet, s conversion.Scope) error {900 if err := metav1.Convert_intstr_IntOrString_To_Pointer_intstr_IntOrString(&in.MaxUnavailable, &out.MaxUnavailable, s); err != nil {901 return err902 }903 return nil904}905// Convert_apps_RollingUpdateDaemonSet_To_v1_RollingUpdateDaemonSet is an autogenerated conversion function.906func Convert_apps_RollingUpdateDaemonSet_To_v1_RollingUpdateDaemonSet(in *apps.RollingUpdateDaemonSet, out *v1.RollingUpdateDaemonSet, s conversion.Scope) error {907 return autoConvert_apps_RollingUpdateDaemonSet_To_v1_RollingUpdateDaemonSet(in, out, s)908}909func autoConvert_v1_RollingUpdateDeployment_To_apps_RollingUpdateDeployment(in *v1.RollingUpdateDeployment, out *apps.RollingUpdateDeployment, s conversion.Scope) error {910 if err := metav1.Convert_Pointer_intstr_IntOrString_To_intstr_IntOrString(&in.MaxUnavailable, &out.MaxUnavailable, s); err != nil {911 return err912 }913 if err := metav1.Convert_Pointer_intstr_IntOrString_To_intstr_IntOrString(&in.MaxSurge, &out.MaxSurge, s); err != nil {914 return err915 }916 return nil917}918// Convert_v1_RollingUpdateDeployment_To_apps_RollingUpdateDeployment is an autogenerated conversion function.919func Convert_v1_RollingUpdateDeployment_To_apps_RollingUpdateDeployment(in *v1.RollingUpdateDeployment, out *apps.RollingUpdateDeployment, s conversion.Scope) error {920 return autoConvert_v1_RollingUpdateDeployment_To_apps_RollingUpdateDeployment(in, out, s)921}922func autoConvert_apps_RollingUpdateDeployment_To_v1_RollingUpdateDeployment(in *apps.RollingUpdateDeployment, out *v1.RollingUpdateDeployment, s conversion.Scope) error {923 if err := metav1.Convert_intstr_IntOrString_To_Pointer_intstr_IntOrString(&in.MaxUnavailable, &out.MaxUnavailable, s); err != nil {924 return err925 }926 if err := metav1.Convert_intstr_IntOrString_To_Pointer_intstr_IntOrString(&in.MaxSurge, &out.MaxSurge, s); err != nil {927 return err928 }929 return nil930}931// Convert_apps_RollingUpdateDeployment_To_v1_RollingUpdateDeployment is an autogenerated conversion function.932func Convert_apps_RollingUpdateDeployment_To_v1_RollingUpdateDeployment(in *apps.RollingUpdateDeployment, out *v1.RollingUpdateDeployment, s conversion.Scope) error {933 return autoConvert_apps_RollingUpdateDeployment_To_v1_RollingUpdateDeployment(in, out, s)934}935func autoConvert_v1_RollingUpdateStatefulSetStrategy_To_apps_RollingUpdateStatefulSetStrategy(in *v1.RollingUpdateStatefulSetStrategy, out *apps.RollingUpdateStatefulSetStrategy, s conversion.Scope) error {936 if err := metav1.Convert_Pointer_int32_To_int32(&in.Partition, &out.Partition, s); err != nil {937 return err938 }939 return nil940}941// Convert_v1_RollingUpdateStatefulSetStrategy_To_apps_RollingUpdateStatefulSetStrategy is an autogenerated conversion function.942func Convert_v1_RollingUpdateStatefulSetStrategy_To_apps_RollingUpdateStatefulSetStrategy(in *v1.RollingUpdateStatefulSetStrategy, out *apps.RollingUpdateStatefulSetStrategy, s conversion.Scope) error {943 return autoConvert_v1_RollingUpdateStatefulSetStrategy_To_apps_RollingUpdateStatefulSetStrategy(in, out, s)944}945func autoConvert_apps_RollingUpdateStatefulSetStrategy_To_v1_RollingUpdateStatefulSetStrategy(in *apps.RollingUpdateStatefulSetStrategy, out *v1.RollingUpdateStatefulSetStrategy, s conversion.Scope) error {946 if err := metav1.Convert_int32_To_Pointer_int32(&in.Partition, &out.Partition, s); err != nil {947 return err948 }949 return nil950}951// Convert_apps_RollingUpdateStatefulSetStrategy_To_v1_RollingUpdateStatefulSetStrategy is an autogenerated conversion function.952func Convert_apps_RollingUpdateStatefulSetStrategy_To_v1_RollingUpdateStatefulSetStrategy(in *apps.RollingUpdateStatefulSetStrategy, out *v1.RollingUpdateStatefulSetStrategy, s conversion.Scope) error {953 return autoConvert_apps_RollingUpdateStatefulSetStrategy_To_v1_RollingUpdateStatefulSetStrategy(in, out, s)954}955func autoConvert_v1_StatefulSet_To_apps_StatefulSet(in *v1.StatefulSet, out *apps.StatefulSet, s conversion.Scope) error {956 out.ObjectMeta = in.ObjectMeta957 if err := Convert_v1_StatefulSetSpec_To_apps_StatefulSetSpec(&in.Spec, &out.Spec, s); err != nil {958 return err959 }960 if err := Convert_v1_StatefulSetStatus_To_apps_StatefulSetStatus(&in.Status, &out.Status, s); err != nil {961 return err962 }963 return nil964}965// Convert_v1_StatefulSet_To_apps_StatefulSet is an autogenerated conversion function.966func Convert_v1_StatefulSet_To_apps_StatefulSet(in *v1.StatefulSet, out *apps.StatefulSet, s conversion.Scope) error {967 return autoConvert_v1_StatefulSet_To_apps_StatefulSet(in, out, s)968}969func autoConvert_apps_StatefulSet_To_v1_StatefulSet(in *apps.StatefulSet, out *v1.StatefulSet, s conversion.Scope) error {970 out.ObjectMeta = in.ObjectMeta971 if err := Convert_apps_StatefulSetSpec_To_v1_StatefulSetSpec(&in.Spec, &out.Spec, s); err != nil {972 return err973 }974 if err := Convert_apps_StatefulSetStatus_To_v1_StatefulSetStatus(&in.Status, &out.Status, s); err != nil {975 return err976 }977 return nil978}979// Convert_apps_StatefulSet_To_v1_StatefulSet is an autogenerated conversion function.980func Convert_apps_StatefulSet_To_v1_StatefulSet(in *apps.StatefulSet, out *v1.StatefulSet, s conversion.Scope) error {981 return autoConvert_apps_StatefulSet_To_v1_StatefulSet(in, out, s)982}983func autoConvert_v1_StatefulSetCondition_To_apps_StatefulSetCondition(in *v1.StatefulSetCondition, out *apps.StatefulSetCondition, s conversion.Scope) error {984 out.Type = apps.StatefulSetConditionType(in.Type)985 out.Status = core.ConditionStatus(in.Status)986 out.LastTransitionTime = in.LastTransitionTime987 out.Reason = in.Reason988 out.Message = in.Message989 return nil990}991// Convert_v1_StatefulSetCondition_To_apps_StatefulSetCondition is an autogenerated conversion function.992func Convert_v1_StatefulSetCondition_To_apps_StatefulSetCondition(in *v1.StatefulSetCondition, out *apps.StatefulSetCondition, s conversion.Scope) error {993 return autoConvert_v1_StatefulSetCondition_To_apps_StatefulSetCondition(in, out, s)994}995func autoConvert_apps_StatefulSetCondition_To_v1_StatefulSetCondition(in *apps.StatefulSetCondition, out *v1.StatefulSetCondition, s conversion.Scope) error {996 out.Type = v1.StatefulSetConditionType(in.Type)997 out.Status = corev1.ConditionStatus(in.Status)998 out.LastTransitionTime = in.LastTransitionTime999 out.Reason = in.Reason1000 out.Message = in.Message1001 return nil1002}1003// Convert_apps_StatefulSetCondition_To_v1_StatefulSetCondition is an autogenerated conversion function.1004func Convert_apps_StatefulSetCondition_To_v1_StatefulSetCondition(in *apps.StatefulSetCondition, out *v1.StatefulSetCondition, s conversion.Scope) error {1005 return autoConvert_apps_StatefulSetCondition_To_v1_StatefulSetCondition(in, out, s)1006}1007func autoConvert_v1_StatefulSetList_To_apps_StatefulSetList(in *v1.StatefulSetList, out *apps.StatefulSetList, s conversion.Scope) error {1008 out.ListMeta = in.ListMeta1009 if in.Items != nil {1010 in, out := &in.Items, &out.Items1011 *out = make([]apps.StatefulSet, len(*in))1012 for i := range *in {1013 if err := Convert_v1_StatefulSet_To_apps_StatefulSet(&(*in)[i], &(*out)[i], s); err != nil {1014 return err1015 }1016 }1017 } else {1018 out.Items = nil1019 }1020 return nil1021}1022// Convert_v1_StatefulSetList_To_apps_StatefulSetList is an autogenerated conversion function.1023func Convert_v1_StatefulSetList_To_apps_StatefulSetList(in *v1.StatefulSetList, out *apps.StatefulSetList, s conversion.Scope) error {1024 return autoConvert_v1_StatefulSetList_To_apps_StatefulSetList(in, out, s)1025}1026func autoConvert_apps_StatefulSetList_To_v1_StatefulSetList(in *apps.StatefulSetList, out *v1.StatefulSetList, s conversion.Scope) error {1027 out.ListMeta = in.ListMeta1028 if in.Items != nil {1029 in, out := &in.Items, &out.Items1030 *out = make([]v1.StatefulSet, len(*in))1031 for i := range *in {1032 if err := Convert_apps_StatefulSet_To_v1_StatefulSet(&(*in)[i], &(*out)[i], s); err != nil {1033 return err1034 }1035 }1036 } else {1037 out.Items = nil1038 }1039 return nil1040}1041// Convert_apps_StatefulSetList_To_v1_StatefulSetList is an autogenerated conversion function.1042func Convert_apps_StatefulSetList_To_v1_StatefulSetList(in *apps.StatefulSetList, out *v1.StatefulSetList, s conversion.Scope) error {1043 return autoConvert_apps_StatefulSetList_To_v1_StatefulSetList(in, out, s)1044}1045func autoConvert_v1_StatefulSetSpec_To_apps_StatefulSetSpec(in *v1.StatefulSetSpec, out *apps.StatefulSetSpec, s conversion.Scope) error {1046 if err := metav1.Convert_Pointer_int32_To_int32(&in.Replicas, &out.Replicas, s); err != nil {1047 return err1048 }1049 out.Selector = (*metav1.LabelSelector)(unsafe.Pointer(in.Selector))1050 if err := apiscorev1.Convert_v1_PodTemplateSpec_To_core_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {1051 return err1052 }1053 out.VolumeClaimTemplates = *(*[]core.PersistentVolumeClaim)(unsafe.Pointer(&in.VolumeClaimTemplates))1054 out.ServiceName = in.ServiceName1055 out.PodManagementPolicy = apps.PodManagementPolicyType(in.PodManagementPolicy)1056 if err := Convert_v1_StatefulSetUpdateStrategy_To_apps_StatefulSetUpdateStrategy(&in.UpdateStrategy, &out.UpdateStrategy, s); err != nil {1057 return err1058 }1059 out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit))1060 return nil1061}1062func autoConvert_apps_StatefulSetSpec_To_v1_StatefulSetSpec(in *apps.StatefulSetSpec, out *v1.StatefulSetSpec, s conversion.Scope) error {1063 if err := metav1.Convert_int32_To_Pointer_int32(&in.Replicas, &out.Replicas, s); err != nil {1064 return err1065 }1066 out.Selector = (*metav1.LabelSelector)(unsafe.Pointer(in.Selector))1067 if err := apiscorev1.Convert_core_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {1068 return err1069 }1070 out.VolumeClaimTemplates = *(*[]corev1.PersistentVolumeClaim)(unsafe.Pointer(&in.VolumeClaimTemplates))1071 out.ServiceName = in.ServiceName1072 out.PodManagementPolicy = v1.PodManagementPolicyType(in.PodManagementPolicy)1073 if err := Convert_apps_StatefulSetUpdateStrategy_To_v1_StatefulSetUpdateStrategy(&in.UpdateStrategy, &out.UpdateStrategy, s); err != nil {1074 return err1075 }1076 out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit))1077 return nil1078}1079func autoConvert_v1_StatefulSetStatus_To_apps_StatefulSetStatus(in *v1.StatefulSetStatus, out *apps.StatefulSetStatus, s conversion.Scope) error {1080 if err := metav1.Convert_int64_To_Pointer_int64(&in.ObservedGeneration, &out.ObservedGeneration, s); err != nil {1081 return err1082 }1083 out.Replicas = in.Replicas1084 out.ReadyReplicas = in.ReadyReplicas1085 out.CurrentReplicas = in.CurrentReplicas1086 out.UpdatedReplicas = in.UpdatedReplicas1087 out.CurrentRevision = in.CurrentRevision1088 out.UpdateRevision = in.UpdateRevision1089 out.CollisionCount = (*int32)(unsafe.Pointer(in.CollisionCount))1090 out.Conditions = *(*[]apps.StatefulSetCondition)(unsafe.Pointer(&in.Conditions))1091 return nil1092}1093// Convert_v1_StatefulSetStatus_To_apps_StatefulSetStatus is an autogenerated conversion function.1094func Convert_v1_StatefulSetStatus_To_apps_StatefulSetStatus(in *v1.StatefulSetStatus, out *apps.StatefulSetStatus, s conversion.Scope) error {1095 return autoConvert_v1_StatefulSetStatus_To_apps_StatefulSetStatus(in, out, s)1096}1097func autoConvert_apps_StatefulSetStatus_To_v1_StatefulSetStatus(in *apps.StatefulSetStatus, out *v1.StatefulSetStatus, s conversion.Scope) error {1098 if err := metav1.Convert_Pointer_int64_To_int64(&in.ObservedGeneration, &out.ObservedGeneration, s); err != nil {1099 return err1100 }1101 out.Replicas = in.Replicas1102 out.ReadyReplicas = in.ReadyReplicas1103 out.CurrentReplicas = in.CurrentReplicas1104 out.UpdatedReplicas = in.UpdatedReplicas1105 out.CurrentRevision = in.CurrentRevision1106 out.UpdateRevision = in.UpdateRevision1107 out.CollisionCount = (*int32)(unsafe.Pointer(in.CollisionCount))1108 out.Conditions = *(*[]v1.StatefulSetCondition)(unsafe.Pointer(&in.Conditions))1109 return nil1110}1111// Convert_apps_StatefulSetStatus_To_v1_StatefulSetStatus is an autogenerated conversion function.1112func Convert_apps_StatefulSetStatus_To_v1_StatefulSetStatus(in *apps.StatefulSetStatus, out *v1.StatefulSetStatus, s conversion.Scope) error {1113 return autoConvert_apps_StatefulSetStatus_To_v1_StatefulSetStatus(in, out, s)1114}1115func autoConvert_v1_StatefulSetUpdateStrategy_To_apps_StatefulSetUpdateStrategy(in *v1.StatefulSetUpdateStrategy, out *apps.StatefulSetUpdateStrategy, s conversion.Scope) error {1116 out.Type = apps.StatefulSetUpdateStrategyType(in.Type)1117 if in.RollingUpdate != nil {1118 in, out := &in.RollingUpdate, &out.RollingUpdate1119 *out = new(apps.RollingUpdateStatefulSetStrategy)1120 if err := Convert_v1_RollingUpdateStatefulSetStrategy_To_apps_RollingUpdateStatefulSetStrategy(*in, *out, s); err != nil {1121 return err1122 }1123 } else {1124 out.RollingUpdate = nil1125 }1126 return nil1127}1128// Convert_v1_StatefulSetUpdateStrategy_To_apps_StatefulSetUpdateStrategy is an autogenerated conversion function.1129func Convert_v1_StatefulSetUpdateStrategy_To_apps_StatefulSetUpdateStrategy(in *v1.StatefulSetUpdateStrategy, out *apps.StatefulSetUpdateStrategy, s conversion.Scope) error {1130 return autoConvert_v1_StatefulSetUpdateStrategy_To_apps_StatefulSetUpdateStrategy(in, out, s)1131}1132func autoConvert_apps_StatefulSetUpdateStrategy_To_v1_StatefulSetUpdateStrategy(in *apps.StatefulSetUpdateStrategy, out *v1.StatefulSetUpdateStrategy, s conversion.Scope) error {1133 out.Type = v1.StatefulSetUpdateStrategyType(in.Type)1134 if in.RollingUpdate != nil {1135 in, out := &in.RollingUpdate, &out.RollingUpdate1136 *out = new(v1.RollingUpdateStatefulSetStrategy)1137 if err := Convert_apps_RollingUpdateStatefulSetStrategy_To_v1_RollingUpdateStatefulSetStrategy(*in, *out, s); err != nil {1138 return err1139 }1140 } else {1141 out.RollingUpdate = nil1142 }1143 return nil1144}1145// Convert_apps_StatefulSetUpdateStrategy_To_v1_StatefulSetUpdateStrategy is an autogenerated conversion function.1146func Convert_apps_StatefulSetUpdateStrategy_To_v1_StatefulSetUpdateStrategy(in *apps.StatefulSetUpdateStrategy, out *v1.StatefulSetUpdateStrategy, s conversion.Scope) error {1147 return autoConvert_apps_StatefulSetUpdateStrategy_To_v1_StatefulSetUpdateStrategy(in, out, s)1148}...
event_test.go
Source:event_test.go
...30 ref "k8s.io/client-go/tools/reference"31)32type testEventSink struct {33 OnCreate func(e *v1.Event) (*v1.Event, error)34 OnUpdate func(e *v1.Event) (*v1.Event, error)35 OnPatch func(e *v1.Event, p []byte) (*v1.Event, error)36}37// CreateEvent records the event for testing.38func (t *testEventSink) Create(e *v1.Event) (*v1.Event, error) {39 if t.OnCreate != nil {40 return t.OnCreate(e)41 }42 return e, nil43}44// UpdateEvent records the event for testing.45func (t *testEventSink) Update(e *v1.Event) (*v1.Event, error) {46 if t.OnUpdate != nil {47 return t.OnUpdate(e)48 }49 return e, nil50}51// PatchEvent records the event for testing.52func (t *testEventSink) Patch(e *v1.Event, p []byte) (*v1.Event, error) {53 if t.OnPatch != nil {54 return t.OnPatch(e, p)55 }56 return e, nil57}58type OnCreateFunc func(*v1.Event) (*v1.Event, error)59func OnCreateFactory(testCache map[string]*v1.Event, createEvent chan<- *v1.Event) OnCreateFunc {60 return func(event *v1.Event) (*v1.Event, error) {61 testCache[getEventKey(event)] = event62 createEvent <- event63 return event, nil64 }65}66type OnPatchFunc func(*v1.Event, []byte) (*v1.Event, error)67func OnPatchFactory(testCache map[string]*v1.Event, patchEvent chan<- *v1.Event) OnPatchFunc {68 return func(event *v1.Event, patch []byte) (*v1.Event, error) {69 cachedEvent, found := testCache[getEventKey(event)]70 if !found {71 return nil, fmt.Errorf("unexpected error: couldn't find Event in testCache.")72 }73 originalData, err := json.Marshal(cachedEvent)74 if err != nil {75 return nil, fmt.Errorf("unexpected error: %v", err)76 }77 patched, err := strategicpatch.StrategicMergePatch(originalData, patch, event)78 if err != nil {79 return nil, fmt.Errorf("unexpected error: %v", err)80 }81 patchedObj := &v1.Event{}82 err = json.Unmarshal(patched, patchedObj)83 if err != nil {84 return nil, fmt.Errorf("unexpected error: %v", err)85 }86 patchEvent <- patchedObj87 return patchedObj, nil88 }89}90func TestEventf(t *testing.T) {91 testPod := &v1.Pod{92 ObjectMeta: metav1.ObjectMeta{93 SelfLink: "/api/version/pods/foo",94 Name: "foo",95 Namespace: "baz",96 UID: "bar",97 },98 }99 testPod2 := &v1.Pod{100 ObjectMeta: metav1.ObjectMeta{101 SelfLink: "/api/version/pods/foo",102 Name: "foo",103 Namespace: "baz",104 UID: "differentUid",105 },106 }107 testRef, err := ref.GetPartialReference(scheme.Scheme, testPod, "spec.containers[2]")108 testRef2, err := ref.GetPartialReference(scheme.Scheme, testPod2, "spec.containers[3]")109 if err != nil {110 t.Fatal(err)111 }112 table := []struct {113 obj k8sruntime.Object114 eventtype string115 reason string116 messageFmt string117 elements []interface{}118 expect *v1.Event119 expectLog string120 expectUpdate bool121 }{122 {123 obj: testRef,124 eventtype: v1.EventTypeNormal,125 reason: "Started",126 messageFmt: "some verbose message: %v",127 elements: []interface{}{1},128 expect: &v1.Event{129 ObjectMeta: metav1.ObjectMeta{130 Name: "foo",131 Namespace: "baz",132 },133 InvolvedObject: v1.ObjectReference{134 Kind: "Pod",135 Name: "foo",136 Namespace: "baz",137 UID: "bar",138 APIVersion: "version",139 FieldPath: "spec.containers[2]",140 },141 Reason: "Started",142 Message: "some verbose message: 1",143 Source: v1.EventSource{Component: "eventTest"},144 Count: 1,145 Type: v1.EventTypeNormal,146 },147 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,148 expectUpdate: false,149 },150 {151 obj: testPod,152 eventtype: v1.EventTypeNormal,153 reason: "Killed",154 messageFmt: "some other verbose message: %v",155 elements: []interface{}{1},156 expect: &v1.Event{157 ObjectMeta: metav1.ObjectMeta{158 Name: "foo",159 Namespace: "baz",160 },161 InvolvedObject: v1.ObjectReference{162 Kind: "Pod",163 Name: "foo",164 Namespace: "baz",165 UID: "bar",166 APIVersion: "version",167 },168 Reason: "Killed",169 Message: "some other verbose message: 1",170 Source: v1.EventSource{Component: "eventTest"},171 Count: 1,172 Type: v1.EventTypeNormal,173 },174 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:""}): type: 'Normal' reason: 'Killed' some other verbose message: 1`,175 expectUpdate: false,176 },177 {178 obj: testRef,179 eventtype: v1.EventTypeNormal,180 reason: "Started",181 messageFmt: "some verbose message: %v",182 elements: []interface{}{1},183 expect: &v1.Event{184 ObjectMeta: metav1.ObjectMeta{185 Name: "foo",186 Namespace: "baz",187 },188 InvolvedObject: v1.ObjectReference{189 Kind: "Pod",190 Name: "foo",191 Namespace: "baz",192 UID: "bar",193 APIVersion: "version",194 FieldPath: "spec.containers[2]",195 },196 Reason: "Started",197 Message: "some verbose message: 1",198 Source: v1.EventSource{Component: "eventTest"},199 Count: 2,200 Type: v1.EventTypeNormal,201 },202 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,203 expectUpdate: true,204 },205 {206 obj: testRef2,207 eventtype: v1.EventTypeNormal,208 reason: "Started",209 messageFmt: "some verbose message: %v",210 elements: []interface{}{1},211 expect: &v1.Event{212 ObjectMeta: metav1.ObjectMeta{213 Name: "foo",214 Namespace: "baz",215 },216 InvolvedObject: v1.ObjectReference{217 Kind: "Pod",218 Name: "foo",219 Namespace: "baz",220 UID: "differentUid",221 APIVersion: "version",222 FieldPath: "spec.containers[3]",223 },224 Reason: "Started",225 Message: "some verbose message: 1",226 Source: v1.EventSource{Component: "eventTest"},227 Count: 1,228 Type: v1.EventTypeNormal,229 },230 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,231 expectUpdate: false,232 },233 {234 obj: testRef,235 eventtype: v1.EventTypeNormal,236 reason: "Started",237 messageFmt: "some verbose message: %v",238 elements: []interface{}{1},239 expect: &v1.Event{240 ObjectMeta: metav1.ObjectMeta{241 Name: "foo",242 Namespace: "baz",243 },244 InvolvedObject: v1.ObjectReference{245 Kind: "Pod",246 Name: "foo",247 Namespace: "baz",248 UID: "bar",249 APIVersion: "version",250 FieldPath: "spec.containers[2]",251 },252 Reason: "Started",253 Message: "some verbose message: 1",254 Source: v1.EventSource{Component: "eventTest"},255 Count: 3,256 Type: v1.EventTypeNormal,257 },258 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,259 expectUpdate: true,260 },261 {262 obj: testRef2,263 eventtype: v1.EventTypeNormal,264 reason: "Stopped",265 messageFmt: "some verbose message: %v",266 elements: []interface{}{1},267 expect: &v1.Event{268 ObjectMeta: metav1.ObjectMeta{269 Name: "foo",270 Namespace: "baz",271 },272 InvolvedObject: v1.ObjectReference{273 Kind: "Pod",274 Name: "foo",275 Namespace: "baz",276 UID: "differentUid",277 APIVersion: "version",278 FieldPath: "spec.containers[3]",279 },280 Reason: "Stopped",281 Message: "some verbose message: 1",282 Source: v1.EventSource{Component: "eventTest"},283 Count: 1,284 Type: v1.EventTypeNormal,285 },286 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,287 expectUpdate: false,288 },289 {290 obj: testRef2,291 eventtype: v1.EventTypeNormal,292 reason: "Stopped",293 messageFmt: "some verbose message: %v",294 elements: []interface{}{1},295 expect: &v1.Event{296 ObjectMeta: metav1.ObjectMeta{297 Name: "foo",298 Namespace: "baz",299 },300 InvolvedObject: v1.ObjectReference{301 Kind: "Pod",302 Name: "foo",303 Namespace: "baz",304 UID: "differentUid",305 APIVersion: "version",306 FieldPath: "spec.containers[3]",307 },308 Reason: "Stopped",309 Message: "some verbose message: 1",310 Source: v1.EventSource{Component: "eventTest"},311 Count: 2,312 Type: v1.EventTypeNormal,313 },314 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,315 expectUpdate: true,316 },317 }318 testCache := map[string]*v1.Event{}319 logCalled := make(chan struct{})320 createEvent := make(chan *v1.Event)321 updateEvent := make(chan *v1.Event)322 patchEvent := make(chan *v1.Event)323 testEvents := testEventSink{324 OnCreate: OnCreateFactory(testCache, createEvent),325 OnUpdate: func(event *v1.Event) (*v1.Event, error) {326 updateEvent <- event327 return event, nil328 },329 OnPatch: OnPatchFactory(testCache, patchEvent),330 }331 eventBroadcaster := NewBroadcasterForTests(0)332 sinkWatcher := eventBroadcaster.StartRecordingToSink(&testEvents)333 clock := clock.NewFakeClock(time.Now())334 recorder := recorderWithFakeClock(v1.EventSource{Component: "eventTest"}, eventBroadcaster, clock)335 for index, item := range table {336 clock.Step(1 * time.Second)337 logWatcher := eventBroadcaster.StartLogging(func(formatter string, args ...interface{}) {338 if e, a := item.expectLog, fmt.Sprintf(formatter, args...); e != a {339 t.Errorf("Expected '%v', got '%v'", e, a)340 }341 logCalled <- struct{}{}342 })343 recorder.Eventf(item.obj, item.eventtype, item.reason, item.messageFmt, item.elements...)344 <-logCalled345 // validate event346 if item.expectUpdate {347 actualEvent := <-patchEvent348 validateEvent(strconv.Itoa(index), actualEvent, item.expect, t)349 } else {350 actualEvent := <-createEvent351 validateEvent(strconv.Itoa(index), actualEvent, item.expect, t)352 }353 logWatcher.Stop()354 }355 sinkWatcher.Stop()356}357func recorderWithFakeClock(eventSource v1.EventSource, eventBroadcaster EventBroadcaster, clock clock.Clock) EventRecorder {358 return &recorderImpl{scheme.Scheme, eventSource, eventBroadcaster.(*eventBroadcasterImpl).Broadcaster, clock}359}360func TestWriteEventError(t *testing.T) {361 type entry struct {362 timesToSendError int363 attemptsWanted int364 err error365 }366 table := map[string]*entry{367 "giveUp1": {368 timesToSendError: 1000,369 attemptsWanted: 1,370 err: &restclient.RequestConstructionError{},371 },372 "giveUp2": {373 timesToSendError: 1000,374 attemptsWanted: 1,375 err: &errors.StatusError{},376 },377 "retry1": {378 timesToSendError: 1000,379 attemptsWanted: 12,380 err: &errors.UnexpectedObjectError{},381 },382 "retry2": {383 timesToSendError: 1000,384 attemptsWanted: 12,385 err: fmt.Errorf("A weird error"),386 },387 "succeedEventually": {388 timesToSendError: 2,389 attemptsWanted: 2,390 err: fmt.Errorf("A weird error"),391 },392 }393 clock := clock.IntervalClock{Time: time.Now(), Duration: time.Second}394 eventCorrelator := NewEventCorrelator(&clock)395 randGen := rand.New(rand.NewSource(time.Now().UnixNano()))396 for caseName, ent := range table {397 attempts := 0398 sink := &testEventSink{399 OnCreate: func(event *v1.Event) (*v1.Event, error) {400 attempts++401 if attempts < ent.timesToSendError {402 return nil, ent.err403 }404 return event, nil405 },406 }407 ev := &v1.Event{}408 recordToSink(sink, ev, eventCorrelator, randGen, 0)409 if attempts != ent.attemptsWanted {410 t.Errorf("case %v: wanted %d, got %d attempts", caseName, ent.attemptsWanted, attempts)411 }412 }413}414func TestUpdateExpiredEvent(t *testing.T) {415 clock := clock.IntervalClock{Time: time.Now(), Duration: time.Second}416 eventCorrelator := NewEventCorrelator(&clock)417 randGen := rand.New(rand.NewSource(time.Now().UnixNano()))418 var createdEvent *v1.Event419 sink := &testEventSink{420 OnPatch: func(*v1.Event, []byte) (*v1.Event, error) {421 return nil, &errors.StatusError{422 ErrStatus: metav1.Status{423 Code: http.StatusNotFound,424 Reason: metav1.StatusReasonNotFound,425 }}426 },427 OnCreate: func(event *v1.Event) (*v1.Event, error) {428 createdEvent = event429 return event, nil430 },431 }432 ev := &v1.Event{}433 ev.ResourceVersion = "updated-resource-version"434 ev.Count = 2435 recordToSink(sink, ev, eventCorrelator, randGen, 0)436 if createdEvent == nil {437 t.Error("Event did not get created after patch failed")438 return439 }440 if createdEvent.ResourceVersion != "" {441 t.Errorf("Event did not have its resource version cleared, was %s", createdEvent.ResourceVersion)442 }443}444func TestLotsOfEvents(t *testing.T) {445 recorderCalled := make(chan struct{})446 loggerCalled := make(chan struct{})447 // Fail each event a few times to ensure there's some load on the tested code.448 var counts [1000]int449 testEvents := testEventSink{450 OnCreate: func(event *v1.Event) (*v1.Event, error) {451 num, err := strconv.Atoi(event.Message)452 if err != nil {453 t.Error(err)454 return event, nil455 }456 counts[num]++457 if counts[num] < 5 {458 return nil, fmt.Errorf("fake error")459 }460 recorderCalled <- struct{}{}461 return event, nil462 },463 }464 eventBroadcaster := NewBroadcasterForTests(0)465 sinkWatcher := eventBroadcaster.StartRecordingToSink(&testEvents)466 logWatcher := eventBroadcaster.StartLogging(func(formatter string, args ...interface{}) {467 loggerCalled <- struct{}{}468 })469 recorder := eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "eventTest"})470 for i := 0; i < maxQueuedEvents; i++ {471 // we want a unique object to stop spam filtering472 ref := &v1.ObjectReference{473 Kind: "Pod",474 Name: fmt.Sprintf("foo-%v", i),475 Namespace: "baz",476 UID: "bar",477 APIVersion: "version",478 }479 // we need to vary the reason to prevent aggregation480 go recorder.Eventf(ref, v1.EventTypeNormal, "Reason-"+string(i), strconv.Itoa(i))481 }482 // Make sure no events were dropped by either of the listeners.483 for i := 0; i < maxQueuedEvents; i++ {484 <-recorderCalled485 <-loggerCalled486 }487 // Make sure that every event was attempted 5 times488 for i := 0; i < maxQueuedEvents; i++ {489 if counts[i] < 5 {490 t.Errorf("Only attempted to record event '%d' %d times.", i, counts[i])491 }492 }493 sinkWatcher.Stop()494 logWatcher.Stop()495}496func TestEventfNoNamespace(t *testing.T) {497 testPod := &v1.Pod{498 ObjectMeta: metav1.ObjectMeta{499 SelfLink: "/api/version/pods/foo",500 Name: "foo",501 UID: "bar",502 },503 }504 testRef, err := ref.GetPartialReference(scheme.Scheme, testPod, "spec.containers[2]")505 if err != nil {506 t.Fatal(err)507 }508 table := []struct {509 obj k8sruntime.Object510 eventtype string511 reason string512 messageFmt string513 elements []interface{}514 expect *v1.Event515 expectLog string516 expectUpdate bool517 }{518 {519 obj: testRef,520 eventtype: v1.EventTypeNormal,521 reason: "Started",522 messageFmt: "some verbose message: %v",523 elements: []interface{}{1},524 expect: &v1.Event{525 ObjectMeta: metav1.ObjectMeta{526 Name: "foo",527 Namespace: "default",528 },529 InvolvedObject: v1.ObjectReference{530 Kind: "Pod",531 Name: "foo",532 Namespace: "",533 UID: "bar",534 APIVersion: "version",535 FieldPath: "spec.containers[2]",536 },537 Reason: "Started",538 Message: "some verbose message: 1",539 Source: v1.EventSource{Component: "eventTest"},540 Count: 1,541 Type: v1.EventTypeNormal,542 },543 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,544 expectUpdate: false,545 },546 }547 testCache := map[string]*v1.Event{}548 logCalled := make(chan struct{})549 createEvent := make(chan *v1.Event)550 updateEvent := make(chan *v1.Event)551 patchEvent := make(chan *v1.Event)552 testEvents := testEventSink{553 OnCreate: OnCreateFactory(testCache, createEvent),554 OnUpdate: func(event *v1.Event) (*v1.Event, error) {555 updateEvent <- event556 return event, nil557 },558 OnPatch: OnPatchFactory(testCache, patchEvent),559 }560 eventBroadcaster := NewBroadcasterForTests(0)561 sinkWatcher := eventBroadcaster.StartRecordingToSink(&testEvents)562 clock := clock.NewFakeClock(time.Now())563 recorder := recorderWithFakeClock(v1.EventSource{Component: "eventTest"}, eventBroadcaster, clock)564 for index, item := range table {565 clock.Step(1 * time.Second)566 logWatcher := eventBroadcaster.StartLogging(func(formatter string, args ...interface{}) {567 if e, a := item.expectLog, fmt.Sprintf(formatter, args...); e != a {568 t.Errorf("Expected '%v', got '%v'", e, a)569 }570 logCalled <- struct{}{}571 })572 recorder.Eventf(item.obj, item.eventtype, item.reason, item.messageFmt, item.elements...)573 <-logCalled574 // validate event575 if item.expectUpdate {576 actualEvent := <-patchEvent577 validateEvent(strconv.Itoa(index), actualEvent, item.expect, t)578 } else {579 actualEvent := <-createEvent580 validateEvent(strconv.Itoa(index), actualEvent, item.expect, t)581 }582 logWatcher.Stop()583 }584 sinkWatcher.Stop()585}586func TestMultiSinkCache(t *testing.T) {587 testPod := &v1.Pod{588 ObjectMeta: metav1.ObjectMeta{589 SelfLink: "/api/version/pods/foo",590 Name: "foo",591 Namespace: "baz",592 UID: "bar",593 },594 }595 testPod2 := &v1.Pod{596 ObjectMeta: metav1.ObjectMeta{597 SelfLink: "/api/version/pods/foo",598 Name: "foo",599 Namespace: "baz",600 UID: "differentUid",601 },602 }603 testRef, err := ref.GetPartialReference(scheme.Scheme, testPod, "spec.containers[2]")604 testRef2, err := ref.GetPartialReference(scheme.Scheme, testPod2, "spec.containers[3]")605 if err != nil {606 t.Fatal(err)607 }608 table := []struct {609 obj k8sruntime.Object610 eventtype string611 reason string612 messageFmt string613 elements []interface{}614 expect *v1.Event615 expectLog string616 expectUpdate bool617 }{618 {619 obj: testRef,620 eventtype: v1.EventTypeNormal,621 reason: "Started",622 messageFmt: "some verbose message: %v",623 elements: []interface{}{1},624 expect: &v1.Event{625 ObjectMeta: metav1.ObjectMeta{626 Name: "foo",627 Namespace: "baz",628 },629 InvolvedObject: v1.ObjectReference{630 Kind: "Pod",631 Name: "foo",632 Namespace: "baz",633 UID: "bar",634 APIVersion: "version",635 FieldPath: "spec.containers[2]",636 },637 Reason: "Started",638 Message: "some verbose message: 1",639 Source: v1.EventSource{Component: "eventTest"},640 Count: 1,641 Type: v1.EventTypeNormal,642 },643 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,644 expectUpdate: false,645 },646 {647 obj: testPod,648 eventtype: v1.EventTypeNormal,649 reason: "Killed",650 messageFmt: "some other verbose message: %v",651 elements: []interface{}{1},652 expect: &v1.Event{653 ObjectMeta: metav1.ObjectMeta{654 Name: "foo",655 Namespace: "baz",656 },657 InvolvedObject: v1.ObjectReference{658 Kind: "Pod",659 Name: "foo",660 Namespace: "baz",661 UID: "bar",662 APIVersion: "version",663 },664 Reason: "Killed",665 Message: "some other verbose message: 1",666 Source: v1.EventSource{Component: "eventTest"},667 Count: 1,668 Type: v1.EventTypeNormal,669 },670 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:""}): type: 'Normal' reason: 'Killed' some other verbose message: 1`,671 expectUpdate: false,672 },673 {674 obj: testRef,675 eventtype: v1.EventTypeNormal,676 reason: "Started",677 messageFmt: "some verbose message: %v",678 elements: []interface{}{1},679 expect: &v1.Event{680 ObjectMeta: metav1.ObjectMeta{681 Name: "foo",682 Namespace: "baz",683 },684 InvolvedObject: v1.ObjectReference{685 Kind: "Pod",686 Name: "foo",687 Namespace: "baz",688 UID: "bar",689 APIVersion: "version",690 FieldPath: "spec.containers[2]",691 },692 Reason: "Started",693 Message: "some verbose message: 1",694 Source: v1.EventSource{Component: "eventTest"},695 Count: 2,696 Type: v1.EventTypeNormal,697 },698 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,699 expectUpdate: true,700 },701 {702 obj: testRef2,703 eventtype: v1.EventTypeNormal,704 reason: "Started",705 messageFmt: "some verbose message: %v",706 elements: []interface{}{1},707 expect: &v1.Event{708 ObjectMeta: metav1.ObjectMeta{709 Name: "foo",710 Namespace: "baz",711 },712 InvolvedObject: v1.ObjectReference{713 Kind: "Pod",714 Name: "foo",715 Namespace: "baz",716 UID: "differentUid",717 APIVersion: "version",718 FieldPath: "spec.containers[3]",719 },720 Reason: "Started",721 Message: "some verbose message: 1",722 Source: v1.EventSource{Component: "eventTest"},723 Count: 1,724 Type: v1.EventTypeNormal,725 },726 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,727 expectUpdate: false,728 },729 {730 obj: testRef,731 eventtype: v1.EventTypeNormal,732 reason: "Started",733 messageFmt: "some verbose message: %v",734 elements: []interface{}{1},735 expect: &v1.Event{736 ObjectMeta: metav1.ObjectMeta{737 Name: "foo",738 Namespace: "baz",739 },740 InvolvedObject: v1.ObjectReference{741 Kind: "Pod",742 Name: "foo",743 Namespace: "baz",744 UID: "bar",745 APIVersion: "version",746 FieldPath: "spec.containers[2]",747 },748 Reason: "Started",749 Message: "some verbose message: 1",750 Source: v1.EventSource{Component: "eventTest"},751 Count: 3,752 Type: v1.EventTypeNormal,753 },754 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,755 expectUpdate: true,756 },757 {758 obj: testRef2,759 eventtype: v1.EventTypeNormal,760 reason: "Stopped",761 messageFmt: "some verbose message: %v",762 elements: []interface{}{1},763 expect: &v1.Event{764 ObjectMeta: metav1.ObjectMeta{765 Name: "foo",766 Namespace: "baz",767 },768 InvolvedObject: v1.ObjectReference{769 Kind: "Pod",770 Name: "foo",771 Namespace: "baz",772 UID: "differentUid",773 APIVersion: "version",774 FieldPath: "spec.containers[3]",775 },776 Reason: "Stopped",777 Message: "some verbose message: 1",778 Source: v1.EventSource{Component: "eventTest"},779 Count: 1,780 Type: v1.EventTypeNormal,781 },782 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,783 expectUpdate: false,784 },785 {786 obj: testRef2,787 eventtype: v1.EventTypeNormal,788 reason: "Stopped",789 messageFmt: "some verbose message: %v",790 elements: []interface{}{1},791 expect: &v1.Event{792 ObjectMeta: metav1.ObjectMeta{793 Name: "foo",794 Namespace: "baz",795 },796 InvolvedObject: v1.ObjectReference{797 Kind: "Pod",798 Name: "foo",799 Namespace: "baz",800 UID: "differentUid",801 APIVersion: "version",802 FieldPath: "spec.containers[3]",803 },804 Reason: "Stopped",805 Message: "some verbose message: 1",806 Source: v1.EventSource{Component: "eventTest"},807 Count: 2,808 Type: v1.EventTypeNormal,809 },810 expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,811 expectUpdate: true,812 },813 }814 testCache := map[string]*v1.Event{}815 createEvent := make(chan *v1.Event)816 updateEvent := make(chan *v1.Event)817 patchEvent := make(chan *v1.Event)818 testEvents := testEventSink{819 OnCreate: OnCreateFactory(testCache, createEvent),820 OnUpdate: func(event *v1.Event) (*v1.Event, error) {821 updateEvent <- event822 return event, nil823 },824 OnPatch: OnPatchFactory(testCache, patchEvent),825 }826 testCache2 := map[string]*v1.Event{}827 createEvent2 := make(chan *v1.Event)828 updateEvent2 := make(chan *v1.Event)829 patchEvent2 := make(chan *v1.Event)830 testEvents2 := testEventSink{831 OnCreate: OnCreateFactory(testCache2, createEvent2),832 OnUpdate: func(event *v1.Event) (*v1.Event, error) {833 updateEvent2 <- event834 return event, nil835 },836 OnPatch: OnPatchFactory(testCache2, patchEvent2),837 }838 eventBroadcaster := NewBroadcasterForTests(0)839 clock := clock.NewFakeClock(time.Now())840 recorder := recorderWithFakeClock(v1.EventSource{Component: "eventTest"}, eventBroadcaster, clock)841 sinkWatcher := eventBroadcaster.StartRecordingToSink(&testEvents)842 for index, item := range table {843 clock.Step(1 * time.Second)844 recorder.Eventf(item.obj, item.eventtype, item.reason, item.messageFmt, item.elements...)845 // validate event846 if item.expectUpdate {847 actualEvent := <-patchEvent848 validateEvent(strconv.Itoa(index), actualEvent, item.expect, t)849 } else {850 actualEvent := <-createEvent851 validateEvent(strconv.Itoa(index), actualEvent, item.expect, t)852 }853 }854 // Another StartRecordingToSink call should start to record events with new clean cache.855 sinkWatcher2 := eventBroadcaster.StartRecordingToSink(&testEvents2)856 for index, item := range table {857 clock.Step(1 * time.Second)858 recorder.Eventf(item.obj, item.eventtype, item.reason, item.messageFmt, item.elements...)859 // validate event860 if item.expectUpdate {861 actualEvent := <-patchEvent2862 validateEvent(strconv.Itoa(index), actualEvent, item.expect, t)863 } else {864 actualEvent := <-createEvent2865 validateEvent(strconv.Itoa(index), actualEvent, item.expect, t)866 }867 }868 sinkWatcher.Stop()869 sinkWatcher2.Stop()870}...
eventhandler_test.go
Source:eventhandler_test.go
...62 },63 }})64 assert.ElementsMatch(t, []string{"0.0.0.3"}, endpoints)65}66func TestUpdate(t *testing.T) {67 var endpoints []string68 h := NewEventHandler(func(change []string) {69 endpoints = change70 })71 h.OnUpdate(&v1.Endpoints{72 Subsets: []v1.EndpointSubset{73 {74 Addresses: []v1.EndpointAddress{75 {76 IP: "0.0.0.1",77 },78 {79 IP: "0.0.0.2",80 },81 },82 },83 },84 ObjectMeta: metav1.ObjectMeta{85 ResourceVersion: "1",86 },87 }, &v1.Endpoints{88 Subsets: []v1.EndpointSubset{89 {90 Addresses: []v1.EndpointAddress{91 {92 IP: "0.0.0.1",93 },94 {95 IP: "0.0.0.2",96 },97 {98 IP: "0.0.0.3",99 },100 },101 },102 },103 ObjectMeta: metav1.ObjectMeta{104 ResourceVersion: "2",105 },106 })107 assert.ElementsMatch(t, []string{"0.0.0.1", "0.0.0.2", "0.0.0.3"}, endpoints)108}109func TestUpdateNoChange(t *testing.T) {110 h := NewEventHandler(func(change []string) {111 assert.Fail(t, "should not called")112 })113 h.OnUpdate(&v1.Endpoints{114 Subsets: []v1.EndpointSubset{115 {116 Addresses: []v1.EndpointAddress{117 {118 IP: "0.0.0.1",119 },120 {121 IP: "0.0.0.2",122 },123 },124 },125 },126 ObjectMeta: metav1.ObjectMeta{127 ResourceVersion: "1",128 },129 }, &v1.Endpoints{130 Subsets: []v1.EndpointSubset{131 {132 Addresses: []v1.EndpointAddress{133 {134 IP: "0.0.0.1",135 },136 {137 IP: "0.0.0.2",138 },139 },140 },141 },142 ObjectMeta: metav1.ObjectMeta{143 ResourceVersion: "1",144 },145 })146}147func TestUpdateChangeWithDifferentVersion(t *testing.T) {148 var endpoints []string149 h := NewEventHandler(func(change []string) {150 endpoints = change151 })152 h.OnAdd(&v1.Endpoints{Subsets: []v1.EndpointSubset{153 {154 Addresses: []v1.EndpointAddress{155 {156 IP: "0.0.0.1",157 },158 {159 IP: "0.0.0.3",160 },161 },162 },163 }})164 h.OnUpdate(&v1.Endpoints{165 Subsets: []v1.EndpointSubset{166 {167 Addresses: []v1.EndpointAddress{168 {169 IP: "0.0.0.1",170 },171 {172 IP: "0.0.0.3",173 },174 },175 },176 },177 ObjectMeta: metav1.ObjectMeta{178 ResourceVersion: "1",179 },180 }, &v1.Endpoints{181 Subsets: []v1.EndpointSubset{182 {183 Addresses: []v1.EndpointAddress{184 {185 IP: "0.0.0.1",186 },187 {188 IP: "0.0.0.2",189 },190 },191 },192 },193 ObjectMeta: metav1.ObjectMeta{194 ResourceVersion: "2",195 },196 })197 assert.ElementsMatch(t, []string{"0.0.0.1", "0.0.0.2"}, endpoints)198}199func TestUpdateNoChangeWithDifferentVersion(t *testing.T) {200 var endpoints []string201 h := NewEventHandler(func(change []string) {202 endpoints = change203 })204 h.OnAdd(&v1.Endpoints{Subsets: []v1.EndpointSubset{205 {206 Addresses: []v1.EndpointAddress{207 {208 IP: "0.0.0.1",209 },210 {211 IP: "0.0.0.2",212 },213 },214 },215 }})216 h.OnUpdate("bad", &v1.Endpoints{Subsets: []v1.EndpointSubset{217 {218 Addresses: []v1.EndpointAddress{219 {220 IP: "0.0.0.1",221 },222 },223 },224 }})225 h.OnUpdate(&v1.Endpoints{Subsets: []v1.EndpointSubset{226 {227 Addresses: []v1.EndpointAddress{228 {229 IP: "0.0.0.1",230 },231 },232 },233 }}, "bad")234 h.OnUpdate(&v1.Endpoints{235 Subsets: []v1.EndpointSubset{236 {237 Addresses: []v1.EndpointAddress{238 {239 IP: "0.0.0.1",240 },241 {242 IP: "0.0.0.2",243 },244 },245 },246 },247 ObjectMeta: metav1.ObjectMeta{248 ResourceVersion: "1",...
Update
Using AI Code Generation
1v1.Update()2v2.Update()3v1.Update()4v2.Update()5v1.Update()6v2.Update()7v1.Update()8v2.Update()9v1.Update()10v2.Update()11v1.Update()12v2.Update()13v1.Update()14v2.Update()15v1.Update()16v2.Update()17v1.Update()18v2.Update()19v1.Update()20v2.Update()21v1.Update()22v2.Update()23v1.Update()
Update
Using AI Code Generation
1v1.Update()2v2.Update()3v1.Update()4v2.Update()5v1.Update()6v2.Update()7v1.Update()8v2.Update()9v1.Update()10v2.Update()11v1.Update()12v2.Update()13v1.Update()14v2.Update()15v1.Update()16v2.Update()17v1.Update()18v2.Update()19v1.Update()20v2.Update()21v1.Update()22v2.Update()23v1.Update()24v2.Update()25v1.Update()26v2.Update()27v1.Update()
Update
Using AI Code Generation
1func main() {2 v1 := v1.New()3 v1.Update()4}5func main() {6 v2 := v2.New()7 v2.Update()8}9func main() {10 v3 := v3.New()11 v3.Update()12}13func main() {14 v4 := v4.New()15 v4.Update()16}17func main() {18 v5 := v5.New()19 v5.Update()20}21func main() {22 v6 := v6.New()23 v6.Update()24}25func main() {26 v7 := v7.New()27 v7.Update()28}29func main() {30 v8 := v8.New()31 v8.Update()32}33func main() {34 v9 := v9.New()35 v9.Update()36}37func main() {38 v10 := v10.New()39 v10.Update()40}41func main() {42 v11 := v11.New()43 v11.Update()44}45func main() {46 v12 := v12.New()47 v12.Update()48}49func main() {50 v13 := v13.New()51 v13.Update()52}53func main() {54 v14 := v14.New()55 v14.Update()56}
Update
Using AI Code Generation
1import (2func main() {3 fmt.Println(v1.Update())4 fmt.Println(v2.Update())5}6import (7func main() {8 fmt.Println(v1.Update())9 fmt.Println(v2.Update())10}11import (12func main() {13 fmt.Println(v1.Update())14 fmt.Println(v2.Update())15}16import (17func main() {18 fmt.Println(v1.Update())19 fmt.Println(v2.Update())20}21import (22func main() {23 fmt.Println(v1.Update())24 fmt.Println(v2.Update())25}
Update
Using AI Code Generation
1v1.Update("Hello World")2v2.Update("Hello World")3v3.Update("Hello World")4v4.Update("Hello World")5v5.Update("Hello World")6v6.Update("Hello World")7v7.Update("Hello World")8v8.Update("Hello World")9v9.Update("Hello World")10v10.Update("Hello World")11v11.Update("Hello World")12v12.Update("Hello World")13v13.Update("Hello World")14v14.Update("Hello World")15v15.Update("Hello World")16v16.Update("Hello World")17v17.Update("Hello World")18v18.Update("Hello World")19v19.Update("Hello World")20v20.Update("Hello World")
Update
Using AI Code Generation
1import (2func main() {3 fmt.Println("Hello World")4}5import (6type Student struct {7}8func (s Student) Update() {9 fmt.Println("Update method of v1")10}11import (12type Student struct {13}14func (s Student) Update() {15 fmt.Println("Update method of v2")16}17import (18type Student struct {19}20func (s Student) Update() {21 fmt.Println("Update method of v3")22}23import (24type Student struct {25}26func (s Student) Update() {27 fmt.Println("Update method of v4")28}29import (30type Student struct {31}32func (s Student) Update() {33 fmt.Println("Update method of v5")34}35import (36type Student struct {37}38func (s Student) Update() {39 fmt.Println("Update method of v6")40}41import (42type Student struct {43}44func (s Student) Update() {45 fmt.Println("Update method of v7")46}47import (48type Student struct {49}50func (s Student) Update() {51 fmt.Println("Update method of v8")52}53import (54type Student struct {55}56func (s Student) Update() {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!