Closed msharbaji closed 5 years ago
I am trying to emit informative kubernetes event using api/v1beta, This event to give me information about creating/updating secret status. I didn't get any wrong and nothing happend.
here is an example:
func postEventAboutStatus(kubeClient *k8s.Client, secret *corev1.Secret, event *eventsv1beta1.Event, action string, reason string, note string )(err error){ now := time.Now() secs := int64(now.Unix()) event.Metadata = new(metav1.ObjectMeta) event.Metadata.Name = secret.Metadata.Name event.Metadata.Namespace = secret.Metadata.Namespace event.Metadata.CreationTimestamp = new(metav1.Time) event.Metadata.CreationTimestamp.Seconds = &secs event.Metadata.Labels = secret.Metadata.Labels event.EventTime = new(metav1.MicroTime) event.EventTime.Seconds = &secs event.Action = &action event.Note = ¬e err := kubeClient.Create(context.Background(), event) if err != nil { log.Error().Err(err) return err } if apiErr, ok := err.(*k8s.APIError); ok { log.Info().Msgf(" Api Server Code: %v ", apiErr.Code ) } return }
Without some API server logs or other information I can't tell. Sorry
My problem solved, but with api/core api version and it didn't work events/v1beta1.. I will close this issue.. Thanks!
I am trying to emit informative kubernetes event using api/v1beta, This event to give me information about creating/updating secret status. I didn't get any wrong and nothing happend.
here is an example: