Documentation
¶
Index ¶
- Constants
- Variables
- func HelmChartPaths() (helmChartPath string, operatorChartPath string)
- func InstallCockroachDBEnterpriseOperator(t *testing.T, kubectlOptions *k8s.KubectlOptions)
- func MustMarshalJSON(value interface{}) string
- func PatchHelmValues(inputValues map[string]string) map[string]string
- func UninstallCockroachDBEnterpriseOperator(t *testing.T, kubectlOptions *k8s.KubectlOptions)
- type OperatorUseCases
- type Region
- func (r *Region) CleanUpCACertificate(t *testing.T)
- func (r *Region) CleanupResources(t *testing.T)
- func (r *Region) CreateCACertificate(t *testing.T) error
- func (r *Region) EnsureKubeConfigPath() (string, error)
- func (r *Region) GetCurrentContext(t *testing.T) (string, api.Config)
- func (r *Region) InstallCharts(t *testing.T, cluster string, index int)
- func (r *Region) OperatorRegions(index int, nodes int) []map[string]interface{}
- func (r *Region) ValidateCRDB(t *testing.T, cluster string)
- func (r *Region) ValidateCRDBContainerResources(t *testing.T, kubectlOptions *k8s.KubectlOptions)
- func (r *Region) ValidateMultiRegionSetup(t *testing.T)
- func (r *Region) VerifyHelmUpgrade(t *testing.T, initialTimestamp time.Time, kubectlOptions *k8s.KubectlOptions) error
Constants ¶
const ( TestDBName = "testdb" Namespace = "cockroach-ns" LabelSelector = "app=cockroachdb" OperatorLabelSelector = "app=cockroach-operator" )
Variables ¶
var ( Clusters = []string{"chart-testing-cluster-0", "chart-testing-cluster-1"} CustomDomains = map[int]string{ 0: "cluster1.local", 1: "cluster2.local", } ReleaseName = "cockroachdb" CockroachContainerName = "cockroachdb" )
Functions ¶
func HelmChartPaths ¶
func InstallCockroachDBEnterpriseOperator ¶
func InstallCockroachDBEnterpriseOperator(t *testing.T, kubectlOptions *k8s.KubectlOptions)
func MustMarshalJSON ¶
func MustMarshalJSON(value interface{}) string
func PatchHelmValues ¶
PatchHelmValues adds and overrides few default values for the helm charts for testing purposes. It sets the persistent storage size to 1Gi, terminationGracePeriod to 30s and rolling restart delay to 30s.
func UninstallCockroachDBEnterpriseOperator ¶
func UninstallCockroachDBEnterpriseOperator(t *testing.T, kubectlOptions *k8s.KubectlOptions)
Types ¶
type OperatorUseCases ¶
type OperatorUseCases interface {
TestHelmInstall(t *testing.T)
TestHelmUpgrade(t *testing.T)
TestClusterScaleUp(t *testing.T)
TestClusterRollingRestart(t *testing.T)
TestKillingCockroachNode(t *testing.T)
TestInstallWithCertManager(t *testing.T)
}
OperatorUseCases defines use cases for the CockroachDB cluster.
type Region ¶
type Region struct {
// IsCertManager is true if the cockroachdb cluster is using cert-manager.
IsCertManager bool
// IsMultiRegion is true if the region is multi-region.
IsMultiRegion bool
// NodeCount is the desired CockroachDB nodes in the region.
NodeCount int
// Namespace stores mapping between cluster name and namespace.
Namespace map[string]string
ReusingInfra bool
// Clients store the k8s client for each cluster
// needed for performing k8s operations on k8s objects.
Clients map[string]client.Client
Clusters []string
CorednsClusterOptions map[string]coredns.CoreDNSClusterOption
Provider string
RegionCodes []string
}
func (*Region) CleanUpCACertificate ¶
func (*Region) CleanupResources ¶
CleanupResources will clean the resources installed by Operator, CockroachDB charts and deletes the namespace. Any failure in doing so might cause issues in other tests as some of the cluster resources are tied to the namespace.
func (*Region) CreateCACertificate ¶
CreateCACertificate creates CA cert and key at the same path.
func (*Region) EnsureKubeConfigPath ¶
EnsureKubeConfigPath ensures that the kubeconfig file exists and returns its path.
func (*Region) GetCurrentContext ¶
GetCurrentContext gets the current cluster context from KubeConfig.
func (*Region) InstallCharts ¶
InstallCharts Installs both Operator and CockroachDB charts by providing custom CA secret which is generated through cockroach binary, It also verifies whether relevant services are up and running.
func (*Region) OperatorRegions ¶
OperatorRegions returns the regions config based on the index which is referring to cluster index.
func (*Region) ValidateCRDB ¶
ValidateCRDB validates the CockroachDB cluster by performing basic operations on db.
func (*Region) ValidateCRDBContainerResources ¶
func (r *Region) ValidateCRDBContainerResources(t *testing.T, kubectlOptions *k8s.KubectlOptions)
func (*Region) ValidateMultiRegionSetup ¶
ValidateMultiRegionSetup validates the multi-region setup.
func (*Region) VerifyHelmUpgrade ¶
func (r *Region) VerifyHelmUpgrade(t *testing.T, initialTimestamp time.Time, kubectlOptions *k8s.KubectlOptions) error
VerifyHelmUpgrade waits till all the pods are restarted after the helm upgrade is completed, it verifies with initialTimestamp which is the timestamp of the pods before recreation and returns the pod name.