Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-4.2: update release-tools #781

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions client/apis/volumesnapshot/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ type VolumeSnapshotSource struct {
// VolumeSnapshotStatus and VolumeSnapshotContentStatus. Fields in VolumeSnapshotStatus
// are updated based on fields in VolumeSnapshotContentStatus. They are eventual
// consistency. These fields are duplicate in both objects due to the following reasons:
// - Fields in VolumeSnapshotContentStatus can be used for filtering when importing a
// volumesnapshot.
// - VolumsnapshotStatus is used by end users because they cannot see VolumeSnapshotContent.
// - CSI snapshotter sidecar is light weight as it only watches VolumeSnapshotContent
// object, not VolumeSnapshot object.
// - Fields in VolumeSnapshotContentStatus can be used for filtering when importing a
// volumesnapshot.
// - VolumsnapshotStatus is used by end users because they cannot see VolumeSnapshotContent.
// - CSI snapshotter sidecar is light weight as it only watches VolumeSnapshotContent
// object, not VolumeSnapshot object.
type VolumeSnapshotStatus struct {
// boundVolumeSnapshotContentName is the name of the VolumeSnapshotContent
// object to which this VolumeSnapshot object intends to bind to.
Expand Down Expand Up @@ -355,11 +355,11 @@ type VolumeSnapshotContentSource struct {
// VolumeSnapshotStatus and VolumeSnapshotContentStatus. Fields in VolumeSnapshotStatus
// are updated based on fields in VolumeSnapshotContentStatus. They are eventual
// consistency. These fields are duplicate in both objects due to the following reasons:
// - Fields in VolumeSnapshotContentStatus can be used for filtering when importing a
// volumesnapshot.
// - VolumsnapshotStatus is used by end users because they cannot see VolumeSnapshotContent.
// - CSI snapshotter sidecar is light weight as it only watches VolumeSnapshotContent
// object, not VolumeSnapshot object.
// - Fields in VolumeSnapshotContentStatus can be used for filtering when importing a
// volumesnapshot.
// - VolumsnapshotStatus is used by end users because they cannot see VolumeSnapshotContent.
// - CSI snapshotter sidecar is light weight as it only watches VolumeSnapshotContent
// object, not VolumeSnapshot object.
type VolumeSnapshotContentStatus struct {
// snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system.
// If not specified, it indicates that dynamic snapshot creation has either failed
Expand Down
14 changes: 7 additions & 7 deletions client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions client/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 26 additions & 25 deletions pkg/common-controller/framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ import (
// function to call as the actual test. Available functions are:
// - testSyncSnapshot - calls syncSnapshot on the first snapshot in initialSnapshots.
// - testSyncSnapshotError - calls syncSnapshot on the first snapshot in initialSnapshots
// and expects an error to be returned.
// and expects an error to be returned.
// - testSyncContent - calls syncContent on the first content in initialContents.
// - any custom function for specialized tests.
//
// The test then contains list of contents/snapshots that are expected at the end
// of the test and list of generated events.
type controllerTest struct {
Expand Down Expand Up @@ -122,21 +123,21 @@ var noerrors = []reactorError{}

// snapshotReactor is a core.Reactor that simulates etcd and API server. It
// stores:
// - Latest version of snapshots contents saved by the controller.
// - Queue of all saves (to simulate "content/snapshot updated" events). This queue
// contains all intermediate state of an object - e.g. a snapshot.VolumeName
// is updated first and snapshot.Phase second. This queue will then contain both
// updates as separate entries.
// - Number of changes since the last call to snapshotReactor.syncAll().
// - Optionally, content and snapshot fake watchers which should be the same ones
// used by the controller. Any time an event function like deleteContentEvent
// is called to simulate an event, the reactor's stores are updated and the
// controller is sent the event via the fake watcher.
// - Optionally, list of error that should be returned by reactor, simulating
// etcd / API server failures. These errors are evaluated in order and every
// error is returned only once. I.e. when the reactor finds matching
// reactorError, it return appropriate error and removes the reactorError from
// the list.
// - Latest version of snapshots contents saved by the controller.
// - Queue of all saves (to simulate "content/snapshot updated" events). This queue
// contains all intermediate state of an object - e.g. a snapshot.VolumeName
// is updated first and snapshot.Phase second. This queue will then contain both
// updates as separate entries.
// - Number of changes since the last call to snapshotReactor.syncAll().
// - Optionally, content and snapshot fake watchers which should be the same ones
// used by the controller. Any time an event function like deleteContentEvent
// is called to simulate an event, the reactor's stores are updated and the
// controller is sent the event via the fake watcher.
// - Optionally, list of error that should be returned by reactor, simulating
// etcd / API server failures. These errors are evaluated in order and every
// error is returned only once. I.e. when the reactor finds matching
// reactorError, it return appropriate error and removes the reactorError from
// the list.
type snapshotReactor struct {
secrets map[string]*v1.Secret
volumes map[string]*v1.PersistentVolume
Expand Down Expand Up @@ -1207,11 +1208,11 @@ var (
)

// wrapTestWithInjectedOperation returns a testCall that:
// - starts the controller and lets it run original testCall until
// scheduleOperation() call. It blocks the controller there and calls the
// injected function to simulate that something is happening when the
// controller waits for the operation lock. Controller is then resumed and we
// check how it behaves.
// - starts the controller and lets it run original testCall until
// scheduleOperation() call. It blocks the controller there and calls the
// injected function to simulate that something is happening when the
// controller waits for the operation lock. Controller is then resumed and we
// check how it behaves.
func wrapTestWithInjectedOperation(toWrap testCall, injectBeforeOperation func(ctrl *csiSnapshotCommonController, reactor *snapshotReactor)) testCall {

return func(ctrl *csiSnapshotCommonController, reactor *snapshotReactor, test controllerTest) error {
Expand Down Expand Up @@ -1255,10 +1256,10 @@ func evaluateTestResults(ctrl *csiSnapshotCommonController, reactor *snapshotRea

// Test single call to syncSnapshot and syncContent methods.
// For all tests:
// 1. Fill in the controller with initial data
// 2. Call the tested function (syncSnapshot/syncContent) via
// controllerTest.testCall *once*.
// 3. Compare resulting contents and snapshots with expected contents and snapshots.
// 1. Fill in the controller with initial data
// 2. Call the tested function (syncSnapshot/syncContent) via
// controllerTest.testCall *once*.
// 3. Compare resulting contents and snapshots with expected contents and snapshots.
func runSyncTests(t *testing.T, tests []controllerTest, snapshotClasses []*crdv1.VolumeSnapshotClass) {
snapshotscheme.AddToScheme(scheme.Scheme)
for _, test := range tests {
Expand Down
11 changes: 6 additions & 5 deletions pkg/common-controller/snapshot_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,11 +760,12 @@ func (ctrl *csiSnapshotCommonController) storeContentUpdate(content interface{})
// given event on the snapshot. It saves the status and emits the event only when
// the status has actually changed from the version saved in API server.
// Parameters:
// snapshot - snapshot to update
// setReadyToFalse bool - indicates whether to set the snapshot's ReadyToUse status to false.
// if true, ReadyToUse will be set to false;
// otherwise, ReadyToUse will not be changed.
// eventtype, reason, message - event to send, see EventRecorder.Event()
//
// snapshot - snapshot to update
// setReadyToFalse bool - indicates whether to set the snapshot's ReadyToUse status to false.
// if true, ReadyToUse will be set to false;
// otherwise, ReadyToUse will not be changed.
// eventtype, reason, message - event to send, see EventRecorder.Event()
func (ctrl *csiSnapshotCommonController) updateSnapshotErrorStatusWithEvent(snapshot *crdv1.VolumeSnapshot, setReadyToFalse bool, eventtype, reason, message string) error {
klog.V(5).Infof("updateSnapshotErrorStatusWithEvent[%s]", utils.SnapshotKey(snapshot))

Expand Down
8 changes: 4 additions & 4 deletions pkg/common-controller/snapshot_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ var metaTimeNow = &metav1.Time{
var emptyString = ""

// Test single call to syncSnapshot and syncContent methods.
// 1. Fill in the controller with initial data
// 2. Call the tested function (syncSnapshot/syncContent) via
// controllerTest.testCall *once*.
// 3. Compare resulting contents and snapshots with expected contents and snapshots.
// 1. Fill in the controller with initial data
// 2. Call the tested function (syncSnapshot/syncContent) via
// controllerTest.testCall *once*.
// 3. Compare resulting contents and snapshots with expected contents and snapshots.
func TestSync(t *testing.T) {
size := int64(1)
snapshotErr := newVolumeError("Mock content error")
Expand Down
8 changes: 4 additions & 4 deletions pkg/common-controller/snapshotclass_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
)

// Test single call to checkAndUpdateSnapshotClass.
// 1. Fill in the controller with initial data
// 2. Call the tested function checkAndUpdateSnapshotClass via
// controllerTest.testCall *once*.
// 3. Compare resulting snapshotclass.
// 1. Fill in the controller with initial data
// 2. Call the tested function checkAndUpdateSnapshotClass via
// controllerTest.testCall *once*.
// 3. Compare resulting snapshotclass.
func TestUpdateSnapshotClass(t *testing.T) {
tests := []controllerTest{
{
Expand Down
47 changes: 24 additions & 23 deletions pkg/sidecar-controller/framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import (
// function to call as the actual test. Available functions are:
// - testSyncContent - calls syncContent on the first content in initialContents.
// - any custom function for specialized tests.
//
// The test then contains list of contents that are expected at the end
// of the test and list of generated events.
type controllerTest struct {
Expand Down Expand Up @@ -108,20 +109,20 @@ var noerrors = []reactorError{}

// snapshotReactor is a core.Reactor that simulates etcd and API server. It
// stores:
// - Latest version of snapshots contents saved by the controller.
// - Queue of all saves (to simulate "content updated" events). This queue
// contains all intermediate state of an object. This queue will then contain both
// updates as separate entries.
// - Number of changes since the last call to snapshotReactor.syncAll().
// - Optionally, content watcher which should be the same ones
// used by the controller. Any time an event function like deleteContentEvent
// is called to simulate an event, the reactor's stores are updated and the
// controller is sent the event via the fake watcher.
// - Optionally, list of error that should be returned by reactor, simulating
// etcd / API server failures. These errors are evaluated in order and every
// error is returned only once. I.e. when the reactor finds matching
// reactorError, it return appropriate error and removes the reactorError from
// the list.
// - Latest version of snapshots contents saved by the controller.
// - Queue of all saves (to simulate "content updated" events). This queue
// contains all intermediate state of an object. This queue will then contain both
// updates as separate entries.
// - Number of changes since the last call to snapshotReactor.syncAll().
// - Optionally, content watcher which should be the same ones
// used by the controller. Any time an event function like deleteContentEvent
// is called to simulate an event, the reactor's stores are updated and the
// controller is sent the event via the fake watcher.
// - Optionally, list of error that should be returned by reactor, simulating
// etcd / API server failures. These errors are evaluated in order and every
// error is returned only once. I.e. when the reactor finds matching
// reactorError, it return appropriate error and removes the reactorError from
// the list.
type snapshotReactor struct {
secrets map[string]*v1.Secret
snapshotClasses map[string]*crdv1.VolumeSnapshotClass
Expand Down Expand Up @@ -663,11 +664,11 @@ var (
)

// wrapTestWithInjectedOperation returns a testCall that:
// - starts the controller and lets it run original testCall until
// scheduleOperation() call. It blocks the controller there and calls the
// injected function to simulate that something is happening when the
// controller waits for the operation lock. Controller is then resumed and we
// check how it behaves.
// - starts the controller and lets it run original testCall until
// scheduleOperation() call. It blocks the controller there and calls the
// injected function to simulate that something is happening when the
// controller waits for the operation lock. Controller is then resumed and we
// check how it behaves.
func wrapTestWithInjectedOperation(toWrap testCall, injectBeforeOperation func(ctrl *csiSnapshotSideCarController, reactor *snapshotReactor)) testCall {

return func(ctrl *csiSnapshotSideCarController, reactor *snapshotReactor, test controllerTest) error {
Expand Down Expand Up @@ -710,10 +711,10 @@ func evaluateTestResults(ctrl *csiSnapshotSideCarController, reactor *snapshotRe

// Test single call to syncContent methods.
// For all tests:
// 1. Fill in the controller with initial data
// 2. Call the tested function (syncContent) via
// controllerTest.testCall *once*.
// 3. Compare resulting contents and snapshots with expected contents and snapshots.
// 1. Fill in the controller with initial data
// 2. Call the tested function (syncContent) via
// controllerTest.testCall *once*.
// 3. Compare resulting contents and snapshots with expected contents and snapshots.
func runSyncContentTests(t *testing.T, tests []controllerTest, snapshotClasses []*crdv1.VolumeSnapshotClass) {
snapshotscheme.AddToScheme(scheme.Scheme)
for _, test := range tests {
Expand Down
5 changes: 3 additions & 2 deletions pkg/sidecar-controller/snapshot_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ func (ctrl *csiSnapshotSideCarController) checkandUpdateContentStatus(content *c
// given event on the content. It saves the status and emits the event only when
// the status has actually changed from the version saved in API server.
// Parameters:
// content - content to update
// eventtype, reason, message - event to send, see EventRecorder.Event()
//
// content - content to update
// eventtype, reason, message - event to send, see EventRecorder.Event()
func (ctrl *csiSnapshotSideCarController) updateContentErrorStatusWithEvent(content *crdv1.VolumeSnapshotContent, eventtype, reason, message string) error {
klog.V(5).Infof("updateContentStatusWithEvent[%s]", content.Name)

Expand Down
4 changes: 3 additions & 1 deletion pkg/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ func verifyAndGetSecretNameAndNamespaceTemplate(secret secretParamsMap, snapshot
}

// getSecretReference returns a reference to the secret specified in the given nameTemplate
// and namespaceTemplate, or an error if the templates are not specified correctly.
//
// and namespaceTemplate, or an error if the templates are not specified correctly.
//
// No lookup of the referenced secret is performed, and the secret may or may not exist.
//
// supported tokens for name resolution:
Expand Down
1 change: 1 addition & 0 deletions release-tools/KUBERNETES_CSI_OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ aliases:
- jingxu97
- jsafrane
- pohly
- RaunakShah
- xing-yang

# This documents who previously contributed to Kubernetes-CSI
Expand Down
Loading