17344: Remove client code setting X-External-Client header.
authorTom Clegg <tom@curii.com>
Tue, 30 Aug 2022 15:23:52 +0000 (11:23 -0400)
committerTom Clegg <tom@curii.com>
Tue, 30 Aug 2022 15:23:52 +0000 (11:23 -0400)
It doesn't do anything: Nginx replaces it with 0 or 1 based on remote
IP address.

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

12 files changed:
sdk/go/arvadosclient/arvadosclient.go
sdk/python/arvados/api.py
sdk/python/arvados/keep.py
sdk/python/tests/run_test_server.py
sdk/python/tests/test_keep_client.py
services/crunch-dispatch-local/crunch-dispatch-local.go
services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
services/keepproxy/keepproxy_test.go
tools/keep-block-check/keep-block-check.go
tools/keep-block-check/keep-block-check_test.go
tools/keep-rsync/keep-rsync.go
tools/keep-rsync/keep-rsync_test.go

index 2044df633783894a37b426a0963a33ca93ec5852..13b3a30ac40d8c9f21f5a39434164f34d353d270 100644 (file)
@@ -103,10 +103,6 @@ type ArvadosClient struct {
        // Client object shared by client requests.  Supports HTTP KeepAlive.
        Client *http.Client
 
-       // If true, sets the X-External-Client header to indicate
-       // the client is outside the cluster.
-       External bool
-
        // Base URIs of Keep services, e.g., {"https://host1:8443",
        // "https://host2:8443"}.  If this is nil, Keep clients will
        // use the arvados.v1.keep_services.accessible API to discover
@@ -180,7 +176,6 @@ func New(c *arvados.Client) (*ArvadosClient, error) {
                ApiToken:          c.AuthToken,
                ApiInsecure:       c.Insecure,
                Client:            hc,
-               External:          false,
                Retries:           2,
                KeepServiceURIs:   c.KeepServiceURIs,
                lastClosedIdlesAt: time.Now(),
@@ -191,15 +186,9 @@ func New(c *arvados.Client) (*ArvadosClient, error) {
 
 // MakeArvadosClient creates a new ArvadosClient using the standard
 // environment variables ARVADOS_API_HOST, ARVADOS_API_TOKEN,
-// ARVADOS_API_HOST_INSECURE, ARVADOS_EXTERNAL_CLIENT, and
-// ARVADOS_KEEP_SERVICES.
-func MakeArvadosClient() (ac *ArvadosClient, err error) {
-       ac, err = New(arvados.NewClientFromEnv())
-       if err != nil {
-               return
-       }
-       ac.External = StringBool(os.Getenv("ARVADOS_EXTERNAL_CLIENT"))
-       return
+// ARVADOS_API_HOST_INSECURE, and ARVADOS_KEEP_SERVICES.
+func MakeArvadosClient() (*ArvadosClient, error) {
+       return New(arvados.NewClientFromEnv())
 }
 
 // CallRaw is the same as Call() but returns a Reader that reads the
@@ -280,9 +269,6 @@ func (c *ArvadosClient) CallRaw(method string, resourceType string, uuid string,
                if c.RequestID != "" {
                        req.Header.Add("X-Request-Id", c.RequestID)
                }
-               if c.External {
-                       req.Header.Add("X-External-Client", "1")
-               }
 
                resp, err = c.Client.Do(req)
                if err != nil {
index db1d0f4e1296bab02a2ecda9ff00377ca9636b24..85d419758820617b7bbdecd980e1a8f49e7cb009 100644 (file)
@@ -66,9 +66,6 @@ def _intercept_http_request(self, uri, method="GET", headers={}, **kwargs):
             self.max_request_size < len(kwargs['body'])):
             raise apiclient_errors.MediaUploadSizeError("Request size %i bytes exceeds published limit of %i bytes" % (len(kwargs['body']), self.max_request_size))
 
-        if config.get("ARVADOS_EXTERNAL_CLIENT", "") == "true":
-            headers['X-External-Client'] = '1'
-
         headers['Authorization'] = 'OAuth2 %s' % self.arvados_api_token
 
         retryable = method in [
index 7c05cc0a6a2c72ca818686b6eea5c6f0a4874d3d..44e915776734fe87020ba46b5d95d9985f8e8dfe 100644 (file)
@@ -159,7 +159,6 @@ class Keep(object):
                config.get('ARVADOS_API_TOKEN'),
                config.flag_is_true('ARVADOS_API_HOST_INSECURE'),
                config.get('ARVADOS_KEEP_PROXY'),
-               config.get('ARVADOS_EXTERNAL_CLIENT') == 'true',
                os.environ.get('KEEP_LOCAL_STORE'))
         if (global_client_object is None) or (cls._last_key != key):
             global_client_object = KeepClient()
index 7147c7aa8fdf826c6b469a0a0dc3b7631a69d133..e5d1d8fa380fb49513452d7555618c5410993764 100644 (file)
@@ -926,7 +926,6 @@ class TestCaseWithServers(unittest.TestCase):
         cls._orig_config = arvados.config.settings().copy()
         cls._cleanup_funcs = []
         os.environ.pop('ARVADOS_KEEP_SERVICES', None)
-        os.environ.pop('ARVADOS_EXTERNAL_CLIENT', None)
         for server_kwargs, start_func, stop_func in (
                 (cls.MAIN_SERVER, run, reset),
                 (cls.WS_SERVER, run_ws, stop_ws),
index 722b70b58b9cdead75da2fd721a45b17f09cf971..87e4eefb29d666b4f3fa724151ba8cf268f7d20b 100644 (file)
@@ -184,7 +184,6 @@ class KeepProxyTestCase(run_test_server.TestCaseWithServers):
         cls.api_client = arvados.api('v1')
 
     def tearDown(self):
-        arvados.config.settings().pop('ARVADOS_EXTERNAL_CLIENT', None)
         super(KeepProxyTestCase, self).tearDown()
 
     def test_KeepProxyTest1(self):
index c33c2358ca3b7612ef92498edbef9a5562d6b9f5..e45598189107261401930126cc1e04235211b798 100644 (file)
@@ -102,7 +102,6 @@ func main() {
                if client.Insecure {
                        os.Setenv("ARVADOS_API_HOST_INSECURE", "1")
                }
-               os.Setenv("ARVADOS_EXTERNAL_CLIENT", "")
        } else {
                logger.Warnf("Client credentials missing from config, so falling back on environment variables (deprecated).")
        }
index c774584d683c338e70629320d9d602b9fea30814..ac394e114962ddf05d2e71e94cc4bb1ff46c4780 100644 (file)
@@ -101,7 +101,6 @@ func (disp *Dispatcher) configure() error {
                if disp.Client.Insecure {
                        os.Setenv("ARVADOS_API_HOST_INSECURE", "1")
                }
-               os.Setenv("ARVADOS_EXTERNAL_CLIENT", "")
                for k, v := range disp.cluster.Containers.SLURM.SbatchEnvironmentVariables {
                        os.Setenv(k, v)
                }
index 8242f5b2b56868b23dfaecf4aefe814100e682ee..2eaea278162c9c4d2fb308b30d27b38e8ea5b639 100644 (file)
@@ -146,7 +146,6 @@ func runProxy(c *C, bogusClientToken bool, loadKeepstoresFromConfig bool, kp *ar
                TestProxyUUID: "http://" + srv.Addr,
        }
        kc.SetServiceRoots(sr, sr, sr)
-       kc.Arvados.External = true
        return srv, kc, logbuf
 }
 
index 995a1fd559a396c9b364a0bea6adcf40b66176d0..6127485835388d359b64e5ffae4cd2607c298cc6 100644 (file)
@@ -108,7 +108,6 @@ type apiConfig struct {
        APIToken        string
        APIHost         string
        APIHostInsecure bool
-       ExternalClient  bool
 }
 
 // Load config from given file
@@ -152,8 +151,6 @@ func readConfigFromFile(filename string) (config apiConfig, blobSigningKey strin
                                config.APIHost = value
                        case "ARVADOS_API_HOST_INSECURE":
                                config.APIHostInsecure = arvadosclient.StringBool(value)
-                       case "ARVADOS_EXTERNAL_CLIENT":
-                               config.ExternalClient = arvadosclient.StringBool(value)
                        case "ARVADOS_BLOB_SIGNING_KEY":
                                blobSigningKey = value
                        }
@@ -171,7 +168,6 @@ func setupKeepClient(config apiConfig, keepServicesJSON string, blobSignatureTTL
                ApiInsecure: config.APIHostInsecure,
                Client: &http.Client{Transport: &http.Transport{
                        TLSClientConfig: &tls.Config{InsecureSkipVerify: config.APIHostInsecure}}},
-               External: config.ExternalClient,
        }
 
        // If keepServicesJSON is provided, use it instead of service discovery
index d973e06027c6ed2b707fce39a4f2ab00fcc51a11..4dcb47a8da02e3eea9edddf5e612dff660076147 100644 (file)
@@ -118,7 +118,6 @@ func setupConfigFile(c *C, fileName string) string {
        fileContent += "ARVADOS_API_TOKEN=" + arvadostest.DataManagerToken + "\n"
        fileContent += "\n"
        fileContent += "ARVADOS_API_HOST_INSECURE=" + os.Getenv("ARVADOS_API_HOST_INSECURE") + "\n"
-       fileContent += " ARVADOS_EXTERNAL_CLIENT = false \n"
        fileContent += " NotANameValuePairAndShouldGetIgnored \n"
        fileContent += "ARVADOS_BLOB_SIGNING_KEY=abcdefg\n"
 
@@ -291,7 +290,6 @@ func (s *ServerRequiredSuite) TestLoadConfig(c *C) {
        c.Assert(config.APIHost, Equals, os.Getenv("ARVADOS_API_HOST"))
        c.Assert(config.APIToken, Equals, arvadostest.DataManagerToken)
        c.Assert(config.APIHostInsecure, Equals, arvadosclient.StringBool(os.Getenv("ARVADOS_API_HOST_INSECURE")))
-       c.Assert(config.ExternalClient, Equals, false)
        c.Assert(blobSigningKey, Equals, "abcdefg")
 }
 
index 98c9609cb3c522f9524084194ecab1bd68531b79..7e519f775ba9bb4d500e578c891a55d50f1fae34 100644 (file)
@@ -118,7 +118,6 @@ type apiConfig struct {
        APIToken        string
        APIHost         string
        APIHostInsecure bool
-       ExternalClient  bool
 }
 
 // Load src and dst config from given files
@@ -164,8 +163,6 @@ func readConfigFromFile(filename string) (config apiConfig, blobSigningKey strin
                        config.APIHost = value
                case "ARVADOS_API_HOST_INSECURE":
                        config.APIHostInsecure = arvadosclient.StringBool(value)
-               case "ARVADOS_EXTERNAL_CLIENT":
-                       config.ExternalClient = arvadosclient.StringBool(value)
                case "ARVADOS_BLOB_SIGNING_KEY":
                        blobSigningKey = value
                }
@@ -181,7 +178,6 @@ func setupKeepClient(config apiConfig, keepServicesJSON string, isDst bool, repl
                ApiInsecure: config.APIHostInsecure,
                Client: &http.Client{Transport: &http.Transport{
                        TLSClientConfig: &tls.Config{InsecureSkipVerify: config.APIHostInsecure}}},
-               External: config.ExternalClient,
        }
 
        // If keepServicesJSON is provided, use it instead of service discovery
index 45ed3f67f52cc41e16782bd3a6c6144e3d64ecad..dc5b957125c731d13ae51969b7a47ec765ffcf33 100644 (file)
@@ -367,7 +367,6 @@ func (s *ServerNotRequiredSuite) TestLoadConfig(c *C) {
        c.Assert(srcConfig.APIHost, Equals, os.Getenv("ARVADOS_API_HOST"))
        c.Assert(srcConfig.APIToken, Equals, arvadostest.SystemRootToken)
        c.Assert(srcConfig.APIHostInsecure, Equals, arvadosclient.StringBool(os.Getenv("ARVADOS_API_HOST_INSECURE")))
-       c.Assert(srcConfig.ExternalClient, Equals, false)
 
        dstConfig, _, err := loadConfig(dstConfigFile)
        c.Check(err, IsNil)
@@ -375,7 +374,6 @@ func (s *ServerNotRequiredSuite) TestLoadConfig(c *C) {
        c.Assert(dstConfig.APIHost, Equals, os.Getenv("ARVADOS_API_HOST"))
        c.Assert(dstConfig.APIToken, Equals, arvadostest.SystemRootToken)
        c.Assert(dstConfig.APIHostInsecure, Equals, arvadosclient.StringBool(os.Getenv("ARVADOS_API_HOST_INSECURE")))
-       c.Assert(dstConfig.ExternalClient, Equals, false)
 
        c.Assert(srcBlobSigningKey, Equals, "abcdefg")
 }
@@ -412,7 +410,6 @@ func setupConfigFile(c *C, name string) *os.File {
        fileContent := "ARVADOS_API_HOST=" + os.Getenv("ARVADOS_API_HOST") + "\n"
        fileContent += "ARVADOS_API_TOKEN=" + arvadostest.SystemRootToken + "\n"
        fileContent += "ARVADOS_API_HOST_INSECURE=" + os.Getenv("ARVADOS_API_HOST_INSECURE") + "\n"
-       fileContent += "ARVADOS_EXTERNAL_CLIENT=false\n"
        fileContent += "ARVADOS_BLOB_SIGNING_KEY=abcdefg"
 
        _, err = file.Write([]byte(fileContent))