cloudup

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2018 License: Apache-2.0 Imports: 75 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// This IP is from TEST-NET-3
	// https://en.wikipedia.org/wiki/Reserved_IP_addresses
	PlaceholderIP  = "203.0.113.123"
	PlaceholderTTL = 10
)
View Source
const (
	KEY_NAME = "name"
	KEY_TYPE = "_type"
)
View Source
const (

	// Environment variable for overriding CNI url
	ENV_VAR_CNI_VERSION_URL       = "CNI_VERSION_URL"
	ENV_VAR_CNI_ASSET_HASH_STRING = "CNI_ASSET_HASH_STRING"
)
View Source
const TargetCloudformation = "cloudformation"
View Source
const TargetDirect = "direct"
View Source
const TargetDryRun = "dryrun"
View Source
const TargetTerraform = "terraform"

Variables

View Source
var (
	// AlphaAllowBareMetal is a feature flag that gates BareMetal support while it is alpha
	AlphaAllowBareMetal = featureflag.New("AlphaAllowBareMetal", featureflag.Bool(false))
	// AlphaAllowDO is a feature flag that gates DigitalOcean support while it is alpha
	AlphaAllowDO = featureflag.New("AlphaAllowDO", featureflag.Bool(false))
	// AlphaAllowGCE is a feature flag that gates GCE support while it is alpha
	AlphaAllowGCE = featureflag.New("AlphaAllowGCE", featureflag.Bool(false))
	// AlphaAllowVsphere is a feature flag that gates vsphere support while it is alpha
	AlphaAllowVsphere = featureflag.New("AlphaAllowVsphere", featureflag.Bool(false))
	// AlphaAllowALI is a feature flag that gates aliyun support while it is alpha
	AlphaAllowALI = featureflag.New("AlphaAllowALI", featureflag.Bool(false))
	// CloudupModels a list of supported models
	CloudupModels = []string{"proto", "cloudup"}
)
View Source
var EtcdClusters = []string{"main", "events"}

EtcdClusters is a list of the etcd clusters kops creates

Phases are used for validation and cli help.

Functions

func BaseUrl added in v1.10.0

func BaseUrl() (*url.URL, error)

BaseUrl returns the base url for the distribution of kops - in particular for nodeup & docker images

func BuildCloud

func BuildCloud(cluster *kops.Cluster) (fi.Cloud, error)

func ChannelForCluster

func ChannelForCluster(c *kops.Cluster) (*kops.Channel, error)

func FindDNSHostedZone added in v1.10.0

func FindDNSHostedZone(dns dnsprovider.Interface, clusterDNSName string, dnsType kops.DNSType) (string, error)

func FindLatestKubernetesVersion added in v1.10.0

func FindLatestKubernetesVersion() (string, error)

FindLatestKubernetesVersion returns the latest kubernetes version, as stored at https://storage.googleapis.com/kubernetes-release/release/stable.txt This shouldn't be used any more; we prefer reading the stable channel

func KopsFileUrl added in v1.10.0

func KopsFileUrl(file string, assetBuilder *assets.AssetBuilder) (*url.URL, *hashing.Hash, error)

KopsFileUrl returns the base url for the distribution of kops - in particular for nodeup & docker images

func NodeUpLocation added in v1.10.0

func NodeUpLocation(assetsBuilder *assets.AssetBuilder) (*url.URL, *hashing.Hash, error)

NodeUpLocation returns the URL where nodeup should be downloaded

func PerformAssignments added in v1.10.0

func PerformAssignments(c *kops.Cluster) error

PerformAssignments populates values that are required and immutable For example, it assigns stable Keys to InstanceGroups & Masters, and it assigns CIDRs to subnets We also assign KubernetesVersion, because we want it to be explicit

PerformAssignments is called on create, as well as an update. In fact any time Run() is called in apply_cluster.go we will reach this function. Please do all after-market logic here.

func PopulateClusterSpec

func PopulateClusterSpec(clientset simple.Clientset, cluster *api.Cluster, assetBuilder *assets.AssetBuilder) (*api.Cluster, error)

PopulateClusterSpec takes a user-specified cluster spec, and computes the full specification that should be set on the cluster. We do this so that we don't need any real "brains" on the node side.

func PopulateInstanceGroupSpec

func PopulateInstanceGroupSpec(cluster *kops.Cluster, input *kops.InstanceGroup, channel *kops.Channel) (*kops.InstanceGroup, error)

PopulateInstanceGroupSpec sets default values in the InstanceGroup The InstanceGroup is simpler than the cluster spec, so we just populate in place (like the rest of k8s)

func ProtokubeImageSource added in v1.10.0

func ProtokubeImageSource(assetsBuilder *assets.AssetBuilder) (*url.URL, *hashing.Hash, error)

ProtokubeImageSource returns the source for the docker image for protokube. Either a docker name (e.g. gcr.io/protokube:1.4), or a URL (https://...) in which case we download the contents of the url and docker load it

func SetKopsAssetsLocations added in v1.10.0

func SetKopsAssetsLocations(assetsBuilder *assets.AssetBuilder) error

SetKopsAssetsLocations sets the kops assets locations This func adds kops binary to the list of file assets, and stages the binary in the assets file repository

Types

type ApplyClusterCmd

type ApplyClusterCmd struct {
	Cluster *kops.Cluster

	InstanceGroups []*kops.InstanceGroup

	// NodeUpSource is the location from which we download nodeup
	NodeUpSource string

	// NodeUpHash is the sha hash
	NodeUpHash string

	// Models is a list of cloudup models to apply
	Models []string

	// TargetName specifies how we are operating e.g. direct to GCE, or AWS, or dry-run, or terraform
	TargetName string

	// Target is the fi.Target we will operate against
	Target fi.Target

	// OutDir is a local directory in which we place output, can cache files etc
	OutDir string

	// Assets is a list of sources for files (primarily when not using everything containerized)
	// Formats:
	//  raw url: http://... or https://...
	//  url with hash: <hex>@http://... or <hex>@https://...
	Assets []string

	Clientset simple.Clientset

	// DryRun is true if this is only a dry run
	DryRun bool

	// RunTasksOptions defines parameters for task execution, e.g. retry interval
	RunTasksOptions *fi.RunTasksOptions

	// Phase can be set to a Phase to run the specific subset of tasks, if we don't want to run everything
	Phase Phase

	// LifecycleOverrides is passed in to override the lifecycle for one of more tasks.
	// The key value is the task name such as InternetGateway and the value is the fi.Lifecycle
	// that is re-mapped.
	LifecycleOverrides map[string]fi.Lifecycle

	// TaskMap is the map of tasks that we built (output)
	TaskMap map[string]fi.Task
	// contains filtered or unexported fields
}

func (*ApplyClusterCmd) AddFileAssets added in v1.10.0

func (c *ApplyClusterCmd) AddFileAssets(assetBuilder *assets.AssetBuilder) error

AddFileAssets adds the file assets within the assetBuilder

func (*ApplyClusterCmd) BuildNodeUpConfig added in v1.10.0

func (c *ApplyClusterCmd) BuildNodeUpConfig(assetBuilder *assets.AssetBuilder, ig *kops.InstanceGroup) (*nodeup.Config, error)

BuildNodeUpConfig returns the NodeUp config, in YAML format

func (*ApplyClusterCmd) Run

func (c *ApplyClusterCmd) Run() error

type BootstrapChannelBuilder added in v1.10.0

type BootstrapChannelBuilder struct {
	Lifecycle *fi.Lifecycle
	// contains filtered or unexported fields
}

BootstrapChannelBuilder is responsible for handling the addons in channels

func (*BootstrapChannelBuilder) Build added in v1.10.0

Build is responsible for adding the addons to the channel

type ByZone added in v1.10.0

type ByZone []*kops.ClusterSubnetSpec

ByZone implements sort.Interface for []*ClusterSubnetSpec based on the Zone field.

func (ByZone) Len added in v1.10.0

func (a ByZone) Len() int

func (ByZone) Less added in v1.10.0

func (a ByZone) Less(i, j int) bool

func (ByZone) Swap added in v1.10.0

func (a ByZone) Swap(i, j int)

type Loader

type Loader struct {
	Cluster *api.Cluster

	WorkDir string

	ModelStore vfs.Path

	Tags              sets.String
	TemplateFunctions template.FuncMap

	Resources map[string]fi.Resource

	Builders []fi.ModelBuilder
	// contains filtered or unexported fields
}

func (*Loader) AddTypes

func (l *Loader) AddTypes(types map[string]interface{})

func (*Loader) BuildTasks

func (l *Loader) BuildTasks(modelStore vfs.Path, models []string, assetBuilder *assets.AssetBuilder, lifecycle *fi.Lifecycle, lifecycleOverrides map[string]fi.Lifecycle) (map[string]fi.Task, error)

func (*Loader) Init

func (l *Loader) Init()

type Phase added in v1.10.0

type Phase string

Phase is a portion of work that kops completes.

const (
	// PhaseStageAssets uploads various assets such as containers in a private registry
	PhaseStageAssets Phase = "assets"
	// PhaseNetwork creates network infrastructure.
	PhaseNetwork Phase = "network"
	// PhaseSecurity creates IAM profiles and roles, security groups and firewalls
	PhaseSecurity Phase = "security"
	// PhaseCluster creates the servers, and load-alancers
	PhaseCluster Phase = "cluster"
)

type SpecBuilder

type SpecBuilder struct {
	OptionsLoader *loader.OptionsLoader

	Tags sets.String
}

func (*SpecBuilder) BuildCompleteSpec

func (l *SpecBuilder) BuildCompleteSpec(clusterSpec *api.ClusterSpec) (*api.ClusterSpec, error)

type TemplateFunctions

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

TemplateFunctions provides a collection of methods used throughout the templates

func (*TemplateFunctions) AddTo

func (tf *TemplateFunctions) AddTo(dest template.FuncMap, secretStore fi.SecretStore) (err error)

This will define the available functions we can use in our YAML models If we are trying to get a new function implemented it MUST be defined here.

func (*TemplateFunctions) DnsControllerArgv added in v1.4.1

func (tf *TemplateFunctions) DnsControllerArgv() ([]string, error)

DnsControllerArgv returns the args to the DNS controller

func (*TemplateFunctions) EtcdScheme added in v1.10.0

func (tf *TemplateFunctions) EtcdScheme() string

EtcdScheme parses and grabs the protocol to the etcd cluster

func (*TemplateFunctions) ExternalDnsArgv added in v1.10.0

func (tf *TemplateFunctions) ExternalDnsArgv() ([]string, error)

func (*TemplateFunctions) GetInstanceGroup

func (tf *TemplateFunctions) GetInstanceGroup(name string) (*kops.InstanceGroup, error)

GetInstanceGroup returns the instance group with the specified name

func (*TemplateFunctions) HasTag

func (tf *TemplateFunctions) HasTag(tag string) bool

HasTag returns true if the specified tag is set

func (*TemplateFunctions) ProxyEnv added in v1.10.0

func (tf *TemplateFunctions) ProxyEnv() map[string]string

func (*TemplateFunctions) SharedVPC

func (tf *TemplateFunctions) SharedVPC() bool

SharedVPC is a simple helper function which makes the templates for a shared VPC clearer

func (*TemplateFunctions) ToJSON added in v1.10.0

func (tf *TemplateFunctions) ToJSON(data interface{}) string

ToJSON returns a json representation of the struct or on error an empty string

Jump to

Keyboard shortcuts

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