yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/apis/compute/loadbalancer_const.go (about) 1 // Copyright 2019 Yunion 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package compute 16 17 import ( 18 "yunion.io/x/onecloud/pkg/util/choices" 19 ) 20 21 // Load balancer status transition (for spec status) 22 // 23 // create start stop delete 24 // init running - - - 25 // running - - stopped stopped 26 // stopped - running - - 27 // 28 // Each entity will have spec and runtime version. Spec version will increment 29 // on entity attribute update. Runtime version will be filled by the scheduler 30 // to the newest spec it has seen and committed 31 // 32 // When spec and runtime version differ, scheduler will set runtime version to 33 // "configuring", "stopping" and will finally transition to a terminal state. 34 // 35 // In the case of instance has PendingDeleted marked, it is also the 36 // scheduler's duty to make the runtime status to stopped and finally the 37 // entity in question 38 // 39 const ( 40 LB_STATUS_ENABLED = "enabled" 41 LB_STATUS_DISABLED = "disabled" 42 43 LB_STATUS_INIT = "init" 44 45 LB_CREATING = "creating" 46 LB_CREATE_FAILED = "create_failed" 47 48 LB_SYNC_CONF = "sync_conf" 49 LB_SYNC_CONF_FAILED = "sync_conf_failed" 50 51 LB_STATUS_DELETING = "deleting" 52 LB_STATUS_DELETE_FAILED = "delete_failed" 53 LB_STATUS_DELETED = "deleted" 54 55 LB_STATUS_START_FAILED = "start_failed" 56 LB_STATUS_STOP_FAILED = "stop_failed" 57 58 LB_UPDATE_TAGS = "update_tags" 59 LB_UPDATE_TAGS_FAILED = "update_tags_fail" 60 61 LB_STATUS_UNKNOWN = "unknown" 62 ) 63 64 var LB_STATUS_SPEC = choices.NewChoices( 65 LB_STATUS_ENABLED, 66 LB_STATUS_DISABLED, 67 ) 68 69 const ( 70 //默认后端服务器组 71 LB_BACKENDGROUP_TYPE_DEFAULT = "default" 72 //普通后端服务器组 73 LB_BACKENDGROUP_TYPE_NORMAL = "normal" 74 //主备后端服务器组 75 LB_BACKENDGROUP_TYPE_MASTER_SLAVE = "master_slave" 76 ) 77 78 var LB_BACKENDGROUP_TYPE = choices.NewChoices( 79 LB_BACKENDGROUP_TYPE_DEFAULT, 80 LB_BACKENDGROUP_TYPE_NORMAL, 81 LB_BACKENDGROUP_TYPE_MASTER_SLAVE, 82 ) 83 84 const ( 85 LB_ALIYUN_SPEC_SHAREABLE = "" //性能共享型 86 LB_ALIYUN_SPEC_S1_SMALL = "slb.s1.small" 87 LB_ALIYUN_SPEC_S2_SMALL = "slb.s2.small" 88 LB_ALIYUN_SPEC_S3_SMALL = "slb.s3.small" 89 LB_ALIYUN_SPEC_S2_MEDIUM = "slb.s2.medium" 90 LB_ALIYUN_SPEC_S3_MEDIUM = "slb.s3.medium" 91 LB_ALIYUN_SPEC_S3_LARGE = "slb.s3.large" 92 93 LB_AWS_SPEC_APPLICATION = "application" 94 LB_AWS_SPEC_NETWORK = "network" 95 ) 96 97 const ( 98 LB_MbpsMin = 0 99 LB_MbpsMax = 10000 100 ) 101 102 var LB_ALIYUN_SPECS = choices.NewChoices( 103 LB_ALIYUN_SPEC_SHAREABLE, 104 LB_ALIYUN_SPEC_S1_SMALL, 105 LB_ALIYUN_SPEC_S2_SMALL, 106 LB_ALIYUN_SPEC_S3_SMALL, 107 LB_ALIYUN_SPEC_S2_MEDIUM, 108 LB_ALIYUN_SPEC_S3_MEDIUM, 109 LB_ALIYUN_SPEC_S3_LARGE, 110 ) 111 112 var LB_AWS_SPECS = choices.NewChoices( 113 LB_AWS_SPEC_APPLICATION, 114 LB_AWS_SPEC_NETWORK, 115 ) 116 117 // Load Balancer network type (vpc or classic) determines viable backend 118 // servers (they should be from the same network type as the load balancer). 119 // 120 // Load Balancer address type (intranet or internet) determins the scope the 121 // service provided by load balancer can be accessed. If it's intranet, then 122 // it will only be accessible from the specified network. If it's internet, 123 // then it's public and can be accessed from outside the cloud region 124 const ( 125 LB_ADDR_TYPE_INTRANET = "intranet" 126 LB_ADDR_TYPE_INTERNET = "internet" 127 ) 128 129 var LB_ADDR_TYPES = choices.NewChoices( 130 LB_ADDR_TYPE_INTERNET, 131 LB_ADDR_TYPE_INTRANET, 132 ) 133 134 const ( 135 LB_NETWORK_TYPE_CLASSIC = "classic" 136 LB_NETWORK_TYPE_VPC = "vpc" 137 ) 138 139 var LB_NETWORK_TYPES = choices.NewChoices( 140 LB_NETWORK_TYPE_CLASSIC, 141 LB_NETWORK_TYPE_VPC, 142 ) 143 144 // TODO https_direct sni 145 const ( 146 LB_LISTENER_TYPE_TCP = "tcp" 147 LB_LISTENER_TYPE_UDP = "udp" 148 LB_LISTENER_TYPE_TCP_UDP = "tcp_udp" 149 LB_LISTENER_TYPE_HTTP = "http" 150 LB_LISTENER_TYPE_HTTPS = "https" 151 LB_LISTENER_TYPE_TERMINATED_HTTPS = "terminated_https" 152 ) 153 154 var LB_LISTENER_TYPES = choices.NewChoices( 155 LB_LISTENER_TYPE_TCP, 156 LB_LISTENER_TYPE_UDP, 157 LB_LISTENER_TYPE_HTTP, 158 LB_LISTENER_TYPE_HTTPS, 159 ) 160 161 // aws_network_lb_listener 162 var AWS_NETWORK_LB_LISTENER_TYPES = choices.NewChoices( 163 LB_LISTENER_TYPE_TCP, 164 LB_LISTENER_TYPE_UDP, 165 // LB_LISTENER_TYPE_TCP_UDP 166 ) 167 168 // aws_application_lb_listener 169 var AWS_APPLICATION_LB_LISTENER_TYPES = choices.NewChoices( 170 LB_LISTENER_TYPE_HTTP, 171 LB_LISTENER_TYPE_HTTPS, 172 ) 173 174 // huawei backend group protocal choices 175 var HUAWEI_LBBG_PROTOCOL_TYPES = choices.NewChoices( 176 LB_LISTENER_TYPE_TCP, 177 LB_LISTENER_TYPE_UDP, 178 LB_LISTENER_TYPE_HTTP, 179 ) 180 181 var HUAWEI_LBBG_SCHDULERS = choices.NewChoices( 182 LB_SCHEDULER_WLC, 183 LB_SCHEDULER_RR, 184 LB_SCHEDULER_SCH, 185 ) 186 187 const ( 188 LB_ACL_TYPE_BLACK = "black" 189 LB_ACL_TYPE_WHITE = "white" 190 ) 191 192 var LB_ACL_TYPES = choices.NewChoices( 193 LB_ACL_TYPE_BLACK, 194 LB_ACL_TYPE_WHITE, 195 ) 196 197 const ( 198 LB_TLS_CERT_FINGERPRINT_ALGO_SHA1 = "sha1" 199 LB_TLS_CERT_FINGERPRINT_ALGO_SHA256 = "sha256" 200 ) 201 202 const ( 203 LB_TLS_CERT_PUBKEY_ALGO_RSA = "RSA" 204 LB_TLS_CERT_PUBKEY_ALGO_ECDSA = "ECDSA" 205 ) 206 207 var LB_TLS_CERT_PUBKEY_ALGOS = choices.NewChoices( 208 LB_TLS_CERT_PUBKEY_ALGO_RSA, 209 LB_TLS_CERT_PUBKEY_ALGO_ECDSA, 210 ) 211 212 // TODO may want extra for legacy apps 213 const ( 214 LB_TLS_CIPHER_POLICY_1_0 = "tls_cipher_policy_1_0" 215 LB_TLS_CIPHER_POLICY_1_1 = "tls_cipher_policy_1_1" 216 LB_TLS_CIPHER_POLICY_1_2 = "tls_cipher_policy_1_2" 217 LB_TLS_CIPHER_POLICY_1_2_strict = "tls_cipher_policy_1_2_strict" 218 LB_TLS_CIPHER_POLICY_deault = "" 219 ) 220 221 var LB_TLS_CIPHER_POLICIES = choices.NewChoices( 222 LB_TLS_CIPHER_POLICY_1_0, 223 LB_TLS_CIPHER_POLICY_1_1, 224 LB_TLS_CIPHER_POLICY_1_2, 225 LB_TLS_CIPHER_POLICY_1_2_strict, 226 LB_TLS_CIPHER_POLICY_deault, 227 ) 228 229 const ( 230 LB_STICKY_SESSION_TYPE_INSERT = "insert" 231 LB_STICKY_SESSION_TYPE_SERVER = "server" 232 ) 233 234 var LB_STICKY_SESSION_TYPES = choices.NewChoices( 235 LB_STICKY_SESSION_TYPE_INSERT, 236 LB_STICKY_SESSION_TYPE_SERVER, 237 ) 238 239 // TODO maybe https check when field need comes ;) 240 const ( 241 LB_HEALTH_CHECK_PING = "ping" 242 LB_HEALTH_CHECK_TCP = "tcp" 243 LB_HEALTH_CHECK_UDP = "udp" 244 LB_HEALTH_CHECK_HTTP = "http" 245 LB_HEALTH_CHECK_HTTPS = "https" 246 ) 247 248 var LB_HEALTH_CHECK_TYPES = choices.NewChoices( 249 LB_HEALTH_CHECK_TCP, 250 LB_HEALTH_CHECK_UDP, 251 LB_HEALTH_CHECK_HTTP, 252 ) 253 254 var LB_HEALTH_CHECK_TYPES_TCP = choices.NewChoices( 255 LB_HEALTH_CHECK_TCP, 256 LB_HEALTH_CHECK_HTTP, 257 ) 258 259 var LB_HEALTH_CHECK_TYPES_UDP = choices.NewChoices( 260 LB_HEALTH_CHECK_UDP, 261 ) 262 263 const ( 264 LB_HEALTH_CHECK_HTTP_CODE_1xx = "http_1xx" 265 LB_HEALTH_CHECK_HTTP_CODE_2xx = "http_2xx" 266 LB_HEALTH_CHECK_HTTP_CODE_3xx = "http_3xx" 267 LB_HEALTH_CHECK_HTTP_CODE_4xx = "http_4xx" 268 LB_HEALTH_CHECK_HTTP_CODE_5xx = "http_5xx" 269 LB_HEALTH_CHECK_HTTP_CODE_DEFAULT = "http_2xx,http_3xx" 270 ) 271 272 var LB_HEALTH_CHECK_HTTP_CODES = choices.NewChoices( 273 LB_HEALTH_CHECK_HTTP_CODE_1xx, 274 LB_HEALTH_CHECK_HTTP_CODE_2xx, 275 LB_HEALTH_CHECK_HTTP_CODE_3xx, 276 LB_HEALTH_CHECK_HTTP_CODE_4xx, 277 LB_HEALTH_CHECK_HTTP_CODE_5xx, 278 ) 279 280 const ( 281 LB_REDIRECT_OFF = "off" 282 LB_REDIRECT_RAW = "raw" 283 ) 284 285 var LB_REDIRECT_TYPES = choices.NewChoices( 286 LB_REDIRECT_OFF, 287 LB_REDIRECT_RAW, 288 ) 289 290 const ( 291 LB_REDIRECT_CODE_301 = int64(301) // Moved Permanently 292 LB_REDIRECT_CODE_302 = int64(302) // Found 293 LB_REDIRECT_CODE_307 = int64(307) // Temporary Redirect 294 ) 295 296 var LB_REDIRECT_CODES = []int64{ 297 LB_REDIRECT_CODE_301, 298 LB_REDIRECT_CODE_302, 299 LB_REDIRECT_CODE_307, 300 } 301 302 const ( 303 LB_REDIRECT_SCHEME_IDENTITY = "" 304 LB_REDIRECT_SCHEME_HTTP = "http" 305 LB_REDIRECT_SCHEME_HTTPS = "https" 306 ) 307 308 var LB_REDIRECT_SCHEMES = choices.NewChoices( 309 LB_REDIRECT_SCHEME_IDENTITY, 310 LB_REDIRECT_SCHEME_HTTP, 311 LB_REDIRECT_SCHEME_HTTPS, 312 ) 313 314 const ( 315 LB_BOOL_ON = "on" 316 LB_BOOL_OFF = "off" 317 ) 318 319 var LB_BOOL_VALUES = choices.NewChoices( 320 LB_BOOL_ON, 321 LB_BOOL_OFF, 322 ) 323 324 //TODO 325 // 326 // - qch, quic connection id 327 // - mh, maglev consistent hash 328 const ( 329 LB_SCHEDULER_RR = "rr" // round robin 330 LB_SCHEDULER_WRR = "wrr" // weighted round robin 331 LB_SCHEDULER_WLC = "wlc" // weighted least connection 332 LB_SCHEDULER_SCH = "sch" // source-ip-based consistent hash 333 LB_SCHEDULER_TCH = "tch" // 4-tuple-based consistent hash 334 LB_SCHEDULER_QCH = "qch" 335 LB_SCHEDULER_MH = "mh" // maglev consistent hash 336 ) 337 338 var LB_SCHEDULER_TYPES = choices.NewChoices( 339 LB_SCHEDULER_RR, 340 LB_SCHEDULER_WRR, 341 LB_SCHEDULER_WLC, 342 LB_SCHEDULER_SCH, 343 LB_SCHEDULER_TCH, 344 ) 345 346 const ( 347 LB_SENDPROXY_OFF = "off" 348 LB_SENDPROXY_V1 = "v1" 349 LB_SENDPROXY_V2 = "v2" 350 LB_SENDPROXY_V2_SSL = "v2-ssl" 351 LB_SENDPROXY_V2_SSL_CN = "v2-ssl-cn" 352 ) 353 354 var LB_SENDPROXY_CHOICES = choices.NewChoices( 355 LB_SENDPROXY_OFF, 356 LB_SENDPROXY_V1, 357 LB_SENDPROXY_V2, 358 LB_SENDPROXY_V2_SSL, 359 LB_SENDPROXY_V2_SSL_CN, 360 ) 361 362 var LB_ALIYUN_UDP_SCHEDULER_TYPES = choices.NewChoices( 363 LB_SCHEDULER_RR, 364 LB_SCHEDULER_WRR, 365 LB_SCHEDULER_WLC, 366 LB_SCHEDULER_SCH, 367 LB_SCHEDULER_TCH, 368 LB_SCHEDULER_QCH, 369 ) 370 371 var LB_ALIYUN_COMMON_SCHEDULER_TYPES = choices.NewChoices( 372 LB_SCHEDULER_RR, 373 LB_SCHEDULER_WRR, 374 LB_SCHEDULER_WLC, 375 ) 376 377 // TODO raw type 378 const ( 379 LB_BACKEND_GUEST = "guest" 380 LB_BACKEND_HOST = "host" 381 LB_BACKEND_IP = "ip" 382 ) 383 384 var LB_BACKEND_TYPES = choices.NewChoices( 385 LB_BACKEND_GUEST, 386 LB_BACKEND_HOST, 387 LB_BACKEND_IP, 388 ) 389 390 const ( 391 LB_BACKEND_ROLE_DEFAULT = "default" 392 LB_BACKEND_ROLE_MASTER = "master" 393 LB_BACKEND_ROLE_SLAVE = "slave" 394 ) 395 396 var LB_BACKEND_ROLES = choices.NewChoices( 397 LB_BACKEND_ROLE_MASTER, 398 LB_BACKEND_ROLE_DEFAULT, 399 LB_BACKEND_ROLE_SLAVE, 400 ) 401 402 const ( 403 LB_CHARGE_TYPE_BY_TRAFFIC = "traffic" 404 LB_CHARGE_TYPE_BY_BANDWIDTH = "bandwidth" 405 ) 406 407 var LB_CHARGE_TYPES = choices.NewChoices( 408 LB_CHARGE_TYPE_BY_TRAFFIC, 409 LB_CHARGE_TYPE_BY_BANDWIDTH, 410 ) 411 412 const ( 413 LB_HA_STATE_MASTER = "MASTER" 414 LB_HA_STATE_BACKUP = "BACKUP" 415 LB_HA_STATE_FAULT = "FAULT" 416 LB_HA_STATE_STOP = "STOP" 417 LB_HA_STATE_UNKNOWN = "UNKNOWN" 418 ) 419 420 var LB_HA_STATES = choices.NewChoices( 421 LB_HA_STATE_MASTER, 422 LB_HA_STATE_BACKUP, 423 LB_HA_STATE_FAULT, 424 LB_HA_STATE_STOP, 425 LB_HA_STATE_UNKNOWN, 426 ) 427 428 const ( 429 LBAGENT_QUERY_ORIG_KEY = "_orig" 430 LBAGENT_QUERY_ORIG_VAL = "lbagent" 431 ) 432 433 const ( 434 LB_ASSOCIATE_TYPE_LISTENER = "listener" 435 LB_ASSOCIATE_TYPE_RULE = "rule" 436 )