upgrades

package
v0.0.0-...-9697773 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2020 License: Apache-2.0 Imports: 35 Imported by: 0

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

Setup creates a secret and then verifies that a pod can consume it.

func (AppArmorUpgradeTest) Skip

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

Name returns the tracking name of the test.

func (*CassandraUpgradeTest) Setup

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

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

Name returns the tracking name of the test.

func (*ConfigMapUpgradeTest) Setup

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 GCPResourceStore

type GCPResourceStore struct {
	Fw      *compute.Firewall
	FwdList []*compute.ForwardingRule
	UmList  []*compute.UrlMap
	TpList  []*compute.TargetHttpProxy
	TpsList []*compute.TargetHttpsProxy
	SslList []*compute.SslCertificate
	BeList  []*compute.BackendService
	IP      *compute.Address
	IgList  []*compute.InstanceGroup
}

GCPResourceStore keeps track of the GCP resources spun up by an ingress. Note: Fields are exported so that we can utilize reflection.

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 IngressUpgradeTest

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

IngressUpgradeTest adapts the Ingress e2e for upgrade testing

func (IngressUpgradeTest) Name

func (IngressUpgradeTest) Name() string

Name returns the tracking name of the test.

func (*IngressUpgradeTest) Setup

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

Setup creates a GLBC, allocates an ip, and an ingress resource, then waits for a successful connectivity check to the ip. Also keeps track of all load balancer resources for cross-checking during an IngressUpgrade.

func (*IngressUpgradeTest) Skip

func (t *IngressUpgradeTest) Skip(upgCtx UpgradeContext) bool

Skip checks if the test or part of the test should be skipped.

func (*IngressUpgradeTest) Teardown

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

Teardown cleans up any remaining resources.

func (*IngressUpgradeTest) Test

func (t *IngressUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade UpgradeType)

Test waits for the upgrade to complete, and then verifies with a connectivity check to the loadbalancer ip.

type KubeProxyDowngradeTest

type KubeProxyDowngradeTest struct {
}

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

func (KubeProxyDowngradeTest) Name

Name returns the tracking name of the test.

func (*KubeProxyDowngradeTest) Setup

Setup verifies kube-proxy DaemonSet is running before uprgade.

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

Name returns the tracking name of the test.

func (*KubeProxyUpgradeTest) Setup

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

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

Name returns the tracking name of the test.

func (*NvidiaGPUUpgradeTest) Setup

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 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

	// IngressUpgrade indicates that only ingress is being upgraded.
	IngressUpgrade
)

type VersionContext

type VersionContext struct {
	Version   version.Version
	NodeImage string
}

VersionContext represents a stage of the upgrade.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL