Documentation
¶
Index ¶
- Constants
- func Create(ctx context.Context, cl crclient.Client, ...) func() error
- func FilterAllProviders() []string
- func Generate(templateType templates.Type, clusterName, template string) *kcmv1.ClusterDeployment
- func GenerateClusterName(postfix string) string
- func GetProviderLabel(provider ProviderType) string
- func PatchHostedClusterReady(kc *kubeclient.KubeClient, provider ProviderType, clusterName string)
- func ValidateClusterTemplates(ctx context.Context, client *kubeclient.KubeClient) error
- func ValidateDeployment(ctx context.Context, kc *kubeclient.KubeClient, name string) error
- func ValidateDeploymentVars(v []string)
- func ValidateService(ctx context.Context, kc *kubeclient.KubeClient, name string) error
- type ManagedServiceResource
- type ProviderType
- type ProviderValidator
- type ServiceValidator
- type ValidationAction
Constants ¶
const ( // Common EnvVarClusterDeploymentName = "CLUSTER_DEPLOYMENT_NAME" EnvVarClusterDeploymentPrefix = "CLUSTER_DEPLOYMENT_PREFIX" EnvVarClusterDeploymentTemplate = "CLUSTER_DEPLOYMENT_TEMPLATE" EnvVarNamespace = "NAMESPACE" // EnvVarNoCleanup disables After* cleanup in provider specs to allow for // debugging of test failures. EnvVarNoCleanup = "NO_CLEANUP" EnvVarManagementClusterName = "MANAGEMENT_CLUSTER_NAME" // AWS EnvVarAWSAccessKeyID = "AWS_ACCESS_KEY_ID" EnvVarAWSSecretAccessKey = "AWS_SECRET_ACCESS_KEY" EnvVarAWSVPCID = "AWS_VPC_ID" EnvVarAWSSubnets = "AWS_SUBNETS" EnvVarAWSInstanceType = "AWS_INSTANCE_TYPE" EnvVarAWSAMIID = "AWS_AMI_ID" EnvVarAWSSecurityGroupID = "AWS_SG_ID" // VSphere EnvVarVSphereUser = "VSPHERE_USER" EnvVarVSpherePassword = "VSPHERE_PASSWORD" EnvVarVSphereServer = "VSPHERE_SERVER" EnvVarVSphereThumbprint = "VSPHERE_THUMBPRINT" EnvVarVSphereDatacenter = "VSPHERE_DATACENTER" EnvVarVSphereDatastore = "VSPHERE_DATASTORE" EnvVarVSphereResourcepool = "VSPHERE_RESOURCEPOOL" EnvVarVSphereFolder = "VSPHERE_FOLDER" EnvVarVSphereControlPlaneEndpoint = "VSPHERE_CONTROL_PLANE_ENDPOINT" EnvVarVSphereVMTemplate = "VSPHERE_VM_TEMPLATE" EnvVarVSphereNetwork = "VSPHERE_NETWORK" EnvVarVSphereSSHKey = "VSPHERE_SSH_KEY" EnvVarVSphereHostedControlPlaneEndpoint = "VSPHERE_HOSTED_CONTROL_PLANE_ENDPOINT" // Azure EnvVarAzureClientSecret = "AZURE_CLIENT_SECRET" EnvVarAzureClientID = "AZURE_CLIENT_ID" EnvVarAzureTenantID = "AZURE_TENANT_ID" EnvVarAzureSubscription = "AZURE_SUBSCRIPTION_ID" EnvVarAzureVMSize = "AZURE_VM_SIZE" EnvVarAzureImageGallery = "AZURE_IMAGE_GALLERY" EnvVarAzureImageName = "AZURE_IMAGE_NAME" EnvVarAzureImageVersion = "AZURE_IMAGE_VERSION" // GCP EnvVarGCPEncodedCredentials = "GCP_B64ENCODED_CREDENTIALS" EnvVarGCPProject = "GCP_PROJECT" EnvVarGCPRegion = "GCP_REGION" EnvVarGCPInstanceType = "GCP_INSTANCE_TYPE" EnvVarGCPImage = "GCP_IMAGE" EnvVarGCPRootDeviceType = "GCP_ROOT_DEVICE_TYPE" // Adopted EnvVarAdoptedKubeconfigData = "KUBECONFIG_DATA" // Remote EnvVarPrivateSSHKeyB64 = "PRIVATE_SSH_KEY_B64" )
Variables ¶
This section is empty.
Functions ¶
func Create ¶ added in v1.0.0
func Create(ctx context.Context, cl crclient.Client, clusterDeployment *kcmv1.ClusterDeployment) func() error
Create creates a clusterdeployment.k0rdent.mirantis.com and returns a DeleteFunc to clean up the deployment. The DeleteFunc is a no-op if the deployment has already been deleted.
func FilterAllProviders ¶
func FilterAllProviders() []string
func Generate ¶ added in v1.0.0
func Generate(templateType templates.Type, clusterName, template string) *kcmv1.ClusterDeployment
func GenerateClusterName ¶ added in v0.2.0
func GetProviderLabel ¶
func GetProviderLabel(provider ProviderType) string
func PatchHostedClusterReady ¶
func PatchHostedClusterReady(kc *kubeclient.KubeClient, provider ProviderType, clusterName string)
PatchHostedClusterReady patches a hosted clusters' infrastructure resource as Ready depending on the given provider. See: https://docs.k0smotron.io/stable/capi-aws/#prepare-the-aws-infra-provider Use Eventually as the resource might not be available immediately following a ClusterDeployment creation.
func ValidateClusterTemplates ¶ added in v0.1.0
func ValidateClusterTemplates(ctx context.Context, client *kubeclient.KubeClient) error
func ValidateDeployment ¶ added in v0.1.0
func ValidateDeployment(ctx context.Context, kc *kubeclient.KubeClient, name string) error
func ValidateDeploymentVars ¶
func ValidateDeploymentVars(v []string)
func ValidateService ¶ added in v0.1.0
func ValidateService(ctx context.Context, kc *kubeclient.KubeClient, name string) error
Types ¶
type ManagedServiceResource ¶ added in v0.1.0
type ManagedServiceResource struct {
// ResourceNameSuffix is the suffix added to the resource name
ResourceNameSuffix string
// ValidationFunc is the validation function for the resource
ValidationFunc resourceValidationFunc
}
type ProviderType ¶
type ProviderType string
const ( ProviderCAPI ProviderType = "cluster-api" ProviderAWS ProviderType = "infrastructure-aws" ProviderAzure ProviderType = "infrastructure-azure" ProviderGCP ProviderType = "infrastructure-gcp" ProviderVSphere ProviderType = "infrastructure-vsphere" ProviderAdopted ProviderType = "infrastructure-internal" )
type ProviderValidator ¶
type ProviderValidator struct {
// contains filtered or unexported fields
}
ProviderValidator is a struct that contains the necessary information to validate a provider's resources. Some providers do not support all of the resources that can potentially be validated.
func NewProviderValidator ¶
func NewProviderValidator(templateType templates.Type, clusterName string, action ValidationAction) *ProviderValidator
func (*ProviderValidator) Validate ¶
func (p *ProviderValidator) Validate(ctx context.Context, kc *kubeclient.KubeClient) error
Validate is a provider-agnostic verification that checks for a specific set of resources and either validates their readiness or their deletion depending on the passed map of resourceValidationFuncs and desired order. It is meant to be used in conjunction with an Eventually block. In some cases it may be necessary to end the Eventually block early if the resource will never reach a ready state, in these instances Ginkgo's Fail should be used to end the spec early.
type ServiceValidator ¶ added in v0.1.0
type ServiceValidator struct {
// contains filtered or unexported fields
}
func NewServiceValidator ¶ added in v0.1.0
func NewServiceValidator(clusterName, serviceName, namespace string) *ServiceValidator
func (*ServiceValidator) Validate ¶ added in v0.1.0
func (v *ServiceValidator) Validate(ctx context.Context, kc *kubeclient.KubeClient) error
func (*ServiceValidator) WithResourceValidation ¶ added in v0.1.0
func (v *ServiceValidator) WithResourceValidation(resourceName string, resource ManagedServiceResource) *ServiceValidator
type ValidationAction ¶
type ValidationAction string
const ( ValidationActionDeploy ValidationAction = "deploy" ValidationActionDelete ValidationAction = "delete" )