kops

package
v0.87.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentCni added in v0.45.0

func GetCurrentCni(network string) string

GetCurrentCni it get the current CNI value for the cluster

Types

type Cluster added in v0.55.0

type Cluster struct {
	Metadata ResourceMetadata `json:"metadata"`
	Spec     ClusterSpec      `json:"spec"`
}

Cluster is the configuration of a kops cluster.

type ClusterSpec added in v0.55.0

type ClusterSpec struct {
	Kubelet   ClusterSpecKubelet `json:"kubelet"`
	NetworkID string             `json:"networkID"`
}

ClusterSpec is the spec configuration of a kops cluster.

type ClusterSpecKubelet added in v0.55.0

type ClusterSpecKubelet struct {
	MaxPods int64 `json:"maxPods"`
}

ClusterSpecKubelet is the kubelet configuration of a kops cluster.

type Cmd

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

Cmd is the kops command to execute.

func New

func New(s3StateStore string, logger log.FieldLogger) (*Cmd, error)

New creates a new instance of Cmd through which to execute kops.

func (*Cmd) Close

func (c *Cmd) Close() error

Close cleans up the temporary output directory used by kops.

func (*Cmd) CreateCluster

func (c *Cmd) CreateCluster(name, cloud string, kopsRequest *model.KopsMetadataRequestedState, zones, privateSubnetIds, publicSubnetIds, masterSecurityGroups, workerSecurityGroups, allowSSHCIDRS []string) error

CreateCluster invokes kops create cluster, using the context of the created Cmd.

func (*Cmd) DeleteCluster

func (c *Cmd) DeleteCluster(name string) error

DeleteCluster invokes kops delete cluster, using the context of the created Cmd.

func (*Cmd) ExportKubecfg

func (c *Cmd) ExportKubecfg(name string) error

ExportKubecfg invokes kops export kubecfg for the named cluster in the context of the created Cmd.

func (*Cmd) GetCluster

func (c *Cmd) GetCluster(name string) (string, error)

GetCluster invokes kops get cluster, using the context of the created Cmd, and returns the stdout.

func (*Cmd) GetClusterJSON added in v0.55.0

func (c *Cmd) GetClusterJSON(clusterName string) (*Cluster, error)

GetClusterJSON invokes kops get instancegroup, using the context of the created Cmd, and returns the unmarshaled response as *Cluster.

func (*Cmd) GetClusterSpecInfoFromJSON added in v0.44.0

func (c *Cmd) GetClusterSpecInfoFromJSON(name string, subData string) (string, error)

GetClusterSpecInfoFromJSON invokes kops get cluster, using the context of the created Cmd, and returns the stdout.

func (*Cmd) GetClustersJSON added in v0.46.1

func (c *Cmd) GetClustersJSON() (string, error)

GetClustersJSON invokes kops get clusters, using the context of the created Cmd, and returns the stdout.

func (*Cmd) GetInstanceGroupYAML added in v0.19.0

func (c *Cmd) GetInstanceGroupYAML(clusterName, igName string) (string, error)

GetInstanceGroupYAML invokes kops get instancegroup, using the context of the created Cmd, and returns the YAML stdout.

func (*Cmd) GetInstanceGroupsJSON added in v0.20.0

func (c *Cmd) GetInstanceGroupsJSON(clusterName string) ([]InstanceGroup, error)

GetInstanceGroupsJSON invokes kops get instancegroup, using the context of the created Cmd, and returns the unmarshaled response as []InstanceGroup.

func (*Cmd) GetKubeConfigPath

func (c *Cmd) GetKubeConfigPath() string

GetKubeConfigPath returns the temporary kubeconfig directory used by kops.

func (*Cmd) GetOutputDirectory

func (c *Cmd) GetOutputDirectory() string

GetOutputDirectory returns the temporary output directory used by kops.

func (*Cmd) GetTempDir added in v0.19.0

func (c *Cmd) GetTempDir() string

GetTempDir returns the root temporary directory used by kops.

func (*Cmd) Replace added in v0.19.0

func (c *Cmd) Replace(name string) (string, error)

Replace invokes kops replace, using the context of the created Cmd, and returns the stdout. The filename passed in is expected to be in the root temp dir of this kops command.

func (*Cmd) RollingUpdateCluster

func (c *Cmd) RollingUpdateCluster(name string) error

RollingUpdateCluster invokes kops rolling-update cluster, using the context of the created Cmd.

func (*Cmd) RollingUpdateClusterRequired added in v0.70.0

func (c *Cmd) RollingUpdateClusterRequired(name string) (bool, error)

RollingUpdateClusterRequired invokes kops rolling-update using the context of the cmd on the provided cluster name in dry-run mode to check if a rolling update is required or not. This is used to know if rotator needs to be enabled when performing cluster mutation operations.

func (*Cmd) SetCluster added in v0.9.0

func (c *Cmd) SetCluster(name, setValue string) error

SetCluster invokes kops set cluster, using the context of the created Cmd. Example setValue: spec.kubernetesVersion=1.10.0

func (*Cmd) SetInstanceGroup added in v0.60.0

func (c *Cmd) SetInstanceGroup(clusterName, instanceGroupName, setValue string) error

SetInstanceGroup invokes kops set instancegroup, using the context of the created Cmd.

func (*Cmd) SetLogger added in v0.37.0

func (c *Cmd) SetLogger(logger log.FieldLogger)

SetLogger sets a new logger for kops commands.

func (*Cmd) UpdateCluster

func (c *Cmd) UpdateCluster(name, dir string) error

UpdateCluster invokes kops update cluster, using the context of the created Cmd.

func (*Cmd) UpdateMetadata added in v0.21.0

func (c *Cmd) UpdateMetadata(metadata *model.KopsMetadata) error

UpdateMetadata updates KopsMetadata with the current values from kops state store. This can be a bit tricky. We are attempting to correlate multiple kops instance groups into a simplified set of metadata information. To do so, we assume and check the following: - There is one or more worker node instance group. - There is one or more master instance groups. - All the master nodes are running the same instance type. Note: If any violations are found, we don't return an error as that is beyond the scope of updating the metadata. Instead, warnings for each violation are returned and stored.

func (*Cmd) UpgradeCluster

func (c *Cmd) UpgradeCluster(name string) error

UpgradeCluster invokes kops upgrade cluster, using the context of the created Cmd.

func (*Cmd) ValidateCluster

func (c *Cmd) ValidateCluster(name string, silent bool) error

ValidateCluster invokes kops validate cluster, using the context of the created Cmd.

func (*Cmd) Version

func (c *Cmd) Version() (string, error)

Version invokes kops version, using the context of the created Cmd, and returns the stdout.

func (*Cmd) WaitForKubernetesReadiness

func (c *Cmd) WaitForKubernetesReadiness(dns string, timeout int) error

WaitForKubernetesReadiness will poll a given kubernetes cluster at a regular interval for it to become ready. If the cluster fails to become ready before the provided timeout then an error will be returned.

type InstanceGroup added in v0.20.0

type InstanceGroup struct {
	Metadata ResourceMetadata  `json:"metadata"`
	Spec     InstanceGroupSpec `json:"spec"`
}

InstanceGroup is the configuration of a kops instance group.

type InstanceGroupSpec added in v0.20.0

type InstanceGroupSpec struct {
	Role                    string `json:"role"`
	Image                   string `json:"image"`
	MachineType             string `json:"machineType"`
	MinSize                 int64  `json:"minSize"`
	MaxSize                 int64  `json:"maxSize"`
	RootVolumeEncryptionKey string `json:"rootVolumeEncryptionKey"`
}

InstanceGroupSpec is the spec configuration of a kops instance group.

type ResourceMetadata added in v0.55.0

type ResourceMetadata struct {
	Name   string            `json:"name"`
	Labels map[string]string `json:"labels"`
}

ResourceMetadata is the metadata of a kops resource.

Jump to

Keyboard shortcuts

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