cluster

package
v0.0.0-...-a2c64ce Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 6 Imported by: 137

Documentation

Index

Constants

View Source
const (
	CloudAmazon       = "amazon"
	CloudAzure        = "azure"
	CloudGoogle       = "google"
	CloudBaremetal    = "baremetal"
	CloudDigitalOcean = "digitalocean"
	CloudOVH          = "ovh"
	CloudPacket       = "packet"
	CloudECS          = "ecs"
)
View Source
const (
	NetworkTypeLocal   = "local"
	NetworkTypePublic  = "public"
	NetworkTypePrivate = "private"
)
View Source
const (
	ServerPoolTypeMaster = "master"
	ServerPoolTypeNode   = "node"
	ServerPoolTypeHybrid = "hybrid"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AwsConfiguration

type AwsConfiguration struct {
	SpotPrice string `json:"spotPrice,omitempty"`
}

type Cluster

type Cluster struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Name is the publically available name of the Cluster
	Name string `json:"name,omitempty"`

	// ClusterAPI is the official Kubernetes cluster API
	// We have this wrapped in a larger struct to support the transition
	// and possibly allow for more values downstream
	ClusterAPI *clusterv1.Cluster `json:"clusterAPI,omitempty"`

	// ControlPlane is the control plane MachineSet
	ControlPlane *clusterv1.MachineSet `json:"controlPlane,omitempty"`

	// MachineSets are a subset of worker machines
	MachineSets []*clusterv1.MachineSet `json:"machineSets,omitempty"`

	// ControllerDeployment is the controller to use with controller profiles.
	// Kubicorn will deploy this resource to the Kubernetes cluster after it is online.
	//
	// Here we only allow this single Deployment to be added to bootstrapping logic.
	// The pattern here says that from an arbitrary deployment, you should be able
	// to bootstrap anything else you could need. We default to the kubicorn controller.
	ControllerDeployment *appsv1beta2.Deployment `json:"controllerDeployment,omitempty"`
	APITokenSecret       *v1.Secret              `json:"cloudManagerSecret,omitempty"`
}

Cluster is what we use internally in Kubicorn. This used to be the internal Kubicorn API but we are now migrating to the official cluster API (below) This represents a Kubernetes Cluster

func NewCluster

func NewCluster(name string) *Cluster

NewCluster will initialize a new Cluster

func (*Cluster) ControlPlaneMachineSet

func (c *Cluster) ControlPlaneMachineSet() *clusterv1.MachineSet

func (*Cluster) MachineProviderConfigs

func (c *Cluster) MachineProviderConfigs() []*MachineProviderConfig

MachineProviderConfigs will return all MachineProviderConfigs for a cluster

func (*Cluster) NewMachineSetsFromProviderConfigs

func (c *Cluster) NewMachineSetsFromProviderConfigs(providerConfigs []*MachineProviderConfig)

func (*Cluster) ProviderConfig

func (c *Cluster) ProviderConfig() *ControlPlaneProviderConfig

ProviderConfig is a convenience method that will attempt to return a ControlPlaneProviderConfig for a cluster. This is useful for managing the legacy API in a clean way. This will ignore errors from json.Unmarshal and will simply return an empty config.

func (*Cluster) ServerPools

func (c *Cluster) ServerPools() []*ServerPool

func (*Cluster) SetMachineProviderConfigs

func (c *Cluster) SetMachineProviderConfigs(providerConfigs []*MachineProviderConfig)

SetMachineProviderConfig will attempt to match a provider config to a machine set on the "Name" field. If a match cannot be made we warn and move on.

func (*Cluster) SetProviderConfig

func (c *Cluster) SetProviderConfig(config *ControlPlaneProviderConfig) error

SetProviderConfig is a convenience method that will attempt to set a provider config on a particular cluster. Just like it's counterpart ProviderConfig this makes working with the legacy API much easier.

type ControlPlaneProviderConfig

type ControlPlaneProviderConfig struct {
	//Name              string         `json:"name,omitempty"`
	Project *Project `json:"project,omitempty"`
	CloudId string   `json:"cloudId,omitempty"`
	//ServerPools       []*ServerPool  `json:"serverPools,omitempty"`
	Cloud           string         `json:"cloud,omitempty"`
	Location        string         `json:"location,omitempty"`
	SSH             *SSH           `json:"SSH,omitempty"`
	Network         *Network       `json:"network,omitempty"`
	Values          *Values        `json:"values,omitempty"`
	KubernetesAPI   *KubernetesAPI `json:"kubernetesAPI,omitempty"`
	GroupIdentifier string         `json:"groupIdentifier,omitempty"`
}

ControlPlaneProviderConfig is the legacy Kubicorn API. We are temporarily storing this as a ProviderConfig and these fields will slowly transition into fields in the official cluster API

type EgressRule

type EgressRule struct {
	Shared
	EgressToPort      string `json:"engressToPort,omitempty"` //this thing should be a string.
	EgressDestination string `json:"engressDestination,omitempty"`
	EgressProtocol    string `json:"engressProtocol,omitempty"`
}

EgressRule parameters for the firewall

type Firewall

type Firewall struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Identifier        string         `json:"identifier,omitempty"`
	IngressRules      []*IngressRule `json:"ingressRules,omitempty"`
	EgressRules       []*EgressRule  `json:"egressRules,omitempty"`
	Name              string         `json:"name,omitempty"`
}

Firewall contains the configuration a user expects to be applied.

type IAMInstanceProfile

type IAMInstanceProfile struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Name              string   `json:"name,omitempty"`
	Identifier        string   `json:"identifier,omitempty"`
	Role              *IAMRole `json:"role,omitempty"`
}

type IAMPolicy

type IAMPolicy struct {
	Name       string `json:"name,omitempty"`
	Document   string `json:"document,omitempty"`
	Identifier string `json:"identifier,omitempty"`
}

type IAMRole

type IAMRole struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Name              string       `json:"name,omitempty"`
	Identifier        string       `json:"identifier,omitempty"`
	Policies          []*IAMPolicy `json:"policies,omitempty"`
	PolicyAttachments []string     `json:"policyAttachments,omitempty"`
}

type IngressRule

type IngressRule struct {
	Shared
	IngressFromPort string `json:"ingressFromPort,omitempty"`
	IngressToPort   string `json:"ingressToPort,omitempty"` //this thing should be a string.
	IngressSource   string `json:"ingressSource,omitempty"`
	IngressProtocol string `json:"ingressProtocol,omitempty"`
}

IngressRule parameters for the firewall

type InternetGW

type InternetGW struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Name              string `json:"name,omitempty"`
	Identifier        string `json:"identifier,omitempty"`
}

type KubernetesAPI

type KubernetesAPI struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Endpoint          string `json:"endpoint,omitempty"`
	Port              string `json:"port,omitempty"`
}

type MachineProviderConfig

type MachineProviderConfig struct {

	// Name is required as it is how we will match our configs
	// to machineSets later
	Name string `json:"name,omitempty"`

	// The legacy configuration for a MachineSet
	ServerPool *ServerPool `json:"serverPool,omitempty"`
}

ControlPlaneProviderConfig is less exciting ProviderConfig, but contains everything defined in a ServerPool

type Network

type Network struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	CIDR              string      `json:"cidr,omitempty"`
	Identifier        string      `json:"identifier,omitempty"`
	Type              string      `json:"type,omitempty"`
	InternetGW        *InternetGW `json:"internetgw,omitempty"`
}

type Project

type Project struct {
	Name       string `json:"name,omitempty"`
	Identifier string `json:"identifier,omitempty"`
}

type SSH

type SSH struct {
	metav1.TypeMeta      `json:",inline"`
	metav1.ObjectMeta    `json:"metadata,omitempty"`
	Name                 string `json:"name,omitempty"`
	User                 string `json:"user,omitempty"`
	Identifier           string `json:"identifier,omitempty"`
	PublicKeyPath        string `json:"publicKeyPath,omitempty"`
	PublicKeyData        []byte `json:"publicKeyData,omitempty"`
	PublicKeyFingerprint string `json:"publicKeyFingerprint,omitempty"`
	Port                 string `json:"port,omitempty"`
}

type ServerPool

type ServerPool struct {
	metav1.TypeMeta       `json:",inline"`
	metav1.ObjectMeta     `json:"metadata,omitempty"`
	Identifier            string              `json:"identifier,omitempty"`
	MinCount              int                 `json:"minCount,omitempty"`
	MaxCount              int                 `json:"maxCount,omitempty"`
	Type                  string              `json:"type,omitempty"`
	Name                  string              `json:"name,omitempty"`
	Image                 string              `json:"image,omitempty"`
	Size                  string              `json:"size,omitempty"`
	InstanceProfile       *IAMInstanceProfile `json:"instanceProfile,omitempty"`
	BootstrapScripts      []string            `json:"bootstrapScripts,omitempty"`
	Subnets               []*Subnet           `json:"subnets,omitempty"`
	Firewalls             []*Firewall         `json:"firewalls,omitempty"`
	AwsConfiguration      *AwsConfiguration   `json:"awsconfiguration,omitempty"`
	GeneratedNodeUserData []byte              `json:"generatedNodeUserData,omitempty"`
}

type Shared

type Shared struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Identifier        string `json:"identifier,omitempty"`
}

Shared object infor among rules.

type Subnet

type Subnet struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Identifier        string `json:"identifier,omitempty"`
	CIDR              string `json:"cidr,omitempty"`
	Location          string `json:"location,omitempty"`
	Zone              string `json:"zone,omitempty"`
	Name              string `json:"name,omitempty"`
}

type Values

type Values struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	ItemMap           map[string]string `json:"itemMap,omitempty"`
}

Jump to

Keyboard shortcuts

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