model

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewID

func NewID() string

NewID is a globally unique identifier. It is a [A-Z0-9] string 26 characters long. It is a UUID version 4 Guid that is zbased32 encoded with the padding stripped off.

func StringWithCharset

func StringWithCharset(length int, charset string) string

StringWithCharset is returning a random string based on a given string.

Types

type Client

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

Client is the programmatic interface to the provisioning server API.

func NewClient

func NewClient(address string) *Client

NewClient creates a client to the provisioning server at the given address.

func (*Client) RotateCluster

func (c *Client) RotateCluster(request *RotateClusterRequest) (*Cluster, error)

RotateCluster requests the rotation of a K8s cluster from the rotator server.

type Cluster

type Cluster struct {
	ClusterID               string
	MaxScaling              int
	RotateMasters           bool
	RotateWorkers           bool
	MaxDrainRetries         int
	EvictGracePeriod        int
	WaitBetweenRotations    int
	WaitBetweenDrains       int
	WaitBetweenPodEvictions int
	ClientSet               *kubernetes.Clientset
}

Cluster represents a K8s cluster.

func ClusterFromReader

func ClusterFromReader(reader io.Reader) (*Cluster, error)

ClusterFromReader decodes a json-encoded cluster from the given io.Reader.

type Node

type Node struct {
	NodeName string
}

Node represents a K8s node.

func NodeFromReader

func NodeFromReader(reader io.Reader) (*Node, error)

NodeFromReader decodes a json-encoded node from the given io.Reader.

type RotateClusterRequest

type RotateClusterRequest struct {
	ClusterID               string `json:"clusterID,omitempty"`
	MaxScaling              int    `json:"maxScaling,omitempty"`
	RotateMasters           bool   `json:"rotateMasters,omitempty"`
	RotateWorkers           bool   `json:"rotateWorkers,omitempty"`
	MaxDrainRetries         int    `json:"maxDrainRetries,omitempty"`
	EvictGracePeriod        int    `json:"evictGracePeriod,omitempty"`
	WaitBetweenRotations    int    `json:"waitBetweenRotations,omitempty"`
	WaitBetweenDrains       int    `json:"waitBetweenDrains,omitempty"`
	WaitBetweenPodEvictions int    `json:"waitBetweenPodEvictions,omitempty"`
}

RotateClusterRequest specifies the parameters for a new cluster rotation.

func NewRotateClusterRequestFromReader

func NewRotateClusterRequestFromReader(reader io.Reader) (*RotateClusterRequest, error)

NewRotateClusterRequestFromReader decodes the request and returns after validation and setting the defaults.

func (*RotateClusterRequest) SetDefaults

func (request *RotateClusterRequest) SetDefaults()

SetDefaults sets the default values for a cluster provision request.

func (*RotateClusterRequest) Validate

func (request *RotateClusterRequest) Validate() error

Validate validates the values of a cluster rotate request.

Jump to

Keyboard shortcuts

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