//CreateOrUpdateCuration reconciles curation for an instance of ClusterLogging
CreateOrUpdateCuration reconciles curation for an instance of ClusterLogging
// CreateOrUpdateCuration reconciles curation for an instance of ClusterLogging
func (cluster *ClusterLogging) CreateOrUpdateCuration() (err error) {
	if cluster.Spec.Curation.Type == logging.CurationTypeCurator {
		if err = cluster.createOrUpdateCuratorServiceAccount(); err != nil {
			return
		}
		if err = cluster.createOrUpdateCuratorConfigMap(); err != nil {
			return
		}
		if err = cluster.createOrUpdateCuratorCronJob(); err != nil {
			return
		}
		if err = cluster.createOrUpdateCuratorSecret(); err != nil {
			return
		}
		curatorStatus, err := cluster.getCuratorStatus()
		if err != nil {
			return fmt.Errorf("Failed to get status for Curator: %v", err)
		}
		printUpdateMessage := true
		retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error {
			if exists := cluster.Exists(); exists {
				if !reflect.DeepEqual(curatorStatus, cluster.Status.Curation.CuratorStatus) {
					if printUpdateMessage {
						logrus.Info("Updating status of Curator")
						printUpdateMessage = false
					}
					cluster.Status.Curation.CuratorStatus = curatorStatus
					return sdk.Update(cluster.ClusterLogging)
				}
			}
			return nil
		})
		if retryErr != nil {
			return fmt.Errorf("Failed to update Cluster Logging Curator status: %v", retryErr)
		}
	} else {
		cluster.removeCurator()
	}
	return nil
}
func ( cluster * ClusterLogging ) CreateOrUpdateCuration ( ) ( err error ) { if cluster . Spec . Curation . Type == logging . CurationTypeCurator { if err = cluster . createOrUpdateCuratorServiceAccount ( ) ; err != nil { return } if err = cluster . createOrUpdateCuratorConfigMap ( ) ; err != nil { return } if err = cluster . createOrUpdateCuratorCronJob ( ) ; err != nil { return } if err = cluster . createOrUpdateCuratorSecret ( ) ; err != nil { return } curatorStatus , err := cluster . getCuratorStatus ( ) if err != nil { return fmt . Errorf ( " " , err ) } printUpdateMessage := true retryErr := retry . RetryOnConflict ( retry . DefaultRetry , func ( ) error { if exists := cluster . Exists ( ) ; exists { if ! reflect . DeepEqual ( curatorStatus , cluster . Status . Curation . CuratorStatus ) { if printUpdateMessage { logrus . Info ( " " ) printUpdateMessage = false } cluster . Status . Curation . CuratorStatus = curatorStatus return sdk . Update ( cluster . ClusterLogging ) } } return nil } ) if retryErr != nil { return fmt . Errorf ( " " , retryErr ) } } else { cluster . removeCurator ( ) } return nil }
CreateOrUpdateCuration reconciles curation for an instance of ClusterLogging
CreateOrUpdateCuration reconciles curation for an instance of ClusterLogging