Documentation ¶
Index ¶
- func Delete(instance InstanceSpec, kubernetesClientset dynamic.Interface) (err error)
- func GenerateName(instance InstanceSpec) (name string)
- func GetEnvironmentRepository() string
- func GetEnvironmentVersion() string
- func GetGitHubUserSSHKeys(username string) (sshKeys []string, err error)
- func GetInstanceDefaultNodeOS() string
- func GetInstanceDefaultNodeSize() string
- func GetKubernetesVersion() string
- func GetValueFromEnvMap(input map[string]string, key string) string
- func GetValueFromEnvSlice(input []map[string]string, key string) string
- func Int32ToInt32Pointer(input int32) *int32
- func KubernetesAddCertToMachine(clientset *kubernetes.Clientset, dynamicClient dynamic.Interface, ...) (err error)
- func KubernetesAddMachineIPToDNS(dynamicClient dynamic.Interface, name string, subdomain string) (err error)
- func KubernetesClientsetFromKubeconfigBytes(kubeconfigBytes []byte) (clientset *kubernetes.Clientset, err error)
- func KubernetesDelete(name string, kubernetesClientset dynamic.Interface) (err error)
- func KubernetesDynamicGetKubeconfigBytes(name string, kubernetesClientset dynamic.Interface) (kubeconfig []byte, err error)
- func KubernetesExec(clientset *kubernetes.Clientset, restConfig *rest.Config, options ExecOptions) (stdout string, stderr string, err error)
- func KubernetesGetInstanceAPIServerLiveness(clientset *kubernetes.Clientset, instanceName string) error
- func KubernetesGetInstanceEnvironmentPodReadiness(clientset *kubernetes.Clientset, instanceName string, userLowercase string) error
- func KubernetesGetInstanceWildcardTLSCert(clientset *kubernetes.Clientset, instance InstanceSpec) (secret *corev1.Secret, err error)
- func KubernetesGetKubeconfig(name string, clientset *kubernetes.Clientset) (kubeconfig *clientcmdapi.Config, err error)
- func KubernetesGetKubeconfigBytes(name string, clientset *kubernetes.Clientset) (kubeconfigBytes []byte, err error)
- func KubernetesGetKubeconfigYAML(name string, clientset *kubernetes.Clientset) (kubeconfig string, err error)
- func KubernetesGetLocalInstanceWildcardTLSCert(clientset *kubernetes.Clientset, username string) (secret *corev1.Secret, err error)
- func KubernetesGetTmateSSHSession(clientset *kubernetes.Clientset, instanceName string, userName string) (output string, err error)
- func KubernetesGetTmateWebSession(clientset *kubernetes.Clientset, instanceName string, userName string) (output string, err error)
- func KubernetesUpsertInstanceWildcardTLSCert(clientset *kubernetes.Clientset, instance InstanceSpec, secret *corev1.Secret) (err error)
- func KubernetesUpsertLocalInstanceWildcardTLSCert(clientset *kubernetes.Clientset, username string, secret *corev1.Secret) (err error)
- func KubernetesWaitForInstanceKubeconfig(clientset *kubernetes.Clientset, instanceName string)
- func TemplateFuncMap() template.FuncMap
- func UpdateInstanceNodeWithProviderID(clientset *kubernetes.Clientset, dynamicClient dynamic.Interface, ...) error
- func ValidateInstance(instance InstanceSpec) (err error)
- type ExecOptions
- type Ingress
- type Instance
- func Get(name string) (instance Instance, err error)
- func KubernetesGet(name string, kubernetesClientset dynamic.Interface, ...) (instance Instance, err error)
- func KubernetesList(kubernetesClientset dynamic.Interface, clientset *kubernetes.Clientset, ...) (instances []Instance, err error)
- func List(dynamicClient dynamic.Interface, clientset *kubernetes.Clientset, ...) (instances []Instance, err error)
- type InstanceCreateOptions
- type InstanceFilter
- type InstanceIngressList
- type InstanceKubeconfig
- type InstanceList
- type InstanceListOptions
- type InstanceNameScheme
- type InstanceResourceStatus
- type InstanceSpec
- func Create(instance InstanceSpec, dynamicClient dynamic.Interface, ...) (instanceCreated InstanceSpec, err error)
- func KubernetesCreate(instance InstanceSpec, dynamicClient dynamic.Interface, ...) (instanceCreated InstanceSpec, err error)
- func KubernetesUpdate(instance InstanceSpec) (instanceUpdated InstanceSpec, err error)
- func Update(instance InstanceSpec) (instanceUpdated InstanceSpec, err error)
- func UpdateInstanceSpecIfEnvOverrides(instance InstanceSpec) InstanceSpec
- type InstanceStatus
- type InstanceStatusPhase
- type InstanceType
- type KubernetesCluster
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
func Delete(instance InstanceSpec, kubernetesClientset dynamic.Interface) (err error)
Delete ... delete an instance
func GenerateName ¶
func GenerateName(instance InstanceSpec) (name string)
GenerateName ... given a username, append a 4 byte string to the end
func GetEnvironmentRepository ¶
func GetEnvironmentRepository() string
GetEnvironmentRepository ... get the container repository of where environment is
func GetEnvironmentVersion ¶
func GetEnvironmentVersion() string
GetEnvironmentVersion ... get the version to deploy of the Environment container
func GetGitHubUserSSHKeys ¶
GetGitHubUserSSHKeys downloads the public SSH keys of a user from GitHub
func GetInstanceDefaultNodeOS ¶
func GetInstanceDefaultNodeOS() string
GetInstanceDefaultNodeOS ... get the OS of node to create
func GetInstanceDefaultNodeSize ¶
func GetInstanceDefaultNodeSize() string
GetInstanceDefaultNodeSize ... get the size of node to create
func GetKubernetesVersion ¶
func GetKubernetesVersion() string
GetKubernetesVersion ... get the version of Kubernetes to use in the cluster
func GetValueFromEnvMap ¶
GetValueFromEnvMap ... returns a value when keys of a map match
func GetValueFromEnvSlice ¶
GetValueFromEnvSlice ... returns a value when keys of a slice map match
func Int32ToInt32Pointer ¶
Int32ToInt32Pointer ... helper function to make int32 into a pointer
func KubernetesAddCertToMachine ¶
func KubernetesAddCertToMachine(clientset *kubernetes.Clientset, dynamicClient dynamic.Interface, instance InstanceSpec) (err error)
KubernetesAddCertToMachine ... given a clientset, dynamic client, and instance name, manage the lifecycle of a cert on an instance
func KubernetesAddMachineIPToDNS ¶
func KubernetesAddMachineIPToDNS(dynamicClient dynamic.Interface, name string, subdomain string) (err error)
KubernetesAddMachineIPToDNS ... given a dynamicClient, instance name, and subdomain, wait for machine IP and upsert the DNS endpoint with the external provider
func KubernetesClientsetFromKubeconfigBytes ¶
func KubernetesClientsetFromKubeconfigBytes(kubeconfigBytes []byte) (clientset *kubernetes.Clientset, err error)
KubernetesClientsetFromKubeconfigBytes ... given an kubeconfig as a slice of bytes return a clientset
func KubernetesDelete ¶
KubernetesDelete ... delete a Kubernetes instance
func KubernetesDynamicGetKubeconfigBytes ¶
func KubernetesDynamicGetKubeconfigBytes(name string, kubernetesClientset dynamic.Interface) (kubeconfig []byte, err error)
KubernetesDynamicGetKubeconfigBytes ... given an instance name and dynamic client, return the instance's kubeconfig as bytes
func KubernetesExec ¶
func KubernetesExec(clientset *kubernetes.Clientset, restConfig *rest.Config, options ExecOptions) (stdout string, stderr string, err error)
KubernetesExec ... exec a command in an Instance Kubernetes Pod
func KubernetesGetInstanceAPIServerLiveness ¶
func KubernetesGetInstanceAPIServerLiveness(clientset *kubernetes.Clientset, instanceName string) error
KubernetesGetInstanceAPIServerLiveness returns an error if the instance APIServer is not live or healthy
func KubernetesGetInstanceEnvironmentPodReadiness ¶
func KubernetesGetInstanceEnvironmentPodReadiness(clientset *kubernetes.Clientset, instanceName string, userLowercase string) error
KubernetesGetInstanceEnvironmentPodReadiness returns an error given the unreadiness of the Environment Pod
func KubernetesGetInstanceWildcardTLSCert ¶
func KubernetesGetInstanceWildcardTLSCert(clientset *kubernetes.Clientset, instance InstanceSpec) (secret *corev1.Secret, err error)
KubernetesGetInstanceWildcardTLSCert ... given an instance clientset and instance, return a TLS wildcard cert
func KubernetesGetKubeconfig ¶
func KubernetesGetKubeconfig(name string, clientset *kubernetes.Clientset) (kubeconfig *clientcmdapi.Config, err error)
KubernetesGetKubeconfig ... given an instance name and clientset, return a kubeconfig for clientset
func KubernetesGetKubeconfigBytes ¶
func KubernetesGetKubeconfigBytes(name string, clientset *kubernetes.Clientset) (kubeconfigBytes []byte, err error)
KubernetesGetKubeconfigBytes ... given an instance name and clientset, return the instance's kubeconfig as bytes
func KubernetesGetKubeconfigYAML ¶
func KubernetesGetKubeconfigYAML(name string, clientset *kubernetes.Clientset) (kubeconfig string, err error)
KubernetesGetKubeconfigYAML ... given an instance name and clientset, return the instance's kubeconfig as YAML
func KubernetesGetLocalInstanceWildcardTLSCert ¶
func KubernetesGetLocalInstanceWildcardTLSCert(clientset *kubernetes.Clientset, username string) (secret *corev1.Secret, err error)
KubernetesGetLocalInstanceWildcardTLSCert ... given a local clientset and instance name, return the local TLS wildcard cert
func KubernetesGetTmateSSHSession ¶
func KubernetesGetTmateSSHSession(clientset *kubernetes.Clientset, instanceName string, userName string) (output string, err error)
KubernetesGetTmateSSHSession ... given a clienset, instancename, and username, get the tmate SSH session for the Environment Pod
func KubernetesGetTmateWebSession ¶
func KubernetesGetTmateWebSession(clientset *kubernetes.Clientset, instanceName string, userName string) (output string, err error)
KubernetesGetTmateWebSession ... given a clienset, instancename, and username, get the tmate web session for the Environment Pod
func KubernetesUpsertInstanceWildcardTLSCert ¶
func KubernetesUpsertInstanceWildcardTLSCert(clientset *kubernetes.Clientset, instance InstanceSpec, secret *corev1.Secret) (err error)
KubernetesUpsertInstanceWildcardTLSCert ... given an instance clientset, username, and secert, upsert the secret to the instance
func KubernetesUpsertLocalInstanceWildcardTLSCert ¶
func KubernetesUpsertLocalInstanceWildcardTLSCert(clientset *kubernetes.Clientset, username string, secret *corev1.Secret) (err error)
KubernetesUpsertLocalInstanceWildcardTLSCert ... given a local clientset, username, and secret, locally upsert the secret
func KubernetesWaitForInstanceKubeconfig ¶
func KubernetesWaitForInstanceKubeconfig(clientset *kubernetes.Clientset, instanceName string)
KubernetesWaitForInstanceKubeconfig ... given a local clientset and instance name, wait for the instance kubeconfig to populate locally
func TemplateFuncMap ¶
TemplateFuncMap ... helpers for go templating
func UpdateInstanceNodeWithProviderID ¶
func UpdateInstanceNodeWithProviderID(clientset *kubernetes.Clientset, dynamicClient dynamic.Interface, instanceName string) error
UpdateInstanceNodeWithProviderID ... sets the ProviderID field in the Node resources of the target cluster
func ValidateInstance ¶
func ValidateInstance(instance InstanceSpec) (err error)
ValidateInstance ... ensure an Instance is valid
Types ¶
type ExecOptions ¶
type ExecOptions struct { Command []string Namespace string PodName string ContainerName string Stdin io.Reader CaptureStdout bool CaptureStderr bool // If false, whitespace in std{err,out} will be removed. PreserveWhitespace bool TTY bool }
ExecOptions ... passed to ExecWithOptions
type Ingress ¶
type Ingress struct { Protocol string `json:"protocol"` Host string `json:"host"` URL string `json:"url"` Source string `json:"source"` IngressClass string `json:"ingressClass"` }
func KubernetesGetInstanceIngresses ¶
func KubernetesGetInstanceIngresses(clientset *kubernetes.Clientset, instanceName string) (ingresses []Ingress, err error)
KubernetesGetInstanceIngresses ... given a clienset and instance name, return the Ingresses available on the instance
type Instance ¶
type Instance struct { Metadata types.JSONResponseMetadata `json:"metadata"` Spec InstanceSpec `json:"spec"` Status InstanceStatus `json:"status"` }
Instance ... generic instance swagger:response instance
func KubernetesGet ¶
func KubernetesGet(name string, kubernetesClientset dynamic.Interface, clientset *kubernetes.Clientset) (instance Instance, err error)
KubernetesGet ... Get a Kubernetes instance
func KubernetesList ¶
func KubernetesList(kubernetesClientset dynamic.Interface, clientset *kubernetes.Clientset, options InstanceListOptions) (instances []Instance, err error)
KubernetesList ... list all Kubernetes instances
func List ¶
func List(dynamicClient dynamic.Interface, clientset *kubernetes.Clientset, options InstanceListOptions) (instances []Instance, err error)
List ... list all instances
type InstanceCreateOptions ¶
type InstanceCreateOptions struct { DryRun bool NameScheme InstanceNameScheme }
InstanceCreateOptions ... options for creating instances
type InstanceFilter ¶
type InstanceFilter struct { Username string `json:"username"` Type InstanceType `json:"type"` }
InstanceFilter ... fields to filter by when listing
type InstanceIngressList ¶
type InstanceIngressList struct {
Metadata types.JSONResponseMetadata `json:"metadata"`
}
InstanceIngressList ... instance ingress list swagger:response instanceIngresses
type InstanceKubeconfig ¶
type InstanceKubeconfig struct { Metadata types.JSONResponseMetadata `json:"metadata"` Spec string `json:"spec"` }
InstanceKubeconfig ... kubeconfig response swagger:response instanceData
type InstanceList ¶
type InstanceList struct { Metadata types.JSONResponseMetadata `json:"metadata"` List []InstanceSpec `json:"list"` }
InstanceList ... generic instance list swagger:response instanceList
type InstanceListOptions ¶
type InstanceListOptions struct {
Filter InstanceFilter `json:"filter"`
}
InstanceListOptions ... options for listing instances
type InstanceNameScheme ¶
type InstanceNameScheme string
InstanceNameScheme ... schemes for naming instances
const ( InstanceNameSchemeSpecified InstanceNameScheme = "Specified" InstanceNameSchemeUsername InstanceNameScheme = "Username" InstanceNameSchemeGenerateFromUsername InstanceNameScheme = "GenerateFromUsername" )
valid schemes for naming instances
type InstanceResourceStatus ¶
type InstanceResourceStatus struct { KubeadmControlPlane clusterAPIControlPlaneKubeadmv1alpha3.KubeadmControlPlaneStatus Cluster clusterAPIv1alpha3.ClusterStatus EnvironmentPod corev1.PodStatus MachineStatus clusterAPIv1alpha3.MachineStatus PacketMachineUID *string }
InstanceResourceStatus ... various status fields for an instance
type InstanceSpec ¶
type InstanceSpec struct { Name string `json:"name"` Type InstanceType `json:"type"` Setup types.SetupSpec `json:"setup"` NodeSize string `json:"nodeSize"` NodeOS string `json:"nodeOS"` KubernetesNodeCount int `json:"kubernetesNodeCount"` Facility string `json:"facility"` NameScheme InstanceNameScheme `json:"nameScheme"` RegistryMirrors []string `json:"registryMirrors"` }
InstanceSpec ... specification for an instance
func Create ¶
func Create(instance InstanceSpec, dynamicClient dynamic.Interface, clientset *kubernetes.Clientset, options InstanceCreateOptions) (instanceCreated InstanceSpec, err error)
Create ... create an instance
func KubernetesCreate ¶
func KubernetesCreate(instance InstanceSpec, dynamicClient dynamic.Interface, clientset *kubernetes.Clientset, options InstanceCreateOptions) (instanceCreated InstanceSpec, err error)
KubernetesCreate ... create a Kubernetes Instance
func KubernetesUpdate ¶
func KubernetesUpdate(instance InstanceSpec) (instanceUpdated InstanceSpec, err error)
KubernetesUpdate ... update a Kubernetes instance
func Update ¶
func Update(instance InstanceSpec) (instanceUpdated InstanceSpec, err error)
Update ... update an instance
func UpdateInstanceSpecIfEnvOverrides ¶
func UpdateInstanceSpecIfEnvOverrides(instance InstanceSpec) InstanceSpec
UpdateInstanceSpecIfEnvOverrides ... sets overrides from instance.Setup.Env to set fields in instance this way is a quick way to test new fields for new instances, but ideally these fields will be written by the client
type InstanceStatus ¶
type InstanceStatus struct { Phase InstanceStatusPhase `json:"phase"` Resources InstanceResourceStatus `json:"resources"` }
InstanceStatus ... status fields
type InstanceStatusPhase ¶
type InstanceStatusPhase string
InstanceStatusPhase ... Instance phase status definitions
const ( InstanceStatusPhasePending InstanceStatusPhase = "Pending" InstanceStatusPhaseProvisioning InstanceStatusPhase = "Provisioning" InstanceStatusPhaseProvisioned InstanceStatusPhase = "Provisioned" InstanceStatusPhaseDeleting InstanceStatusPhase = "Deleting" )
phases for instance status
type InstanceType ¶
type InstanceType string
InstanceType ... types of valid instances
const ( InstanceTypeKubernetes InstanceType = "Kubernetes" InstanceTypePlain InstanceType = "Plain" )
instance types
type KubernetesCluster ¶
type KubernetesCluster struct { KubeadmControlPlane clusterAPIControlPlaneKubeadmv1alpha3.KubeadmControlPlane Cluster clusterAPIv1alpha3.Cluster MachineDeploymentWorker clusterAPIv1alpha3.MachineDeployment KubeadmConfigTemplateWorker cabpkv1.KubeadmConfigTemplate PacketMachineTemplate clusterAPIPacketv1alpha3.PacketMachineTemplate PacketCluster clusterAPIPacketv1alpha3.PacketCluster PacketMachineTemplateWorker clusterAPIPacketv1alpha3.PacketMachineTemplate }
KubernetesCluster ... resources required for Cluster-API to provision a Kubernetes cluster on Packet
func KubernetesTemplateResources ¶
func KubernetesTemplateResources(instance InstanceSpec, namespace string) (newInstance KubernetesCluster, err error)
KubernetesTemplateResources ... given an instance spec and namespace, return KubernetesCluster resources