api

package
v0.1.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterExists

func ClusterExists(name string, clientset simple.Clientset) (bool, error)

func DeleteCluster

func DeleteCluster(name string, clientset simple.Clientset) error

func SyncInstanceGroups

func SyncInstanceGroups(cluster *Cluster, clientset simple.Clientset) error

Types

type AwsAssumeRole

type AwsAssumeRole struct {
	RoleArn string
}

type AwsConfig

type AwsConfig struct {
	Profile    string
	AssumeRole *AwsAssumeRole
}

type Cluster

type Cluster struct {
	// The cluster name
	Name string
	// The cluster admin ssh key
	AdminSshKey string
	// The Channel we are following
	Channel string
	// Additional addons that should be installed on the cluster
	Addons []kops.AddonSpec
	// ConfigBase is the path where we store configuration for the cluster
	// This might be different than the location where the cluster spec itself is stored,
	// both because this must be accessible to the cluster,
	// and because it might be on a different cloud or storage system (etcd vs S3)
	ConfigBase string
	// The CloudProvider to use (aws or gce)
	CloudProvider string
	// Container runtime to use for Kubernetes
	ContainerRuntime string
	// The version of kubernetes to install (optional, and can be a "spec" like stable)
	KubernetesVersion string
	// Configuration of subnets we are targeting
	Subnet []kops.ClusterSubnetSpec
	// Project is the cloud project we should use, required on GCE
	Project string
	// MasterPublicName is the external DNS name for the master nodes
	MasterPublicName string
	// MasterInternalName is the internal DNS name for the master nodes
	MasterInternalName string
	// NetworkCIDR is the CIDR used for the AWS VPC / GCE Network, or otherwise allocated to k8s
	// This is a real CIDR, not the internal k8s network
	// On AWS, it maps to the VPC CIDR.  It is not required on GCE.
	NetworkCIDR string
	// AdditionalNetworkCIDRs is a list of additional CIDR used for the AWS VPC
	// or otherwise allocated to k8s. This is a real CIDR, not the internal k8s network
	// On AWS, it maps to any additional CIDRs added to a VPC.
	AdditionalNetworkCIDRs []string
	// NetworkID is an identifier of a network, if we want to reuse/share an existing network (e.g. an AWS VPC)
	NetworkID string
	// Topology defines the type of network topology to use on the cluster - default public
	// This is heavily weighted towards AWS for the time being, but should also be agnostic enough
	// to port out to GCE later if needed
	Topology *kops.TopologySpec
	// SecretStore is the VFS path to where secrets are stored
	SecretStore string
	// KeyStore is the VFS path to where SSL keys and certificates are stored
	KeyStore string
	// ConfigStore is the VFS path to where the configuration (Cluster, InstanceGroups etc) is stored
	ConfigStore string
	// DNSZone is the DNS zone we should use when configuring DNS
	// This is because some clouds let us define a managed zone foo.bar, and then have
	// kubernetes.dev.foo.bar, without needing to define dev.foo.bar as a hosted zone.
	// DNSZone will probably be a suffix of the MasterPublicName and MasterInternalName
	// Note that DNSZone can either by the host name of the zone (containing dots),
	// or can be an identifier for the zone.
	DNSZone string
	// AdditionalSANs adds additional Subject Alternate Names to apiserver cert that kops generates
	AdditionalSANs []string
	// ClusterDNSDomain is the suffix we use for internal DNS names (normally cluster.local)
	ClusterDNSDomain string
	// ServiceClusterIPRange is the CIDR, from the internal network, where we allocate IPs for services
	ServiceClusterIPRange string
	// PodCIDR is the CIDR from which we allocate IPs for pods
	PodCIDR string
	// NonMasqueradeCIDR is the CIDR for the internal k8s network (on which pods & services live)
	// It cannot overlap ServiceClusterIPRange
	NonMasqueradeCIDR string
	// SSHAccess is a list of the CIDRs that can access SSH.
	SSHAccess []string
	// NodePortAccess is a list of the CIDRs that can access the node ports range (30000-32767).
	NodePortAccess []string
	// HTTPProxy defines connection information to support use of a private cluster behind an forward HTTP Proxy
	EgressProxy *kops.EgressProxySpec
	// SSHKeyName specifies a preexisting SSH key to use
	SSHKeyName *string
	// KubernetesAPIAccess is a list of the CIDRs that can access the Kubernetes API endpoint (master HTTPS)
	KubernetesAPIAccess []string
	// IsolateMasters determines whether we should lock down masters so that they are not on the pod network.
	// true is the kube-up behaviour, but it is very surprising: it means that daemonsets only work on the master
	// if they have hostNetwork=true.
	// false is now the default, and it will:
	//  * give the master a normal PodCIDR
	//  * run kube-proxy on the master
	//  * enable debugging handlers on the master, so kubectl logs works
	IsolateMasters *bool
	// UpdatePolicy determines the policy for applying upgrades automatically.
	// Valid values:
	//   'external' do not apply updates automatically - they are applied manually or by an external system
	//   missing: default policy (currently OS security upgrades that do not require a reboot)
	UpdatePolicy *string
	// ExternalPolicies allows the insertion of pre-existing managed policies on IG Roles
	ExternalPolicies *map[string][]string
	// Additional policies to add for roles
	AdditionalPolicies *map[string]string
	// A collection of files assets for deployed cluster wide
	FileAssets []kops.FileAssetSpec
	// EtcdClusters stores the configuration for each cluster
	EtcdCluster []*kops.EtcdClusterSpec
	// Component configurations
	Containerd                     *kops.ContainerdConfig
	Docker                         *kops.DockerConfig
	KubeDNS                        *kops.KubeDNSConfig
	KubeAPIServer                  *kops.KubeAPIServerConfig
	KubeControllerManager          *kops.KubeControllerManagerConfig
	ExternalCloudControllerManager *kops.CloudControllerManagerConfig
	KubeScheduler                  *kops.KubeSchedulerConfig
	KubeProxy                      *kops.KubeProxyConfig
	Kubelet                        *kops.KubeletConfigSpec
	MasterKubelet                  *kops.KubeletConfigSpec
	CloudConfig                    *kops.CloudConfiguration
	ExternalDNS                    *kops.ExternalDNSConfig
	// Networking configuration
	Networking *kops.NetworkingSpec
	// API field controls how the API is exposed outside the cluster
	API *kops.AccessSpec
	// Authentication field controls how the cluster is configured for authentication
	Authentication *kops.AuthenticationSpec
	// Authorization field controls how the cluster is configured for authorization
	Authorization *kops.AuthorizationSpec
	// NodeAuthorization defined the custom node authorization configuration
	NodeAuthorization *kops.NodeAuthorizationSpec
	// Tags for AWS instance groups
	CloudLabels map[string]string
	// Hooks for custom actions e.g. on first installation
	Hooks []kops.HookSpec
	// Assets is alternative locations for files and containers; the API under construction, will remove this comment once this API is fully functional.
	Assets *kops.Assets
	// IAM field adds control over the IAM security policies applied to resources
	IAM *kops.IAMSpec
	// EncryptionConfig controls if encryption is enabled
	EncryptionConfig *bool
	// DisableSubnetTags controls if subnets are tagged in AWS
	DisableSubnetTags bool
	// UseHostCertificates will mount /etc/ssl/certs to inside needed containers.
	// This is needed if some APIs do have self-signed certs
	UseHostCertificates *bool
	// SysctlParameters will configure kernel parameters using sysctl(8). When
	// specified, each parameter must follow the form variable=value, the way
	// it would appear in sysctl.conf.
	SysctlParameters []string
	// RollingUpdate defines the default rolling-update settings for instance groups
	RollingUpdate *kops.RollingUpdate
	// InstanceGroup defines the list of instance groups making the cluster
	InstanceGroup []*InstanceGroup
	// KubeConfig holds the necessary information to connect to the cluster
	KubeConfig *KubeConfig
	// RollingUpdateOptions contains the options used when doing a cluster rolling update
	RollingUpdateOptions RollingUpdateOptions
	// ValidateOptions contains the options used when validating the cluster
	ValidateOptions ValidateOptions
}

Cluster defines the configuration for a cluster It includes cluster instance groups.

func GetCluster

func GetCluster(name string, clientset simple.Clientset) (*Cluster, error)

func SyncCluster

func SyncCluster(cluster *Cluster, clientset simple.Clientset) (*Cluster, error)

type InstanceGroup

type InstanceGroup struct {
	// Instance group name
	Name string
	// Determines the role of instances in this group: masters or nodes
	Role kops.InstanceGroupRole
	// Image is the instance (ami etc) we should use
	Image string
	// MinSize is the minimum size of the pool
	MinSize *int32
	// MaxSize is the maximum size of the pool
	MaxSize *int32
	// MachineType is the instance class
	MachineType string
	// RootVolumeSize is the size of the EBS root volume to use, in GB
	RootVolumeSize *int32
	// RootVolumeType is the type of the EBS root volume to use (e.g. gp2)
	RootVolumeType *string
	// If volume type is io1, then we need to specify the number of Iops.
	RootVolumeIops *int32
	// RootVolumeOptimization enables EBS optimization for an instance
	RootVolumeOptimization *bool
	// RootVolumeDeleteOnTermination configures root volume retention policy upon instance termination.
	// The root volume is deleted by default. Cluster deletion does not remove retained root volumes.
	// NOTE: This setting applies only to the Launch Configuration and does not affect Launch Templates.
	RootVolumeDeleteOnTermination *bool
	// RootVolumeEncryption enables EBS root volume encryption for an instance
	RootVolumeEncryption *bool
	// Volumes is a collection of additional volumes to create for instances within this InstanceGroup
	Volumes []*kops.VolumeSpec
	// VolumeMounts a collection of volume mounts
	VolumeMounts []*kops.VolumeMountSpec
	// Subnets is the names of the Subnets (as specified in the Cluster) where machines in this instance group should be placed
	Subnets []string
	// Zones is the names of the Zones where machines in this instance group should be placed
	// This is needed for regional subnets (e.g. GCE), to restrict placement to particular zones
	Zones []string
	// Hooks is a list of hooks for this instanceGroup, note: these can override the cluster wide ones if required
	Hooks []kops.HookSpec
	// MaxPrice indicates this is a spot-pricing group, with the specified value as our max-price bid
	MaxPrice *string
	// SpotDurationInMinutes reserves a spot block for the period specified
	SpotDurationInMinutes *int64
	// AssociatePublicIP is true if we want instances to have a public IP
	AssociatePublicIP *bool
	// AdditionalSecurityGroups attaches additional security groups (e.g. i-123456)
	AdditionalSecurityGroups []string
	// CloudLabels indicates the labels for instances in this group, at the AWS level
	CloudLabels map[string]string
	// NodeLabels indicates the kubernetes labels for nodes in this group
	NodeLabels map[string]string
	// FileAssets is a collection of file assets for this instance group
	FileAssets []kops.FileAssetSpec
	// Describes the tenancy of the instance group. Can be either default or dedicated. Currently only applies to AWS.
	Tenancy string
	// Kubelet overrides kubelet config from the ClusterSpec
	Kubelet *kops.KubeletConfigSpec
	// Taints indicates the kubernetes taints for nodes in this group
	Taints []string
	// MixedInstancesPolicy defined a optional backing of an AWS ASG by a EC2 Fleet (AWS Only)
	MixedInstancesPolicy *kops.MixedInstancesPolicySpec
	// AdditionalUserData is any additional user-data to be passed to the host
	AdditionalUserData []kops.UserData
	// SuspendProcesses disables the listed Scaling Policies
	SuspendProcesses []string
	// ExternalLoadBalancers define loadbalancers that should be attached to the instancegroup
	ExternalLoadBalancers []kops.LoadBalancer
	// DetailedInstanceMonitoring defines if detailed-monitoring is enabled (AWS only)
	DetailedInstanceMonitoring *bool
	// IAMProfileSpec defines the identity of the cloud group IAM profile (AWS only).
	IAM *kops.IAMProfileSpec
	// SecurityGroupOverride overrides the default security group created by Kops for this IG (AWS only).
	SecurityGroupOverride *string
	// InstanceProtection makes new instances in an autoscaling group protected from scale in
	InstanceProtection *bool
	// SysctlParameters will configure kernel parameters using sysctl(8). When
	// specified, each parameter must follow the form variable=value, the way
	// it would appear in sysctl.conf.
	SysctlParameters []string
	// RollingUpdate defines the rolling-update behavior
	RollingUpdate *kops.RollingUpdate
	// InstanceInterruptionBehavior defines if a spot instance should be terminated, hibernated,
	// or stopped after interruption
	InstanceInterruptionBehavior *string
}

InstanceGroup represents a group of instances (either nodes or masters) with the same configuration

type KubeConfig

type KubeConfig struct {
	Server          string
	Context         string
	Namespace       string
	KubeBearerToken string
	KubeUser        string
	KubePassword    string
	CaCert          string
	ClientCert      string
	ClientKey       string
}

type ProviderConfig

type ProviderConfig struct {
	StateStore string
	Aws        *AwsConfig
}

type RollingUpdateOptions

type RollingUpdateOptions struct {
	Skip              bool
	MasterInterval    *metav1.Duration
	NodeInterval      *metav1.Duration
	BastionInterval   *metav1.Duration
	FailOnDrainError  bool
	FailOnValidate    bool
	PostDrainDelay    *metav1.Duration
	ValidationTimeout *metav1.Duration
	ValidateCount     *int
}

type ValidateOptions

type ValidateOptions struct {
	Skip         bool
	Timeout      *metav1.Duration
	PollInterval *metav1.Duration
}

Jump to

Keyboard shortcuts

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