ElasticBox / elastickube

ElasticKube is an open source management platform for Kubernetes.

Home Page:https://elastickube.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Probem accessing https://github.com/helm/charts.git

bergtwvd opened this issue · comments

No charts are displayed.

Part of the log of elasticbox/elastickube-charts:latest is shown below.

One thing I can think of is that the Kubernetes host runs behind a corporate proxy, The Docker daemon is configured for that, but what about elastickube?

INFO:root:Initializing charts sync
INFO:root:Initializing watcher...
INFO:root:Initializing GitSync.
INFO:root:Cloning repository in /var/elastickube/charts
DEBUG:git.cmd:AutoInterrupt wait stderr: "Cloning into '/var/elastickube/charts'...\nfatal: unable to access 'https://github.com/helm/charts.git/': Failed to connect to github.com port 443: Connection refused\n"
ERROR:root:Unexpected error executing GitSync sync loop.
Traceback (most recent call last):
  File "/opt/elastickube/charts/sync/__init__.py", line 45, in initialize
    yield GitSync(elastickube_db).sync_loop()
  File "/opt/elastickube/charts/sync/repo.py", line 48, in __init__
    self.repo = Repo.clone_from(self.url, REPO_DIRECTORY)
  File "/usr/local/lib/python2.7/site-packages/git/repo/base.py", line 966, in clone_from
    return cls._clone(git, url, to_path, GitCmdObjectDB, progress, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/git/repo/base.py", line 912, in _clone
    finalize_process(proc, stderr=stderr)
  File "/usr/local/lib/python2.7/site-packages/git/util.py", line 155, in finalize_process
    proc.wait(**kwargs)
  File "/usr/local/lib/python2.7/site-packages/git/cmd.py", line 335, in wait
    raise GitCommandError(self.args, status, errstr)
GitCommandError: 'git clone -v https://github.com/helm/charts.git /var/elastickube/charts' returned with exit code 128
stderr: 'Cloning into '/var/elastickube/charts'...
fatal: unable to access 'https://github.com/helm/charts.git/': Failed to connect to github.com port 443: Connection refused
'

Does the HTTP PROXY needs to be set for Git?

There is one discussion thread about that here:
http://stackoverflow.com/questions/128035/how-do-i-pull-from-a-git-repository-through-an-http-proxy

Ok, confirmed, it is the corporate proxy that sits in the way.

I resolved it by adding environment settings to each of the container images in the script elastickube.sh.

For example:

    spec:
      containers:
      - name: elastickube-api
        image: elasticbox/elastickube-api:${VERSION}
        env:
        - name: HTTPS_PROXY
          value: "https://xxxx.xxxx.xxxx:8080"
        - name: HTTP_PROXY
          value: "http://xxxx.xxxx.xxxx:8080"

Where the https://xxxx.xxxx.xxxx:8080 is the proxy address in my situation.

Now the Git repository is successfully cloned.

Before I added these env settings I set up a local Git repository server (using the following: https://github.com/cirocosta/gitserver-http) to work around the proxy. Next, I changed the Git Chart Repository under the Admin page to point to the new repository. But since the container was in an infinite loop to attempt to clone the github repository it never saw my new repository setting. After I added the env settings elastickube.sh and restarted ElasticKube, the charts got loaded from github. And I could also change the repository to my local one.

I close this issue and open a new one related to not being able to change the repository when github is not accessible,