Documentation ¶
Index ¶
- Constants
- Variables
- func BaseUrl() (*url.URL, error)
- func BuildCloud(cluster *kops.Cluster) (fi.Cloud, error)
- func ChannelForCluster(c *kops.Cluster) (*kops.Channel, error)
- func FindDNSHostedZone(dns dnsprovider.Interface, clusterDNSName string, dnsType kops.DNSType) (string, error)
- func FindLatestKubernetesVersion() (string, error)
- func KopsFileUrl(file string, assetBuilder *assets.AssetBuilder) (*url.URL, *hashing.Hash, error)
- func NodeUpLocation(assetsBuilder *assets.AssetBuilder) (*url.URL, *hashing.Hash, error)
- func PerformAssignments(c *kops.Cluster) error
- func PopulateClusterSpec(clientset simple.Clientset, cluster *api.Cluster, ...) (*api.Cluster, error)
- func PopulateInstanceGroupSpec(cluster *kops.Cluster, input *kops.InstanceGroup, channel *kops.Channel) (*kops.InstanceGroup, error)
- func ProtokubeImageSource(assetsBuilder *assets.AssetBuilder) (*url.URL, *hashing.Hash, error)
- func SetKopsAssetsLocations(assetsBuilder *assets.AssetBuilder) error
- type ApplyClusterCmd
- type BootstrapChannelBuilder
- type ByZone
- type Loader
- type Phase
- type SpecBuilder
- type TemplateFunctions
- func (tf *TemplateFunctions) AddTo(dest template.FuncMap, secretStore fi.SecretStore) (err error)
- func (tf *TemplateFunctions) DnsControllerArgv() ([]string, error)
- func (tf *TemplateFunctions) EtcdScheme() string
- func (tf *TemplateFunctions) ExternalDnsArgv() ([]string, error)
- func (tf *TemplateFunctions) GetInstanceGroup(name string) (*kops.InstanceGroup, error)
- func (tf *TemplateFunctions) HasTag(tag string) bool
- func (tf *TemplateFunctions) ProxyEnv() map[string]string
- func (tf *TemplateFunctions) SharedVPC() bool
- func (tf *TemplateFunctions) ToJSON(data interface{}) string
Constants ¶
const ( // This IP is from TEST-NET-3 // https://en.wikipedia.org/wiki/Reserved_IP_addresses PlaceholderIP = "203.0.113.123" PlaceholderTTL = 10 )
const ( KEY_NAME = "name" KEY_TYPE = "_type" )
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" )
const TargetCloudformation = "cloudformation"
const TargetDirect = "direct"
const TargetDryRun = "dryrun"
const TargetTerraform = "terraform"
Variables ¶
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"} )
var EtcdClusters = []string{"main", "events"}
EtcdClusters is a list of the etcd clusters kops creates
var Phases = sets.NewString( string(PhaseStageAssets), string(PhaseSecurity), string(PhaseNetwork), string(PhaseCluster), )
Phases are used for validation and cli help.
Functions ¶
func BaseUrl ¶ added in v1.10.0
BaseUrl returns the base url for the distribution of kops - in particular for nodeup & docker images
func FindDNSHostedZone ¶ added in v1.10.0
func FindLatestKubernetesVersion ¶ added in v1.10.0
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
KopsFileUrl returns the base url for the distribution of kops - in particular for nodeup & docker images
func NodeUpLocation ¶ added in v1.10.0
NodeUpLocation returns the URL where nodeup should be downloaded
func PerformAssignments ¶ added in v1.10.0
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
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
func (b *BootstrapChannelBuilder) Build(c *fi.ModelBuilderContext) error
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.
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) BuildTasks ¶
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