SUSE / caasp-services

Layered Services on the SUSE Container-as-a-Service Platform
Apache License 2.0
25 stars 30 forks source link

Pod was crashed after registering my private repository to Portus #31

Closed lightnet328 closed 6 years ago

lightnet328 commented 6 years ago

Pod was crashed after registering my private repository to Portus. This has been deployed by helm.

portus-background has log as follows.

[Initialization] Running: 'Registry events', 'Registry synchronization'
/usr/lib64/ruby/2.5.0/uri/rfc3986_parser.rb:67:in `split': bad URI(is not URI?): http://registry.example.com:%!s(<nil>)/v2/token?account=portus&scope=registry%3Acatalog%3A%2A&service=portus-portus-registry%3A5000 (URI::InvalidURIError)
    from /usr/lib64/ruby/2.5.0/uri/rfc3986_parser.rb:73:in `parse'
    from /usr/lib64/ruby/2.5.0/uri/common.rb:237:in `parse'
    from /usr/lib64/ruby/2.5.0/uri/common.rb:743:in `URI'
    from /srv/Portus/lib/portus/http_helpers.rb:110:in `request_auth_token'
    from /srv/Portus/lib/portus/http_helpers.rb:48:in `perform_request'
    from /srv/Portus/lib/portus/registry_client.rb:131:in `get_page'
    from /srv/Portus/lib/portus/registry_client.rb:118:in `paged_response'
    from /srv/Portus/lib/portus/registry_client.rb:83:in `catalog'
    from /srv/Portus/lib/portus/background/sync.rb:55:in `block in execute!'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/activerecord-4.2.10/lib/active_record/relation/batches.rb:51:in `block (2 levels) in find_each'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/activerecord-4.2.10/lib/active_record/relation/batches.rb:51:in `each'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/activerecord-4.2.10/lib/active_record/relation/batches.rb:51:in `block in find_each'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/activerecord-4.2.10/lib/active_record/relation/batches.rb:124:in `find_in_batches'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/activerecord-4.2.10/lib/active_record/relation/batches.rb:50:in `find_each'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/activerecord-4.2.10/lib/active_record/querying.rb:9:in `find_each'
    from /srv/Portus/lib/portus/background/sync.rb:54:in `execute!'
    from /srv/Portus/bin/background.rb:56:in `block (2 levels) in <top (required)>'
    from /srv/Portus/bin/background.rb:54:in `each'
    from /srv/Portus/bin/background.rb:54:in `each_with_index'
    from /srv/Portus/bin/background.rb:54:in `block in <top (required)>'
    from /srv/Portus/bin/background.rb:53:in `loop'
    from /srv/Portus/bin/background.rb:53:in `<top (required)>'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/railties-4.2.10/lib/rails/commands/runner.rb:60:in `load'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/railties-4.2.10/lib/rails/commands/runner.rb:60:in `<top (required)>'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:123:in `require'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:90:in `runner'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /srv/Portus/vendor/bundle/ruby/2.5.0/gems/railties-4.2.10/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:12:in `require'
    from bin/rails:12:in `<main>'
bundler: failed to load command: packaging/suse/portusctl/bin/portusctl (packaging/suse/portusctl/bin/portusctl)
RuntimeError: Something went wrong while invoking: /srv/Portus/vendor/bundle/ruby/2.5.0/bin/bundler.ruby2.5 exec rails r /srv/Portus/bin/background.rb
  /srv/Portus/packaging/suse/portusctl/lib/runner.rb:12:in `exec'
  /srv/Portus/packaging/suse/portusctl/lib/runner.rb:34:in `block in bundler_exec'
  /srv/Portus/packaging/suse/portusctl/lib/runner.rb:30:in `chdir'
  /srv/Portus/packaging/suse/portusctl/lib/runner.rb:30:in `bundler_exec'
  /srv/Portus/packaging/suse/portusctl/lib/cli.rb:272:in `exec'
  /srv/Portus/vendor/bundle/ruby/2.5.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
  /srv/Portus/vendor/bundle/ruby/2.5.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
  /srv/Portus/vendor/bundle/ruby/2.5.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
  /srv/Portus/vendor/bundle/ruby/2.5.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
  packaging/suse/portusctl/bin/portusctl:6:in `<top (required)>'

Did I make any mistakes in setting?

The following is configuration used:

nginx:
  host: registry.example.com
  ingress:
    enabled: true
    annotations:
      kubernetes.io/ingress.class: nginx
    tls:
      enabled: true
      secretName: example-tls

Also, information when registering the registry to Portus:

Name: example
Hostname: registry.example.com
Use SSL: yes
lightnet328 commented 6 years ago

I noticed strange url of http://registry.example.com:%!s(<nil>)/v2/token is related to environment variable of REGISTRY_AUTH_SILLY_REALM.

REGISTRY_AUTH_SILLY_REALM in registry-configmap.yaml: https://github.com/kubic-project/caasp-services/blob/master/contrib/helm-charts/portus/templates/registry-configmap.yaml#L19

Since it was clearly obvious that the value of port was missing, i could fix InvalidURIError by modifying the configuration as follows.

nginx:
  host: registry.example.com
  # Added
  port: "443"
  ingress:
    enabled: true
    annotations:
      kubernetes.io/ingress.class: nginx
    tls:
      enabled: true
      secretName: example-tls