Documentation
¶
Index ¶
- Constants
- func APIEndpoint() (string, error)
- func IsHealthyCluster(healthStatus *apiv1.ClusterHealth) bool
- func KubernetesVersion() string
- func Logout()
- func NewKubermaticClient(endpointURL string) (*client.KubermaticAPI, error)
- func NewRoundTripperWithRetries(t *testing.T, requestTimeout time.Duration, backoff Backoff, ...) http.RoundTripper
- func OIDCAdminCredentials() (string, string, error)
- func OIDCCredentials() (string, string, error)
- func RetrieveAdminMasterToken(ctx context.Context) (string, error)
- func RetrieveMasterToken(ctx context.Context) (string, error)
- func SetupParams(t *testing.T, p requestParameterHolder, interval time.Duration, ...)
- func SetupRetryParams(t *testing.T, p requestParameterHolder, backoff Backoff, ...)
- func WaitFor(interval time.Duration, timeout time.Duration, callback func() bool) bool
- type Backoff
- type PatchCluster
- type TestClient
- func (r *TestClient) AddProjectUser(projectID, email, name, group string) (*apiv1.User, error)
- func (r *TestClient) AddTokenToServiceAccount(name, saID, projectID string) (*apiv1.ServiceAccountToken, error)
- func (r *TestClient) AssignSSHKeyToCluster(projectID, clusterID, dc, keyID string) error
- func (r *TestClient) BindUserToClusterRole(projectID, dc, clusterID, roleName, user string) (*apiv1.ClusterRoleBinding, error)
- func (r *TestClient) BindUserToRole(projectID, dc, clusterID, roleName, namespace, user string) (*apiv1.RoleBinding, error)
- func (r *TestClient) CleanupCluster(t *testing.T, projectID, dc, clusterID string)
- func (r *TestClient) CleanupProject(t *testing.T, id string)
- func (r *TestClient) CreateAWSCluster(...) (*apiv1.Cluster, error)
- func (r *TestClient) CreateDC(seed string, dc *models.Datacenter) (*models.Datacenter, error)
- func (r *TestClient) CreateDOCluster(projectID, dc, name, credential, version, location string, replicas int32) (*apiv1.Cluster, error)
- func (r *TestClient) CreateProject(name string) (*apiv1.Project, error)
- func (r *TestClient) CreateServiceAccount(name, group, projectID string) (*apiv1.ServiceAccount, error)
- func (r *TestClient) CreateUserSSHKey(projectID, keyName, publicKey string) (*apiv1.SSHKey, error)
- func (r *TestClient) DeleteCluster(projectID, dc, clusterID string) error
- func (r *TestClient) DeleteDC(seed, dc string) error
- func (r *TestClient) DeleteProject(id string) error
- func (r *TestClient) DeleteServiceAccount(saID, projectID string) error
- func (r *TestClient) DeleteTokenForServiceAccount(tokenID, saID, projectID string) error
- func (r *TestClient) DeleteUserFromProject(projectID, userID string) error
- func (r *TestClient) DeleteUserSSHKey(projectID, keyID string) error
- func (r *TestClient) DetachSSHKeyFromClusterParams(projectID, clusterID, dc, keyID string) error
- func (r *TestClient) GetCluster(projectID, dc, clusterID string) (*apiv1.Cluster, error)
- func (r *TestClient) GetClusterBindings(projectID, dc, clusterID string) ([]apiv1.ClusterRoleBinding, error)
- func (r *TestClient) GetClusterEvents(projectID, dc, clusterID string) ([]*models.Event, error)
- func (r *TestClient) GetClusterHealthStatus(projectID, dc, clusterID string) (*apiv1.ClusterHealth, error)
- func (r *TestClient) GetClusterNodeDeployments(projectID, dc, clusterID string) ([]apiv1.NodeDeployment, error)
- func (r *TestClient) GetClusterRoles(projectID, dc, clusterID string) ([]apiv1.ClusterRoleName, error)
- func (r *TestClient) GetDC(dc string) (*models.Datacenter, error)
- func (r *TestClient) GetDCForProvider(provider, dc string) (*models.Datacenter, error)
- func (r *TestClient) GetDCForSeed(seed, dc string) (*models.Datacenter, error)
- func (r *TestClient) GetGlobalSettings() (*apiv1.GlobalSettings, error)
- func (r *TestClient) GetKubeconfig(dc, projectID, clusterID string) (string, error)
- func (r *TestClient) GetProject(id string) (*apiv1.Project, error)
- func (r *TestClient) GetProjectUsers(projectID string) ([]apiv1.User, error)
- func (r *TestClient) GetRoles(projectID, dc, clusterID string) ([]apiv1.RoleName, error)
- func (r *TestClient) GetServiceAccount(saID, projectID string) (*apiv1.ServiceAccount, error)
- func (r *TestClient) ListCredentials(providerName, datacenter string) ([]string, error)
- func (r *TestClient) ListDC() ([]*models.Datacenter, error)
- func (r *TestClient) ListDCForProvider(provider string) ([]*models.Datacenter, error)
- func (r *TestClient) ListDCForSeed(seed string) ([]*models.Datacenter, error)
- func (r *TestClient) ListGCPDiskTypes(credential, zone string) ([]string, error)
- func (r *TestClient) ListGCPSizes(credential, zone string) ([]apiv1.GCPMachineSize, error)
- func (r *TestClient) ListGCPZones(credential, dc string) ([]string, error)
- func (r *TestClient) ListProjects(displayAll bool) ([]*apiv1.Project, error)
- func (r *TestClient) ListUserSSHKey(projectID string) ([]*apiv1.SSHKey, error)
- func (r *TestClient) Logout() error
- func (r *TestClient) PatchDC(seed, dcToPatch, patch string) (*models.Datacenter, error)
- func (r *TestClient) PrintClusterEvents(projectID, dc, clusterID string) error
- func (r *TestClient) SetAdmin(email string, isAdmin bool) error
- func (r *TestClient) UpdateCluster(projectID, dc, clusterID string, patch PatchCluster) (*apiv1.Cluster, error)
- func (r *TestClient) UpdateDC(seed, dcToUpdate string, dc *models.Datacenter) (*models.Datacenter, error)
- func (r *TestClient) UpdateGlobalSettings(patch json.RawMessage) (*apiv1.GlobalSettings, error)
- func (r *TestClient) UpdateProject(projectToUpdate *apiv1.Project) (*apiv1.Project, error)
- func (r *TestClient) WaitForClusterHealthy(projectID, dc, clusterID string) error
- func (r *TestClient) WaitForClusterNodeDeploymentsToByReady(projectID, dc, clusterID string, replicas int32) error
- func (r *TestClient) WaitForClusterNodeDeploymentsToExist(projectID, dc, clusterID string) error
Constants ¶
const ( LoginEnvironmentVariable = "KUBERMATIC_OIDC_LOGIN" PasswordEnvironmentVariable = "KUBERMATIC_OIDC_PASSWORD" DexValuesFileEnvironmentVariable = "KUBERMATIC_DEX_VALUES_FILE" )
Variables ¶
This section is empty.
Functions ¶
func APIEndpoint ¶
func IsHealthyCluster ¶
func IsHealthyCluster(healthStatus *apiv1.ClusterHealth) bool
IsHealthyCluster check if all cluster components are up
func KubernetesVersion ¶
func KubernetesVersion() string
func Logout ¶
func Logout()
Logout resets the runtime cache for the master/admin tokens and forces a new login to Dex.
func NewKubermaticClient ¶
func NewKubermaticClient(endpointURL string) (*client.KubermaticAPI, error)
func OIDCAdminCredentials ¶
OIDCAdminCredentials takes the admin login name and password from environment variables and returns them.
func OIDCCredentials ¶
OIDCCredentials takes the login name and password from environment variables and returns them.
func SetupParams ¶
func SetupParams(t *testing.T, p requestParameterHolder, interval time.Duration, timeout time.Duration, ignoredStatusCodes ...int)
SetupParams configures retries for HTTP calls for a total period defined by 'timeout' parameter and for an 'interval' duration. Deprecated: Use SetupRetryParams instead.
Types ¶
type PatchCluster ¶
type TestClient ¶
type TestClient struct {
// contains filtered or unexported fields
}
TestClient wraps the Swagger-generated API client with some more convenient functions, tailor-made for writing tests.
func NewTestClient ¶
func NewTestClient(token string, t *testing.T) *TestClient
func (*TestClient) AddProjectUser ¶
func (r *TestClient) AddProjectUser(projectID, email, name, group string) (*apiv1.User, error)
func (*TestClient) AddTokenToServiceAccount ¶
func (r *TestClient) AddTokenToServiceAccount(name, saID, projectID string) (*apiv1.ServiceAccountToken, error)
AddTokenToServiceAccount creates a new token for service account
func (*TestClient) AssignSSHKeyToCluster ¶
func (r *TestClient) AssignSSHKeyToCluster(projectID, clusterID, dc, keyID string) error
AssignSSHKeyToCluster adds user SSH key to the cluster
func (*TestClient) BindUserToClusterRole ¶
func (r *TestClient) BindUserToClusterRole(projectID, dc, clusterID, roleName, user string) (*apiv1.ClusterRoleBinding, error)
BindUserToClusterRole
func (*TestClient) BindUserToRole ¶
func (r *TestClient) BindUserToRole(projectID, dc, clusterID, roleName, namespace, user string) (*apiv1.RoleBinding, error)
func (*TestClient) CleanupCluster ¶
func (r *TestClient) CleanupCluster(t *testing.T, projectID, dc, clusterID string)
func (*TestClient) CleanupProject ¶
func (r *TestClient) CleanupProject(t *testing.T, id string)
func (*TestClient) CreateAWSCluster ¶
func (r *TestClient) CreateAWSCluster(projectID, dc, name, secretAccessKey, accessKeyID, version, location, availabilityZone string, replicas int32) (*apiv1.Cluster, error)
CreateAWSCluster creates cluster for AWS provider
func (*TestClient) CreateDC ¶
func (r *TestClient) CreateDC(seed string, dc *models.Datacenter) (*models.Datacenter, error)
func (*TestClient) CreateDOCluster ¶
func (r *TestClient) CreateDOCluster(projectID, dc, name, credential, version, location string, replicas int32) (*apiv1.Cluster, error)
CreateDOCluster creates cluster for DigitalOcean provider
func (*TestClient) CreateProject ¶
func (r *TestClient) CreateProject(name string) (*apiv1.Project, error)
CreateProject creates a new project and waits for it to become active (ready).
func (*TestClient) CreateServiceAccount ¶
func (r *TestClient) CreateServiceAccount(name, group, projectID string) (*apiv1.ServiceAccount, error)
CreateServiceAccount method creates a new service account and waits a certain amount of time for it to become active.
func (*TestClient) CreateUserSSHKey ¶
func (r *TestClient) CreateUserSSHKey(projectID, keyName, publicKey string) (*apiv1.SSHKey, error)
CreateUserSSHKey creates a new user SSH key
func (*TestClient) DeleteCluster ¶
func (r *TestClient) DeleteCluster(projectID, dc, clusterID string) error
DeleteCluster delete cluster method
func (*TestClient) DeleteDC ¶
func (r *TestClient) DeleteDC(seed, dc string) error
func (*TestClient) DeleteProject ¶
func (r *TestClient) DeleteProject(id string) error
DeleteProject deletes given project
func (*TestClient) DeleteServiceAccount ¶
func (r *TestClient) DeleteServiceAccount(saID, projectID string) error
DeleteServiceAccount deletes service account for given ID and project
func (*TestClient) DeleteTokenForServiceAccount ¶
func (r *TestClient) DeleteTokenForServiceAccount(tokenID, saID, projectID string) error
DeleteTokenForServiceAccount deletes a token for service account
func (*TestClient) DeleteUserFromProject ¶
func (r *TestClient) DeleteUserFromProject(projectID, userID string) error
func (*TestClient) DeleteUserSSHKey ¶
func (r *TestClient) DeleteUserSSHKey(projectID, keyID string) error
DeleteUserSSHKey deletes user SSH keys
func (*TestClient) DetachSSHKeyFromClusterParams ¶
func (r *TestClient) DetachSSHKeyFromClusterParams(projectID, clusterID, dc, keyID string) error
DetachSSHKeyFromClusterParams detaches user SSH key from the cluster
func (*TestClient) GetCluster ¶
func (r *TestClient) GetCluster(projectID, dc, clusterID string) (*apiv1.Cluster, error)
GetCluster cluster getter
func (*TestClient) GetClusterBindings ¶
func (r *TestClient) GetClusterBindings(projectID, dc, clusterID string) ([]apiv1.ClusterRoleBinding, error)
func (*TestClient) GetClusterEvents ¶
func (r *TestClient) GetClusterEvents(projectID, dc, clusterID string) ([]*models.Event, error)
GetClusterEvents returns the cluster events
func (*TestClient) GetClusterHealthStatus ¶
func (r *TestClient) GetClusterHealthStatus(projectID, dc, clusterID string) (*apiv1.ClusterHealth, error)
GetClusterHealthStatus gets the cluster status
func (*TestClient) GetClusterNodeDeployments ¶
func (r *TestClient) GetClusterNodeDeployments(projectID, dc, clusterID string) ([]apiv1.NodeDeployment, error)
GetClusterNodeDeployments returns the cluster node deployments
func (*TestClient) GetClusterRoles ¶
func (r *TestClient) GetClusterRoles(projectID, dc, clusterID string) ([]apiv1.ClusterRoleName, error)
func (*TestClient) GetDC ¶
func (r *TestClient) GetDC(dc string) (*models.Datacenter, error)
func (*TestClient) GetDCForProvider ¶
func (r *TestClient) GetDCForProvider(provider, dc string) (*models.Datacenter, error)
func (*TestClient) GetDCForSeed ¶
func (r *TestClient) GetDCForSeed(seed, dc string) (*models.Datacenter, error)
func (*TestClient) GetGlobalSettings ¶
func (r *TestClient) GetGlobalSettings() (*apiv1.GlobalSettings, error)
func (*TestClient) GetKubeconfig ¶
func (r *TestClient) GetKubeconfig(dc, projectID, clusterID string) (string, error)
func (*TestClient) GetProject ¶
func (r *TestClient) GetProject(id string) (*apiv1.Project, error)
GetProject gets the project with the given ID; it does not perform any retries if the API returns errors.
func (*TestClient) GetProjectUsers ¶
func (r *TestClient) GetProjectUsers(projectID string) ([]apiv1.User, error)
func (*TestClient) GetRoles ¶
func (r *TestClient) GetRoles(projectID, dc, clusterID string) ([]apiv1.RoleName, error)
func (*TestClient) GetServiceAccount ¶
func (r *TestClient) GetServiceAccount(saID, projectID string) (*apiv1.ServiceAccount, error)
GetServiceAccount returns service account for given ID and project
func (*TestClient) ListCredentials ¶
func (r *TestClient) ListCredentials(providerName, datacenter string) ([]string, error)
ListCredentials returns list of credential names for the provider
func (*TestClient) ListDC ¶
func (r *TestClient) ListDC() ([]*models.Datacenter, error)
func (*TestClient) ListDCForProvider ¶
func (r *TestClient) ListDCForProvider(provider string) ([]*models.Datacenter, error)
func (*TestClient) ListDCForSeed ¶
func (r *TestClient) ListDCForSeed(seed string) ([]*models.Datacenter, error)
func (*TestClient) ListGCPDiskTypes ¶
func (r *TestClient) ListGCPDiskTypes(credential, zone string) ([]string, error)
ListGCPDiskTypes returns list of GCP disk types
func (*TestClient) ListGCPSizes ¶
func (r *TestClient) ListGCPSizes(credential, zone string) ([]apiv1.GCPMachineSize, error)
ListGCPSizes returns list of GCP sizes
func (*TestClient) ListGCPZones ¶
func (r *TestClient) ListGCPZones(credential, dc string) ([]string, error)
ListGCPZones returns list of GCP zones
func (*TestClient) ListProjects ¶
func (r *TestClient) ListProjects(displayAll bool) ([]*apiv1.Project, error)
ListProjects gets projects
func (*TestClient) ListUserSSHKey ¶
func (r *TestClient) ListUserSSHKey(projectID string) ([]*apiv1.SSHKey, error)
ListUserSSHKey list user SSH keys
func (*TestClient) Logout ¶
func (r *TestClient) Logout() error
func (*TestClient) PatchDC ¶
func (r *TestClient) PatchDC(seed, dcToPatch, patch string) (*models.Datacenter, error)
func (*TestClient) PrintClusterEvents ¶
func (r *TestClient) PrintClusterEvents(projectID, dc, clusterID string) error
PrintClusterEvents prints all cluster events using its test.Logf
func (*TestClient) UpdateCluster ¶
func (r *TestClient) UpdateCluster(projectID, dc, clusterID string, patch PatchCluster) (*apiv1.Cluster, error)
func (*TestClient) UpdateDC ¶
func (r *TestClient) UpdateDC(seed, dcToUpdate string, dc *models.Datacenter) (*models.Datacenter, error)
func (*TestClient) UpdateGlobalSettings ¶
func (r *TestClient) UpdateGlobalSettings(patch json.RawMessage) (*apiv1.GlobalSettings, error)
func (*TestClient) UpdateProject ¶
UpdateProject updates the given project
func (*TestClient) WaitForClusterHealthy ¶
func (r *TestClient) WaitForClusterHealthy(projectID, dc, clusterID string) error
func (*TestClient) WaitForClusterNodeDeploymentsToByReady ¶
func (r *TestClient) WaitForClusterNodeDeploymentsToByReady(projectID, dc, clusterID string, replicas int32) error
func (*TestClient) WaitForClusterNodeDeploymentsToExist ¶
func (r *TestClient) WaitForClusterNodeDeploymentsToExist(projectID, dc, clusterID string) error