Documentation
¶
Index ¶
- Constants
- Variables
- func AllControlPlaneComponents() []*v0.ControlPlaneComponent
- func DeleteNamespaces(kubeClient dynamic.Interface, mapper *meta.RESTMapper, namespaces []string) error
- func GetLocalThreeportAPIEndpoint(authEnabled bool) string
- func GetThreeportAPIPort(authEnabled bool) int
- func InstallThreeportCRDs(kubeClient dynamic.Interface, mapper *meta.RESTMapper) error
- func InstallThreeportSupportServicesOperator(kubeClient dynamic.Interface, mapper *meta.RESTMapper) error
- func InstallThreeportSystemServices(kubeClient dynamic.Interface, mapper *meta.RESTMapper, infraProvider string, ...) error
- type ControlPlane
- type ControlPlaneInstaller
- func (cpi *ControlPlaneInstaller) CreateOrUpdateKubeResource(resource *unstructured.Unstructured, kubeClient dynamic.Interface, ...) error
- func (cpi *ControlPlaneInstaller) CreateThreeportControlPlaneNamespace(kubeClient dynamic.Interface, mapper *meta.RESTMapper) error
- func (cpi *ControlPlaneInstaller) GetAPIServicePort() (string, int32)
- func (cpi *ControlPlaneInstaller) GetThreeportAPIEndpoint(kubeClient dynamic.Interface, mapper meta.RESTMapper) (string, error)
- func (cpi *ControlPlaneInstaller) GetThreeportAPIService(kubeClient dynamic.Interface, mapper meta.RESTMapper) (*unstructured.Unstructured, error)
- func (cpi *ControlPlaneInstaller) InstallComputeSpaceControlPlaneComponents(kubeClient dynamic.Interface, mapper *meta.RESTMapper, ...) error
- func (cpi *ControlPlaneInstaller) InstallThreeportAPITLS(kubeClient dynamic.Interface, mapper *meta.RESTMapper, ...) error
- func (cpi *ControlPlaneInstaller) InstallThreeportAgent(kubeClient dynamic.Interface, mapper *meta.RESTMapper, ...) error
- func (cpi *ControlPlaneInstaller) InstallThreeportControlPlaneDependencies(kubeClient dynamic.Interface, mapper *meta.RESTMapper, ...) error
- func (cpi *ControlPlaneInstaller) InstallThreeportControllers(kubeClient dynamic.Interface, mapper *meta.RESTMapper, ...) error
- func (cpi *ControlPlaneInstaller) SetAllImageRepo(imageRepo string)
- func (cpi *ControlPlaneInstaller) SetAllImageTags(imageTag string)
- func (cpi *ControlPlaneInstaller) UnInstallThreeportControlPlaneComponents(kubeClient dynamic.Interface, mapper *meta.RESTMapper) error
- func (cpi *ControlPlaneInstaller) UpdateControllerDeployment(kubeClient dynamic.Interface, mapper *meta.RESTMapper, ...) error
- func (cpi *ControlPlaneInstaller) UpdateThreeportAPIDeployment(kubeClient dynamic.Interface, mapper *meta.RESTMapper, dbCreds *auth.DbCreds) error
- func (cpi *ControlPlaneInstaller) UpdateThreeportAgentDeployment(kubeClient dynamic.Interface, mapper *meta.RESTMapper, ...) error
- type ControlPlaneTier
- type CustomInstallFunction
- type InstallerOption
- func CustomController(c *v0.ControlPlaneComponent) InstallerOption
- func CustomControllers(c []*v0.ControlPlaneComponent) InstallerOption
- func Name(n string) InstallerOption
- func Namespace(n string) InstallerOption
- func PostInstallFunction(f CustomInstallFunction) InstallerOption
- func PreInstallFunction(f CustomInstallFunction) InstallerOption
- func RestApi(r *v0.ControlPlaneComponent) InstallerOption
- type Options
Constants ¶
const ( DbInitFilename = "db.sql" DbInitLocation = "/etc/threeport/db-create" ThreeportApiCaSecret = "api-ca" )
const ( SupportServicesNamespace = "support-services-system" SupportServicesOperatorImage = "ghcr.io/nukleros/support-services-operator:v0.6.0" RBACProxyImage = "gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0" // links the service account delcared in the IngressComponent resource to the // resource config for github.com/nukleros/aws-builder to create the attached IAM role. DNSManagerServiceAccountName = "external-dns" DNSManagerServiceAccountNamepace = "nukleros-gateway-system" DNS01ChallengeServiceAccountName = "cert-manager" DNS01ChallengeServiceAccountNamepace = "nukleros-certs-system" SecretsManagerServiceAccountName = "external-secrets" SecretsManagerServiceAccountNamespace = "nukleros-secrets-system" // links the service account used by the EBS CSI driver to the resource // config for github.com/nukleros/aws-builder to create the attached IAM role. StorageManagerServiceAccountName = "ebs-csi-controller-sa" StorageManagerServiceAccountNamespace = "kube-system" // links the service account used by the cluster autoscaler installation to // the config for github.com/nukleros/aws-builder to create the attached IAM role. ClusterAutoscalerServiceAccountName = "cluster-autoscaler" ClusterAutoscalerNamespace = "kube-system" )
const ( // Official image repo for threeport images ThreeportImageRepo = "ghcr.io/threeport" // Development image repo used for local development DevImageRepo = "localhost:5001" // Official image names for threeport control plane components ThreeportAPIImage = "threeport-rest-api" ThreeportDatabaseMigratorImage = "threeport-database-migrator" ThreeportWorkloadControllerImage = "threeport-workload-controller" ThreeportKubernetesRuntimeControllerImage = "threeport-kubernetes-runtime-controller" ThreeportControlPlaneControllerImage = "threeport-control-plane-controller" ThreeportAwsControllerImage = "threeport-aws-controller" ThreeportGatewayControllerImage = "threeport-gateway-controller" ThreeportHelmWorkloadControllerImage = "threeport-helm-workload-controller" ThreeportTerraformControllerImage = "threeport-terraform-controller" ThreeportObservabilityControllerImage = "threeport-observability-controller" ThreeportSecretControllerImage = "threeport-secret-controller" ThreeportAgentImage = "threeport-agent" // Name of threeport control plane components ThreeportRestApiName = "rest-api" ThreeportDatabaseMigratorName = "database-migrator" ThreeportWorkloadControllerName = "workload-controller" ThreeportKubernetesRuntimeControllerName = "kubernetes-runtime-controller" ThreeportControlPlaneControllerName = "control-plane-controller" ThreeportAwsControllerName = "aws-controller" ThreeportGatewayControllerName = "gateway-controller" ThreeportHelmWorkloadControllerName = "helm-workload-controller" ThreeportTerraformControllerName = "terraform-controller" ThreeportObservabilityControllerName = "observability-controller" ThreeportSecretControllerName = "secret-controller" ThreeportAgentName = "agent" // Endpoint for threeport API when running locally ThreeportLocalAPIEndpoint = "localhost" // Name of Kubernetes service resource for threeport API ThreeportAPIServiceResourceName = "threeport-api-server" // Name of Kubernetes deployment resource for threeport agent ThreeportAgentDeployName = "threeport-agent" // Name of default Kuberentes service account resource DefaultServiceAccount = "default" // Cockroach db image tag DatabaseImageTag = "v23.1.14" // The Kubernetes namespace in which the threeport control plane is // installed ControlPlaneNamespace = "threeport-control-plane" ControlPlaneName = "threeport" // The maximum length of a threeport instance name is currently limited by // the length of role names in AWS which must include the threeport instance // name to preserve global uniqueness. // * AWS role name max length = 64 chars // * Allow 15 chars for role names (defined in github.com/nukleros/aws-builder) // * Allow 10 chars for "threeport-" prefix InstanceNameMaxLength = 30 ControlPlaneTierDev = "development" ControlPlaneTierProd = "production" )
Variables ¶
var DatabaseMigrator *v0.ControlPlaneComponent = &v0.ControlPlaneComponent{ Name: ThreeportDatabaseMigratorName, BinaryName: ThreeportDatabaseMigratorName, ImageName: ThreeportDatabaseMigratorImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), }
var ThreeportAgent *v0.ControlPlaneComponent = &v0.ControlPlaneComponent{ Name: ThreeportAgentName, BinaryName: ThreeportAgentName, ImageName: ThreeportAgentImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), ServiceAccountName: DefaultServiceAccount, Enabled: &enabled, }
var ThreeportControllerList []*v0.ControlPlaneComponent = []*v0.ControlPlaneComponent{ { Name: ThreeportWorkloadControllerName, BinaryName: ThreeportWorkloadControllerName, ImageName: ThreeportWorkloadControllerImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), ServiceAccountName: DefaultServiceAccount, Enabled: &enabled, }, { Name: ThreeportKubernetesRuntimeControllerName, BinaryName: ThreeportKubernetesRuntimeControllerName, ImageName: ThreeportKubernetesRuntimeControllerImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), ServiceAccountName: DefaultServiceAccount, Enabled: &enabled, }, { Name: ThreeportAwsControllerName, BinaryName: ThreeportAwsControllerName, ImageName: ThreeportAwsControllerImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), ServiceAccountName: DefaultServiceAccount, Enabled: &enabled, }, { Name: ThreeportGatewayControllerName, BinaryName: ThreeportGatewayControllerName, ImageName: ThreeportGatewayControllerImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), ServiceAccountName: DefaultServiceAccount, Enabled: &enabled, }, { Name: ThreeportControlPlaneControllerName, BinaryName: ThreeportControlPlaneControllerName, ImageName: ThreeportControlPlaneControllerImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), ServiceAccountName: DefaultServiceAccount, Enabled: &enabled, }, { Name: ThreeportHelmWorkloadControllerName, BinaryName: ThreeportHelmWorkloadControllerName, ImageName: ThreeportHelmWorkloadControllerImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), ServiceAccountName: DefaultServiceAccount, Enabled: &enabled, }, { Name: ThreeportTerraformControllerName, BinaryName: ThreeportTerraformControllerName, ImageName: ThreeportTerraformControllerImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), ServiceAccountName: DefaultServiceAccount, Enabled: &enabled, }, { Name: ThreeportObservabilityControllerName, BinaryName: ThreeportObservabilityControllerName, ImageName: ThreeportObservabilityControllerImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), ServiceAccountName: DefaultServiceAccount, Enabled: &enabled, }, { Name: ThreeportSecretControllerName, BinaryName: ThreeportSecretControllerName, ImageName: ThreeportSecretControllerImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), ServiceAccountName: DefaultServiceAccount, Enabled: &enabled, }, }
var ThreeportRestApi *v0.ControlPlaneComponent = &v0.ControlPlaneComponent{ Name: ThreeportRestApiName, BinaryName: ThreeportRestApiName, ImageName: ThreeportAPIImage, ImageRepo: ThreeportImageRepo, ImageTag: version.GetVersion(), ServiceAccountName: DefaultServiceAccount, ServiceResourceName: ThreeportAPIServiceResourceName, Enabled: &enabled, }
Functions ¶
func AllControlPlaneComponents ¶
func AllControlPlaneComponents() []*v0.ControlPlaneComponent
AllControlPlaneComponents returns a list of all control plane components.
func DeleteNamespaces ¶ added in v0.5.0
func DeleteNamespaces( kubeClient dynamic.Interface, mapper *meta.RESTMapper, namespaces []string, ) error
DeleteNamespace deletes a list of namespaces from a Kubernetes cluster.
func GetLocalThreeportAPIEndpoint ¶
GetLocalThreeportAPIEndpoint returns the endpoint for the threeport API running locally.
func GetThreeportAPIPort ¶
GetThreeportAPIPort returns the port that the threeport API is running on.
func InstallThreeportCRDs ¶
func InstallThreeportCRDs( kubeClient dynamic.Interface, mapper *meta.RESTMapper, ) error
InstallThreeportCRDs installs all CRDs needed by threeport in the target cluster.
func InstallThreeportSupportServicesOperator ¶
func InstallThreeportSupportServicesOperator( kubeClient dynamic.Interface, mapper *meta.RESTMapper, ) error
InstallThreeportSupportServicesOperator installs the support services operator
func InstallThreeportSystemServices ¶
func InstallThreeportSystemServices( kubeClient dynamic.Interface, mapper *meta.RESTMapper, infraProvider string, clusterName string, accountId string, ) error
InstallThreeportSystemServices installs system services that do not directly service tenant workload such as cluster autoscaler. Installed only on clusters using eks provider.
Types ¶
type ControlPlane ¶
type ControlPlane struct { InfraProvider v0.KubernetesRuntimeInfraProvider Tier ControlPlaneTier }
ControlPlane is an instance of a threeport control plane.
type ControlPlaneInstaller ¶
type ControlPlaneInstaller struct {
Opts Options
}
func NewInstaller ¶
func NewInstaller(os ...InstallerOption) *ControlPlaneInstaller
func (*ControlPlaneInstaller) CreateOrUpdateKubeResource ¶
func (cpi *ControlPlaneInstaller) CreateOrUpdateKubeResource( resource *unstructured.Unstructured, kubeClient dynamic.Interface, mapper *meta.RESTMapper, ) error
CreateOrUpdateKubeResource creates or updates a Kubernetes resource.
func (*ControlPlaneInstaller) CreateThreeportControlPlaneNamespace ¶
func (cpi *ControlPlaneInstaller) CreateThreeportControlPlaneNamespace( kubeClient dynamic.Interface, mapper *meta.RESTMapper, ) error
CreateThreeportControlPlaneNamespace creates the threeport control plane namespace in a Kubernetes cluster.
func (*ControlPlaneInstaller) GetAPIServicePort ¶
func (cpi *ControlPlaneInstaller) GetAPIServicePort() (string, int32)
GetAPIServicePort returns threeport API's service port based on infra provider. For kind returns 80 or 443 based on whether authentication is enabled.
func (*ControlPlaneInstaller) GetThreeportAPIEndpoint ¶
func (cpi *ControlPlaneInstaller) GetThreeportAPIEndpoint( kubeClient dynamic.Interface, mapper meta.RESTMapper, ) (string, error)
GetThreeportAPIEndpoint retrieves the endpoint given to the threeport API when the external load balancer was provisioned by the infra provider. It will attempt to retrieve this value several times since the load balancer value may not be available immediately.
func (*ControlPlaneInstaller) GetThreeportAPIService ¶
func (cpi *ControlPlaneInstaller) GetThreeportAPIService( kubeClient dynamic.Interface, mapper meta.RESTMapper, ) (*unstructured.Unstructured, error)
getThreeportAPIService returns the Kubernetes service resource for the threeport API as an unstructured object.
func (*ControlPlaneInstaller) InstallComputeSpaceControlPlaneComponents ¶
func (cpi *ControlPlaneInstaller) InstallComputeSpaceControlPlaneComponents( kubeClient dynamic.Interface, mapper *meta.RESTMapper, runtimeInstanceName string, ) error
InstallComputeSpaceControlPlaneComponents installs the Threeport control plane components that are deployed to Threeport-managed compute space clusters, i.e. clusters that do not have the Threeport control plane installed.
func (*ControlPlaneInstaller) InstallThreeportAPITLS ¶
func (cpi *ControlPlaneInstaller) InstallThreeportAPITLS( kubeClient dynamic.Interface, mapper *meta.RESTMapper, authConfig *auth.AuthConfig, serverAltName string, ) error
InstallThreeportAPITLS installs TLS assets for threeport API.
func (*ControlPlaneInstaller) InstallThreeportAgent ¶
func (cpi *ControlPlaneInstaller) InstallThreeportAgent( kubeClient dynamic.Interface, mapper *meta.RESTMapper, threeportInstanceName string, authConfig *auth.AuthConfig, ) error
InstallThreeportAgent installs the threeport agent on a Kubernetes cluster.
func (*ControlPlaneInstaller) InstallThreeportControlPlaneDependencies ¶
func (cpi *ControlPlaneInstaller) InstallThreeportControlPlaneDependencies( kubeClient dynamic.Interface, mapper *meta.RESTMapper, infraProvider, encryptionKey string, dbCreds *auth.DbCreds, ) error
InstallThreeportControlPlaneDependencies installs the necessary components for the threeport REST API and controllers to operate. It includes the database and message broker.
func (*ControlPlaneInstaller) InstallThreeportControllers ¶
func (cpi *ControlPlaneInstaller) InstallThreeportControllers( kubeClient dynamic.Interface, mapper *meta.RESTMapper, authConfig *auth.AuthConfig, ) error
InstallThreeportControllers installs the threeport controllers in a Kubernetes cluster.
func (*ControlPlaneInstaller) SetAllImageRepo ¶
func (cpi *ControlPlaneInstaller) SetAllImageRepo(imageRepo string)
func (*ControlPlaneInstaller) SetAllImageTags ¶
func (cpi *ControlPlaneInstaller) SetAllImageTags(imageTag string)
func (*ControlPlaneInstaller) UnInstallThreeportControlPlaneComponents ¶
func (cpi *ControlPlaneInstaller) UnInstallThreeportControlPlaneComponents( kubeClient dynamic.Interface, mapper *meta.RESTMapper, ) error
UnInstallThreeportControlPlaneComponents removes any threeport components that are tied to infrastructure. It removes the threeport API's service resource that removes the load balancer. The load balancer must be removed prior to deleting infra.
func (*ControlPlaneInstaller) UpdateControllerDeployment ¶
func (cpi *ControlPlaneInstaller) UpdateControllerDeployment( kubeClient dynamic.Interface, mapper *meta.RESTMapper, controller v0.ControlPlaneComponent, ) error
UpdateControllerDeployment installs a threeport controller by name.
func (*ControlPlaneInstaller) UpdateThreeportAPIDeployment ¶
func (cpi *ControlPlaneInstaller) UpdateThreeportAPIDeployment( kubeClient dynamic.Interface, mapper *meta.RESTMapper, dbCreds *auth.DbCreds, ) error
UpdateThreeportAPIDeployment installs the threeport API in a Kubernetes cluster.
func (*ControlPlaneInstaller) UpdateThreeportAgentDeployment ¶
func (cpi *ControlPlaneInstaller) UpdateThreeportAgentDeployment( kubeClient dynamic.Interface, mapper *meta.RESTMapper, threeportInstanceName string, ) error
UpdateThreeportAgentDeployment updates the threeport agent on a Kubernetes cluster.
type ControlPlaneTier ¶
type ControlPlaneTier string
ControlPlaneTier denotes what level of availability and data retention is employed for an installation of a threeport control plane.
type CustomInstallFunction ¶
type CustomInstallFunction func(*v0.KubernetesRuntimeInstance, *ControlPlaneInstaller) error
type InstallerOption ¶
type InstallerOption func(o *Options)
func CustomController ¶
func CustomController(c *v0.ControlPlaneComponent) InstallerOption
func CustomControllers ¶
func CustomControllers(c []*v0.ControlPlaneComponent) InstallerOption
func Name ¶
func Name(n string) InstallerOption
func Namespace ¶
func Namespace(n string) InstallerOption
func PostInstallFunction ¶
func PostInstallFunction(f CustomInstallFunction) InstallerOption
func PreInstallFunction ¶
func PreInstallFunction(f CustomInstallFunction) InstallerOption
func RestApi ¶
func RestApi(r *v0.ControlPlaneComponent) InstallerOption
type Options ¶
type Options struct { // Name of the control plane being installed, by default it is Threeport. Name string // Namespace of the control plane Namespace string // A function that is run prior to installing the components for the control plane. PreInstallFunction CustomInstallFunction // A function that is run after installing the components for the control plane. PostInstallFunction CustomInstallFunction // List of controllers to install as part of the control plane ControllerList []*v0.ControlPlaneComponent // Info for the Rest Api being installed RestApiInfo *v0.ControlPlaneComponent // Additionl init containers for rest api RestApiAdditionalInitContainers []map[string]interface{} // Info for the Database migrator being installed for the Rest Api DatabaseMigratorInfo *v0.ControlPlaneComponent // Info for the agent being installed AgentInfo *v0.ControlPlaneComponent // A boolean used to indicate whether the installer is being run from within threeport itself such as a reconciler InThreeport bool // CreateOrUpdate Kube resources during install. If true, resources will be updated if they already exist. If false, an error will occur if a resource already exists. CreateOrUpdateKubeResources bool // Installer option to determine if auth is enabled/disabled AuthEnabled bool // The AWS config profile to draw credentials from when using eks provider. AwsConfigProfile string // Retrieve AWS credentials from environment variables when using eks provider. AwsConfigEnv bool // AWS region code to install threeport control plane in. AwsRegion string // Path to config file for threeport CfgFile string // The root domain name to use for the Threeport API. Requires a public hosted zone in AWS Route53. A subdomain for the Threeport API will be added to the root domain. CreateRootDomain string // Email address of control plane admin. Provided to TLS provider. CreateAdminEmail string // Bool used to indicate whether installing in Dev environment or not DevEnvironment bool // EncryptionKey is the key used to encrypt and decrypt sensitive fields. EncryptionKey string // Overwrite any applicable config entries ForceOverwriteConfig bool // Name of the Control Plane being installed ControlPlaneName string // InfraProvider to instal control plane on e.g. kind, eks etc InfraProvider string // Path to kube config KubeconfigPath string // Number of additional worker nodes to deploy. Only applies to kind provider. (default is 0) NumWorkerNodes int // Path to infra provider config directory where cloud infra inventory is saved. ProviderConfigDir string // Path to threeport repository root ThreeportPath string // If true, run in debug mode. Appropriate for development environments only. Debug bool // If true, live changes made in development will be live-reloaded into control plane components. Only applicable for kind infra-provider. LiveReload bool // If true, infrastructure is not provisioned, control plane is installed on existing infra. ControlPlaneOnly bool // Port forwards for kind infra provider KindInfraPortForward []string // If true, an EKS load balancer is provisioned for the threeport API. RestApiEksLoadBalancer bool // verbose logging Verbose bool // provide any additional conditions to be added to aws IRSA AdditionalAwsIrsaConditions []string // A general map to pass around information between various install phases. AdditionalOptions map[string]interface{} // Skip teardown of control plane components if an error is encountered. SkipTeardown bool // Create and connect local container registry for local control plane // clusters. LocalRegistry bool }