Skip to content

Operator CR and Design Spec

Parul Singh edited this page Nov 7, 2022 · 10 revisions

CR for Kepler

collector:
    source-metrics:
      cgroup: (enable|disable)
      bpf: 
      counters: 
      kubelet: 
    ratio-metrics:
      core: (cpu_cycles)
      uncore: 
      dram:
      others:
estimator:
    initial-model: (true|false)
    enable: (true|false)
    strategy:
    - node-selector:
        [label]: [value]
      type: numerical
      eval-key: (mse)
      max-value:
      min-value:
    - node-selector:
        [label]: [value]
      type: list
      key: (features)
      values:
      exclude: (true|false)
    - node-selector:
        [label]: [value]
      type: string
      key: (model_name)
      value:
model-server:
    install: (true|false)
    data-source: # use grafana data source for reference
      type: (prometheus)
      endpoint: 
    image: 
    query-step:
    sampling-interval:
    enable-pipelines:
    - * (all available pipelines)
    - [pipeline name]
    models-storage:
      type: local
      hostPath: 
      ...
add-ons:
  prometheus:
    enable: (true|false)
    service-monitor: # value to patch to default service monitor template
  openshift-machine-config:
    cgroupv2-config: (true|false)
    ...

Design Spec for Kepler

// +kubebuilder:validation:Enum=FooOne;FooTwo
type ModelPipeline string

// +kubebuilder:validation:Enum=enable;disable
type Cgroupv2 string

const (
	// random list of pipelines
	FooOnePipeline ModelPipeline = "FooOne"
	FooTwoPipeline ModelPipeline = "FooTwo"
	// enum for cgroup options
	EnableCgroupv2  Cgroupv2 = "enable"
	DisableCgroupv2 Cgroupv2 = "disable"
)

// Collector CRD Requirements

type RatioMetrics struct {
	Global string `json:"global,omitempty"`
	Core   string `json:"core,omitempty"`
	Uncore string `json:"uncore,omitempty"`
	Dram   string `json:"dram,omitempty"`
}

type Sources struct {
	Cgroupv2 Cgroupv2 `json:"cgroupv2,omitempty"`
	Bpf      string   `json:"bpf,omitempty"`
	Counters string   `json:"counters,omitempty"`
	Kubelet  string   `json:"kubelet,omitempty"`
}

type CollectorSpec struct {
	Image        string       `json:"image,omitempty"`
	Sources      Sources      `json:"sources,omitempty"`
	RatioMetrics RatioMetrics `json:"ratioMetrics,omitempty"`
}

// Estimater CRD Requirements

type EstimatorSpec struct {
	// +kubebuilder:default=true
	Enable   bool                  `json:"enable,omitempty"`
	Image    string                `json:"image,omitempty"`
	Strategy []v1.NodeSelectorTerm `json:"strategy,omitempty"`
}

// Model Server CRD Requirements
type ModelStorage struct {
	// +kubebuilder:default="local"
	Type     string `json:"type,omitempty"`
	HostPath string `json:"hostPath,omitempty"`
}

type ModelServerSpec struct {
	// +kubebuilder:default=false
	Install          bool            `json:"install,omitempty"`
	Image            string          `json:"image,omitempty"`
	QueryStep        int64           `json:"queryStep,omitempty"`
	SamplingInterval int64           `json:"samplingInterval,omitempty"`
	EnablePipelines  []ModelPipeline `json:"enablePipelines"`
	ModelStorage     ModelStorage    `json:"modelStorage,omitempty"`
}

// KeplerDependencySpec defines the desired state of KeplerDependency
type KeplerDependencySpec struct {
	ModelServer ModelServerSpec `json:"modelServer,omitempty"`
	Estimator   EstimatorSpec   `json:"estimatorSpec,omitempty"`
	Collector   CollectorSpec   `json:"collectorSpec,omitempty"`
}

Design Spec for Prometheus Operator use

import (
	"github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1"
)
type ServiceMonitorSpec struct {
	ServiceMonitor v1.ServiceMonitorSpec `json:"serviceMonitor,omitempty"`
}

Design Spec for Grafana Operator use import ( "github.com/grafana-operator/grafana-operator/pkg/apis/integreatly/v1alpha1" ) type ServiceMonitorSpec struct { ServiceMonitor v1.ServiceMonitorSpec json:"serviceMonitor,omitempty" }

Clone this wiki locally