reconciler

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReconcilerClient

func NewReconcilerClient(httpClient *http.Client, log logrus.FieldLogger, cfg *Config) *client

func NewReconcilerError

func NewReconcilerError(failures *[]reconcilerApi.Failure, format string, args ...interface{}) kebError.ErrorReporter

func PrettyFailures

func PrettyFailures(response *reconcilerApi.HTTPClusterResponse) string

Types

type Client

type Client interface {
	ApplyClusterConfig(cluster reconcilerApi.Cluster) (*reconcilerApi.HTTPClusterResponse, error)
	DeleteCluster(clusterName string) error
	GetCluster(clusterName string, configVersion int64) (*reconcilerApi.HTTPClusterResponse, error)
	GetLatestCluster(clusterName string) (*reconcilerApi.HTTPClusterResponse, error)
	GetStatusChange(clusterName, offset string) ([]*reconcilerApi.StatusChange, error)
}

type Config

type Config struct {
	URL                 string
	ProvisioningTimeout time.Duration `json:"default=2h"`
}

type FakeClient

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

FakeClient is simulating API and db transactions in Reconciler Inventory

  • registeredCluster is representation of 'inventory_clusters' table each unique clusterVersion should be a separate record
  • registeredCluster.clusterConfigs is representation of `inventory_cluster_configs` table and it is a map[configVersion]Cluster; it stores different clusterConfigs for the same cluster
  • registeredCluster.clusterStates is a map[configVersion]State; it simulates returning the status of given cluster in given configVersion
  • registeredCluster.statusChanges is representation of 'inventory_cluster_config_statuses' table and it is a slice of *StatusChange; it contains all status changes for the cluster

calling ApplyClusterConfig method on already existing cluster results in adding a new ClusterConfig

func NewFakeClient

func NewFakeClient() *FakeClient

func (*FakeClient) ApplyClusterConfig

func (c *FakeClient) ApplyClusterConfig(cluster reconcilerApi.Cluster) (*reconcilerApi.HTTPClusterResponse, error)

POST /v1/clusters

func (*FakeClient) ChangeClusterState

func (c *FakeClient) ChangeClusterState(clusterName string, clusterVersion int64, desiredState reconcilerApi.Status)

func (*FakeClient) ClusterExists

func (c *FakeClient) ClusterExists(id string) bool

func (*FakeClient) DeleteCluster

func (c *FakeClient) DeleteCluster(clusterName string) error

DELETE /v1/clusters/{clusterName}

func (*FakeClient) GetCluster

func (c *FakeClient) GetCluster(clusterName string, configVersion int64) (*reconcilerApi.HTTPClusterResponse, error)

GET /v1/clusters/{clusterName}/configs/{configVersion}/status

func (*FakeClient) GetLatestCluster

func (c *FakeClient) GetLatestCluster(clusterName string) (*reconcilerApi.HTTPClusterResponse, error)

GET v1/clusters/{clusterName}/status

func (*FakeClient) GetStatusChange

func (c *FakeClient) GetStatusChange(clusterName, offset string) ([]*reconcilerApi.StatusChange, error)

GET v1/clusters/{clusterName}/statusChanges/{offset} offset is parsed to time.Duration

func (*FakeClient) IsBeingDeleted

func (c *FakeClient) IsBeingDeleted(id string) bool

func (*FakeClient) LastClusterConfig

func (c *FakeClient) LastClusterConfig(runtimeID string) (*reconcilerApi.Cluster, error)

Jump to

Keyboard shortcuts

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