github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/pkg/cli/cmd/fault/fault_constant.go (about)

     1  /*
     2  Copyright (C) 2022-2023 ApeCloud Co., Ltd
     3  
     4  This file is part of KubeBlocks project
     5  
     6  This program is free software: you can redistribute it and/or modify
     7  it under the terms of the GNU Affero General Public License as published by
     8  the Free Software Foundation, either version 3 of the License, or
     9  (at your option) any later version.
    10  
    11  This program is distributed in the hope that it will be useful
    12  but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  GNU Affero General Public License for more details.
    15  
    16  You should have received a copy of the GNU Affero General Public License
    17  along with this program.  If not, see <http://www.gnu.org/licenses/>.
    18  */
    19  
    20  package fault
    21  
    22  import cp "github.com/1aal/kubeblocks/pkg/cli/cloudprovider"
    23  
    24  // Unchanged DryRun flag
    25  const (
    26  	Unchanged = "unchanged"
    27  )
    28  
    29  // GVR
    30  const (
    31  	Group        = "chaos-mesh.org"
    32  	Version      = "v1alpha1"
    33  	GroupVersion = Group + "/" + Version
    34  
    35  	ResourcePodChaos     = "podchaos"
    36  	ResourceNetworkChaos = "networkchaos"
    37  	ResourceDNSChaos     = "dnschaos"
    38  	ResourceHTTPChaos    = "httpchaos"
    39  	ResourceIOChaos      = "iochaos"
    40  	ResourceStressChaos  = "stresschaos"
    41  	ResourceTimeChaos    = "timechaos"
    42  	ResourceAWSChaos     = "awschaos"
    43  	ResourceGCPChaos     = "gcpchaos"
    44  
    45  	KindAWSChaos = "AWSChaos"
    46  	KindGCPChaos = "GCPChaos"
    47  )
    48  
    49  // Cue Template Name
    50  const (
    51  	CueTemplatePodChaos     = "pod_chaos_template.cue"
    52  	CueTemplateNetworkChaos = "network_chaos_template.cue"
    53  	CueTemplateDNSChaos     = "dns_chaos_template.cue"
    54  	CueTemplateHTTPChaos    = "http_chaos_template.cue"
    55  	CueTemplateIOChaos      = "io_chaos_template.cue"
    56  	CueTemplateStressChaos  = "stress_chaos_template.cue"
    57  	CueTemplateTimeChaos    = "time_chaos_template.cue"
    58  	CueTemplateNodeChaos    = "node_chaos_template.cue"
    59  )
    60  
    61  // Pod Chaos Command
    62  const (
    63  	Kill               = "kill"
    64  	KillShort          = "kill pod"
    65  	Failure            = "failure"
    66  	FailureShort       = "failure pod"
    67  	KillContainer      = "kill-container"
    68  	KillContainerShort = "kill containers"
    69  )
    70  
    71  // NetWork Chaos Command
    72  const (
    73  	Partition      = "partition"
    74  	PartitionShort = "Make a pod network partitioned from other objects."
    75  	Loss           = "loss"
    76  	LossShort      = "Cause pods to communicate with other objects to drop packets."
    77  	Delay          = "delay"
    78  	DelayShort     = "Make pods communicate with other objects lazily."
    79  	Duplicate      = "duplicate"
    80  	DuplicateShort = "Make pods communicate with other objects to pick up duplicate packets."
    81  	Corrupt        = "corrupt"
    82  	CorruptShort   = "Distorts the messages a pod communicates with other objects."
    83  	Bandwidth      = "bandwidth"
    84  	BandwidthShort = "Limit the bandwidth that pods use to communicate with other objects."
    85  )
    86  
    87  // DNS Chaos Command
    88  const (
    89  	Random      = "random"
    90  	RandomShort = "Make DNS return any IP when resolving external domain names."
    91  	Error       = "error"
    92  	ErrorShort  = "Make DNS return an error when resolving external domain names."
    93  )
    94  
    95  // HTTP Chaos Command
    96  const (
    97  	Abort          = "abort"
    98  	AbortShort     = "Abort the HTTP request and response."
    99  	HTTPDelay      = "delay"
   100  	HTTPDelayShort = "Delay the HTTP request and response."
   101  	Replace        = "replace"
   102  	ReplaceShort   = "Replace the HTTP request and response."
   103  	Patch          = "patch"
   104  	PatchShort     = "Patch the HTTP request and response."
   105  )
   106  
   107  // IO Chaos Command
   108  const (
   109  	Latency        = "latency"
   110  	LatencyShort   = "Delayed IO operations."
   111  	Errno          = "errno"
   112  	ErrnoShort     = "Causes IO operations to return specific errors."
   113  	Attribute      = "attribute"
   114  	AttributeShort = "Override the attributes of the file."
   115  	Mistake        = "mistake"
   116  	MistakeShort   = "Alters the contents of the file, distorting the contents of the file."
   117  )
   118  
   119  // Stress Chaos Command
   120  const (
   121  	Stress      = "stress"
   122  	StressShort = "Add memory pressure or CPU load to the system."
   123  )
   124  
   125  // Time Chaos Command
   126  const (
   127  	Time      = "time"
   128  	TimeShort = "Clock skew failure."
   129  )
   130  
   131  // Node Chaos Command
   132  const (
   133  	Stop              = "stop"
   134  	StopShort         = "Stop instance"
   135  	Restart           = "restart"
   136  	RestartShort      = "Restart instance"
   137  	DetachVolume      = "detach-volume"
   138  	DetachVolumeShort = "Detach volume"
   139  
   140  	AWSSecretName = "cloud-key-secret-aws"
   141  	GCPSecretName = "cloud-key-secret-gcp"
   142  )
   143  
   144  var supportedCloudProviders = []string{cp.AWS, cp.GCP}