server

package
v1.6.2-tectonic.1-rc.4 Latest Latest
Warning

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

Go to latest
Published: May 8, 2017 License: Apache-2.0 Imports: 60 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KnownPlatforms = []string{
	"aws-tf",
	"bare-metal-tf",
	"azure",
	"openstack",
}

KnownPlatforms is the list of supported platforms.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper that allocates a new bool, stores v, and returns the pointer.

func Int

func Int(v int) *int

Int is a helper that allocates a new int, stores v, and returns the pointer.

func NewBootkubeAssets

func NewBootkubeAssets(cfg BootkubeConfig) ([]asset.Asset, error)

NewBootkubeAssets wraps bootkube default asset generation and replace specific assets to fit our needs (e.g. OIDC).

func NewServer

func NewServer(config *Config) (http.Handler, error)

NewServer returns a new server handler.

func NewTectonicAssets

func NewTectonicAssets(assets []asset.Asset, config *TectonicConfig, m metrics) ([]asset.Asset, error)

NewTectonicAssets generates Kubernetes manifests for Tectonic clusters.

Types

type BootkubeConfig

type BootkubeConfig struct {
	bootkube.Config
	OIDCIssuer *OIDCIssuer
}

BootkubeConfig represents the configuration needed to generate Bootkube assets.

type Cluster

type Cluster interface {
	// Initialize validates cluster fields and sets any defaults.
	Initialize() error
	// GenerateAssets generates cluster provisioning assets.
	GenerateAssets() ([]asset.Asset, error)
	// StatusChecker returns a checker for the status of cluster components.
	StatusChecker() (StatusChecker, error)
	// Kind returns the kind name of a cluster.
	Kind() string
	// Publish writes configs to a provisioning service.
	Publish(context.Context) error
}

A Cluster defines cluster setup operations and steps.

type Config

type Config struct {
	// If not "", serve assets from this local directory rather than from binassets
	AssetDir string

	// List of platform names to support
	Platforms []string

	// Whether the server was started with --dev
	DevMode bool

	// Cookie Sessions
	CookieSigningSecret string
	// Allow cookies to be sent over HTTP
	DisableSecureCookie bool
}

Config configures a server.

type CreateOperation

type CreateOperation struct {
	// Kind of cluster which should be created
	ClusterKind string `json:"clusterKind"`
	// Cluster properties
	ClusterData json.RawMessage `json:"cluster"`
	// If true, don't actually create cluster. Just generate assets.
	DryRun bool `json:"dryRun"`
}

CreateOperation defines a cluster creation request.

func (*CreateOperation) Cluster

func (o *CreateOperation) Cluster() (Cluster, error)

Cluster parses cluster kind and data to return a Cluster.

type Image

type Image struct {
	Version string `json:"version"`
}

Image represents a versioned set of OS image assets.

type Images

type Images struct {
	CoreOS []Image `json:"coreos"`
}

Images represents the list images response format.

type ListItems

type ListItems []listItem

ListItems are a slice of listItems

func (ListItems) Len

func (slice ListItems) Len() int

func (ListItems) Less

func (slice ListItems) Less(i, j int) bool

func (ListItems) Swap

func (slice ListItems) Swap(i, j int)

type MatchboxClient

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

MatchboxClient allows Cluster manifests to be written to the matchbox service.

func NewMatchboxClient

func NewMatchboxClient(config *MatchboxConfig) (*MatchboxClient, error)

NewMatchboxClient returns a new MatchboxClient.

func (*MatchboxClient) Close

func (c *MatchboxClient) Close() error

Close closes the client's connections.

func (*MatchboxClient) Push

func (c *MatchboxClient) Push(ctx context.Context, groups []*storagepb.Group, profiles []*storagepb.Profile, ignitions []asset.Asset) error

Push writes machine profiles, groups, and Ignition templates to the matchbox service. Repeated writes are idempotent.

type MatchboxConfig

type MatchboxConfig struct {
	Endpoint   string
	CA         []byte
	ClientCert []byte
	ClientKey  []byte
}

MatchboxConfig configures a matchbox client with PEM encoded TLS credentials.

type Node

type Node struct {
	// FQDN
	Name string `json:"name"`
	// MAC Address
	MAC *macAddr `json:"mac"`
}

The Node type can simplify generation of cluster manifests.

type OIDCIssuer

type OIDCIssuer struct {
	IssuerURL     string
	ClientID      string
	UsernameClaim string
	CAPath        string
}

OIDCIssuer is the OIDC configuration for the Bootkube assets.

type PlatformsValue

type PlatformsValue struct {
	Names []string
}

PlatformsValue is a flag.Value/flag.Getter compatible type for reading platform arguments

func (*PlatformsValue) Set

func (p *PlatformsValue) Set(s string) error

Set parses a command line value into Names, or returns an error.

func (*PlatformsValue) String

func (p *PlatformsValue) String() string

String formats the platform list in a command-line-acceptable way

type ServiceStatus

type ServiceStatus struct {
	Instance   string   `json:"instance"`
	Message    string   `json:"message"`
	Ready      bool     `json:"ready"`
	RemoteAddr string   `json:"remoteAddr"`
	Addrs      []string `json:"addrs"`
}

ServiceStatus gives the status of an instance of a service.

func EtcdHealth

func EtcdHealth(client *http.Client, endpoint string) ServiceStatus

EtcdHealth returns the ServiceStatus of the given Node's etcd instance.

func KubeletHealth

func KubeletHealth(client *http.Client, endpoint string) ServiceStatus

KubeletHealth returns the ServiceStatus of the Kubelet via read-only port.

func TectonicConsoleHealth

func TectonicConsoleHealth(client *http.Client, endpoint string) ServiceStatus

TectonicConsoleHealth returns the ServiceStatus of the Tectonic Console.

type StatusChecker

type StatusChecker interface {
	// Status returns the status of cluster components and services.
	Status() ([]byte, error)
}

StatusChecker is a client for checking the status of cluster components.

type TectonicAWSChecker

type TectonicAWSChecker struct {
	AccessKeyID      string
	SecretAccessKey  string
	SessionToken     string
	Region           string
	ControllerDomain string
	TectonicDomain   string
	Cluster          *cloudforms.Cluster
}

TectonicAWSChecker is a serializable StatusChecker for Tectonic AWS clusters.

func (TectonicAWSChecker) Status

func (c TectonicAWSChecker) Status() ([]byte, error)

Status checks the state of AWS infrastructure, on-host kubelets, and Tectonic components in the cluster.

type TectonicAWSCluster

type TectonicAWSCluster struct {
	CloudForm *cloudforms.Config `json:"cloudForm"`

	// AWS api credential
	AccessKeyID     string `json:"accessKeyID"`
	SecretAccessKey string `json:"secretAccessKey"`
	SessionToken    string `json:"sessionToken"`

	// Custom Certificate Authority (optional)
	CACertificate string `json:"caCertificate"`
	CAPrivateKey  string `json:"caPrivateKey"`

	// Tectonic
	Tectonic *TectonicConfig `json:"tectonic"`
	// contains filtered or unexported fields
}

TectonicAWSCluster provisions a Tectonic self-hosted Kubernetes cluster on AWS EC2.

func (*TectonicAWSCluster) GenerateAssets

func (c *TectonicAWSCluster) GenerateAssets() ([]asset.Asset, error)

GenerateAssets generates cluster provisioning assets.

func (*TectonicAWSCluster) Initialize

func (c *TectonicAWSCluster) Initialize() error

Initialize validates cluster data and sets defaults.

func (*TectonicAWSCluster) Kind

func (c *TectonicAWSCluster) Kind() string

Kind returns the kind name of a cluster.

func (*TectonicAWSCluster) Publish

func (c *TectonicAWSCluster) Publish(ctx context.Context) error

Publish pushes the Cloud Formation template to AWS.

func (*TectonicAWSCluster) StatusChecker

func (c *TectonicAWSCluster) StatusChecker() (StatusChecker, error)

StatusChecker returns a StatusChecker for Tectonic AWS clusters.

type TectonicConfig

type TectonicConfig struct {
	ControllerDomain string `json:"-"`
	TectonicDomain   string `json:"-"`
	License          string `json:"license"`
	Dockercfg        string `json:"dockercfg"`

	// Identity
	IdentityAdminUser     string `json:"identityAdminUser"`
	IdentityAdminPassword []byte `json:"identityAdminPassword"`

	// Ingress
	IngressKind string `json:"ingressKind"`

	// Updater
	Updater TectonicUpdaterConfig `json:"updater"`
}

TectonicConfig holds variables needed when generating Tectonic templates or assets.

func (*TectonicConfig) AssertValid

func (t *TectonicConfig) AssertValid() error

AssertValid validates the Tectonic data for common errors.

type TectonicMetalChecker

type TectonicMetalChecker struct {
	Controllers    []Node
	Workers        []Node
	TectonicDomain string
}

TectonicMetalChecker is a serializable StatusChecker for Tectonic bare-metal clusters.

func (TectonicMetalChecker) Status

func (c TectonicMetalChecker) Status() ([]byte, error)

Status checks the state of etcd, on-host kublets, and Tectonic components in the cluster.

type TectonicMetalCluster

type TectonicMetalCluster struct {
	// Matchbox HTTP name/IP and port
	MatchboxHTTP string `json:"matchboxHTTP"`
	// Matchbox gRPC API name/IP and port
	MatchboxRPC string `json:"matchboxRPC"`
	// Matchbox certificate authority for verifying the server's identity
	MatchboxCA string `json:"matchboxCA"`
	// Matchbox client certificate and key for authentication
	MatchboxClientCert string `json:"matchboxClientCert"`
	MatchboxClientKey  string `json:"matchboxClientKey"`

	// CoreOS PXE and install channel/version
	Channel string `json:"channel"`
	Version string `json:"version"`

	// External etcd client endpoint, e.g. etcd.example.com:2379
	ExternalETCDClient string `json:"externalETCDClient"`

	// Kubernetes Control Plane nodes
	ControllerDomain string `json:"controllerDomain"`
	Controllers      []Node `json:"controllers"`
	// Kuberntes Worker nodes
	Workers []Node `json:"workers"`
	// Admin SSH Public Keys
	SSHAuthorizedKeys []string `json:"sshAuthorizedKeys"`

	// Custom Certificate Authority (optional)
	CACertificate string `json:"caCertificate"`
	CAPrivateKey  string `json:"caPrivateKey"`

	PodCIDR     string `json:"podCIDR"`
	ServiceCIDR string `json:"serviceCIDR"`

	// Computed IPs for self-hosted Kubernetes
	APIServiceIP net.IP
	DNSServiceIP net.IP

	// Tectonic
	TectonicDomain string          `json:"tectonicDomain"`
	Tectonic       *TectonicConfig `json:"tectonic"`
	// contains filtered or unexported fields
}

TectonicMetalCluster provisions a Tectonic self-hosted Kuberntes cluster on physical machines (bare metal).

func (*TectonicMetalCluster) GenerateAssets

func (c *TectonicMetalCluster) GenerateAssets() ([]asset.Asset, error)

GenerateAssets generates cluster assets.

func (*TectonicMetalCluster) Initialize

func (c *TectonicMetalCluster) Initialize() error

Initialize validates cluster data and sets defaults.

func (*TectonicMetalCluster) Kind

func (c *TectonicMetalCluster) Kind() string

Kind returns the kind name.

func (*TectonicMetalCluster) Publish

func (c *TectonicMetalCluster) Publish(ctx context.Context) error

Publish writes profiles, groups, and Ignition to a matchbox service.

func (*TectonicMetalCluster) StatusChecker

func (c *TectonicMetalCluster) StatusChecker() (StatusChecker, error)

StatusChecker returns a StatusChecker for Tectonic metal clusters.

type TectonicUpdaterConfig

type TectonicUpdaterConfig struct {
	Enabled bool `json:"enabled"`

	// Omaha configuration
	Server  string `json:"server"`
	Channel string `json:"channel"`
	AppID   string `json:"appID"`
}

TectonicUpdaterConfig represents the configuration for the Tectonic Channel Operator.

type TerraformApplyHandlerInput

type TerraformApplyHandlerInput struct {
	Platform      string                 `json:"platform"`
	Credentials   terraform.Credentials  `json:"credentials"`
	AdminPassword []byte                 `json:"adminPassword"`
	Variables     map[string]interface{} `json:"variables"`
	License       string                 `json:"license"`
	PullSecret    string                 `json:"pullSecret"`
	DryRun        bool                   `json:"dryRun"`
	Retry         bool                   `json:"retry"`
}

TerraformApplyHandlerInput describes the input expected by the terraformApplyHandler HTTP Handler.

type TerraformDestroyHandlerInput

type TerraformDestroyHandlerInput struct {
	Platform    string                `json:"platform"`
	Credentials terraform.Credentials `json:"credentials"`
}

TerraformDestroyHandlerInput describes the input expected by the terraformDestroyHandler HTTP Handler.

Directories

Path Synopsis
Package asset abstracts generated asset representations.
Package asset abstracts generated asset representations.
aws
Package version provides the build version.
Package version provides the build version.

Jump to

Keyboard shortcuts

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