Skip to content

Operator CR and Design Spec

Kaiyi edited this page Sep 26, 2022 · 10 revisions

CR for Kepler

collector:
    image:
    sources:
      cgroupv2: (enable|disable)
      bpf: 
      counters: 
      kubelet:
    ratio-metrics:
      global:
      core: (cpu_cycles)
      uncore: 
      dram:
estimator:
    enable: (true|false)
    image:
    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)
    image: 
    query-step:
    sampling-interval:
    enable-pipelines:
    - * (all available pipelines)
    - [pipeline name]
    models-storage:
      type: local
      hostPath: 
      ...

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