forked from chaos-mesh/chaos-mesh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
30 changed files
with
6,186 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Copyright 2021 Chaos Mesh Authors.PodPVCChaos | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +kubebuilder:object:root=true | ||
// +chaos-mesh:experiment | ||
|
||
// PodPVCChaos is the control script`s spec. | ||
type PodPVCChaos struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// Spec defines the behavior of a pod chaos experiment | ||
Spec PodPVCChaosSpec `json:"spec"` | ||
|
||
// +optional | ||
// Most recently observed status of the chaos experiment about pods | ||
Status PodPVCChaosStatus `json:"status,omitempty"` | ||
} | ||
|
||
// PodPVCChaosSpec defines the attributes that a user creates on a chaos experiment about pods. | ||
type PodPVCChaosSpec struct { | ||
PodPVCSelector `json:",inline"` | ||
|
||
// Duration represents the duration of the chaos action. | ||
// It is required when the action is `PodFailureAction`. | ||
// A duration string is a possibly signed sequence of | ||
// decimal numbers, each with optional fraction and a unit suffix, | ||
// such as "300ms", "-1.5h" or "2h45m". | ||
// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". | ||
// +optional | ||
Duration *string `json:"duration,omitempty" webhook:"Duration"` | ||
|
||
// GracePeriod is used in pod-kill action. It represents the duration in seconds before the pod should be deleted. | ||
// Value must be non-negative integer. The default value is zero that indicates delete immediately. | ||
// +optional | ||
// +kubebuilder:validation:Minimum=0 | ||
GracePeriod int64 `json:"gracePeriod,omitempty"` | ||
|
||
// RemoteCluster represents the remote cluster where the chaos will be deployed | ||
// +optional | ||
RemoteCluster string `json:"remoteCluster,omitempty"` | ||
} | ||
|
||
type PodPVCSelector struct { | ||
PodSelector `json:",inline"` | ||
|
||
// VolumeName defines the name of the Volume to target. | ||
VolumeName string `json:"volumeName"` | ||
} | ||
|
||
// PodPVCChaosStatus represents the current status of the chaos experiment about pods. | ||
type PodPVCChaosStatus struct { | ||
ChaosStatus `json:",inline"` | ||
} | ||
|
||
func (obj *PodPVCChaos) GetSelectorSpecs() map[string]interface{} { | ||
return map[string]interface{}{ | ||
".": &obj.Spec.PodPVCSelector, | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.