stash
stash copied to clipboard
[0.5.0] Record backup event on kubernetes failure
After restic backed up an event should be recorded on kubernetes as you see below: https://github.com/appscode/stash/blob/d56e913c92b1b8601d41290c9a017aebcc032e0f/pkg/scheduler/scheduler.go#L273
But logs show event registration failed:
Could not construct reference to: '&v1alpha1.Restic{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"...", GenerateName:"", Namespace:"...", SelfLink:"/apis/stash.appscode.com/v1alpha1/namespaces/.../restics/...", UID:"...", ResourceVersion:"...", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{sec:63642636294, nsec:0, loc:(*time.Location)(0x1fa3560)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:v1alpha1.ResticSpec{Selector:v1.LabelSelector{MatchLabels:map[string]string{"heritage":"Tiller", "release":"...", "app":"..."}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}, FileGroups:[]v1alpha1.FileGroup{v1alpha1.FileGroup{Path:"/data", Tags:[]string(nil), RetentionPolicy:v1alpha1.RetentionPolicy{KeepLast:2, KeepHourly:0, KeepDaily:0, KeepWeekly:0, KeepMonthly:0, KeepYearly:0, KeepTags:[]string(nil), Prune:true, DryRun:false}}}, Backend:v1alpha1.Backend{StorageSecretName:"...", Local:(*v1alpha1.LocalSpec)(nil), S3:(*v1alpha1.S3Spec)(0xc4200df7a0), GCS:(*v1alpha1.GCSSpec)(nil), Azure:(*v1alpha1.AzureSpec)(nil), Swift:(*v1alpha1.SwiftSpec)(nil)}, Schedule:"0 7 * * 2,5", UseAutoPrefix:0, VolumeMounts:[]v1.VolumeMount{v1.VolumeMount{Name:"data", ReadOnly:false, MountPath:"/data", SubPath:""}}, Resources:v1.ResourceRequirements{Limits:v1.ResourceList(nil), Requests:v1.ResourceList(nil)}}, Status:v1alpha1.ResticStatus{FirstBackupTime:(*v1.Time)(...), LastBackupTime:(*v1.Time)(...), LastSuccessfulBackupTime:(*v1.Time)(nil), LastBackupDuration:"4m24.886083216s", BackupCount:28}}' due to: 'no kind is registered for the type v1alpha1.Restic'. Will not report event: 'Normal' 'SuccessfulBackup' 'Backed up pod:... path:/data'
Thanks for reporting the issue. What is your Kubernetes version?
1.7
kubectl version
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3+coreos.0", GitCommit:"42de91f04e456f7625941a6c4aaedaa69708be1b", GitTreeState:"clean", BuildDate:"2017-08-07T19:44:31Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Fixed in master