Documentation

Overview

Package upgrades provides a framework for testing Kubernetes features before, during, and after different types of upgrades.

Index

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

type CassandraUpgradeTest struct {
	// contains filtered or unexported fields
}

CassandraUpgradeTest ups and verifies that a Cassandra StatefulSet behaves well across upgrades.

func (CassandraUpgradeTest) Name

func (CassandraUpgradeTest) Name() string

Name returns the tracking name of the test.

func (*CassandraUpgradeTest) Setup

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

func (CassandraUpgradeTest) Skip(upgCtx UpgradeContext) bool

Skip returns true when this test can be skipped.

func (*CassandraUpgradeTest) Teardown

func (t *CassandraUpgradeTest) Teardown(f *framework.Framework)

Teardown does one final check of the data's availability.

func (*CassandraUpgradeTest) Test

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

type EtcdUpgradeTest struct {
	// contains filtered or unexported fields
}

EtcdUpgradeTest tests that etcd is writable before and after a cluster upgrade.

func (EtcdUpgradeTest) Name

func (EtcdUpgradeTest) Name() string

Name returns the tracking name of the test.

func (*EtcdUpgradeTest) Setup

func (t *EtcdUpgradeTest) Setup(f *framework.Framework)

Setup creates etcd statefulset and then verifies that the etcd is writable.

func (EtcdUpgradeTest) Skip

func (EtcdUpgradeTest) Skip(upgCtx UpgradeContext) bool

Skip returns true when this test can be skipped.

func (*EtcdUpgradeTest) Teardown

func (t *EtcdUpgradeTest) Teardown(f *framework.Framework)

Teardown does one final check of the data's availability.

func (*EtcdUpgradeTest) Test

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

type KubeProxyDowngradeTest struct {
}

KubeProxyDowngradeTest tests kube-proxy DaemonSet -> static pods downgrade path.

func (KubeProxyDowngradeTest) Name

func (KubeProxyDowngradeTest) Name() string

Name returns the tracking name of the test.

func (*KubeProxyDowngradeTest) Setup

func (t *KubeProxyDowngradeTest) Setup(f *framework.Framework)

Setup verifies kube-proxy DaemonSet is running before upgrade.

func (*KubeProxyDowngradeTest) Teardown

func (t *KubeProxyDowngradeTest) Teardown(f *framework.Framework)

Teardown does nothing.

func (*KubeProxyDowngradeTest) Test

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

type KubeProxyUpgradeTest struct {
}

KubeProxyUpgradeTest tests kube-proxy static pods -> DaemonSet upgrade path.

func (KubeProxyUpgradeTest) Name

func (KubeProxyUpgradeTest) Name() string

Name returns the tracking name of the test.

func (*KubeProxyUpgradeTest) Setup

func (t *KubeProxyUpgradeTest) Setup(f *framework.Framework)

Setup verifies kube-proxy static pods is running before upgrade.

func (*KubeProxyUpgradeTest) Teardown

func (t *KubeProxyUpgradeTest) Teardown(f *framework.Framework)

Teardown does nothing.

func (*KubeProxyUpgradeTest) Test

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

type MySQLUpgradeTest struct {
	// contains filtered or unexported fields
}

MySQLUpgradeTest implements an upgrade test harness that polls a replicated sql database.

func (MySQLUpgradeTest) Name

func (MySQLUpgradeTest) Name() string

Name returns the tracking name of the test.

func (*MySQLUpgradeTest) Setup

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

func (MySQLUpgradeTest) Skip(upgCtx UpgradeContext) bool

Skip returns true when this test can be skipped.

func (*MySQLUpgradeTest) Teardown

func (t *MySQLUpgradeTest) Teardown(f *framework.Framework)

Teardown performs one final check of the data's availability.

func (*MySQLUpgradeTest) Test

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

type NvidiaGPUUpgradeTest struct {
}

NvidiaGPUUpgradeTest tests that gpu resource is available before and after a cluster upgrade.

func (NvidiaGPUUpgradeTest) Name

func (NvidiaGPUUpgradeTest) Name() string

Name returns the tracking name of the test.

func (*NvidiaGPUUpgradeTest) Setup

func (t *NvidiaGPUUpgradeTest) Setup(f *framework.Framework)

Setup creates a job requesting gpu.

func (*NvidiaGPUUpgradeTest) Teardown

func (t *NvidiaGPUUpgradeTest) Teardown(f *framework.Framework)

Teardown cleans up any remaining resources.

func (*NvidiaGPUUpgradeTest) Test

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

type ServiceAccountAdmissionControllerMigrationTest struct {
	// contains filtered or unexported fields
}

ServiceAccountAdmissionControllerMigrationTest test that a pod is functioning before and after a cluster upgrade.

func (ServiceAccountAdmissionControllerMigrationTest) Name

func (ServiceAccountAdmissionControllerMigrationTest) Name() string

Name returns the tracking name of the test.

func (*ServiceAccountAdmissionControllerMigrationTest) Setup

func (t *ServiceAccountAdmissionControllerMigrationTest) Setup(f *framework.Framework)

Setup creates pod-before-migration which has legacy service account token.

func (*ServiceAccountAdmissionControllerMigrationTest) Teardown

func (t *ServiceAccountAdmissionControllerMigrationTest) Teardown(f *framework.Framework)

Teardown cleans up any remaining resources.

func (*ServiceAccountAdmissionControllerMigrationTest) Test

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

type VersionContext struct {
	Version   version.Version
	NodeImage string
}

VersionContext represents a stage of the upgrade.

Directories

Path Synopsis
apps
storage