github.com/openebs/api@v1.12.0/pkg/apis/cstor/v1/cstorvolumepolicy.go (about) 1 /* 2 Copyright 2020 The OpenEBS Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1 18 19 import ( 20 corev1 "k8s.io/api/core/v1" 21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 22 ) 23 24 // +genclient 25 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 26 // +k8s:openapi-gen=true 27 28 // CStorVolumePolicy describes a configuration required for cstor volume 29 // resources 30 type CStorVolumePolicy struct { 31 metav1.TypeMeta `json:",inline"` 32 metav1.ObjectMeta `json:"metadata,omitempty"` 33 // Spec defines a configuration info of a cstor volume required 34 // to provisione cstor volume resources 35 Spec CStorVolumePolicySpec `json:"spec"` 36 Status CStorVolumePolicyStatus `json:"status"` 37 } 38 39 // CStorVolumePolicySpec ... 40 type CStorVolumePolicySpec struct { 41 // replicaAffinity is set to true then volume replica resources need to be 42 // distributed across the pool instances 43 Provision Provision `json:"provision"` 44 45 // TargetSpec represents configuration related to cstor target and its resources 46 Target TargetSpec `json:"target"` 47 48 // ReplicaSpec represents configuration related to replicas resources 49 Replica ReplicaSpec `json:"replica"` 50 51 // ReplicaPoolInfo holds the pool information of volume replicas. 52 // Ex: If volume is provisioned on which CStor pool volume replicas exist 53 ReplicaPoolInfo []ReplicaPoolInfo `json:"replicaPoolInfo"` 54 } 55 56 // TargetSpec represents configuration related to cstor target and its resources 57 type TargetSpec struct { 58 // QueueDepth sets the queue size at iSCSI target which limits the 59 // ongoing IO count from client 60 QueueDepth string `json:"queueDepth,omitempty"` 61 62 // IOWorkers sets the number of threads that are working on above queue 63 IOWorkers int64 `json:"luWorkers,omitempty"` 64 65 // Monitor enables or disables the target exporter sidecar 66 Monitor bool `json:"monitor,omitempty"` 67 68 // ReplicationFactor represents maximum number of replicas 69 // that are allowed to connect to the target 70 ReplicationFactor int64 `json:"replicationFactor,omitempty"` 71 72 // Resources are the compute resources required by the cstor-target 73 // container. 74 Resources *corev1.ResourceRequirements `json:"resources,omitempty"` 75 76 // AuxResources are the compute resources required by the cstor-target pod 77 // side car containers. 78 AuxResources *corev1.ResourceRequirements `json:"auxResources,omitempty"` 79 80 // Tolerations, if specified, are the target pod's tolerations 81 Tolerations []corev1.Toleration `json:"tolerations,omitempty"` 82 83 // PodAffinity if specified, are the target pod's affinities 84 PodAffinity *corev1.PodAffinity `json:"affinity,omitempty"` 85 86 // NodeSelector is the labels that will be used to select 87 // a node for target pod scheduleing 88 // Required field 89 NodeSelector map[string]string `json:"nodeSelector,omitempty"` 90 91 // PriorityClassName if specified applies to this target pod 92 // If left empty, no priority class is applied. 93 PriorityClassName string `json:"priorityClassName,omitempty"` 94 } 95 96 // ReplicaSpec represents configuration related to replicas resources 97 type ReplicaSpec struct { 98 // IOWorkers represents number of threads that executes client IOs 99 IOWorkers string `json:"zvolWorkers,omitempty"` 100 // Controls the compression algorithm used for this volumes 101 // examples: on|off|gzip|gzip-N|lz4|lzjb|zle 102 // 103 // Setting compression to "on" indicates that the current default compression 104 // algorithm should be used.The default balances compression and decompression 105 // speed, with compression ratio and is expected to work well on a wide variety 106 // of workloads. Unlike all other setātings for this property, on does not 107 // select a fixed compression type. As new compression algorithms are added 108 // to ZFS and enabled on a pool, the default compression algorithm may change. 109 // The current default compression algorithm is either lzjb or, if the 110 // `lz4_compress feature is enabled, lz4. 111 112 // The lz4 compression algorithm is a high-performance replacement for the lzjb 113 // algorithm. It features significantly faster compression and decompression, 114 // as well as a moderately higher compression ratio than lzjb, but can only 115 // be used on pools with the lz4_compress 116 117 // feature set to enabled. See zpool-features(5) for details on ZFS feature 118 // flags and the lz4_compress feature. 119 120 // The lzjb compression algorithm is optimized for performance while providing 121 // decent data compression. 122 123 // The gzip compression algorithm uses the same compression as the gzip(1) 124 // command. You can specify the gzip level by using the value gzip-N, 125 // where N is an integer from 1 (fastest) to 9 (best compression ratio). 126 // Currently, gzip is equivalent to gzip-6 (which is also the default for gzip(1)). 127 128 // The zle compression algorithm compresses runs of zeros. 129 Compression string `json:"compression,omitempty"` 130 } 131 132 // Provision represents different provisioning policy for cstor volumes 133 type Provision struct { 134 // replicaAffinity is set to true then volume replica resources need to be 135 // distributed across the cstor pool instances based on the given topology 136 ReplicaAffinity bool `json:"replicaAffinity"` 137 // BlockSize is the logical block size in multiple of 512 bytes 138 // BlockSize specifies the block size of the volume. The blocksize 139 // cannot be changed once the volume has been written, so it should be 140 // set at volume creation time. The default blocksize for volumes is 4 Kbytes. 141 // Any power of 2 from 512 bytes to 128 Kbytes is valid. 142 BlockSize uint32 `json:"blockSize,omitempty"` 143 } 144 145 // ReplicaPoolInfo represents the pool information of volume replica 146 type ReplicaPoolInfo struct { 147 // PoolName represents the pool name where volume replica exists 148 PoolName string `json:"poolName"` 149 // UID also can be added 150 } 151 152 // CStorVolumePolicyStatus is for handling status of CstorVolumePolicy 153 type CStorVolumePolicyStatus struct { 154 Phase string `json:"phase"` 155 } 156 157 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 158 // +k8s:openapi-gen=true 159 160 // CStorVolumePolicyList is a list of CStorVolumePolicy resources 161 type CStorVolumePolicyList struct { 162 metav1.TypeMeta `json:",inline"` 163 metav1.ListMeta `json:"metadata"` 164 165 Items []CStorVolumePolicy `json:"items"` 166 }