Uploaded image for project: 'Project Quay'
  1. Project Quay
  2. PROJQUAY-5792

Config edit tool threw panic error when use Elasticsearch service set up by customers themselves

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • quay-v3.7.11, quay-v3.8.8, quay-v3.9.0
    • config-tool
    • False
    • None
    • False

      Description of problem:

      If QE didn't use AWS Elasticsearch service, created a elasticsearch service by running image "docker.io/library/elasticsearch:8.5.3",  in this case, config edit throws panic error.

      Quay should support elasticsearch service set up by customers themselves.

      Version-Release number of selected component (if applicable):

      quay 3.9.0 
      quay 3.8.x
      quay 3.7.x

      How reproducible:

      always

      Steps to Reproduce:
      1. Set up a elasticsearch service in a VM by below steps

      ------------------------------
      $ podman run -d --rm --name elasticsearch -p 10.0.12.110:9200:9200 -p 10.0.12.110:9300:9300  -e "discovery.type=single-node" -e "xpack.security.http.ssl.enabled=false" -e "xpack.security.enrollment.enabled=false" docker.io/library/elasticsearch:8.5.3
      9005fa8cbd4bb06297f57010d429690056f8a7f9ba29b0d81ba9cfd7fabedfd1
      ------------------------------
      $ sleep 30
      ------------------------------
      $ podman exec -it elasticsearch /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
      This tool will reset the password of the [elastic] user to an autogenerated value.
      The password will be printeelasticsearchd in the console.
      Please confirm that you would like to continue [y/N]y
      Password for the [elastic] user successfully reset.
      New value: AgyOjKvVuwuZjV7ZYoED
      

      2. check elasticsearch service health status

      ------------------------------
      $ curl -u elastic:AgyOjKvVuwuZjV7ZYoED http://ec2-3-219-234-246.compute-1.amazonaws.com:9200
      {
        "name" : "9005fa8cbd4b",
        "cluster_name" : "docker-cluster",
        "cluster_uuid" : "FDCCn-2jTJCJyMZ3pJJ24Q",
        "version" : {
          "number" : "8.5.3",
          "build_flavor" : "default",
          "build_type" : "docker",
          "build_hash" : "4ed5ee9afac63de92ec98f404ccbed7d3ba9584e",
          "build_date" : "2022-12-05T18:22:22.226119656Z",
          "build_snapshot" : false,
          "lucene_version" : "9.4.2",
          "minimum_wire_compatibility_version" : "7.17.0",
          "minimum_index_compatibility_version" : "7.0.0"
        },
        "tagline" : "You Know, for Search"
      }
      ------------------------------
      $ curl -XPUT -u 'elastic:AgyOjKvVuwuZjV7ZYoED' 'http://ec2-3-219-234-246.compute-1.amazonaws.com:9200/movies/_doc/1' -d '{"director": "Burton, Tim", "genre": ["Comedy","Sci-Fi"], "year": 1996, "actor": ["Jack Nicholson","Pierce Brosnan","Sarah Jessica Parker"], "title": "Mars Attacks!"}' -H 'Content-Type: application/json'|jq .
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   305  100   139  100   166    209    250 --:--:-- --:--:-- --:--:--   459
      {
        "_index": "movies",
        "_id": "1",
        "_version": 1,
        "result": "created",
        "_shards": {
          "total": 2,
          "successful": 1,
          "failed": 0
        },
        "_seq_no": 0,
        "_primary_term": 1
      }
      ------------------------------
      $ curl -XGET -u 'elastic:AgyOjKvVuwuZjV7ZYoED' 'http://ec2-3-219-234-246.compute-1.amazonaws.com:9200/movies/_search?q=mars&pretty=true'|jq .
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   706  100   706    0     0   1253      0 --:--:-- --:--:-- --:--:--  1253
      {
        "took": 20,
        "timed_out": false,
        "_shards": {
          "total": 1,
          "successful": 1,
          "skipped": 0,
          "failed": 0
        },
        "hits": {
          "total": {
            "value": 1,
            "relation": "eq"
          },
          "max_score": 1.3551693,
          "hits": [
            {
              "_index": "movies",
              "_id": "1",
              "_score": 1.3551693,
              "_source": {
                "director": "Burton, Tim",
                "genre": [
                  "Comedy",
                  "Sci-Fi"
                ],
                "year": 1996,
                "actor": [
                  "Jack Nicholson",
                  "Pierce Brosnan",
                  "Sarah Jessica Parker"
                ],
                "title": "Mars Attacks!"
              }
            }
          ]
        }
      } 
      

      3. Configure the above elasticsearch as quay action log storage

      configure elasticsearch in config edit UI

      Actual results:

      Got error message

      validation error

      Expected results:

      Config edit tool should support elasticsearch service set up by customers themselves.

      Additional info:

      Got below errors in quay pod logs

      21571 config-editor stdout | e Get "https://ec2-3-219-234-246.compute-1.amazonaws.com:9200/logentry_*": http: server ga      ve HTTP response to HTTPS client
      21572 config-editor stdout | 2023/07/06 09:10:42 [quayregistry-quay-config-editor-54d6b9bbdd-7jscr/0IZ18z1A1r-000001] "POST http://quayregistry-quay-config-editor-quay-enterprise39.apps.whu413az19.qe.azure.devcluster.openshift.com/api/v1/config/validate?mode=online HTTP/1.1" from 209.132.188.14 - 000 0B in 818.380279ms
      21573 config-editor stderr | 2023/07/06 09:10:42 http: panic serving 10.129.2.24:38652: runtime error: slice bounds out  of range [-1:]
      21574 config-editor stderr | goroutine 50 [running]:
      21575 config-editor stderr | net/http.(*conn).serve.func1()
      21576 config-editor stderr |  /usr/lib/golang/src/net/http/server.go:1802 +0xb9
      21577 config-editor stderr | panic({0xe5f4c0, 0xc000e8e168})
      21578 config-editor stderr |  /usr/lib/golang/src/runtime/panic.go:1047 +0x266
      21579 config-editor stderr | github.com/go-chi/chi/middleware.prettyStack.decorateFuncCallLine({}, {0xc0010882d2, 0x4531d4}, 0x49, 0x8)
      21580 config-editor stderr |  /remote-source/config-tool/deps/gomod/pkg/mod/github.com/go-chi/chi@v4.1.2+incompatible/middleware/recoverer.go:130 +0x545
      21581 config-editor stderr | github.com/go-chi/chi/middleware.prettyStack.decorateLine({}, {0xc0010882d2, 0xc000f10600}      , 0x80, 0x1)
      21582 config-editor stderr |  /remote-source/config-tool/deps/gomod/pkg/mod/github.com/go-chi/chi@v4.1.2+incompatible/middleware/recoverer.go:106 +0x15d
      21583 config-editor stderr | github.com/go-chi/chi/middleware.prettyStack.parse({}, {0xc001080000, 0x1171, 0xc000eaad48}, {0xdc9ae0, 0x1f1ba00})
      21584 config-editor stderr |  /remote-source/config-tool/deps/gomod/pkg/mod/github.com/go-chi/chi@v4.1.2+incompatible/middleware/recoverer.go:89 +0x510
      21585 config-editor stderr | github.com/go-chi/chi/middleware.PrintPrettyStack({0xdc9ae0, 0x1f1ba00})
      21586 config-editor stderr |  /remote-source/config-tool/deps/gomod/pkg/mod/github.com/go-chi/chi@v4.1.2+incompatible/middleware/recoverer.go:46 +0x45

      Attach the whole log in Attachment.

              Unassigned Unassigned
              rhwhu Weihua Hu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: