|
| 1 | +/* |
| 2 | +Copyright 2024 Flant JSC |
| 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 common |
| 18 | + |
| 19 | +import "errors" |
| 20 | + |
| 21 | +const ( |
| 22 | + // FilesystemOverheadVar provides a constant to capture our env variable "FILESYSTEM_OVERHEAD" |
| 23 | + FilesystemOverheadVar = "FILESYSTEM_OVERHEAD" |
| 24 | + // OwnerUID provides the UID of the owner entity (either PVC or DV) |
| 25 | + OwnerUID = "OWNER_UID" |
| 26 | + |
| 27 | + // ImporterContainerName provides a constant to use as a name for importer Container |
| 28 | + ImporterContainerName = "importer" |
| 29 | + // UploaderContainerName provides a constant to use as a name for uploader Container |
| 30 | + UploaderContainerName = "uploader" |
| 31 | + // UploaderPortName provides a constant to use as a port name for uploader Service |
| 32 | + UploaderPortName = "uploader" |
| 33 | + // UploaderPort provides a constant to use as a port for uploader Service |
| 34 | + UploaderPort = 80 |
| 35 | + // ImporterPodImageNameVar is a name of variable with the image name for the importer Pod |
| 36 | + ImporterPodImageNameVar = "IMPORTER_IMAGE" |
| 37 | + // UploaderPodImageNameVar is a name of variable with the image name for the uploader Pod |
| 38 | + UploaderPodImageNameVar = "UPLOADER_IMAGE" |
| 39 | + // ImporterCertDir is where the configmap containing certs will be mounted |
| 40 | + ImporterCertDir = "/certs" |
| 41 | + // ImporterProxyCertDir is where the configmap containing proxy certs will be mounted |
| 42 | + ImporterProxyCertDir = "/proxycerts/" |
| 43 | + |
| 44 | + // ImporterSource provides a constant to capture our env variable "IMPORTER_SOURCE" |
| 45 | + ImporterSource = "IMPORTER_SOURCE" |
| 46 | + // ImporterContentType provides a constant to capture our env variable "IMPORTER_CONTENTTYPE" |
| 47 | + ImporterContentType = "IMPORTER_CONTENTTYPE" |
| 48 | + // ImporterEndpoint provides a constant to capture our env variable "IMPORTER_ENDPOINT" |
| 49 | + ImporterEndpoint = "IMPORTER_ENDPOINT" |
| 50 | + // ImporterAccessKeyID provides a constant to capture our env variable "IMPORTER_ACCES_KEY_ID" |
| 51 | + ImporterAccessKeyID = "IMPORTER_ACCESS_KEY_ID" |
| 52 | + // ImporterSecretKey provides a constant to capture our env variable "IMPORTER_SECRET_KEY" |
| 53 | + ImporterSecretKey = "IMPORTER_SECRET_KEY" |
| 54 | + // ImporterImageSize provides a constant to capture our env variable "IMPORTER_IMAGE_SIZE" |
| 55 | + ImporterImageSize = "IMPORTER_IMAGE_SIZE" |
| 56 | + // ImporterCertDirVar provides a constant to capture our env variable "IMPORTER_CERT_DIR" |
| 57 | + ImporterCertDirVar = "IMPORTER_CERT_DIR" |
| 58 | + // InsecureTLSVar provides a constant to capture our env variable "INSECURE_TLS" |
| 59 | + InsecureTLSVar = "INSECURE_TLS" |
| 60 | + // ImporterDiskID provides a constant to capture our env variable "IMPORTER_DISK_ID" |
| 61 | + ImporterDiskID = "IMPORTER_DISK_ID" |
| 62 | + // ImporterUUID provides a constant to capture our env variable "IMPORTER_UUID" |
| 63 | + ImporterUUID = "IMPORTER_UUID" |
| 64 | + // ImporterReadyFile provides a constant to capture our env variable "IMPORTER_READY_FILE" |
| 65 | + ImporterReadyFile = "IMPORTER_READY_FILE" |
| 66 | + // ImporterDoneFile provides a constant to capture our env variable "IMPORTER_DONE_FILE" |
| 67 | + ImporterDoneFile = "IMPORTER_DONE_FILE" |
| 68 | + // ImporterBackingFile provides a constant to capture our env variable "IMPORTER_BACKING_FILE" |
| 69 | + ImporterBackingFile = "IMPORTER_BACKING_FILE" |
| 70 | + // ImporterThumbprint provides a constant to capture our env variable "IMPORTER_THUMBPRINT" |
| 71 | + ImporterThumbprint = "IMPORTER_THUMBPRINT" |
| 72 | + // ImportProxyHTTP provides a constant to capture our env variable "http_proxy" |
| 73 | + ImportProxyHTTP = "http_proxy" |
| 74 | + // ImportProxyHTTPS provides a constant to capture our env variable "https_proxy" |
| 75 | + ImportProxyHTTPS = "https_proxy" |
| 76 | + // ImportProxyNoProxy provides a constant to capture our env variable "no_proxy" |
| 77 | + ImportProxyNoProxy = "no_proxy" |
| 78 | + // ImporterProxyCertDirVar provides a constant to capture our env variable "IMPORTER_PROXY_CERT_DIR" |
| 79 | + ImporterProxyCertDirVar = "IMPORTER_PROXY_CERT_DIR" |
| 80 | + // ImporterExtraHeader provides a constant to include extra HTTP headers, as the prefix to a format string |
| 81 | + ImporterExtraHeader = "IMPORTER_EXTRA_HEADER_" |
| 82 | + // ImporterSecretExtraHeadersDir is where the secrets containing extra HTTP headers will be mounted |
| 83 | + ImporterSecretExtraHeadersDir = "/extraheaders" |
| 84 | + |
| 85 | + // ImporterDestinationAuthConfigDir is a mount directory for auth Secret. |
| 86 | + ImporterDestinationAuthConfigDir = "/dvcr-auth" |
| 87 | + // ImporterDestinationAuthConfigVar is an environment variable with auth config file for Importer Pod. |
| 88 | + ImporterDestinationAuthConfigVar = "IMPORTER_DESTINATION_AUTH_CONFIG" |
| 89 | + // ImporterDestinationAuthConfigFile is a path to auth config file in mount directory. |
| 90 | + ImporterDestinationAuthConfigFile = "/dvcr-auth/.dockerconfigjson" |
| 91 | + // DestinationInsecureTLSVar is an environment variable for Importer Pod that defines whether DVCR is insecure. |
| 92 | + DestinationInsecureTLSVar = "DESTINATION_INSECURE_TLS" |
| 93 | + ImporterSHA256Sum = "IMPORTER_SHA256SUM" |
| 94 | + ImporterMD5Sum = "IMPORTER_MD5SUM" |
| 95 | + ImporterAuthConfigVar = "IMPORTER_AUTH_CONFIG" |
| 96 | + ImporterAuthConfigDir = "/dvcr-src-auth" |
| 97 | + ImporterAuthConfigFile = "/dvcr-src-auth/.dockerconfigjson" |
| 98 | + ImporterDestinationEndpoint = "IMPORTER_DESTINATION_ENDPOINT" |
| 99 | + |
| 100 | + UploaderDestinationEndpoint = "UPLOADER_DESTINATION_ENDPOINT" |
| 101 | + UploaderDestinationAuthConfigVar = "UPLOADER_DESTINATION_AUTH_CONFIG" |
| 102 | + UploaderExtraHeader = "UPLOADER_EXTRA_HEADER_" |
| 103 | + UploaderDestinationAuthConfigDir = "/dvcr-auth" |
| 104 | + UploaderDestinationAuthConfigFile = "/dvcr-auth/.dockerconfigjson" |
| 105 | + UploaderSecretExtraHeadersDir = "/extraheaders" |
| 106 | + |
| 107 | + DockerRegistrySchemePrefix = "docker://" |
| 108 | + |
| 109 | + VmBlockDeviceAttachedLimit = 16 |
| 110 | +) |
| 111 | + |
| 112 | +var ( |
| 113 | + // ErrUnknownValue is a variable of type `error` that represents an error message indicating an unknown value. |
| 114 | + ErrUnknownValue = errors.New("unknown value") |
| 115 | + // ErrUnknownType is a variable of type `error` that represents an error message indicating an unknown type. |
| 116 | + ErrUnknownType = errors.New("unknown type") |
| 117 | +) |
0 commit comments