xds.go (4284B)
1 /* 2 * 3 * Copyright 2020 gRPC authors. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 */ 18 19 package envconfig 20 21 import ( 22 "os" 23 ) 24 25 const ( 26 // XDSBootstrapFileNameEnv is the env variable to set bootstrap file name. 27 // Do not use this and read from env directly. Its value is read and kept in 28 // variable XDSBootstrapFileName. 29 // 30 // When both bootstrap FileName and FileContent are set, FileName is used. 31 XDSBootstrapFileNameEnv = "GRPC_XDS_BOOTSTRAP" 32 // XDSBootstrapFileContentEnv is the env variable to set bootstrap file 33 // content. Do not use this and read from env directly. Its value is read 34 // and kept in variable XDSBootstrapFileContent. 35 // 36 // When both bootstrap FileName and FileContent are set, FileName is used. 37 XDSBootstrapFileContentEnv = "GRPC_XDS_BOOTSTRAP_CONFIG" 38 ) 39 40 var ( 41 // XDSBootstrapFileName holds the name of the file which contains xDS 42 // bootstrap configuration. Users can specify the location of the bootstrap 43 // file by setting the environment variable "GRPC_XDS_BOOTSTRAP". 44 // 45 // When both bootstrap FileName and FileContent are set, FileName is used. 46 XDSBootstrapFileName = os.Getenv(XDSBootstrapFileNameEnv) 47 // XDSBootstrapFileContent holds the content of the xDS bootstrap 48 // configuration. Users can specify the bootstrap config by setting the 49 // environment variable "GRPC_XDS_BOOTSTRAP_CONFIG". 50 // 51 // When both bootstrap FileName and FileContent are set, FileName is used. 52 XDSBootstrapFileContent = os.Getenv(XDSBootstrapFileContentEnv) 53 // XDSRingHash indicates whether ring hash support is enabled, which can be 54 // disabled by setting the environment variable 55 // "GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH" to "false". 56 XDSRingHash = boolFromEnv("GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH", true) 57 // XDSClientSideSecurity is used to control processing of security 58 // configuration on the client-side. 59 // 60 // Note that there is no env var protection for the server-side because we 61 // have a brand new API on the server-side and users explicitly need to use 62 // the new API to get security integration on the server. 63 XDSClientSideSecurity = boolFromEnv("GRPC_XDS_EXPERIMENTAL_SECURITY_SUPPORT", true) 64 // XDSAggregateAndDNS indicates whether processing of aggregated cluster 65 // and DNS cluster is enabled, which can be enabled by setting the 66 // environment variable 67 // "GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER" to 68 // "true". 69 XDSAggregateAndDNS = boolFromEnv("GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER", true) 70 71 // XDSRBAC indicates whether xDS configured RBAC HTTP Filter is enabled, 72 // which can be disabled by setting the environment variable 73 // "GRPC_XDS_EXPERIMENTAL_RBAC" to "false". 74 XDSRBAC = boolFromEnv("GRPC_XDS_EXPERIMENTAL_RBAC", true) 75 // XDSOutlierDetection indicates whether outlier detection support is 76 // enabled, which can be disabled by setting the environment variable 77 // "GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION" to "false". 78 XDSOutlierDetection = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION", true) 79 // XDSFederation indicates whether federation support is enabled, which can 80 // be enabled by setting the environment variable 81 // "GRPC_EXPERIMENTAL_XDS_FEDERATION" to "true". 82 XDSFederation = boolFromEnv("GRPC_EXPERIMENTAL_XDS_FEDERATION", true) 83 84 // XDSRLS indicates whether processing of Cluster Specifier plugins and 85 // support for the RLS CLuster Specifier is enabled, which can be enabled by 86 // setting the environment variable "GRPC_EXPERIMENTAL_XDS_RLS_LB" to 87 // "true". 88 XDSRLS = boolFromEnv("GRPC_EXPERIMENTAL_XDS_RLS_LB", false) 89 90 // C2PResolverTestOnlyTrafficDirectorURI is the TD URI for testing. 91 C2PResolverTestOnlyTrafficDirectorURI = os.Getenv("GRPC_TEST_ONLY_GOOGLE_C2P_RESOLVER_TRAFFIC_DIRECTOR_URI") 92 )