Skip to content

Commit

Permalink
add local error type VolumeSnapshotError instead of using storage.Vol…
Browse files Browse the repository at this point in the history
…umeError
  • Loading branch information
yuxiangqian committed Aug 28, 2019
1 parent 1eac944 commit 2d966de
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
8 changes: 4 additions & 4 deletions config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ spec:
reported.
properties:
message:
description: String detailing the error encountered during snapshot
creation. This string may be logged, so it should not
contain sensitive information.
description: 'message is a string detailing the encountered error
during snapshot creation if specified. NOTE: message maybe logged,
thus it should not contain sensitive information.'
type: string
time:
description: Time the error was encountered.
description: time is the timestamp when the error was encountered.
format: date-time
type: string
type: object
Expand Down
17 changes: 15 additions & 2 deletions pkg/apis/volumesnapshot/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package v1beta1

import (
core_v1 "k8s.io/api/core/v1"
storage "k8s.io/api/storage/v1beta1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -127,7 +126,7 @@ type VolumeSnapshotStatus struct {
// to decide whether they should continue on waiting for the snapshot to be created
// based on the type of error reported.
// +optional
Error *storage.VolumeError `json:"error,omitempty" protobuf:"bytes,4,opt,name=error,casttype=VolumeError"`
Error *VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,4,opt,name=error,casttype=VolumeSnapshotError"`
}

// +genclient
Expand Down Expand Up @@ -282,3 +281,17 @@ const (
// The default policy is Retain if not specified.
VolumeSnapshotContentRetain DeletionPolicy = "Retain"
)

// VolumeSnapshotError describes an error encountered during snapshot creation.
type VolumeSnapshotError struct {
// time is the timestamp when the error was encountered.
// +optional
Time *metav1.Time `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"`

// message is a string detailing the encountered error during snapshot
// creation if specified.
// NOTE: message maybe logged, thus it should not contain sensitive
// information.
// +optional
Message *string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
}

0 comments on commit 2d966de

Please sign in to comment.