os

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 37 Imported by: 4

Documentation

Index

Constants

View Source
const (
	LocalCluster  = "wks.weave.works/local-cluster"
	Created       = "wks.weave.works/is-created"
	PemDestDir    = "/etc/pki/weaveworks/wksctl/pem"
	ConfigDestDir = "/etc/pki/weaveworks/wksctl"
)

TODO replace wksctl with a more generic term

View Source
const (
	CentOS = "centos"
	Ubuntu = "ubuntu"
	RHEL   = "rhel"
)

Variables

This section is empty.

Functions

func AddClusterAPICRDs added in v0.0.4

func AddClusterAPICRDs(b *plan.Builder, fs http.FileSystem) ([]string, error)

func ApplyPlan added in v0.0.4

func ApplyPlan(ctx context.Context, o *OS, p *plan.Plan) error

func ConfigureFlux added in v0.0.4

func ConfigureFlux(b *plan.Builder, params SeedNodeParams) error

func CreateAssetConfigMap added in v0.2.1

func CreateAssetConfigMap(eic *existinginfrav1.ExistingInfraCluster, namespace string, assetDescriptions map[string]kubeadm.AssetDescription) (*v1.ConfigMap, error)

func CreateClusterConfigMap added in v0.0.7

func CreateClusterConfigMap(eic *existinginfrav1.ExistingInfraCluster, namespace string) *v1.ConfigMap

func CreateConfigFileResourcesFromConfigMaps

func CreateConfigFileResourcesFromConfigMaps(fileSpecs []existinginfrav1.FileSpec, configMaps map[string]*v1.ConfigMap) ([]*resource.File, error)

func CreateConfigFileResourcesFromFileSpecs added in v0.0.4

func CreateConfigFileResourcesFromFileSpecs(fileSpecs []existinginfrav1.FileSpec) ([]*resource.File, error)

func CreatePlan

func CreatePlan(b *plan.Builder) (*plan.Plan, error)

CreatePlan generates a plan from a plan builder

func CreateSeedNodeSetupPlan added in v0.0.4

func CreateSeedNodeSetupPlan(ctx context.Context, o *OS, params SeedNodeParams) (*plan.Plan, error)

CreateSeedNodeSetupPlan constructs the seed node plan used to setup the initial node prior to turning control over to wks-controller

func FindDaemonSet added in v0.0.4

func FindDaemonSet(manifest *v1.List) (int, *appsv1.DaemonSet, error)

Returns a daemonset manifest from a list

func GetAPIServerArgs added in v0.0.4

func GetAPIServerArgs(providerSpec *existinginfrav1.ClusterSpec) map[string]string

func InjectEnvVarToContainer added in v0.0.4

func InjectEnvVarToContainer(
	containers []v1.Container, name string, newEnvVar v1.EnvVar) error

Finds container in the list by name, adds an env var, fails if env var exists with different value

func SetWeaveNetPodCIDRBlock added in v0.0.4

func SetWeaveNetPodCIDRBlock(manifests [][]byte, podsCIDRBlock string) ([][]byte, error)

Sets the pod CIDR block in the weave-net manifest

func SetupSeedNode added in v0.0.4

func SetupSeedNode(ctx context.Context, o *OS, params SeedNodeParams) error

SetupSeedNode installs Kubernetes on this machine, and store the provided manifests in the API server, so that the rest of the cluster can then be set up by the WKS controller.

func StoreIfNotEmpty added in v0.0.4

func StoreIfNotEmpty(vals map[string]string, key, value string)

func UpdateControllerImage added in v0.0.4

func UpdateControllerImage(manifest []byte, controllerImageOverride string) ([]byte, error)

updateControllerImage replaces the controller image in the manifest and returns the updated manifest

func WksControllerManifest added in v0.0.4

func WksControllerManifest(imageOverride, namespace string) ([]byte, error)

Types

type AuthParams added in v0.0.4

type AuthParams struct {
	PEMSecretResources map[string]*SecretResourceSpec
	AuthConfigMap      *v1.ConfigMap
	AuthConfigManifest []byte
}

AuthParams are parameters used to configure authn and authz for the cluster

type CRDFile added in v0.0.4

type CRDFile struct {
	Fname string
	Data  []byte
}

func GetCRDs added in v0.0.4

func GetCRDs(fs http.FileSystem) ([]CRDFile, error)

Retrieve all CRD definitions needed for cluster API

type ControllerParams added in v0.0.4

type ControllerParams struct {
	// ImageOverride will override the WKS controller image if set. It will do so
	// whether the controller manifest comes from a git repository or is the
	// built-in one.
	ImageOverride string
	// ImageBuiltin is the WKS controller image to use when generating the WKS
	// controller manifest from in-memory data.
	ImageBuiltin string
	// Namespace in which the controller runs
	Namespace string
}

ControllerParams are all SeedNodeParams related to the WKS controller

type GitParams added in v0.0.4

type GitParams struct {
	GitURL           string
	GitBranch        string
	GitPath          string
	GitDeployKeyPath string
}

GitParams are all SeedNodeParams related to the user's Git(Hub) repo

type MachineInfo added in v0.0.4

type MachineInfo struct {
	SSHUser     string `json:"sshUser"`
	SSHKey      string `json:"sshKey"`
	PublicIP    string `json:"publicIP"`
	PublicPort  string `json:"publicPort"`
	PrivateIP   string `json:"privateIP"`
	PrivatePort string `json:"privatePort"`
}

MachineInfo holds connection information (key, ips, ports) about a machine

type NodeParams

type NodeParams struct {
	IsMaster                 bool // true if this node is a master, false else.
	MasterIP                 string
	MasterPort               int
	Token                    string // kubeadm's --token
	DiscoveryTokenCaCertHash string // kubeadm's --discovery-token-ca-cert-hash
	CertificateKey           string // kubeadm's --certificate-key
	KubeletConfig            config.KubeletConfig
	KubernetesVersion        string
	CRI                      existinginfrav1.ContainerRuntime
	CNI                      string
	ConfigFileSpecs          []existinginfrav1.FileSpec
	ProviderConfigMaps       map[string]*v1.ConfigMap
	AuthConfigMap            *v1.ConfigMap
	Secrets                  map[string]resource.SecretData // kind of auth -> names/values as-in v1.Secret
	Namespace                string
	ControlPlaneEndpoint     string // used instead of MasterIP if existed
	AddonNamespaces          map[string]string
	AssetDescriptions        map[string]kubeadm.AssetDescription
	Flavor                   existinginfrav1.ClusterFlavor
}

NodeParams groups required inputs to configure a Kubernetes node.

func (NodeParams) Validate

func (params NodeParams) Validate() error

Validate generally validates this NodeParams struct, e.g. ensures it contains mandatory values, that these are well-formed, etc.

type OS

type OS struct {
	Name    string
	Runner  plan.Runner
	PkgType resource.PkgType
}

OS represents an operating system and exposes the operations required to install Kubernetes on a machine setup with that OS.

func Identify

func Identify(ctx context.Context, sshClient plan.Runner) (*OS, error)

Identify uses the provided SSH client to identify the operating system of the machine it is configured to talk to.

func (OS) CreateNodeSetupPlan

func (o OS) CreateNodeSetupPlan(ctx context.Context, params NodeParams) (*plan.Plan, error)

CreateNodeSetupPlan creates the plan that will be used to set up a node.

func (OS) SetupNode

func (o OS) SetupNode(ctx context.Context, p *plan.Plan) error

SetupNode installs Kubernetes on this machine and configures it based on the manifests stored during the initialization of the cluster, when SetupSeedNode was called.

type SecretResourceSpec added in v0.0.4

type SecretResourceSpec struct {
	SecretName string
	Decrypted  resource.SecretData
	Resource   plan.Resource
}

type SeedNodeParams added in v0.0.4

type SeedNodeParams struct {
	PublicIP             string
	PrivateIP            string
	ServicesCIDRBlocks   []string
	PodsCIDRBlocks       []string
	ExistingInfraCluster existinginfrav1.ExistingInfraCluster
	ClusterManifest      string
	MachinesManifest     string
	ConnectionInfo       []MachineInfo
	// BootstrapToken is the token used by kubeadm init and kubeadm join
	// to safely form new clusters.
	BootstrapToken       *kubeadmapi.BootstrapTokenString
	KubeletConfig        config.KubeletConfig
	Controller           ControllerParams
	GitData              GitParams
	AuthInfo             *AuthParams
	SealedSecretKey      string
	SealedSecretCert     string
	ConfigDirectory      string
	Namespace            string
	ImageRepository      string
	ControlPlaneEndpoint string
	AdditionalSANs       []string
	AddonNamespaces      map[string]string
	AssetDescriptions    map[string]kubeadm.AssetDescription
	Flavor               existinginfrav1.ClusterFlavor
}

SeedNodeParams groups required inputs to configure a "seed" Kubernetes node.

func (SeedNodeParams) Validate added in v0.0.4

func (params SeedNodeParams) Validate() error

Validate generally validates this SeedNodeParams struct, e.g. ensures it contains mandatory values, that these are well-formed, etc.

Jump to

Keyboard shortcuts

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