Documentation ¶
Overview ¶
Package upgrades provides a framework for testing Kubernetes features before, during, and after different types of upgrades.
Index ¶
- type AppArmorUpgradeTest
- func (AppArmorUpgradeTest) Name() string
- func (t *AppArmorUpgradeTest) Setup(f *framework.Framework)
- func (AppArmorUpgradeTest) Skip(upgCtx UpgradeContext) bool
- func (t *AppArmorUpgradeTest) Teardown(f *framework.Framework)
- func (t *AppArmorUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
- type CassandraUpgradeTest
- func (CassandraUpgradeTest) Name() string
- func (t *CassandraUpgradeTest) Setup(f *framework.Framework)
- func (CassandraUpgradeTest) Skip(upgCtx UpgradeContext) bool
- func (t *CassandraUpgradeTest) Teardown(f *framework.Framework)
- func (t *CassandraUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
- type ConfigMapUpgradeTest
- type EtcdUpgradeTest
- func (EtcdUpgradeTest) Name() string
- func (t *EtcdUpgradeTest) Setup(f *framework.Framework)
- func (EtcdUpgradeTest) Skip(upgCtx UpgradeContext) bool
- func (t *EtcdUpgradeTest) Teardown(f *framework.Framework)
- func (t *EtcdUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
- type HPAUpgradeTest
- type KubeProxyDowngradeTest
- type KubeProxyUpgradeTest
- type MySQLUpgradeTest
- func (MySQLUpgradeTest) Name() string
- func (t *MySQLUpgradeTest) Setup(f *framework.Framework)
- func (MySQLUpgradeTest) Skip(upgCtx UpgradeContext) bool
- func (t *MySQLUpgradeTest) Teardown(f *framework.Framework)
- func (t *MySQLUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
- type NvidiaGPUUpgradeTest
- type SecretUpgradeTest
- type ServiceAccountAdmissionControllerMigrationTest
- func (ServiceAccountAdmissionControllerMigrationTest) Name() string
- func (t *ServiceAccountAdmissionControllerMigrationTest) Setup(f *framework.Framework)
- func (t *ServiceAccountAdmissionControllerMigrationTest) Teardown(f *framework.Framework)
- func (t *ServiceAccountAdmissionControllerMigrationTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
- type ServiceUpgradeTest
- type Skippable
- type SysctlUpgradeTest
- type Test
- type UpgradeContext
- type UpgradeType
- type VersionContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppArmorUpgradeTest ¶
type AppArmorUpgradeTest struct {
// contains filtered or unexported fields
}
AppArmorUpgradeTest tests that AppArmor profiles are enforced & usable across upgrades.
func (AppArmorUpgradeTest) Name ¶
func (AppArmorUpgradeTest) Name() string
Name returns the tracking name of the test.
func (*AppArmorUpgradeTest) Setup ¶
func (t *AppArmorUpgradeTest) Setup(f *framework.Framework)
Setup creates a secret and then verifies that a pod can consume it.
func (AppArmorUpgradeTest) Skip ¶
func (AppArmorUpgradeTest) Skip(upgCtx UpgradeContext) bool
Skip returns true when this test can be skipped.
func (*AppArmorUpgradeTest) Teardown ¶
func (t *AppArmorUpgradeTest) Teardown(f *framework.Framework)
Teardown cleans up any remaining resources.
func (*AppArmorUpgradeTest) Test ¶
func (t *AppArmorUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test waits for the upgrade to complete, and then verifies that a pod can still consume the secret.
type CassandraUpgradeTest ¶ added in v1.8.0
type CassandraUpgradeTest struct {
// contains filtered or unexported fields
}
CassandraUpgradeTest ups and verifies that a Cassandra StatefulSet behaves well across upgrades.
func (CassandraUpgradeTest) Name ¶ added in v1.8.0
func (CassandraUpgradeTest) Name() string
Name returns the tracking name of the test.
func (*CassandraUpgradeTest) Setup ¶ added in v1.8.0
func (t *CassandraUpgradeTest) Setup(f *framework.Framework)
Setup creates a Cassandra StatefulSet and a PDB. It also brings up a tester ReplicaSet and associated service and PDB to guarantee availability during the upgrade. It waits for the system to stabilize before adding two users to verify connectivity.
func (CassandraUpgradeTest) Skip ¶ added in v1.8.0
func (CassandraUpgradeTest) Skip(upgCtx UpgradeContext) bool
Skip returns true when this test can be skipped.
func (*CassandraUpgradeTest) Teardown ¶ added in v1.8.0
func (t *CassandraUpgradeTest) Teardown(f *framework.Framework)
Teardown does one final check of the data's availability.
func (*CassandraUpgradeTest) Test ¶ added in v1.8.0
func (t *CassandraUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test is called during the upgrade. It launches two goroutines, one continuously writes to the db and one reads from the db. Each attempt is tallied and at the end we verify if the success ratio is over a certain threshold (0.75). We also verify that we get at least the same number of rows back as we successfully wrote.
type ConfigMapUpgradeTest ¶
type ConfigMapUpgradeTest struct {
// contains filtered or unexported fields
}
ConfigMapUpgradeTest tests that a ConfigMap is available before and after a cluster upgrade.
func (ConfigMapUpgradeTest) Name ¶
func (ConfigMapUpgradeTest) Name() string
Name returns the tracking name of the test.
func (*ConfigMapUpgradeTest) Setup ¶
func (t *ConfigMapUpgradeTest) Setup(f *framework.Framework)
Setup creates a ConfigMap and then verifies that a pod can consume it.
func (*ConfigMapUpgradeTest) Teardown ¶
func (t *ConfigMapUpgradeTest) Teardown(f *framework.Framework)
Teardown cleans up any remaining resources.
func (*ConfigMapUpgradeTest) Test ¶
func (t *ConfigMapUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test waits for the upgrade to complete, and then verifies that a pod can still consume the ConfigMap.
type EtcdUpgradeTest ¶ added in v1.8.0
type EtcdUpgradeTest struct {
// contains filtered or unexported fields
}
EtcdUpgradeTest tests that etcd is writable before and after a cluster upgrade.
func (EtcdUpgradeTest) Name ¶ added in v1.8.0
func (EtcdUpgradeTest) Name() string
Name returns the tracking name of the test.
func (*EtcdUpgradeTest) Setup ¶ added in v1.8.0
func (t *EtcdUpgradeTest) Setup(f *framework.Framework)
Setup creates etcd statefulset and then verifies that the etcd is writable.
func (EtcdUpgradeTest) Skip ¶ added in v1.8.0
func (EtcdUpgradeTest) Skip(upgCtx UpgradeContext) bool
Skip returns true when this test can be skipped.
func (*EtcdUpgradeTest) Teardown ¶ added in v1.8.0
func (t *EtcdUpgradeTest) Teardown(f *framework.Framework)
Teardown does one final check of the data's availability.
func (*EtcdUpgradeTest) Test ¶ added in v1.8.0
func (t *EtcdUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test waits for upgrade to complete and verifies if etcd is writable.
type HPAUpgradeTest ¶
type HPAUpgradeTest struct {
// contains filtered or unexported fields
}
HPAUpgradeTest tests that HPA rescales target resource correctly before and after a cluster upgrade.
func (HPAUpgradeTest) Name ¶
func (HPAUpgradeTest) Name() string
Name returns the tracking name of the test.
func (*HPAUpgradeTest) Setup ¶
func (t *HPAUpgradeTest) Setup(f *framework.Framework)
Setup creates a resource consumer and an HPA object that autoscales the consumer.
func (*HPAUpgradeTest) Teardown ¶
func (t *HPAUpgradeTest) Teardown(f *framework.Framework)
Teardown cleans up any remaining resources.
func (*HPAUpgradeTest) Test ¶
func (t *HPAUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test waits for upgrade to complete and verifies if HPA works correctly.
type KubeProxyDowngradeTest ¶ added in v1.8.0
type KubeProxyDowngradeTest struct { }
KubeProxyDowngradeTest tests kube-proxy DaemonSet -> static pods downgrade path.
func (KubeProxyDowngradeTest) Name ¶ added in v1.8.0
func (KubeProxyDowngradeTest) Name() string
Name returns the tracking name of the test.
func (*KubeProxyDowngradeTest) Setup ¶ added in v1.8.0
func (t *KubeProxyDowngradeTest) Setup(f *framework.Framework)
Setup verifies kube-proxy DaemonSet is running before upgrade.
func (*KubeProxyDowngradeTest) Teardown ¶ added in v1.8.0
func (t *KubeProxyDowngradeTest) Teardown(f *framework.Framework)
Teardown does nothing.
func (*KubeProxyDowngradeTest) Test ¶ added in v1.8.0
func (t *KubeProxyDowngradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test validates if kube-proxy is migrated from DaemonSet to static pods.
type KubeProxyUpgradeTest ¶ added in v1.8.0
type KubeProxyUpgradeTest struct { }
KubeProxyUpgradeTest tests kube-proxy static pods -> DaemonSet upgrade path.
func (KubeProxyUpgradeTest) Name ¶ added in v1.8.0
func (KubeProxyUpgradeTest) Name() string
Name returns the tracking name of the test.
func (*KubeProxyUpgradeTest) Setup ¶ added in v1.8.0
func (t *KubeProxyUpgradeTest) Setup(f *framework.Framework)
Setup verifies kube-proxy static pods is running before upgrade.
func (*KubeProxyUpgradeTest) Teardown ¶ added in v1.8.0
func (t *KubeProxyUpgradeTest) Teardown(f *framework.Framework)
Teardown does nothing.
func (*KubeProxyUpgradeTest) Test ¶ added in v1.8.0
func (t *KubeProxyUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test validates if kube-proxy is migrated from static pods to DaemonSet.
type MySQLUpgradeTest ¶ added in v1.14.0
type MySQLUpgradeTest struct {
// contains filtered or unexported fields
}
MySQLUpgradeTest implements an upgrade test harness that polls a replicated sql database.
func (MySQLUpgradeTest) Name ¶ added in v1.14.0
func (MySQLUpgradeTest) Name() string
Name returns the tracking name of the test.
func (*MySQLUpgradeTest) Setup ¶ added in v1.14.0
func (t *MySQLUpgradeTest) Setup(f *framework.Framework)
Setup creates a StatefulSet, HeadlessService, a Service to write to the db, and a Service to read from the db. It then connects to the db with the write Service and populates the db with a table and a few entries. Finally, it connects to the db with the read Service, and confirms the data is available. The db connections are left open to be used later in the test.
func (MySQLUpgradeTest) Skip ¶ added in v1.14.0
func (MySQLUpgradeTest) Skip(upgCtx UpgradeContext) bool
Skip returns true when this test can be skipped.
func (*MySQLUpgradeTest) Teardown ¶ added in v1.14.0
func (t *MySQLUpgradeTest) Teardown(f *framework.Framework)
Teardown performs one final check of the data's availability.
func (*MySQLUpgradeTest) Test ¶ added in v1.14.0
func (t *MySQLUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test continually polls the db using the read and write connections, inserting data, and checking that all the data is readable.
type NvidiaGPUUpgradeTest ¶ added in v1.10.5
type NvidiaGPUUpgradeTest struct { }
NvidiaGPUUpgradeTest tests that gpu resource is available before and after a cluster upgrade.
func (NvidiaGPUUpgradeTest) Name ¶ added in v1.10.5
func (NvidiaGPUUpgradeTest) Name() string
Name returns the tracking name of the test.
func (*NvidiaGPUUpgradeTest) Setup ¶ added in v1.10.5
func (t *NvidiaGPUUpgradeTest) Setup(f *framework.Framework)
Setup creates a job requesting gpu.
func (*NvidiaGPUUpgradeTest) Teardown ¶ added in v1.10.5
func (t *NvidiaGPUUpgradeTest) Teardown(f *framework.Framework)
Teardown cleans up any remaining resources.
func (*NvidiaGPUUpgradeTest) Test ¶ added in v1.10.5
func (t *NvidiaGPUUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test waits for the upgrade to complete, and then verifies that the cuda pod started by the gpu job can successfully finish.
type SecretUpgradeTest ¶
type SecretUpgradeTest struct {
// contains filtered or unexported fields
}
SecretUpgradeTest test that a secret is available before and after a cluster upgrade.
func (SecretUpgradeTest) Name ¶
func (SecretUpgradeTest) Name() string
Name returns the tracking name of the test.
func (*SecretUpgradeTest) Setup ¶
func (t *SecretUpgradeTest) Setup(f *framework.Framework)
Setup creates a secret and then verifies that a pod can consume it.
func (*SecretUpgradeTest) Teardown ¶
func (t *SecretUpgradeTest) Teardown(f *framework.Framework)
Teardown cleans up any remaining resources.
func (*SecretUpgradeTest) Test ¶
func (t *SecretUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test waits for the upgrade to complete, and then verifies that a pod can still consume the secret.
type ServiceAccountAdmissionControllerMigrationTest ¶ added in v1.19.3
type ServiceAccountAdmissionControllerMigrationTest struct {
// contains filtered or unexported fields
}
ServiceAccountAdmissionControllerMigrationTest test that a pod is functioning before and after a cluster upgrade.
func (ServiceAccountAdmissionControllerMigrationTest) Name ¶ added in v1.19.3
func (ServiceAccountAdmissionControllerMigrationTest) Name() string
Name returns the tracking name of the test.
func (*ServiceAccountAdmissionControllerMigrationTest) Setup ¶ added in v1.19.3
func (t *ServiceAccountAdmissionControllerMigrationTest) Setup(f *framework.Framework)
Setup creates pod-before-migration which has legacy service account token.
func (*ServiceAccountAdmissionControllerMigrationTest) Teardown ¶ added in v1.19.3
func (t *ServiceAccountAdmissionControllerMigrationTest) Teardown(f *framework.Framework)
Teardown cleans up any remaining resources.
func (*ServiceAccountAdmissionControllerMigrationTest) Test ¶ added in v1.19.3
func (t *ServiceAccountAdmissionControllerMigrationTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test waits for the upgrade to complete, and then verifies pod-before-migration and pod-after-migration are able to make requests using in cluster config.
type ServiceUpgradeTest ¶
type ServiceUpgradeTest struct {
// contains filtered or unexported fields
}
ServiceUpgradeTest tests that a service is available before and after a cluster upgrade. During a master-only upgrade, it will test that a service remains available during the upgrade.
func (ServiceUpgradeTest) Name ¶
func (ServiceUpgradeTest) Name() string
Name returns the tracking name of the test.
func (*ServiceUpgradeTest) Setup ¶
func (t *ServiceUpgradeTest) Setup(f *framework.Framework)
Setup creates a service with a load balancer and makes sure it's reachable.
func (*ServiceUpgradeTest) Teardown ¶
func (t *ServiceUpgradeTest) Teardown(f *framework.Framework)
Teardown cleans up any remaining resources.
func (*ServiceUpgradeTest) Test ¶
func (t *ServiceUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test runs a connectivity check to the service.
type Skippable ¶
type Skippable interface { // Skip should return true if test should be skipped. upgCtx // provides information about the upgrade that is going to // occur. Skip(upgCtx UpgradeContext) bool }
Skippable is an interface that an upgrade test can implement to be able to indicate that it should be skipped.
type SysctlUpgradeTest ¶
type SysctlUpgradeTest struct {
// contains filtered or unexported fields
}
SysctlUpgradeTest tests that a pod with sysctls runs before and after an upgrade. During a master upgrade, the exact pod is expected to stay running. A pod with unsafe sysctls is expected to keep failing before and after the upgrade.
func (*SysctlUpgradeTest) Setup ¶
func (t *SysctlUpgradeTest) Setup(f *framework.Framework)
Setup creates two pods: one with safe sysctls, one with unsafe sysctls. It checks that the former launched and the later is rejected.
func (*SysctlUpgradeTest) Teardown ¶
func (t *SysctlUpgradeTest) Teardown(f *framework.Framework)
Teardown cleans up any remaining resources.
func (*SysctlUpgradeTest) Test ¶
func (t *SysctlUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)
Test waits for the upgrade to complete, and then verifies that a pod can still consume the ConfigMap.
type Test ¶
type Test interface { // Name should return a test name sans spaces. Name() string // Setup should create and verify whatever objects need to // exist before the upgrade disruption starts. Setup(f *framework.Framework) // Test will run during the upgrade. When the upgrade is // complete, done will be closed and final validation can // begin. Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType) // Teardown should clean up any objects that are created that // aren't already cleaned up by the framework. This will // always be called, even if Setup failed. Teardown(f *framework.Framework) }
Test is an interface for upgrade tests.
type UpgradeContext ¶
type UpgradeContext struct {
Versions []VersionContext
}
UpgradeContext contains information about all the stages of the upgrade that is going to occur.
type UpgradeType ¶
type UpgradeType int
UpgradeType represents different types of upgrades.
const ( // MasterUpgrade indicates that only the master is being upgraded. MasterUpgrade UpgradeType = iota // NodeUpgrade indicates that only the nodes are being upgraded. NodeUpgrade // ClusterUpgrade indicates that both master and nodes are // being upgraded. ClusterUpgrade // EtcdUpgrade indicates that only etcd is being upgraded (or migrated // between storage versions). EtcdUpgrade )
type VersionContext ¶
VersionContext represents a stage of the upgrade.