prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  storage-initialiser fails to copy model from S3
  Upon using a Secret and Service account that look like this:
  
  ```
  apiVersion: v1
  metadata:
    name: kfserving-aws-secret
    namespace: {namespace}
    annotations:
      serving.kubeflow.org/s3-endpoint: s3.eu-east-1.amazonaws.com
      serving.kubeflow.org/s3-usehttps: "1"
      serving.kubeflow.org/s3-verifyssl: "1"
      serving.kubeflow.org/s3-region: eu-east-1
  data:
    AWS_ACCESS_KEY_ID: {access_key_base64}
    AWS_SECRET_ACCESS_KEY: {secret_key_base64}
  kind: Secret
  type: Opaque
  ---
  apiVersion: v1
  kind: ServiceAccount
  metadata:
    name: kfserving-sa
    namespace: {namespace}
  secrets:
    - name: kfserving-aws-secret  
  ```
  ...and an InferenceService like this:
  
  ```
  apiVersion: "serving.kubeflow.org/v1alpha2"
  kind: "InferenceService"
  metadata:
    name: {model_name}
    namespace: {namespace}
  spec:
    default:
      predictor:
        serviceAccountName: kfserving-sa
        tensorflow:
          storageUri: {model_base_path}    
  ```
  
  ...the model fails to serve, with the `storage-initialiser` pod throwing the following error:
  
  ```
  [I 200226 14:09:42 initializer-entrypoint:13] Initializing, args: src_uri [s3://at-kubeflow-training/tf-job/ksc-ebce76a1] dest_path[ [/mnt/models]
  [I 200226 14:09:42 storage:35] Copying contents of s3://at-kubeflow-training/tf-job/ksc-ebce76a1 to local
  Traceback (most recent call last):
    File "/storage-initializer/scripts/initializer-entrypoint", line 14, in <module>
      kfserving.Storage.download(src_uri, dest_path)
    File "/usr/local/lib/python3.7/site-packages/kfserving/storage.py", line 50, in download
      Storage._download_s3(uri, out_dir)
    File "/usr/local/lib/python3.7/site-packages/kfserving/storage.py", line 65, in _download_s3
      client = Storage._create_minio_client()
    File "/usr/local/lib/python3.7/site-packages/kfserving/storage.py", line 217, in _create_minio_client
      secure=use_ssl)
    File "/usr/local/lib/python3.7/site-packages/minio/api.py", line 150, in __init__
      is_valid_endpoint(endpoint)
    File "/usr/local/lib/python3.7/site-packages/minio/helpers.py", line 301, in is_valid_endpoint
      if hostname[-1] == '.':
  IndexError: string index out of range
  ```
  
  This was using Kubeflow 1.0.0RC4, KFServing 0.2.2 and KNative 0.11.1
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `python/kfserving/kfserving/constants/constants.py`
  Content:
  ```
  1 # Copyright 2020 kubeflow.org.
  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 import os
  16 
  17 # KFServing K8S constants
  18 KFSERVING_GROUP = 'serving.kubeflow.org'
  19 KFSERVING_KIND = 'InferenceService'
  20 KFSERVING_PLURAL = 'inferenceservices'
  21 KFSERVING_VERSION = os.environ.get('KFSERVING_VERSION', 'v1alpha2')
  22 KFSERVING_API_VERSION = KFSERVING_GROUP + '/' + KFSERVING_VERSION
  23 
  24 KFSERVING_LOGLEVEL = os.environ.get('KFSERVING_LOGLEVEL', 'INFO').upper()
  25 
  26 # INFERENCESERVICE credentials common constants
  27 INFERENCESERVICE_CONFIG_MAP_NAME = 'inferenceservice-config'
  28 INFERENCESERVICE_SYSTEM_NAMESPACE = 'kfserving-system'
  29 DEFAULT_SECRET_NAME = "kfserving-secret-"
  30 DEFAULT_SA_NAME = "kfserving-service-credentials"
  31 
  32 # S3 credentials constants
  33 S3_ACCESS_KEY_ID_DEFAULT_NAME = "awsAccessKeyID"
  34 S3_SECRET_ACCESS_KEY_DEFAULT_NAME = "awsSecretAccessKey"
  35 S3_DEFAULT_CREDS_FILE = '~/.aws/credentials'
  36 
  37 # GCS credentials constants
  38 GCS_CREDS_FILE_DEFAULT_NAME = 'gcloud-application-credentials.json'
  39 GCS_DEFAULT_CREDS_FILE = '~/.config/gcloud/application_default_credentials.json'
  40 
  41 # Azure credentials constants
  42 AZ_DEFAULT_CREDS_FILE = '~/.azure/azure_credentials.json'
  43
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/python/kfserving/kfserving/constants/constants.py b/python/kfserving/kfserving/constants/constants.py
  --- a/python/kfserving/kfserving/constants/constants.py
  +++ b/python/kfserving/kfserving/constants/constants.py
  @@ -30,8 +30,8 @@
   DEFAULT_SA_NAME = "kfserving-service-credentials"
   
   # S3 credentials constants
  -S3_ACCESS_KEY_ID_DEFAULT_NAME = "awsAccessKeyID"
  -S3_SECRET_ACCESS_KEY_DEFAULT_NAME = "awsSecretAccessKey"
  +S3_ACCESS_KEY_ID_DEFAULT_NAME = "AWS_ACCESS_KEY_ID"
  +S3_SECRET_ACCESS_KEY_DEFAULT_NAME = "AWS_SECRET_ACCESS_KEY"
   S3_DEFAULT_CREDS_FILE = '~/.aws/credentials'
   
   # GCS credentials constants
  
verification_info: {"golden_diff": "diff --git a/python/kfserving/kfserving/constants/constants.py b/python/kfserving/kfserving/constants/constants.py\n--- a/python/kfserving/kfserving/constants/constants.py\n+++ b/python/kfserving/kfserving/constants/constants.py\n@@ -30,8 +30,8 @@\n DEFAULT_SA_NAME = \"kfserving-service-credentials\"\n \n # S3 credentials constants\n-S3_ACCESS_KEY_ID_DEFAULT_NAME = \"awsAccessKeyID\"\n-S3_SECRET_ACCESS_KEY_DEFAULT_NAME = \"awsSecretAccessKey\"\n+S3_ACCESS_KEY_ID_DEFAULT_NAME = \"AWS_ACCESS_KEY_ID\"\n+S3_SECRET_ACCESS_KEY_DEFAULT_NAME = \"AWS_SECRET_ACCESS_KEY\"\n S3_DEFAULT_CREDS_FILE = '~/.aws/credentials'\n \n # GCS credentials constants\n", "issue": "storage-initialiser fails to copy model from S3\nUpon using a Secret and Service account that look like this:\r\n\r\n```\r\napiVersion: v1\r\nmetadata:\r\n  name: kfserving-aws-secret\r\n  namespace: {namespace}\r\n  annotations:\r\n    serving.kubeflow.org/s3-endpoint: s3.eu-east-1.amazonaws.com\r\n    serving.kubeflow.org/s3-usehttps: \"1\"\r\n    serving.kubeflow.org/s3-verifyssl: \"1\"\r\n    serving.kubeflow.org/s3-region: eu-east-1\r\ndata:\r\n  AWS_ACCESS_KEY_ID: {access_key_base64}\r\n  AWS_SECRET_ACCESS_KEY: {secret_key_base64}\r\nkind: Secret\r\ntype: Opaque\r\n---\r\napiVersion: v1\r\nkind: ServiceAccount\r\nmetadata:\r\n  name: kfserving-sa\r\n  namespace: {namespace}\r\nsecrets:\r\n  - name: kfserving-aws-secret  \r\n```\r\n...and an InferenceService like this:\r\n\r\n```\r\napiVersion: \"serving.kubeflow.org/v1alpha2\"\r\nkind: \"InferenceService\"\r\nmetadata:\r\n  name: {model_name}\r\n  namespace: {namespace}\r\nspec:\r\n  default:\r\n    predictor:\r\n      serviceAccountName: kfserving-sa\r\n      tensorflow:\r\n        storageUri: {model_base_path}    \r\n```\r\n\r\n...the model fails to serve, with the `storage-initialiser` pod throwing the following error:\r\n\r\n```\r\n[I 200226 14:09:42 initializer-entrypoint:13] Initializing, args: src_uri [s3://at-kubeflow-training/tf-job/ksc-ebce76a1] dest_path[ [/mnt/models]\r\n[I 200226 14:09:42 storage:35] Copying contents of s3://at-kubeflow-training/tf-job/ksc-ebce76a1 to local\r\nTraceback (most recent call last):\r\n  File \"/storage-initializer/scripts/initializer-entrypoint\", line 14, in <module>\r\n    kfserving.Storage.download(src_uri, dest_path)\r\n  File \"/usr/local/lib/python3.7/site-packages/kfserving/storage.py\", line 50, in download\r\n    Storage._download_s3(uri, out_dir)\r\n  File \"/usr/local/lib/python3.7/site-packages/kfserving/storage.py\", line 65, in _download_s3\r\n    client = Storage._create_minio_client()\r\n  File \"/usr/local/lib/python3.7/site-packages/kfserving/storage.py\", line 217, in _create_minio_client\r\n    secure=use_ssl)\r\n  File \"/usr/local/lib/python3.7/site-packages/minio/api.py\", line 150, in __init__\r\n    is_valid_endpoint(endpoint)\r\n  File \"/usr/local/lib/python3.7/site-packages/minio/helpers.py\", line 301, in is_valid_endpoint\r\n    if hostname[-1] == '.':\r\nIndexError: string index out of range\r\n```\r\n\r\nThis was using Kubeflow 1.0.0RC4, KFServing 0.2.2 and KNative 0.11.1\n", "before_files": [{"content": "# Copyright 2020 kubeflow.org.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport os\n\n# KFServing K8S constants\nKFSERVING_GROUP = 'serving.kubeflow.org'\nKFSERVING_KIND = 'InferenceService'\nKFSERVING_PLURAL = 'inferenceservices'\nKFSERVING_VERSION = os.environ.get('KFSERVING_VERSION', 'v1alpha2')\nKFSERVING_API_VERSION = KFSERVING_GROUP + '/' + KFSERVING_VERSION\n\nKFSERVING_LOGLEVEL = os.environ.get('KFSERVING_LOGLEVEL', 'INFO').upper()\n\n# INFERENCESERVICE credentials common constants\nINFERENCESERVICE_CONFIG_MAP_NAME = 'inferenceservice-config'\nINFERENCESERVICE_SYSTEM_NAMESPACE = 'kfserving-system'\nDEFAULT_SECRET_NAME = \"kfserving-secret-\"\nDEFAULT_SA_NAME = \"kfserving-service-credentials\"\n\n# S3 credentials constants\nS3_ACCESS_KEY_ID_DEFAULT_NAME = \"awsAccessKeyID\"\nS3_SECRET_ACCESS_KEY_DEFAULT_NAME = \"awsSecretAccessKey\"\nS3_DEFAULT_CREDS_FILE = '~/.aws/credentials'\n\n# GCS credentials constants\nGCS_CREDS_FILE_DEFAULT_NAME = 'gcloud-application-credentials.json'\nGCS_DEFAULT_CREDS_FILE = '~/.config/gcloud/application_default_credentials.json'\n\n# Azure credentials constants\nAZ_DEFAULT_CREDS_FILE = '~/.azure/azure_credentials.json'\n", "path": "python/kfserving/kfserving/constants/constants.py"}], "after_files": [{"content": "# Copyright 2020 kubeflow.org.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport os\n\n# KFServing K8S constants\nKFSERVING_GROUP = 'serving.kubeflow.org'\nKFSERVING_KIND = 'InferenceService'\nKFSERVING_PLURAL = 'inferenceservices'\nKFSERVING_VERSION = os.environ.get('KFSERVING_VERSION', 'v1alpha2')\nKFSERVING_API_VERSION = KFSERVING_GROUP + '/' + KFSERVING_VERSION\n\nKFSERVING_LOGLEVEL = os.environ.get('KFSERVING_LOGLEVEL', 'INFO').upper()\n\n# INFERENCESERVICE credentials common constants\nINFERENCESERVICE_CONFIG_MAP_NAME = 'inferenceservice-config'\nINFERENCESERVICE_SYSTEM_NAMESPACE = 'kfserving-system'\nDEFAULT_SECRET_NAME = \"kfserving-secret-\"\nDEFAULT_SA_NAME = \"kfserving-service-credentials\"\n\n# S3 credentials constants\nS3_ACCESS_KEY_ID_DEFAULT_NAME = \"AWS_ACCESS_KEY_ID\"\nS3_SECRET_ACCESS_KEY_DEFAULT_NAME = \"AWS_SECRET_ACCESS_KEY\"\nS3_DEFAULT_CREDS_FILE = '~/.aws/credentials'\n\n# GCS credentials constants\nGCS_CREDS_FILE_DEFAULT_NAME = 'gcloud-application-credentials.json'\nGCS_DEFAULT_CREDS_FILE = '~/.config/gcloud/application_default_credentials.json'\n\n# Azure credentials constants\nAZ_DEFAULT_CREDS_FILE = '~/.azure/azure_credentials.json'\n", "path": "python/kfserving/kfserving/constants/constants.py"}]}