// generateKubernetes generates the SLOs based on a Kuberentes spec format input and
// outs a Kubernetes prometheus operator CRD yaml.
generateKubernetes generates the SLOs based on a Kuberentes spec format input and
outs a Kubernetes prometheus operator CRD yaml.
// generateKubernetes generates the SLOs based on a Kuberentes spec format input and // outs a Kubernetes prometheus operator CRD yaml .
func generateKubernetes(ctx context.Context, logger log.Logger, disableRecs, disableAlerts bool, extraLabels map[string]string, sloGroup k8sprometheus.SLOGroup, out io.Writer) error {
	logger.Infof("Generating from Kubernetes Prometheus spec")
	info := info.Info{
		Version: info.Version,
		Mode:    info.ModeCLIGenKubernetes,
		Spec:    fmt.Sprintf("%s/%s", kubernetesv1.SchemeGroupVersion.Group, kubernetesv1.SchemeGroupVersion.Version),
	}
	result, err := generateRules(ctx, logger, info, disableRecs, disableAlerts, extraLabels, sloGroup.SLOGroup)
	if err != nil {
		return err
	}
	repo := k8sprometheus.NewIOWriterPrometheusOperatorYAMLRepo(out, logger)
	storageSLOs := make([]k8sprometheus.StorageSLO, 0, len(result.PrometheusSLOs))
	for _, s := range result.PrometheusSLOs {
		storageSLOs = append(storageSLOs, k8sprometheus.StorageSLO{
			SLO:   s.SLO,
			Rules: s.SLORules,
		})
	}
	err = repo.StoreSLOs(ctx, sloGroup.K8sMeta, storageSLOs)
	if err != nil {
		return fmt.Errorf("could not store SLOS: %w", err)
	}
	return nil
}
func generateKubernetes ( ctx context . Context , logger log . Logger , disableRecs , disableAlerts bool , extraLabels map [ string ] string , sloGroup k8sprometheus . SLOGroup , out io . Writer ) error { logger . Infof ( " " ) info := info . Info { Version : info . Version , Mode : info . ModeCLIGenKubernetes , Spec : fmt . Sprintf ( " " , kubernetesv1 . SchemeGroupVersion . Group , kubernetesv1 . SchemeGroupVersion . Version ) , } result , err := generateRules ( ctx , logger , info , disableRecs , disableAlerts , extraLabels , sloGroup . SLOGroup ) if err != nil { return err } repo := k8sprometheus . NewIOWriterPrometheusOperatorYAMLRepo ( out , logger ) storageSLOs := make ( [ ] k8sprometheus . StorageSLO , 0 , len ( result . PrometheusSLOs ) ) for _ , s := range result . PrometheusSLOs { storageSLOs = append ( storageSLOs , k8sprometheus . StorageSLO { SLO : s . SLO , Rules : s . SLORules , } ) } err = repo . StoreSLOs ( ctx , sloGroup . K8sMeta , storageSLOs ) if err != nil { return fmt . Errorf ( " " , err ) } return nil }
generateKubernetes generates the SLOs based on a Kuberentes spec format input and
outs a Kubernetes prometheus operator CRD yaml.
generateKubernetes generates the SLOs based on a Kuberentes spec format input and outs a Kubernetes prometheus operator CRD yaml .