ansibleplaybookbundle / ansible-playbook-bundle

THIS REPO IS MIGRATING: https://github.com/automationbroker/apb
GNU General Public License v2.0
140 stars 70 forks source link

Dockerized apb-tool not able to perform push #181

Closed matzew closed 6 years ago

matzew commented 6 years ago

Installing the apb CLI locally, via dnf (version 1.1.1.1), I am able to push to Openshift/ASB. But running into exactly this problem: https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/issues/180

However, when I am using the same cluster environment (I am using the run_latest_build.sh from the ASB), I am not able to perform a push, like:

docker run --rm --privileged -v $(PWD):/mnt:z -v $(HOME)/.kube:/.kube -v /var/run/docker.sock:/var/run/docker.sock -u $(USER) docker.io/ansibleplaybookbundle/apb-tools:latest push --openshift

This does actually result in this problem:

Successfully built a2950fdafd98
docker run --rm --privileged -v /home/Matthias/Work/Conferences/DevConf/kafka-apb:/mnt:z -v /home/Matthias/.kube:/.kube -v /var/run/docker.sock:/var/run/docker.sock -u 1000 docker.io/ansibleplaybookbundle/apb-tools:latest push --openshift
2017-12-19 17:12:26,836 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x3e7d510>: Failed to establish a new connection: [Errno 111] Connection refused',)': /oapi/v1/namespaces/ansible-service-broker/routes
2017-12-19 17:12:26,837 WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x3e7d3d0>: Failed to establish a new connection: [Errno 111] Connection refused',)': /oapi/v1/namespaces/ansible-service-broker/routes
2017-12-19 17:12:26,837 WARNING Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x3e7d110>: Failed to establish a new connection: [Errno 111] Connection refused',)': /oapi/v1/namespaces/ansible-service-broker/routes
2017-12-19 17:12:26,907 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x3e6eed0>: Failed to establish a new connection: [Errno 111] Connection refused',)': /api/v1/namespaces/default/services/docker-registry
2017-12-19 17:12:26,908 WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x3e6e890>: Failed to establish a new connection: [Errno 111] Connection refused',)': /api/v1/namespaces/default/services/docker-registry
2017-12-19 17:12:26,908 WARNING Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x3e6e750>: Failed to establish a new connection: [Errno 111] Connection refused',)': /api/v1/namespaces/default/services/docker-registry
version: 1.0
name: kafka-apb
description: APB for Apache Kafka and Apache Zookeeper
bindable: False
async: optional
metadata:
  displayName: Apache Kafka Cluster
  imageUrl: "https://svn.apache.org/repos/asf/kafka/site/logos/kafka-logo-no-text.png"
  documentationUrl: "http://kafka.apache.org/documentation"
  providerDisplayName: "Matthias Wessendorf"
plans:
  - name: default
    description: This default plan deploys kafka-apb
    free: True
    metadata: {}
    parameters: []
Exception occurred! HTTPSConnectionPool(host='127.0.0.1', port=8443): Max retries exceeded with url: /api/v1/namespaces/default/services/docker-registry (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x3e7b490>: Failed to establish a new connection: [Errno 111] Connection refused',))
make: *** [Makefile:20: apb_push] Error 1

I have a make file that basically embeds the apb push --openshift1

sudhirpandey commented 6 years ago

for me the issue was solved by adding the --net=host docker run command. But i am then facing same error as https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/issues/212

apb image i am using is docker.io/ansibleplaybookbundle/apb-tools latest 79b05404db24 4 days ago 730.2 MB

rthallisey commented 6 years ago

@sudhirpandey does pip install -U openshift kubernetes help fix the error "Exception occurred! 'module' object has no attribute 'configuration'"?

rthallisey commented 6 years ago

Nevermind, you're using the container. I'll check the versions in there.

rthallisey commented 6 years ago

@sudhirpandey try using the 'canary' tag for the containerized apb-tool. Latest will need to be rebuilt.

alias apb='docker run --rm --privileged -v $PWD:/mnt -v $HOME/.kube:/.kube -v /var/run/docker.sock:/var/run/docker.sock -u $UID docker.io/ansibleplaybookbundle/apb-tools:canary'
sudhirpandey commented 6 years ago

@rthallisey canary worked thanks :).

how ever my alias looks like this alias apb='docker run --rm --privileged --net=host -v $PWD:/mnt -v $HOME/.kube:/root/.kube -v /var/run/docker.sock:/var/run/docker.sock -u $UID docker.io/ansibleplaybookbundle/apb-tools:canary'

with out --net=host, it would fails on apb list

usermod: group 'apb' does not exist
2018-01-26 12:50:03,797 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x337fb90>: Failed to establish a new connection: [Errno 111] Connection refused',)': /oapi/v1/namespaces/ansible-service-broker/routes
2018-01-26 12:50:03,797 WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x337f9d0>: Failed to establish a new connection: [Errno 111] Connection refused',)': /oapi/v1/namespaces/ansible-service-broker/routes
2018-01-26 12:50:03,798 WARNING Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x337fe90>: Failed to establish a new connection: [Errno 111] Connection refused',)': /oapi/v1/namespaces/ansible-service-broker/routes
Exception occurred! Could not find route to ansible-service-broker. Use --broker or log into the cluster using "oc login"

i guess its expected as it would not be able to connect to cluster which its trying to reach via 127.0.0.1:8443, as apb docker container itself comes up with lo

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever

and specifying the broker url as apb list --broker asb-1338-ansible-service-broker.labs. works