Documentation
¶
Index ¶
- Constants
- func CreateInstance(ctx context.Context, client *oxide.Client, projectID, instanceName string, ...) (*oxide.Instance, error)
- func GenerateCloudConfig(nodeType string, initCluster bool, controlPlaneIP, joinToken string, ...) ([]byte, error)
- func GenerateCloudConfigB64(nodeType string, initCluster bool, controlPlaneIP, joinToken string, ...) (string, error)
- func GetControlPlaneIP(ctx context.Context, logger *log.Entry, client *oxide.Client, ...) (*oxide.FloatingIp, error)
- func GetSecretConfig(ctx context.Context, apiConfig *rest.Config, logger *log.Entry, ...) (*config.ControllerConfig, error)
- func NewSecretKeyNotFoundError(key string) error
- type CloudConfig
- type Cluster
- func (c *Cluster) CreateControlPlaneNodes(ctx context.Context, initCluster bool, count, start int, ...) ([]oxide.Instance, error)
- func (c *Cluster) EnsureWorkerNodes(ctx context.Context) ([]oxide.Instance, error)
- func (c *Cluster) Execute(ctx context.Context) (newKubeconfig []byte, err error)
- func (c *Cluster) GetJoinToken(ctx context.Context) (string, error)
- func (c *Cluster) GetOxideToken(ctx context.Context) ([]byte, error)
- func (c *Cluster) GetOxideURL(ctx context.Context) ([]byte, error)
- func (c *Cluster) GetUserSSHPublicKey(ctx context.Context) ([]byte, error)
- func (c *Cluster) GetWorkerCount(ctx context.Context) (int, error)
- func (c *Cluster) GetWorkerNodeCount() (int, error)
- func (c *Cluster) LoadControllerToClusterNodes(ctx context.Context, infile io.ReadCloser) error
- func (c *Cluster) LoadHelmCharts(ctx context.Context) error
- func (c *Cluster) SetWorkerCount(ctx context.Context, count int) error
- type Config
- type ConfigSource
- type MultiLineStrings
- type SecretKeyNotFoundError
- type StaticRESTClientGetter
- func (s *StaticRESTClientGetter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
- func (s *StaticRESTClientGetter) ToNamespace() (string, error)
- func (s *StaticRESTClientGetter) ToRESTConfig() (*rest.Config, error)
- func (s *StaticRESTClientGetter) ToRESTMapper() (meta.RESTMapper, error)
- func (s *StaticRESTClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig
- type User
- type WriteFile
Constants ¶
const ( KB = 1024 MB = 1024 * KB GB = 1024 * MB )
Variables ¶
This section is empty.
Functions ¶
func CreateInstance ¶
func GenerateCloudConfig ¶
func GenerateCloudConfig(nodeType string, initCluster bool, controlPlaneIP, joinToken string, pubkey []string, extraDisk, tailscaleAuthKey, tailscaleTag string) ([]byte, error)
GenerateCloudConfig for a particular node type
func GenerateCloudConfigB64 ¶
func GenerateCloudConfigB64(nodeType string, initCluster bool, controlPlaneIP, joinToken string, pubkey []string, extraDisk, tailscaleAuthKey, tailscaleTag string) (string, error)
GenerateCloudConfigB64 generates a base64 encoded cloud config for a particular node type
func GetControlPlaneIP ¶
func GetSecretConfig ¶
func GetSecretConfig(ctx context.Context, apiConfig *rest.Config, logger *log.Entry, namespace, secret string) (*config.ControllerConfig, error)
func getSecretValue(ctx context.Context, apiConfig *rest.Config, logger *log.Entry, namespace, secret, key string) ([]byte, error) {
Types ¶
type CloudConfig ¶
type CloudConfig struct {
Hostname string `yaml:"hostname,omitempty"`
ManageEtcHosts bool `yaml:"manage_etc_hosts,omitempty"`
Packages []string `yaml:"packages,omitempty"`
WriteFiles []WriteFile `yaml:"write_files,omitempty"`
RunCmd MultiLineStrings `yaml:"runcmd,omitempty"`
Users []User `yaml:"users,omitempty"`
SSHPWAuth bool `yaml:"ssh_pwauth"` // disables password logins
DisableRoot bool `yaml:"disable_root"` // ensure root isn't disabled
AllowPublicSSHKeys bool `yaml:"allow_public_ssh_keys"` // allow public SSH keys
}
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func New ¶
func New(logger *log.Entry, ctrlrConfig *config.ControllerConfig, kubeconfigOverwrite bool, ociImage string, initWait time.Duration) *Cluster
New creates a new Cluster instance
func (*Cluster) CreateControlPlaneNodes ¶
func (c *Cluster) CreateControlPlaneNodes(ctx context.Context, initCluster bool, count, start int, additionalPubKeys []string) ([]oxide.Instance, error)
createControlPlaneNodes creates new control plane nodes
func (*Cluster) EnsureWorkerNodes ¶
EnsureWorkerNodes ensures the count of worker nodes matches what it should be
func (*Cluster) Execute ¶
Execute execute the core functionality, which includes: 1. Verifying the project exists 2. Verifying the images exist 3. Verifying the cluster exists 4. Ensuring the worker nodes exist as desired 5. Returning the new kubeconfig, if any
func (*Cluster) GetJoinToken ¶
GetJoinToken retrieves a new k3s worker join token from the Kubernetes cluster
func (*Cluster) GetOxideToken ¶
GetOxideToken retrieves the oxide token from the Kubernetes cluster
func (*Cluster) GetOxideURL ¶
GetOxideURL retrieves the oxide URL from the Kubernetes cluster
func (*Cluster) GetUserSSHPublicKey ¶
GetUserSSHPublicKey retrieves the SSH public key from the Kubernetes cluster
func (*Cluster) GetWorkerCount ¶
GetWorkerCount retrieves the targeted worker count from the Kubernetes cluster
func (*Cluster) GetWorkerNodeCount ¶
GetWorkerNodeCount gets the number of worker nodes in the cluster
func (*Cluster) LoadControllerToClusterNodes ¶
LoadControllerToClusterNodes loads the controller binary to all control plane nodes in the cluster. It is not intended to persist, just used for development purposes. The namespace and pod used are per the cluster configuration.
func (*Cluster) LoadHelmCharts ¶
LoadHelmCharts loads the embedded Helm charts into the cluster.
type ConfigSource ¶
type ConfigSource int
const ( ConfigSourceProvidedKubeconfig ConfigSource = iota ConfigSourceDefaultKubeconfig ConfigSourceInCluster )
type MultiLineStrings ¶
type MultiLineStrings [][]string
func (MultiLineStrings) MarshalYAML ¶
func (m MultiLineStrings) MarshalYAML() (interface{}, error)
MarshalYAML formats each inner slice as a block scalar string
type SecretKeyNotFoundError ¶
type SecretKeyNotFoundError struct {
// contains filtered or unexported fields
}
func (*SecretKeyNotFoundError) Error ¶
func (e *SecretKeyNotFoundError) Error() string
func (*SecretKeyNotFoundError) Is ¶
func (e *SecretKeyNotFoundError) Is(target error) bool
type StaticRESTClientGetter ¶
func (*StaticRESTClientGetter) ToDiscoveryClient ¶
func (s *StaticRESTClientGetter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
func (*StaticRESTClientGetter) ToNamespace ¶
func (s *StaticRESTClientGetter) ToNamespace() (string, error)
func (*StaticRESTClientGetter) ToRESTConfig ¶
func (s *StaticRESTClientGetter) ToRESTConfig() (*rest.Config, error)
func (*StaticRESTClientGetter) ToRESTMapper ¶
func (s *StaticRESTClientGetter) ToRESTMapper() (meta.RESTMapper, error)
func (*StaticRESTClientGetter) ToRawKubeConfigLoader ¶
func (s *StaticRESTClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig