client

package
v0.33.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// TestRootDirEnvKey is the environment variable key used to set the file system root when testing.
	TestRootDirEnvKey = "PLANNER_TEST_ROOT_DIR"
)

Variables

This section is empty.

Functions

func DefaultPlannerClientConfigPath

func DefaultPlannerClientConfigPath() string

DefaultPlannerClientConfigPath returns the default path to the Planner client config file.

func NewFromConfig

func NewFromConfig(config *Config) (*client.ClientWithResponses, error)

NewFromConfig returns a new Planner API client from the given config.

func NewFromConfigFile

func NewFromConfigFile(filename string) (*client.ClientWithResponses, error)

NewFromConfigFile returns a new Planner API client using the config read from the given file.

func NewHTTPClientFromConfig

func NewHTTPClientFromConfig(config *Config) (*http.Client, error)

NewHTTPClientFromConfig returns a new HTTP Client from the given config.

func WriteConfig

func WriteConfig(filename string, server string) error

WriteConfig writes a client config file using the given parameters.

Types

type CPUResources added in v0.4.0

type CPUResources struct {
	Requested       float64 `json:"requested"`
	Total           int     `json:"total"`
	Limits          float64 `json:"limits,omitempty"`
	OverCommitRatio float64 `json:"overCommitRatio,omitempty"`
}

type Config

type Config struct {
	Service Service `json:"service"`
	// contains filtered or unexported fields
}

Config holds the information needed to connect to a Planner API server

func NewDefault

func NewDefault() *Config

func ParseConfigFile

func ParseConfigFile(filename string) (*Config, error)

func (*Config) DeepCopy

func (c *Config) DeepCopy() *Config

func (*Config) Equal

func (c *Config) Equal(c2 *Config) bool

func (*Config) Persist

func (c *Config) Persist(filename string) error

func (*Config) SetBaseDir

func (c *Config) SetBaseDir(baseDir string)

func (*Config) Validate

func (c *Config) Validate() error

type ControlPlaneReserved added in v0.4.0

type ControlPlaneReserved struct {
	CPU    float64 `json:"cpu"`
	Memory float64 `json:"memory"`
}

type DiskResources added in v0.4.0

type DiskResources struct {
	Used  int `json:"used"`
	Total int `json:"total"`
}

type MachineSet added in v0.4.0

type MachineSet struct {
	Name                    string                `json:"name"`
	CPU                     int                   `json:"cpu"`
	Memory                  int                   `json:"memory"`
	InstanceName            string                `json:"instanceName"`
	NumberOfDisks           int                   `json:"numberOfDisks"`
	OnlyFor                 []string              `json:"onlyFor,omitempty"`
	Label                   string                `json:"label,omitempty"`
	AllowWorkloadScheduling *bool                 `json:"allowWorkloadScheduling,omitempty"`
	ControlPlaneReserved    *ControlPlaneReserved `json:"controlPlaneReserved,omitempty"`
}

type MemoryResources added in v0.4.0

type MemoryResources struct {
	Requested       float64 `json:"requested"`
	Total           int     `json:"total"`
	Limits          float64 `json:"limits,omitempty"`
	OverCommitRatio float64 `json:"overCommitRatio,omitempty"`
}

type Node added in v0.4.0

type Node struct {
	Node           string        `json:"node"`
	MachineSet     string        `json:"machineSet"`
	IsControlPlane bool          `json:"isControlPlane"`
	Resources      NodeResources `json:"resources"`
	Services       []string      `json:"services"`
}

type NodeResources added in v0.4.0

type NodeResources struct {
	CPU    CPUResources    `json:"cpu"`
	Memory MemoryResources `json:"memory"`
	Disks  DiskResources   `json:"disks"`
}

type OverCommitRatio added in v0.4.0

type OverCommitRatio struct {
	CPU    float64 `json:"cpu"`
	Memory float64 `json:"memory"`
}

type ResourceConsumption added in v0.4.0

type ResourceConsumption struct {
	CPU             float64          `json:"cpu"`
	Memory          float64          `json:"memory"`
	Limits          *ResourceLimits  `json:"limits,omitempty"`
	OverCommitRatio *OverCommitRatio `json:"overCommitRatio,omitempty"`
}

type ResourceLimits added in v0.4.0

type ResourceLimits struct {
	CPU    float64 `json:"cpu"`
	Memory float64 `json:"memory"`
}

type Service

type Service struct {
	// Server is the URL of the Planner API server (the part before /api/v1/...).
	Server string `json:"server"`
	UI     string `json:"ui"`
}

Service contains information how to connect to and authenticate the Planner API server.

func (*Service) DeepCopy

func (s *Service) DeepCopy() *Service

func (*Service) Equal

func (s *Service) Equal(s2 *Service) bool

type ServiceDescriptor added in v0.4.0

type ServiceDescriptor struct {
	Name           string   `json:"name"`
	RequiredCPU    float64  `json:"requiredCPU"`
	RequiredMemory float64  `json:"requiredMemory"`
	LimitCPU       float64  `json:"limitCPU,omitempty"`
	LimitMemory    float64  `json:"limitMemory,omitempty"`
	Zones          int      `json:"zones"`
	RunsWith       []string `json:"runsWith,omitempty"`
	Avoid          []string `json:"avoid,omitempty"`
}

type SizerClient added in v0.4.0

type SizerClient struct {
	// contains filtered or unexported fields
}

SizerClient is an HTTP client for the sizer service

func NewSizerClient added in v0.4.0

func NewSizerClient(baseURL string, timeout time.Duration) *SizerClient

func (*SizerClient) CalculateSizing added in v0.4.0

func (c *SizerClient) CalculateSizing(ctx context.Context, req *SizerRequest) (*SizerResponse, error)

func (*SizerClient) HealthCheck added in v0.4.0

func (c *SizerClient) HealthCheck(ctx context.Context) error

type SizerData added in v0.4.0

type SizerData struct {
	NodeCount           int                 `json:"nodeCount"`
	Zones               int                 `json:"zones"`
	TotalCPU            int                 `json:"totalCPU"`
	TotalMemory         int                 `json:"totalMemory"`
	ResourceConsumption ResourceConsumption `json:"resourceConsumption"`
	Advanced            []Zone              `json:"advanced,omitempty"`
}

type SizerRequest added in v0.4.0

type SizerRequest struct {
	Platform    string       `json:"platform"`
	MachineSets []MachineSet `json:"machineSets"`
	Workloads   []Workload   `json:"workloads"`
	Detailed    bool         `json:"detailed,omitempty"`
}

type SizerResponse added in v0.4.0

type SizerResponse struct {
	Success bool      `json:"success"`
	Data    SizerData `json:"data"`
	Error   string    `json:"error,omitempty"`
}

type Workload added in v0.4.0

type Workload struct {
	Name         string              `json:"name"`
	Count        int                 `json:"count"`
	UsesMachines []string            `json:"usesMachines"`
	Services     []ServiceDescriptor `json:"services"`
}

type Zone added in v0.4.0

type Zone struct {
	Zone  string `json:"zone"`
	Nodes []Node `json:"nodes"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL