VictoriaMetrics/vendor/google.golang.org/grpc/internal/envconfig/xds.go

93 lines
4.2 KiB
Go
Raw Normal View History

2021-09-27 17:01:40 +02:00
/*
*
* Copyright 2020 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
2021-12-20 11:06:52 +01:00
package envconfig
2021-09-27 17:01:40 +02:00
import (
"os"
)
const (
2021-12-20 11:06:52 +01:00
// XDSBootstrapFileNameEnv is the env variable to set bootstrap file name.
2021-09-27 17:01:40 +02:00
// Do not use this and read from env directly. Its value is read and kept in
2022-03-16 12:55:03 +01:00
// variable XDSBootstrapFileName.
2021-09-27 17:01:40 +02:00
//
// When both bootstrap FileName and FileContent are set, FileName is used.
2021-12-20 11:06:52 +01:00
XDSBootstrapFileNameEnv = "GRPC_XDS_BOOTSTRAP"
2022-03-16 12:55:03 +01:00
// XDSBootstrapFileContentEnv is the env variable to set bootstrap file
2021-09-27 17:01:40 +02:00
// content. Do not use this and read from env directly. Its value is read
2022-03-16 12:55:03 +01:00
// and kept in variable XDSBootstrapFileContent.
2021-09-27 17:01:40 +02:00
//
// When both bootstrap FileName and FileContent are set, FileName is used.
2021-12-20 11:06:52 +01:00
XDSBootstrapFileContentEnv = "GRPC_XDS_BOOTSTRAP_CONFIG"
2021-09-27 17:01:40 +02:00
)
var (
2021-12-20 11:06:52 +01:00
// XDSBootstrapFileName holds the name of the file which contains xDS
// bootstrap configuration. Users can specify the location of the bootstrap
// file by setting the environment variable "GRPC_XDS_BOOTSTRAP".
2021-09-27 17:01:40 +02:00
//
// When both bootstrap FileName and FileContent are set, FileName is used.
2021-12-20 11:06:52 +01:00
XDSBootstrapFileName = os.Getenv(XDSBootstrapFileNameEnv)
// XDSBootstrapFileContent holds the content of the xDS bootstrap
// configuration. Users can specify the bootstrap config by setting the
// environment variable "GRPC_XDS_BOOTSTRAP_CONFIG".
2021-09-27 17:01:40 +02:00
//
// When both bootstrap FileName and FileContent are set, FileName is used.
2021-12-20 11:06:52 +01:00
XDSBootstrapFileContent = os.Getenv(XDSBootstrapFileContentEnv)
// XDSRingHash indicates whether ring hash support is enabled, which can be
// disabled by setting the environment variable
2021-09-27 17:01:40 +02:00
// "GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH" to "false".
2023-02-08 17:55:14 +01:00
XDSRingHash = boolFromEnv("GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH", true)
2021-12-20 11:06:52 +01:00
// XDSClientSideSecurity is used to control processing of security
2021-09-27 17:01:40 +02:00
// configuration on the client-side.
//
// Note that there is no env var protection for the server-side because we
// have a brand new API on the server-side and users explicitly need to use
// the new API to get security integration on the server.
2023-02-08 17:55:14 +01:00
XDSClientSideSecurity = boolFromEnv("GRPC_XDS_EXPERIMENTAL_SECURITY_SUPPORT", true)
2021-12-20 11:06:52 +01:00
// XDSAggregateAndDNS indicates whether processing of aggregated cluster
// and DNS cluster is enabled, which can be enabled by setting the
2021-09-27 17:01:40 +02:00
// environment variable
// "GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER" to
// "true".
2023-02-08 17:55:14 +01:00
XDSAggregateAndDNS = boolFromEnv("GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER", true)
2021-09-27 17:01:40 +02:00
2021-12-20 11:06:52 +01:00
// XDSRBAC indicates whether xDS configured RBAC HTTP Filter is enabled,
2021-11-08 11:41:15 +01:00
// which can be disabled by setting the environment variable
// "GRPC_XDS_EXPERIMENTAL_RBAC" to "false".
2023-02-08 17:55:14 +01:00
XDSRBAC = boolFromEnv("GRPC_XDS_EXPERIMENTAL_RBAC", true)
2022-03-16 12:55:03 +01:00
// XDSOutlierDetection indicates whether outlier detection support is
2022-10-07 00:03:58 +02:00
// enabled, which can be disabled by setting the environment variable
// "GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION" to "false".
2023-02-08 17:55:14 +01:00
XDSOutlierDetection = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION", true)
// XDSFederation indicates whether federation support is enabled, which can
// be enabled by setting the environment variable
// "GRPC_EXPERIMENTAL_XDS_FEDERATION" to "true".
2023-05-10 08:16:43 +02:00
XDSFederation = boolFromEnv("GRPC_EXPERIMENTAL_XDS_FEDERATION", true)
2021-09-27 17:01:40 +02:00
2022-01-27 12:16:16 +01:00
// XDSRLS indicates whether processing of Cluster Specifier plugins and
// support for the RLS CLuster Specifier is enabled, which can be enabled by
// setting the environment variable "GRPC_EXPERIMENTAL_XDS_RLS_LB" to
// "true".
2023-02-08 17:55:14 +01:00
XDSRLS = boolFromEnv("GRPC_EXPERIMENTAL_XDS_RLS_LB", false)
2022-01-27 12:16:16 +01:00
2021-09-27 17:01:40 +02:00
// C2PResolverTestOnlyTrafficDirectorURI is the TD URI for testing.
2023-02-08 17:55:14 +01:00
C2PResolverTestOnlyTrafficDirectorURI = os.Getenv("GRPC_TEST_ONLY_GOOGLE_C2P_RESOLVER_TRAFFIC_DIRECTOR_URI")
2021-09-27 17:01:40 +02:00
)